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 INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX
21 : #define INCLUDED_FILTER_SOURCE_PDF_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/layout.hxx"
31 : #include "vcl/lstbox.hxx"
32 : #include "vcl/combobox.hxx"
33 : #include "vcl/group.hxx"
34 : #include "vcl/pdfwriter.hxx"
35 :
36 : #include <vcl/FilterConfigItem.hxx>
37 :
38 : #include "sfx2/tabdlg.hxx"
39 :
40 : #include "com/sun/star/beans/NamedValue.hpp"
41 :
42 :
43 : // - ImpPDFDialog -
44 :
45 :
46 : class ImpPDFTabGeneralPage;
47 : class ImpPDFTabViewerPage;
48 : class ImpPDFTabOpnFtrPage;
49 : class ImpPDFTabLinksPage;
50 :
51 : class PDFFilterResId : public ResId
52 : {
53 : public:
54 : PDFFilterResId( sal_uInt32 nId );
55 : };
56 :
57 : class ImplErrorDialog : public MessageDialog
58 : {
59 : VclPtr<ListBox> m_pErrors;
60 : VclPtr<FixedText> m_pExplanation;
61 :
62 : DECL_LINK(SelectHdl, void *);
63 : public:
64 : ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& );
65 : virtual ~ImplErrorDialog();
66 : virtual void dispose() SAL_OVERRIDE;
67 : };
68 :
69 : class ImpPDFTabSecurityPage;
70 : class ImpPDFTabLinksPage;
71 :
72 :
73 : //class tabbed dialog
74 : class ImpPDFTabDialog : public SfxTabDialog
75 : {
76 : private:
77 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext> mxContext;
78 : FilterConfigItem maConfigItem;
79 : FilterConfigItem maConfigI18N;
80 :
81 : Any maSelection;
82 :
83 : DECL_LINK(CancelHdl, void *);
84 :
85 : sal_uInt16 mnSigningPageId;
86 : sal_uInt16 mnSecurityPageId;
87 : sal_uInt16 mnLinksPage;
88 : sal_uInt16 mnInterfacePageId;
89 : sal_uInt16 mnViewPageId;
90 : sal_uInt16 mnGeneralPageId;
91 :
92 : protected:
93 : //the following data are the configuration used throughout the dialog and pages
94 : bool mbIsPresentation;
95 : bool mbIsWriter;
96 : bool mbSelectionPresent;
97 : bool mbUseCTLFont;
98 : bool mbUseLosslessCompression;
99 : sal_Int32 mnQuality;
100 : bool mbReduceImageResolution;
101 : sal_Int32 mnMaxImageResolution;
102 : bool mbUseTaggedPDF;
103 : sal_Int32 mnPDFTypeSelection;
104 : bool mbExportNotes;
105 : bool mbViewPDF;
106 : bool mbExportNotesPages;
107 : bool mbUseTransitionEffects;
108 : bool mbIsSkipEmptyPages;
109 : bool mbAddStream;
110 : sal_Int32 mnFormsType;
111 : bool mbExportFormFields;
112 : bool mbAllowDuplicateFieldNames;
113 : bool mbExportBookmarks;
114 : bool mbExportHiddenSlides;
115 : sal_Int32 mnOpenBookmarkLevels;
116 :
117 : bool mbHideViewerToolbar;
118 : bool mbHideViewerMenubar;
119 : bool mbHideViewerWindowControls;
120 : bool mbResizeWinToInit;
121 : bool mbCenterWindow;
122 : bool mbOpenInFullScreenMode;
123 : bool mbDisplayPDFDocumentTitle;
124 : sal_Int32 mnMagnification;
125 : sal_Int32 mnInitialView;
126 : sal_Int32 mnZoom;
127 : sal_Int32 mnInitialPage;
128 :
129 : sal_Int32 mnPageLayout;
130 : bool mbFirstPageLeft;
131 :
132 : bool mbEncrypt;
133 :
134 : bool mbRestrictPermissions;
135 : com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword;
136 : sal_Int32 mnPrint;
137 : sal_Int32 mnChangesAllowed;
138 : bool mbCanCopyOrExtract;
139 : bool mbCanExtractForAccessibility;
140 : com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords;
141 :
142 : bool mbIsRangeChecked;
143 : OUString msPageRange;
144 : bool mbSelectionIsChecked;
145 :
146 : bool mbExportRelativeFsysLinks;
147 : sal_Int32 mnViewPDFMode;
148 : bool mbConvertOOoTargets;
149 : bool mbExportBmkToPDFDestination;
150 :
151 : bool mbSignPDF;
152 : OUString msSignPassword;
153 : OUString msSignLocation;
154 : OUString msSignContact;
155 : OUString msSignReason;
156 : com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
157 : OUString msSignTSA;
158 :
159 : 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( vcl::Window* pParent,
171 : Sequence< PropertyValue >& rFilterData,
172 : const css::uno::Reference< XComponent >& rDoc
173 : );
174 : virtual ~ImpPDFTabDialog();
175 : virtual void dispose() SAL_OVERRIDE;
176 :
177 : Sequence< PropertyValue > GetFilterData();
178 :
179 : ImpPDFTabSecurityPage* getSecurityPage() const;
180 : ImpPDFTabLinksPage* getLinksPage() const;
181 : ImpPDFTabGeneralPage* getGeneralPage() const;
182 :
183 : protected:
184 : virtual void PageCreated( sal_uInt16 _nId,
185 : SfxTabPage& _rPage ) SAL_OVERRIDE;
186 : virtual short Ok() SAL_OVERRIDE;
187 : };
188 :
189 : //class tab page general
190 : class ImpPDFTabGeneralPage : public SfxTabPage
191 : {
192 : friend class ImpPDFTabLinksPage;
193 :
194 : VclPtr<RadioButton> mpRbAll;
195 : VclPtr<RadioButton> mpRbRange;
196 : VclPtr<RadioButton> mpRbSelection;
197 : VclPtr<Edit> mpEdPages;
198 :
199 : VclPtr<RadioButton> mpRbLosslessCompression;
200 : VclPtr<RadioButton> mpRbJPEGCompression;
201 : VclPtr<VclContainer> mpQualityFrame;
202 : VclPtr<MetricField> mpNfQuality;
203 : VclPtr<CheckBox> mpCbReduceImageResolution;
204 : VclPtr<ComboBox> mpCoReduceImageResolution;
205 :
206 : VclPtr<CheckBox> mpCbPDFA1b;
207 : VclPtr<CheckBox> mpCbTaggedPDF;
208 : bool mbTaggedPDFUserSelection;
209 :
210 : VclPtr<CheckBox> mpCbExportFormFields;
211 : bool mbExportFormFieldsUserSelection;
212 : VclPtr<VclContainer> mpFormsFrame;
213 : VclPtr<ListBox> mpLbFormsFormat;
214 : VclPtr<CheckBox> mpCbAllowDuplicateFieldNames;
215 :
216 : VclPtr<CheckBox> mpCbExportBookmarks;
217 : VclPtr<CheckBox> mpCbExportHiddenSlides;
218 : VclPtr<CheckBox> mpCbExportNotes;
219 : VclPtr<CheckBox> mpCbViewPDF;
220 : VclPtr<CheckBox> mpCbExportNotesPages;
221 :
222 : VclPtr<CheckBox> mpCbExportEmptyPages;
223 : VclPtr<CheckBox> mpCbAddStream;
224 :
225 : VclPtr<CheckBox> mpCbWatermark;
226 : VclPtr<FixedText> mpFtWatermark;
227 : VclPtr<Edit> mpEdWatermark;
228 :
229 : bool mbIsPresentation;
230 : bool mbIsWriter;
231 :
232 : VclPtr<ImpPDFTabDialog> mpaParent;
233 :
234 : DECL_LINK( TogglePagesHdl, void* );
235 : DECL_LINK( ToggleCompressionHdl, void* );
236 : DECL_LINK( ToggleReduceImageResolutionHdl, void* );
237 : DECL_LINK( ToggleWatermarkHdl, void* );
238 : DECL_LINK( ToggleAddStreamHdl, void* );
239 : DECL_LINK( ToggleExportFormFieldsHdl, void* );
240 :
241 : public:
242 : DECL_LINK( ToggleExportPDFAHdl, void* );
243 :
244 : ImpPDFTabGeneralPage( vcl::Window* pParent,
245 : const SfxItemSet& rSet );
246 : virtual ~ImpPDFTabGeneralPage();
247 : virtual void dispose() SAL_OVERRIDE;
248 :
249 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
250 : const SfxItemSet* rAttrSet);
251 :
252 : void GetFilterConfigItem(ImpPDFTabDialog* paParent);
253 : void SetFilterConfigItem(ImpPDFTabDialog* paParent);
254 0 : bool IsPdfaSelected() const { return mpCbPDFA1b->IsChecked(); }
255 : };
256 :
257 : //class tab page viewer
258 : class ImpPDFTabOpnFtrPage : public SfxTabPage
259 : {
260 : VclPtr<RadioButton> mpRbOpnPageOnly;
261 : VclPtr<RadioButton> mpRbOpnOutline;
262 : VclPtr<RadioButton> mpRbOpnThumbs;
263 : VclPtr<NumericField> mpNumInitialPage;
264 :
265 : VclPtr<RadioButton> mpRbMagnDefault;
266 : VclPtr<RadioButton> mpRbMagnFitWin;
267 : VclPtr<RadioButton> mpRbMagnFitWidth;
268 : VclPtr<RadioButton> mpRbMagnFitVisible;
269 : VclPtr<RadioButton> mpRbMagnZoom;
270 : VclPtr<NumericField> mpNumZoom;
271 :
272 : VclPtr<RadioButton> mpRbPgLyDefault;
273 : VclPtr<RadioButton> mpRbPgLySinglePage;
274 : VclPtr<RadioButton> mpRbPgLyContinue;
275 : VclPtr<RadioButton> mpRbPgLyContinueFacing;
276 : VclPtr<CheckBox> mpCbPgLyFirstOnLeft;
277 :
278 : bool mbUseCTLFont;
279 :
280 : DECL_LINK( ToggleRbPgLyContinueFacingHdl, void* );
281 : DECL_LINK( ToggleRbMagnHdl, void* );
282 :
283 : public:
284 : ImpPDFTabOpnFtrPage( vcl::Window* pParent,
285 : const SfxItemSet& rSet );
286 :
287 : virtual ~ImpPDFTabOpnFtrPage();
288 : virtual void dispose() SAL_OVERRIDE;
289 : static VclPtr<SfxTabPage> Create( vcl::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 : VclPtr<CheckBox> m_pCbResWinInit;
300 : VclPtr<CheckBox> m_pCbCenterWindow;
301 : VclPtr<CheckBox> m_pCbOpenFullScreen;
302 : VclPtr<CheckBox> m_pCbDispDocTitle;
303 :
304 :
305 : VclPtr<CheckBox> m_pCbHideViewerMenubar;
306 : VclPtr<CheckBox> m_pCbHideViewerToolbar;
307 : VclPtr<CheckBox> m_pCbHideViewerWindowControls;
308 :
309 : VclPtr<CheckBox> m_pCbTransitionEffects;
310 : bool mbIsPresentation;
311 :
312 : VclPtr<RadioButton> m_pRbAllBookmarkLevels;
313 : VclPtr<RadioButton> m_pRbVisibleBookmarkLevels;
314 : VclPtr<NumericField> m_pNumBookmarkLevels;
315 :
316 : DECL_LINK( ToggleRbBookmarksHdl, void* );
317 : public:
318 : ImpPDFTabViewerPage( vcl::Window* pParent,
319 : const SfxItemSet& rSet );
320 :
321 : virtual ~ImpPDFTabViewerPage();
322 : virtual void dispose() SAL_OVERRIDE;
323 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
324 : const SfxItemSet* rAttrSet );
325 :
326 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
327 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
328 : };
329 :
330 : //class security tab page
331 : class ImpPDFTabSecurityPage : public SfxTabPage
332 : {
333 : VclPtr<PushButton> mpPbSetPwd;
334 : OUString msStrSetPwd;
335 :
336 : VclPtr<VclContainer> mpUserPwdSet;
337 : VclPtr<VclContainer> mpUserPwdUnset;
338 : VclPtr<VclContainer> mpUserPwdPdfa;
339 :
340 : VclPtr<VclContainer> mpOwnerPwdSet;
341 : VclPtr<VclContainer> mpOwnerPwdUnset;
342 : VclPtr<VclContainer> mpOwnerPwdPdfa;
343 :
344 : VclPtr<VclContainer> mpPrintPermissions;
345 : VclPtr<RadioButton> mpRbPrintNone;
346 : VclPtr<RadioButton> mpRbPrintLowRes;
347 : VclPtr<RadioButton> mpRbPrintHighRes;
348 :
349 : VclPtr<VclContainer> mpChangesAllowed;
350 : VclPtr<RadioButton> mpRbChangesNone;
351 : VclPtr<RadioButton> mpRbChangesInsDel;
352 : VclPtr<RadioButton> mpRbChangesFillForm;
353 : VclPtr<RadioButton> mpRbChangesComment;
354 : VclPtr<RadioButton> mpRbChangesAnyNoCopy;
355 :
356 : VclPtr<VclContainer> mpContent;
357 : VclPtr<CheckBox> mpCbEnableCopy;
358 : VclPtr<CheckBox> mpCbEnableAccessibility;
359 :
360 : OUString msUserPwdTitle;
361 :
362 : bool mbHaveOwnerPassword;
363 : bool mbHaveUserPassword;
364 : com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword;
365 : OUString msOwnerPwdTitle;
366 :
367 : com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords;
368 :
369 : DECL_LINK( ClickmaPbSetPwdHdl, void* );
370 :
371 : void enablePermissionControls();
372 :
373 : public:
374 : ImpPDFTabSecurityPage( vcl::Window* pParent,
375 : const SfxItemSet& rSet );
376 :
377 : virtual ~ImpPDFTabSecurityPage();
378 : virtual void dispose() SAL_OVERRIDE;
379 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
380 : const SfxItemSet* rAttrSet );
381 :
382 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
383 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
384 : void ImplPDFASecurityControl( bool bEnableSecurity );
385 0 : bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; }
386 : };
387 :
388 : //class to implement the relative link stuff
389 : class ImpPDFTabLinksPage : public SfxTabPage
390 : {
391 : VclPtr<CheckBox> m_pCbExprtBmkrToNmDst;
392 : VclPtr<CheckBox> m_pCbOOoToPDFTargets;
393 : VclPtr<CheckBox> m_pCbExportRelativeFsysLinks;
394 :
395 : VclPtr<RadioButton> m_pRbOpnLnksDefault;
396 : bool mbOpnLnksDefaultUserState;
397 : VclPtr<RadioButton> m_pRbOpnLnksLaunch;
398 : bool mbOpnLnksLaunchUserState;
399 : VclPtr<RadioButton> m_pRbOpnLnksBrowser;
400 : bool mbOpnLnksBrowserUserState;
401 :
402 : DECL_LINK( ClickRbOpnLnksDefaultHdl, void* );
403 : DECL_LINK( ClickRbOpnLnksBrowserHdl, void* );
404 :
405 : public:
406 : ImpPDFTabLinksPage( vcl::Window* pParent,
407 : const SfxItemSet& rSet );
408 :
409 : virtual ~ImpPDFTabLinksPage();
410 : virtual void dispose() SAL_OVERRIDE;
411 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
412 : const SfxItemSet* rAttrSet );
413 :
414 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
415 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
416 :
417 : void ImplPDFALinkControl( bool bEnableLaunch );
418 : };
419 :
420 : //class to implement the digital signing
421 : class ImpPDFTabSigningPage : public SfxTabPage
422 : {
423 : VclPtr<Edit> mpEdSignCert;
424 : VclPtr<PushButton> mpPbSignCertSelect;
425 : VclPtr<PushButton> mpPbSignCertClear;
426 : VclPtr<Edit> mpEdSignPassword;
427 : VclPtr<Edit> mpEdSignLocation;
428 : VclPtr<Edit> mpEdSignContactInfo;
429 : VclPtr<Edit> mpEdSignReason;
430 : VclPtr<ListBox> mpLBSignTSA;
431 : com::sun::star::uno::Reference< com::sun::star::security::XCertificate > maSignCertificate;
432 :
433 : DECL_LINK( ClickmaPbSignCertSelect, void* );
434 : DECL_LINK( ClickmaPbSignCertClear, void* );
435 :
436 : public:
437 : ImpPDFTabSigningPage( vcl::Window* pParent,
438 : const SfxItemSet& rSet );
439 :
440 : virtual ~ImpPDFTabSigningPage();
441 : virtual void dispose() SAL_OVERRIDE;
442 : static VclPtr<SfxTabPage> Create( vcl::Window* pParent,
443 : const SfxItemSet* rAttrSet );
444 :
445 : void GetFilterConfigItem( ImpPDFTabDialog* paParent);
446 : void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
447 : };
448 :
449 : #endif // INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX
450 :
451 :
452 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|