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