Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef IMPDIALOG_HXX
21 : #define IMPDIALOG_HXX
22 :
23 : #include "pdffilter.hxx"
24 :
25 : #include "vcl/dialog.hxx"
26 : #include "vcl/button.hxx"
27 : #include "vcl/fixed.hxx"
28 : #include "vcl/field.hxx"
29 : #include "vcl/edit.hxx"
30 : #include "vcl/lstbox.hxx"
31 : #include "vcl/combobox.hxx"
32 : #include "vcl/group.hxx"
33 : #include "vcl/pdfwriter.hxx"
34 :
35 : #include "svtools/FilterConfigItem.hxx"
36 :
37 : #include "sfx2/tabdlg.hxx"
38 :
39 : #include "com/sun/star/beans/NamedValue.hpp"
40 :
41 : // ----------------
42 : // - ImpPDFDialog -
43 : // ----------------
44 :
45 : class ImpPDFTabGeneralPage;
46 : class ImpPDFTabViewerPage;
47 : class ImpPDFTabOpnFtrPage;
48 : class ImpPDFTabLinksPage;
49 :
50 : class PDFFilterResId : public ResId
51 : {
52 : public:
53 : PDFFilterResId( sal_uInt32 nId );
54 : };
55 :
56 : class ImplErrorDialog : public ModalDialog
57 : {
58 : FixedImage maFI;
59 : FixedText maProcessText;
60 : ListBox maErrors;
61 : FixedText maExplanation;
62 :
63 : OKButton maButton;
64 :
65 : DECL_LINK(SelectHdl, void *);
66 : public:
67 : ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& );
68 : ~ImplErrorDialog();
69 : };
70 :
71 : ////////////////////////////////////////////////////////////////////////
72 : //class tabbed dialog
73 : class ImpPDFTabDialog : public SfxTabDialog
74 : {
75 : private:
76 : com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
77 : FilterConfigItem maConfigItem;
78 : FilterConfigItem maConfigI18N;
79 :
80 : Any maSelection;
81 :
82 : DECL_LINK(CancelHdl, void *);
83 :
84 : protected:
85 : //the following data are the configuration used throughout the dialog and pages
86 : sal_Bool mbIsPresentation;
87 : sal_Bool mbIsWriter;
88 : sal_Bool mbSelectionPresent;
89 : sal_Bool mbUseCTLFont;
90 : sal_Bool mbUseLosslessCompression;
91 : sal_Int32 mnQuality;
92 : sal_Bool mbReduceImageResolution;
93 : sal_Int32 mnMaxImageResolution;
94 : sal_Bool mbUseTaggedPDF;
95 : sal_Int32 mnPDFTypeSelection;
96 : sal_Bool mbExportNotes;
97 : sal_Bool mbExportNotesPages;
98 : sal_Bool mbUseTransitionEffects;
99 : sal_Bool mbIsSkipEmptyPages;
100 : sal_Bool mbAddStream;
101 : sal_Bool mbEmbedStandardFonts;
102 : sal_Int32 mnFormsType;
103 : sal_Bool mbExportFormFields;
104 : sal_Bool mbAllowDuplicateFieldNames;
105 : sal_Bool mbExportBookmarks;
106 : sal_Bool mbExportHiddenSlides;
107 : sal_Int32 mnOpenBookmarkLevels;
108 :
109 : sal_Bool mbHideViewerToolbar;
110 : sal_Bool mbHideViewerMenubar;
111 : sal_Bool mbHideViewerWindowControls;
112 : sal_Bool mbResizeWinToInit;
113 : sal_Bool mbCenterWindow;
114 : sal_Bool mbOpenInFullScreenMode;
115 : sal_Bool mbDisplayPDFDocumentTitle;
116 : sal_Int32 mnMagnification;
117 : sal_Int32 mnInitialView;
118 : sal_Int32 mnZoom;
119 : sal_Int32 mnInitialPage;
120 :
121 : sal_Int32 mnPageLayout;
122 : sal_Bool mbFirstPageLeft;
123 :
124 : sal_Bool mbEncrypt;
125 :
126 : sal_Bool mbRestrictPermissions;
127 : com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword;
128 : sal_Int32 mnPrint;
129 : sal_Int32 mnChangesAllowed;
130 : sal_Bool mbCanCopyOrExtract;
131 : sal_Bool mbCanExtractForAccessibility;
132 : com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords;
133 :
134 : sal_Bool mbIsRangeChecked;
135 : rtl::OUString msPageRange;
136 : sal_Bool mbSelectionIsChecked;
137 :
138 : sal_Bool mbExportRelativeFsysLinks;
139 : sal_Int32 mnViewPDFMode;
140 : sal_Bool mbConvertOOoTargets;
141 : sal_Bool mbExportBmkToPDFDestination;
142 :
143 : sal_Bool mbSignPDF;
144 : ::rtl::OUString msSignPassword;
145 : ::rtl::OUString msSignLocation;
146 : ::rtl::OUString msSignContact;
147 : ::rtl::OUString msSignReason;
148 : com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
149 :
150 : ::rtl::OUString maWatermarkText;
151 :
152 : public:
153 :
154 : friend class ImpPDFTabGeneralPage;
155 : friend class ImpPDFTabViewerPage;
156 : friend class ImpPDFTabOpnFtrPage;
157 : friend class ImpPDFTabSecurityPage;
158 : friend class ImpPDFTabLinksPage;
159 : friend class ImpPDFTabSigningPage;
160 :
161 : ImpPDFTabDialog( Window* pParent,
162 : Sequence< PropertyValue >& rFilterData,
163 : const Reference< XComponent >& rDoc,
164 : const Reference< lang::XMultiServiceFactory >& xFact
165 : );
166 : ~ImpPDFTabDialog();
167 :
168 : Sequence< PropertyValue > GetFilterData();
169 : const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& getServiceFactory() const { return mxMSF; }
170 :
171 : protected:
172 : virtual void PageCreated( sal_uInt16 _nId,
173 : SfxTabPage& _rPage );
174 : virtual short Ok();
175 : };
176 :
177 : //class tab page general
178 : class ImpPDFTabGeneralPage : public SfxTabPage
179 : {
180 : friend class ImpPDFTabLinksPage;
181 :
182 : FixedLine maFlPages;
183 : RadioButton maRbAll;
184 : RadioButton maRbRange;
185 : RadioButton maRbSelection;
186 : Edit maEdPages;
187 :
188 : FixedLine maFlCompression;
189 : RadioButton maRbLosslessCompression;
190 : RadioButton maRbJPEGCompression;
191 : FixedText maFtQuality;
192 : MetricField maNfQuality;
193 : CheckBox maCbReduceImageResolution;
194 : ComboBox maCoReduceImageResolution;
195 :
196 : FixedLine m_aVerticalLine;
197 :
198 : FixedLine maFlGeneral;
199 : CheckBox maCbPDFA1b;
200 : CheckBox maCbTaggedPDF;
201 : sal_Bool mbTaggedPDFUserSelection;
202 :
203 : CheckBox maCbExportFormFields;
204 : sal_Bool mbExportFormFieldsUserSelection;
205 : sal_Bool mbEmbedStandardFontsUserSelection;
206 : FixedText maFtFormsFormat;
207 : ListBox maLbFormsFormat;
208 : CheckBox maCbAllowDuplicateFieldNames;
209 :
210 : CheckBox maCbExportBookmarks;
211 : CheckBox maCbExportHiddenSlides;
212 : CheckBox maCbExportNotes;
213 : CheckBox maCbExportNotesPages;
214 :
215 : CheckBox maCbExportEmptyPages;
216 : CheckBox maCbAddStream;
217 : FixedText maFtAddStreamDescription;
218 : CheckBox maCbEmbedStandardFonts;
219 :
220 : FixedLine maFlWatermark;
221 : CheckBox maCbWatermark;
222 : FixedText maFtWatermark;
223 : Edit maEdWatermark;
224 :
225 : sal_Bool mbIsPresentation;
226 : sal_Bool mbIsWriter;
227 :
228 : const ImpPDFTabDialog* mpaParent;
229 :
230 : DECL_LINK( TogglePagesHdl, void* );
231 : DECL_LINK( ToggleCompressionHdl, void* );
232 : DECL_LINK( ToggleReduceImageResolutionHdl, void* );
233 : DECL_LINK( ToggleWatermarkHdl, void* );
234 : DECL_LINK( ToggleAddStreamHdl, void* );
235 : DECL_LINK( ToggleExportFormFieldsHdl, void* );
236 :
237 : public:
238 : DECL_LINK( ToggleExportPDFAHdl, void* );
239 :
240 : ImpPDFTabGeneralPage( Window* pParent,
241 : const SfxItemSet& rSet );
242 :
243 : ~ImpPDFTabGeneralPage();
244 : static SfxTabPage* Create( Window* pParent,
245 : const SfxItemSet& rAttrSet);
246 :
247 : void GetFilterConfigItem( ImpPDFTabDialog* paParent );
248 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
249 0 : sal_Bool IsPdfaSelected() { return maCbPDFA1b.IsChecked(); };
250 : };
251 :
252 : //class tab page viewer
253 : class ImpPDFTabOpnFtrPage : public SfxTabPage
254 : {
255 : FixedLine maFlInitialView;
256 : RadioButton maRbOpnPageOnly;
257 : RadioButton maRbOpnOutline;
258 : RadioButton maRbOpnThumbs;
259 : FixedText maFtInitialPage;
260 : NumericField maNumInitialPage;
261 :
262 : FixedLine maFlMagnification;
263 : RadioButton maRbMagnDefault;
264 : RadioButton maRbMagnFitWin;
265 : RadioButton maRbMagnFitWidth;
266 : RadioButton maRbMagnFitVisible;
267 : RadioButton maRbMagnZoom;
268 : MetricField maNumZoom;
269 :
270 : FixedLine m_aVerticalLine;
271 :
272 : FixedLine maFlPageLayout;
273 : RadioButton maRbPgLyDefault;
274 : RadioButton maRbPgLySinglePage;
275 : RadioButton maRbPgLyContinue;
276 : RadioButton maRbPgLyContinueFacing;
277 : CheckBox maCbPgLyFirstOnLeft;
278 :
279 : sal_Bool mbUseCTLFont;
280 :
281 : DECL_LINK( ToggleRbPgLyContinueFacingHdl, void* );
282 : DECL_LINK( ToggleRbMagnHdl, void* );
283 :
284 : public:
285 : ImpPDFTabOpnFtrPage( Window* pParent,
286 : const SfxItemSet& rSet );
287 :
288 : ~ImpPDFTabOpnFtrPage();
289 : static SfxTabPage* Create( Window* pParent,
290 : const SfxItemSet& rAttrSet );
291 :
292 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
293 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
294 : };
295 :
296 : //class tab page viewer
297 : class ImpPDFTabViewerPage : public SfxTabPage
298 : {
299 : FixedLine maFlWindowOptions;
300 : CheckBox maCbResWinInit;
301 : CheckBox maCbCenterWindow;
302 : CheckBox maCbOpenFullScreen;
303 : CheckBox maCbDispDocTitle;
304 :
305 : FixedLine m_aVerticalLine;
306 :
307 : FixedLine maFlUIOptions;
308 : CheckBox maCbHideViewerMenubar;
309 : CheckBox maCbHideViewerToolbar;
310 : CheckBox maCbHideViewerWindowControls;
311 :
312 : FixedLine maFlTransitions;
313 : CheckBox maCbTransitionEffects;
314 : sal_Bool mbIsPresentation;
315 :
316 : FixedLine maFlBookmarks;
317 : RadioButton maRbAllBookmarkLevels;
318 : RadioButton maRbVisibleBookmarkLevels;
319 : NumericField maNumBookmarkLevels;
320 :
321 : DECL_LINK( ToggleRbBookmarksHdl, void* );
322 : public:
323 : ImpPDFTabViewerPage( Window* pParent,
324 : const SfxItemSet& rSet );
325 :
326 : ~ImpPDFTabViewerPage();
327 : static SfxTabPage* Create( Window* pParent,
328 : const SfxItemSet& rAttrSet );
329 :
330 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
331 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
332 : };
333 :
334 : //class security tab page
335 : class ImpPDFTabSecurityPage : public SfxTabPage
336 : {
337 : FixedLine maFlGroup;
338 : PushButton maPbSetPwd;
339 : FixedText maFtUserPwd;
340 : String maUserPwdSet;
341 : String maUserPwdUnset;
342 : String maUserPwdPdfa;
343 : String maStrSetPwd;
344 :
345 : FixedText maFtOwnerPwd;
346 : String maOwnerPwdSet;
347 : String maOwnerPwdUnset;
348 : String maOwnerPwdPdfa;
349 :
350 : FixedLine m_aVerticalLine;
351 :
352 : FixedLine maFlPrintPermissions;
353 : RadioButton maRbPrintNone;
354 : RadioButton maRbPrintLowRes;
355 : RadioButton maRbPrintHighRes;
356 :
357 : FixedLine maFlChangesAllowed;
358 : RadioButton maRbChangesNone;
359 : RadioButton maRbChangesInsDel;
360 : RadioButton maRbChangesFillForm;
361 : RadioButton maRbChangesComment;
362 : RadioButton maRbChangesAnyNoCopy;
363 :
364 : CheckBox maCbEnableCopy;
365 : CheckBox maCbEnableAccessibility;
366 :
367 : String msUserPwdTitle;
368 :
369 : bool mbHaveOwnerPassword;
370 : bool mbHaveUserPassword;
371 : com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword;
372 : String msOwnerPwdTitle;
373 :
374 : com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords;
375 :
376 : long nWidth;
377 :
378 : DECL_LINK( ClickmaPbSetPwdHdl, void* );
379 :
380 : void enablePermissionControls();
381 :
382 : void ImplPwdPushButton( const String &, String & );
383 :
384 : public:
385 : ImpPDFTabSecurityPage( Window* pParent,
386 : const SfxItemSet& rSet );
387 :
388 : ~ImpPDFTabSecurityPage();
389 : static SfxTabPage* Create( Window* pParent,
390 : const SfxItemSet& rAttrSet );
391 :
392 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
393 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
394 : void ImplPDFASecurityControl( sal_Bool bEnableSecurity );
395 0 : bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; }
396 : };
397 :
398 : //class to implement the relative link stuff
399 : class ImpPDFTabLinksPage : public SfxTabPage
400 : {
401 : CheckBox maCbExprtBmkrToNmDst;
402 : CheckBox maCbOOoToPDFTargets;
403 : CheckBox maCbExportRelativeFsysLinks;
404 :
405 : FixedLine maFlDefaultTitle;
406 : RadioButton maRbOpnLnksDefault;
407 : sal_Bool mbOpnLnksDefaultUserState;
408 : RadioButton maRbOpnLnksLaunch;
409 : sal_Bool mbOpnLnksLaunchUserState;
410 : RadioButton maRbOpnLnksBrowser;
411 : sal_Bool mbOpnLnksBrowserUserState;
412 :
413 : DECL_LINK( ClickRbOpnLnksDefaultHdl, void* );
414 : DECL_LINK( ClickRbOpnLnksBrowserHdl, void* );
415 :
416 : public:
417 : ImpPDFTabLinksPage( Window* pParent,
418 : const SfxItemSet& rSet );
419 :
420 : ~ImpPDFTabLinksPage();
421 : static SfxTabPage* Create( Window* pParent,
422 : const SfxItemSet& rAttrSet );
423 :
424 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
425 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
426 :
427 : void ImplPDFALinkControl( sal_Bool bEnableLaunch );
428 : };
429 :
430 : //class to implement the digital signing
431 : class ImpPDFTabSigningPage : public SfxTabPage
432 : {
433 : FixedText maFtSignCert;
434 : Edit maEdSignCert;
435 : PushButton maPbSignCertSelect;
436 : PushButton maPbSignCertClear;
437 : FixedText maFtSignPassword;
438 : Edit maEdSignPassword;
439 : FixedText maFtSignLocation;
440 : Edit maEdSignLocation;
441 : FixedText maFtSignContactInfo;
442 : Edit maEdSignContactInfo;
443 : FixedText maFtSignReason;
444 : Edit maEdSignReason;
445 : com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
446 :
447 : DECL_LINK( ClickmaPbSignCertSelect, void* );
448 : DECL_LINK( ClickmaPbSignCertClear, void* );
449 :
450 : public:
451 : ImpPDFTabSigningPage( Window* pParent,
452 : const SfxItemSet& rSet );
453 :
454 : ~ImpPDFTabSigningPage();
455 : static SfxTabPage* Create( Window* pParent,
456 : const SfxItemSet& rAttrSet );
457 :
458 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
459 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
460 : };
461 :
462 : #endif // IMPDIALOG_HXX
463 :
464 :
465 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|