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