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