1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
23 #include "pdffilter.hxx"
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"
35 #include <vcl/FilterConfigItem.hxx>
37 #include "sfx2/tabdlg.hxx"
39 #include "com/sun/star/beans/NamedValue.hpp"
45 class ImpPDFTabGeneralPage
;
46 class ImpPDFTabViewerPage
;
47 class ImpPDFTabOpnFtrPage
;
48 class ImpPDFTabLinksPage
;
50 class PDFFilterResId
: public ResId
53 PDFFilterResId( sal_uInt32 nId
);
56 class ImplErrorDialog
: public ModalDialog
59 FixedText maProcessText
;
61 FixedText maExplanation
;
65 DECL_LINK(SelectHdl
, void *);
67 ImplErrorDialog( const std::set
< vcl::PDFWriter::ErrorCode
>& );
71 ////////////////////////////////////////////////////////////////////////
73 class ImpPDFTabDialog
: public SfxTabDialog
76 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> mxMSF
;
77 FilterConfigItem maConfigItem
;
78 FilterConfigItem maConfigI18N
;
82 DECL_LINK(CancelHdl
, void *);
85 //the following data are the configuration used throughout the dialog and pages
86 sal_Bool mbIsPresentation
;
88 sal_Bool mbSelectionPresent
;
89 sal_Bool mbUseCTLFont
;
90 sal_Bool mbUseLosslessCompression
;
92 sal_Bool mbReduceImageResolution
;
93 sal_Int32 mnMaxImageResolution
;
94 sal_Bool mbUseTaggedPDF
;
95 sal_Int32 mnPDFTypeSelection
;
96 sal_Bool mbExportNotes
;
98 sal_Bool mbExportNotesPages
;
99 sal_Bool mbUseTransitionEffects
;
100 sal_Bool mbIsSkipEmptyPages
;
101 sal_Bool mbAddStream
;
102 sal_Bool mbEmbedStandardFonts
;
103 sal_Int32 mnFormsType
;
104 sal_Bool mbExportFormFields
;
105 sal_Bool mbAllowDuplicateFieldNames
;
106 sal_Bool mbExportBookmarks
;
107 sal_Bool mbExportHiddenSlides
;
108 sal_Int32 mnOpenBookmarkLevels
;
110 sal_Bool mbHideViewerToolbar
;
111 sal_Bool mbHideViewerMenubar
;
112 sal_Bool mbHideViewerWindowControls
;
113 sal_Bool mbResizeWinToInit
;
114 sal_Bool mbCenterWindow
;
115 sal_Bool mbOpenInFullScreenMode
;
116 sal_Bool mbDisplayPDFDocumentTitle
;
117 sal_Int32 mnMagnification
;
118 sal_Int32 mnInitialView
;
120 sal_Int32 mnInitialPage
;
122 sal_Int32 mnPageLayout
;
123 sal_Bool mbFirstPageLeft
;
127 sal_Bool mbRestrictPermissions
;
128 com::sun::star::uno::Sequence
< com::sun::star::beans::NamedValue
> maPreparedOwnerPassword
;
130 sal_Int32 mnChangesAllowed
;
131 sal_Bool mbCanCopyOrExtract
;
132 sal_Bool mbCanExtractForAccessibility
;
133 com::sun::star::uno::Reference
< com::sun::star::beans::XMaterialHolder
> mxPreparedPasswords
;
135 sal_Bool mbIsRangeChecked
;
136 OUString msPageRange
;
137 sal_Bool mbSelectionIsChecked
;
139 sal_Bool mbExportRelativeFsysLinks
;
140 sal_Int32 mnViewPDFMode
;
141 sal_Bool mbConvertOOoTargets
;
142 sal_Bool mbExportBmkToPDFDestination
;
145 OUString msSignPassword
;
146 OUString msSignLocation
;
147 OUString msSignContact
;
148 OUString msSignReason
;
149 com::sun::star::uno::Reference
< com::sun::star::security::XCertificate
> maSignCertificate
;
151 OUString maWatermarkText
;
155 friend class ImpPDFTabGeneralPage
;
156 friend class ImpPDFTabViewerPage
;
157 friend class ImpPDFTabOpnFtrPage
;
158 friend class ImpPDFTabSecurityPage
;
159 friend class ImpPDFTabLinksPage
;
160 friend class ImpPDFTabSigningPage
;
162 ImpPDFTabDialog( Window
* pParent
,
163 Sequence
< PropertyValue
>& rFilterData
,
164 const Reference
< XComponent
>& rDoc
,
165 const Reference
< lang::XMultiServiceFactory
>& xFact
169 Sequence
< PropertyValue
> GetFilterData();
170 const com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>& getServiceFactory() const { return mxMSF
; }
173 virtual void PageCreated( sal_uInt16 _nId
,
174 SfxTabPage
& _rPage
);
178 //class tab page general
179 class ImpPDFTabGeneralPage
: public SfxTabPage
181 friend class ImpPDFTabLinksPage
;
185 RadioButton maRbRange
;
186 RadioButton maRbSelection
;
189 FixedLine maFlCompression
;
190 RadioButton maRbLosslessCompression
;
191 RadioButton maRbJPEGCompression
;
192 FixedText maFtQuality
;
193 MetricField maNfQuality
;
194 CheckBox maCbReduceImageResolution
;
195 ComboBox maCoReduceImageResolution
;
197 FixedLine m_aVerticalLine
;
199 FixedLine maFlGeneral
;
201 CheckBox maCbTaggedPDF
;
202 sal_Bool mbTaggedPDFUserSelection
;
204 CheckBox maCbExportFormFields
;
205 sal_Bool mbExportFormFieldsUserSelection
;
206 sal_Bool mbEmbedStandardFontsUserSelection
;
207 FixedText maFtFormsFormat
;
208 ListBox maLbFormsFormat
;
209 CheckBox maCbAllowDuplicateFieldNames
;
211 CheckBox maCbExportBookmarks
;
212 CheckBox maCbExportHiddenSlides
;
213 CheckBox maCbExportNotes
;
214 CheckBox maCbViewPDF
;
215 CheckBox maCbExportNotesPages
;
217 CheckBox maCbExportEmptyPages
;
218 CheckBox maCbAddStream
;
219 FixedText maFtAddStreamDescription
;
220 CheckBox maCbEmbedStandardFonts
;
222 FixedLine maFlWatermark
;
223 CheckBox maCbWatermark
;
224 FixedText maFtWatermark
;
227 sal_Bool mbIsPresentation
;
230 const ImpPDFTabDialog
* mpaParent
;
232 DECL_LINK( TogglePagesHdl
, void* );
233 DECL_LINK( ToggleCompressionHdl
, void* );
234 DECL_LINK( ToggleReduceImageResolutionHdl
, void* );
235 DECL_LINK( ToggleWatermarkHdl
, void* );
236 DECL_LINK( ToggleAddStreamHdl
, void* );
237 DECL_LINK( ToggleExportFormFieldsHdl
, void* );
240 DECL_LINK( ToggleExportPDFAHdl
, void* );
242 ImpPDFTabGeneralPage( Window
* pParent
,
243 const SfxItemSet
& rSet
);
245 ~ImpPDFTabGeneralPage();
246 static SfxTabPage
* Create( Window
* pParent
,
247 const SfxItemSet
& rAttrSet
);
249 void GetFilterConfigItem( ImpPDFTabDialog
* paParent
);
250 void SetFilterConfigItem( const ImpPDFTabDialog
* paParent
);
251 sal_Bool
IsPdfaSelected() { return maCbPDFA1b
.IsChecked(); };
254 //class tab page viewer
255 class ImpPDFTabOpnFtrPage
: public SfxTabPage
257 FixedLine maFlInitialView
;
258 RadioButton maRbOpnPageOnly
;
259 RadioButton maRbOpnOutline
;
260 RadioButton maRbOpnThumbs
;
261 FixedText maFtInitialPage
;
262 NumericField maNumInitialPage
;
264 FixedLine maFlMagnification
;
265 RadioButton maRbMagnDefault
;
266 RadioButton maRbMagnFitWin
;
267 RadioButton maRbMagnFitWidth
;
268 RadioButton maRbMagnFitVisible
;
269 RadioButton maRbMagnZoom
;
270 MetricField maNumZoom
;
272 FixedLine m_aVerticalLine
;
274 FixedLine maFlPageLayout
;
275 RadioButton maRbPgLyDefault
;
276 RadioButton maRbPgLySinglePage
;
277 RadioButton maRbPgLyContinue
;
278 RadioButton maRbPgLyContinueFacing
;
279 CheckBox maCbPgLyFirstOnLeft
;
281 sal_Bool mbUseCTLFont
;
283 DECL_LINK( ToggleRbPgLyContinueFacingHdl
, void* );
284 DECL_LINK( ToggleRbMagnHdl
, void* );
287 ImpPDFTabOpnFtrPage( Window
* pParent
,
288 const SfxItemSet
& rSet
);
290 ~ImpPDFTabOpnFtrPage();
291 static SfxTabPage
* Create( Window
* pParent
,
292 const SfxItemSet
& rAttrSet
);
294 void GetFilterConfigItem( ImpPDFTabDialog
* paParent
);
295 void SetFilterConfigItem( const ImpPDFTabDialog
* paParent
);
298 //class tab page viewer
299 class ImpPDFTabViewerPage
: public SfxTabPage
301 FixedLine maFlWindowOptions
;
302 CheckBox maCbResWinInit
;
303 CheckBox maCbCenterWindow
;
304 CheckBox maCbOpenFullScreen
;
305 CheckBox maCbDispDocTitle
;
307 FixedLine m_aVerticalLine
;
309 FixedLine maFlUIOptions
;
310 CheckBox maCbHideViewerMenubar
;
311 CheckBox maCbHideViewerToolbar
;
312 CheckBox maCbHideViewerWindowControls
;
314 FixedLine maFlTransitions
;
315 CheckBox maCbTransitionEffects
;
316 sal_Bool mbIsPresentation
;
318 FixedLine maFlBookmarks
;
319 RadioButton maRbAllBookmarkLevels
;
320 RadioButton maRbVisibleBookmarkLevels
;
321 NumericField maNumBookmarkLevels
;
323 DECL_LINK( ToggleRbBookmarksHdl
, void* );
325 ImpPDFTabViewerPage( Window
* pParent
,
326 const SfxItemSet
& rSet
);
328 ~ImpPDFTabViewerPage();
329 static SfxTabPage
* Create( Window
* pParent
,
330 const SfxItemSet
& rAttrSet
);
332 void GetFilterConfigItem( ImpPDFTabDialog
* paParent
);
333 void SetFilterConfigItem( const ImpPDFTabDialog
* paParent
);
336 //class security tab page
337 class ImpPDFTabSecurityPage
: public SfxTabPage
340 PushButton maPbSetPwd
;
341 FixedText maFtUserPwd
;
343 String maUserPwdUnset
;
344 String maUserPwdPdfa
;
347 FixedText maFtOwnerPwd
;
348 String maOwnerPwdSet
;
349 String maOwnerPwdUnset
;
350 String maOwnerPwdPdfa
;
352 FixedLine m_aVerticalLine
;
354 FixedLine maFlPrintPermissions
;
355 RadioButton maRbPrintNone
;
356 RadioButton maRbPrintLowRes
;
357 RadioButton maRbPrintHighRes
;
359 FixedLine maFlChangesAllowed
;
360 RadioButton maRbChangesNone
;
361 RadioButton maRbChangesInsDel
;
362 RadioButton maRbChangesFillForm
;
363 RadioButton maRbChangesComment
;
364 RadioButton maRbChangesAnyNoCopy
;
366 CheckBox maCbEnableCopy
;
367 CheckBox maCbEnableAccessibility
;
369 String msUserPwdTitle
;
371 bool mbHaveOwnerPassword
;
372 bool mbHaveUserPassword
;
373 com::sun::star::uno::Sequence
< com::sun::star::beans::NamedValue
> maPreparedOwnerPassword
;
374 String msOwnerPwdTitle
;
376 com::sun::star::uno::Reference
< com::sun::star::beans::XMaterialHolder
> mxPreparedPasswords
;
380 DECL_LINK( ClickmaPbSetPwdHdl
, void* );
382 void enablePermissionControls();
384 void ImplPwdPushButton( const String
&, String
& );
387 ImpPDFTabSecurityPage( Window
* pParent
,
388 const SfxItemSet
& rSet
);
390 ~ImpPDFTabSecurityPage();
391 static SfxTabPage
* Create( Window
* pParent
,
392 const SfxItemSet
& rAttrSet
);
394 void GetFilterConfigItem( ImpPDFTabDialog
* paParent
);
395 void SetFilterConfigItem( const ImpPDFTabDialog
* paParent
);
396 void ImplPDFASecurityControl( sal_Bool bEnableSecurity
);
397 bool hasPassword() const { return mbHaveOwnerPassword
|| mbHaveUserPassword
; }
400 //class to implement the relative link stuff
401 class ImpPDFTabLinksPage
: public SfxTabPage
403 CheckBox maCbExprtBmkrToNmDst
;
404 CheckBox maCbOOoToPDFTargets
;
405 CheckBox maCbExportRelativeFsysLinks
;
407 FixedLine maFlDefaultTitle
;
408 RadioButton maRbOpnLnksDefault
;
409 sal_Bool mbOpnLnksDefaultUserState
;
410 RadioButton maRbOpnLnksLaunch
;
411 sal_Bool mbOpnLnksLaunchUserState
;
412 RadioButton maRbOpnLnksBrowser
;
413 sal_Bool mbOpnLnksBrowserUserState
;
415 DECL_LINK( ClickRbOpnLnksDefaultHdl
, void* );
416 DECL_LINK( ClickRbOpnLnksBrowserHdl
, void* );
419 ImpPDFTabLinksPage( Window
* pParent
,
420 const SfxItemSet
& rSet
);
422 ~ImpPDFTabLinksPage();
423 static SfxTabPage
* Create( Window
* pParent
,
424 const SfxItemSet
& rAttrSet
);
426 void GetFilterConfigItem( ImpPDFTabDialog
* paParent
);
427 void SetFilterConfigItem( const ImpPDFTabDialog
* paParent
);
429 void ImplPDFALinkControl( sal_Bool bEnableLaunch
);
432 //class to implement the digital signing
433 class ImpPDFTabSigningPage
: public SfxTabPage
435 FixedText maFtSignCert
;
437 PushButton maPbSignCertSelect
;
438 PushButton maPbSignCertClear
;
439 FixedText maFtSignPassword
;
440 Edit maEdSignPassword
;
441 FixedText maFtSignLocation
;
442 Edit maEdSignLocation
;
443 FixedText maFtSignContactInfo
;
444 Edit maEdSignContactInfo
;
445 FixedText maFtSignReason
;
447 com::sun::star::uno::Reference
< com::sun::star::security::XCertificate
> maSignCertificate
;
449 DECL_LINK( ClickmaPbSignCertSelect
, void* );
450 DECL_LINK( ClickmaPbSignCertClear
, void* );
453 ImpPDFTabSigningPage( Window
* pParent
,
454 const SfxItemSet
& rSet
);
456 ~ImpPDFTabSigningPage();
457 static SfxTabPage
* Create( Window
* pParent
,
458 const SfxItemSet
& rAttrSet
);
460 void GetFilterConfigItem( ImpPDFTabDialog
* paParent
);
461 void SetFilterConfigItem( const ImpPDFTabDialog
* paParent
);
464 #endif // IMPDIALOG_HXX
467 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */