android: Update app-specific/MIME type icons
[LibreOffice.git] / filter / source / pdf / impdialog.hxx
blob3690c9e61ff9538e1bb132a7ca2f05e2e1e4ded7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <sfx2/tabdlg.hxx>
23 #include <sfx2/passwd.hxx>
25 #include <vcl/pdfwriter.hxx>
26 #include <vcl/FilterConfigItem.hxx>
27 #include <vcl/weld.hxx>
29 #include <com/sun/star/beans/NamedValue.hpp>
30 #include <com/sun/star/lang/XComponent.hpp>
32 class ImpPDFTabGeneralPage;
33 class ImpPDFTabViewerPage;
34 class ImpPDFTabOpnFtrPage;
35 class ImpPDFTabLinksPage;
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::beans;
39 using namespace ::com::sun::star::lang;
41 class ImplErrorDialog : public weld::MessageDialogController
43 private:
44 std::unique_ptr<weld::TreeView> m_xErrors;
45 std::unique_ptr<weld::Label> m_xExplanation;
47 DECL_LINK(SelectHdl, weld::TreeView&, void);
49 public:
50 explicit ImplErrorDialog(weld::Window* pParent, const std::set<vcl::PDFWriter::ErrorCode>& rErrorCodes);
54 class ImpPDFTabSecurityPage;
55 class ImpPDFTabLinksPage;
58 /// Class tabbed dialog
59 class ImpPDFTabDialog final : public SfxTabDialogController
61 css::uno::Reference<css::lang::XComponent> mrDoc;
63 FilterConfigItem maConfigItem;
64 FilterConfigItem maConfigI18N;
66 Any maSelection;
68 DECL_LINK(CancelHdl, weld::Button&, void);
69 DECL_LINK(OkHdl, weld::Button&, void);
71 // the following data are the configuration used throughout the dialog and pages
72 bool mbIsPresentation;
73 bool mbIsSpreadsheet;
74 bool mbIsWriter;
75 bool mbSelectionPresent;
76 bool mbUseCTLFont;
77 bool mbUseLosslessCompression;
78 sal_Int32 mnQuality;
79 bool mbReduceImageResolution;
80 sal_Int32 mnMaxImageResolution;
81 bool mbUseTaggedPDF;
82 bool mbUseTaggedPDFUserSelection;
83 sal_Int32 mnPDFTypeSelection;
84 bool mbPDFUACompliance;
85 bool mbExportNotes;
86 bool mbExportNotesInMargin;
87 bool mbViewPDF;
88 bool mbUseReferenceXObject;
89 bool mbUseReferenceXObjectUserSelection = false;
90 bool mbExportNotesPages;
91 bool mbExportOnlyNotesPages;
92 bool mbUseTransitionEffects;
93 bool mbIsSkipEmptyPages;
94 bool mbIsExportPlaceholders;
95 bool mbAddStream;
96 sal_Int32 mnFormsType;
97 bool mbExportFormFields;
98 bool mbAllowDuplicateFieldNames;
99 bool mbExportBookmarks;
100 bool mbExportBookmarksUserSelection = true;
101 bool mbExportHiddenSlides;
102 bool mbSinglePageSheets;
103 sal_Int32 mnOpenBookmarkLevels;
105 bool mbHideViewerToolbar;
106 bool mbHideViewerMenubar;
107 bool mbHideViewerWindowControls;
108 bool mbResizeWinToInit;
109 bool mbCenterWindow;
110 bool mbOpenInFullScreenMode;
111 bool mbDisplayPDFDocumentTitle;
112 sal_Int32 mnMagnification;
113 sal_Int32 mnInitialView;
114 sal_Int32 mnInitialViewUserSelection;
115 sal_Int32 mnZoom;
116 sal_Int32 mnInitialPage;
118 sal_Int32 mnPageLayout;
119 bool mbFirstPageLeft;
121 bool mbEncrypt;
123 bool mbRestrictPermissions;
124 css::uno::Sequence< css::beans::NamedValue > maPreparedOwnerPassword;
125 sal_Int32 mnPrint;
126 sal_Int32 mnChangesAllowed;
127 bool mbCanCopyOrExtract;
128 bool mbCanExtractForAccessibility;
129 css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords;
131 bool mbIsRangeChecked;
132 OUString msPageRange;
133 bool mbSelectionIsChecked;
135 bool mbExportRelativeFsysLinks;
136 sal_Int32 mnViewPDFMode;
137 bool mbConvertOOoTargets;
138 bool mbExportBmkToPDFDestination;
140 bool mbSignPDF;
141 OUString msSignPassword;
142 OUString msSignLocation;
143 OUString msSignContact;
144 OUString msSignReason;
145 css::uno::Reference< css::security::XCertificate > maSignCertificate;
146 OUString msSignTSA;
148 OUString maWatermarkText;
150 public:
152 friend class ImpPDFTabGeneralPage;
153 friend class ImpPDFTabViewerPage;
154 friend class ImpPDFTabOpnFtrPage;
155 friend class ImpPDFTabSecurityPage;
156 friend class ImpPDFTabLinksPage;
157 friend class ImpPDFTabSigningPage;
159 ImpPDFTabDialog(weld::Window* pParent, const Sequence< PropertyValue >& rFilterData,
160 const css::uno::Reference< XComponent >& rDoc);
161 virtual ~ImpPDFTabDialog() override;
163 Sequence< PropertyValue > GetFilterData();
165 ImpPDFTabOpnFtrPage* getOpenPage() const;
166 ImpPDFTabSecurityPage* getSecurityPage() const;
167 ImpPDFTabLinksPage* getLinksPage() const;
168 ImpPDFTabGeneralPage* getGeneralPage() const;
170 private:
171 virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override;
175 /// Class tab page general
176 class ImpPDFTabGeneralPage : public SfxTabPage
178 friend class ImpPDFTabLinksPage;
180 bool mbUseTaggedPDFUserSelection;
181 bool mbIsPresentation;
182 bool mbIsSpreadsheet;
183 bool mbIsWriter;
184 ImpPDFTabDialog* mpParent;
186 std::unique_ptr<weld::RadioButton> mxRbAll;
187 std::unique_ptr<weld::RadioButton> mxRbRange;
188 std::unique_ptr<weld::RadioButton> mxRbSelection;
189 std::unique_ptr<weld::Entry> mxEdPages;
190 std::unique_ptr<weld::RadioButton> mxRbLosslessCompression;
191 std::unique_ptr<weld::RadioButton> mxRbJPEGCompression;
192 std::unique_ptr<weld::Widget> mxQualityFrame;
193 std::unique_ptr<weld::MetricSpinButton> mxNfQuality;
194 std::unique_ptr<weld::CheckButton> mxCbReduceImageResolution;
195 std::unique_ptr<weld::ComboBox> mxCoReduceImageResolution;
196 std::unique_ptr<weld::CheckButton> mxCbPDFA;
197 std::unique_ptr<weld::CheckButton> mxCbPDFUA;
198 std::unique_ptr<weld::ComboBox> mxRbPDFAVersion;
199 std::unique_ptr<weld::CheckButton> mxCbTaggedPDF;
200 std::unique_ptr<weld::CheckButton> mxCbExportFormFields;
201 std::unique_ptr<weld::Widget> mxFormsFrame;
202 std::unique_ptr<weld::ComboBox> mxLbFormsFormat;
203 std::unique_ptr<weld::CheckButton> mxCbAllowDuplicateFieldNames;
204 std::unique_ptr<weld::CheckButton> mxCbExportBookmarks;
205 std::unique_ptr<weld::CheckButton> mxCbExportHiddenSlides;
206 std::unique_ptr<weld::CheckButton> mxCbSinglePageSheets;
207 std::unique_ptr<weld::CheckButton> mxCbExportNotes;
208 std::unique_ptr<weld::CheckButton> mxCbExportNotesInMargin;
209 std::unique_ptr<weld::CheckButton> mxCbViewPDF;
210 std::unique_ptr<weld::CheckButton> mxCbUseReferenceXObject;
211 std::unique_ptr<weld::CheckButton> mxCbExportNotesPages;
212 std::unique_ptr<weld::CheckButton> mxCbExportOnlyNotesPages;
213 std::unique_ptr<weld::CheckButton> mxCbExportEmptyPages;
214 std::unique_ptr<weld::CheckButton> mxCbExportPlaceholders;
215 std::unique_ptr<weld::CheckButton> mxCbAddStream;
216 std::unique_ptr<weld::CheckButton> mxCbWatermark;
217 std::unique_ptr<weld::Label> mxFtWatermark;
218 std::unique_ptr<weld::Entry> mxEdWatermark;
219 std::unique_ptr<weld::Label> mxSlidesFt;
220 std::unique_ptr<weld::Label> mxSheetsFt;
222 DECL_LINK(ToggleAllHdl, weld::Toggleable&, void);
223 DECL_LINK(TogglePagesHdl, weld::Toggleable&, void);
224 DECL_LINK(ToggleSelectionHdl, weld::Toggleable&, void);
225 DECL_LINK(ToggleCompressionHdl, weld::Toggleable&, void);
226 DECL_LINK(ToggleReduceImageResolutionHdl, weld::Toggleable&, void);
227 DECL_LINK(ToggleWatermarkHdl, weld::Toggleable&, void);
228 DECL_LINK(ToggleAddStreamHdl, weld::Toggleable&, void);
229 DECL_LINK(ToggleExportFormFieldsHdl, weld::Toggleable&, void);
230 DECL_LINK(ToggleExportNotesPagesHdl, weld::Toggleable&, void);
232 void TogglePagesHdl();
233 void EnableExportNotesPages();
235 DECL_LINK(TogglePDFVersionOrUniversalAccessibilityHandle, weld::Toggleable&, void);
237 std::shared_ptr<weld::MessageDialog> mxPasswordUnusedWarnDialog;
239 public:
241 ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
242 virtual ~ImpPDFTabGeneralPage() override;
244 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
246 void GetFilterConfigItem(ImpPDFTabDialog* paParent);
247 void SetFilterConfigItem(ImpPDFTabDialog* paParent);
248 bool IsPdfaSelected() const { return mxCbPDFA->get_active(); }
249 bool IsPdfUaSelected() const { return mxCbPDFUA->get_active(); }
252 /// Class tab page viewer
253 class ImpPDFTabOpnFtrPage : public SfxTabPage
255 friend class ImpPDFTabGeneralPage;
257 bool mbUseCTLFont;
259 std::unique_ptr<weld::RadioButton> mxRbOpnPageOnly;
260 std::unique_ptr<weld::RadioButton> mxRbOpnOutline;
261 std::unique_ptr<weld::RadioButton> mxRbOpnThumbs;
262 std::unique_ptr<weld::SpinButton> mxNumInitialPage;
263 std::unique_ptr<weld::RadioButton> mxRbMagnDefault;
264 std::unique_ptr<weld::RadioButton> mxRbMagnFitWin;
265 std::unique_ptr<weld::RadioButton> mxRbMagnFitWidth;
266 std::unique_ptr<weld::RadioButton> mxRbMagnFitVisible;
267 std::unique_ptr<weld::RadioButton> mxRbMagnZoom;
268 std::unique_ptr<weld::SpinButton> mxNumZoom;
269 std::unique_ptr<weld::RadioButton> mxRbPgLyDefault;
270 std::unique_ptr<weld::RadioButton> mxRbPgLySinglePage;
271 std::unique_ptr<weld::RadioButton> mxRbPgLyContinue;
272 std::unique_ptr<weld::RadioButton> mxRbPgLyContinueFacing;
273 std::unique_ptr<weld::CheckButton> mxCbPgLyFirstOnLeft;
275 DECL_LINK(ToggleRbPgLyContinueFacingHdl, weld::Toggleable&, void);
276 DECL_LINK(ToggleRbMagnHdl, weld::Toggleable&, void);
278 void ToggleRbPgLyContinueFacingHdl();
279 void ToggleInitialView(ImpPDFTabDialog & rParent);
281 public:
282 ImpPDFTabOpnFtrPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
283 virtual ~ImpPDFTabOpnFtrPage() override;
285 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
287 void GetFilterConfigItem( ImpPDFTabDialog* paParent);
288 void SetFilterConfigItem(ImpPDFTabDialog* pParent);
291 /// Class tab page viewer
292 class ImpPDFTabViewerPage : public SfxTabPage
294 bool mbIsPresentation;
296 std::unique_ptr<weld::CheckButton> m_xCbResWinInit;
297 std::unique_ptr<weld::CheckButton> m_xCbCenterWindow;
298 std::unique_ptr<weld::CheckButton> m_xCbOpenFullScreen;
299 std::unique_ptr<weld::CheckButton> m_xCbDispDocTitle;
300 std::unique_ptr<weld::CheckButton> m_xCbHideViewerMenubar;
301 std::unique_ptr<weld::CheckButton> m_xCbHideViewerToolbar;
302 std::unique_ptr<weld::CheckButton> m_xCbHideViewerWindowControls;
303 std::unique_ptr<weld::CheckButton> m_xCbTransitionEffects;
304 std::unique_ptr<weld::RadioButton> m_xRbAllBookmarkLevels;
305 std::unique_ptr<weld::RadioButton> m_xRbVisibleBookmarkLevels;
306 std::unique_ptr<weld::SpinButton>m_xNumBookmarkLevels;
308 DECL_LINK(ToggleRbBookmarksHdl, weld::Toggleable&, void);
310 public:
311 ImpPDFTabViewerPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
312 virtual ~ImpPDFTabViewerPage() override;
314 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
316 void GetFilterConfigItem( ImpPDFTabDialog* paParent);
317 void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
320 /// Class security tab page
321 class ImpPDFTabSecurityPage : public SfxTabPage
323 OUString msStrSetPwd;
324 OUString msUserPwdTitle;
325 bool mbHaveOwnerPassword;
326 bool mbHaveUserPassword;
327 css::uno::Sequence< css::beans::NamedValue > maPreparedOwnerPassword;
328 OUString msOwnerPwdTitle;
330 css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords;
332 std::unique_ptr<weld::Button> mxPbSetPwd;
333 std::unique_ptr<weld::Widget> mxUserPwdSet;
334 std::unique_ptr<weld::Widget> mxUserPwdUnset;
335 std::unique_ptr<weld::Widget> mxUserPwdPdfa;
336 std::unique_ptr<weld::Widget> mxOwnerPwdSet;
337 std::unique_ptr<weld::Widget> mxOwnerPwdUnset;
338 std::unique_ptr<weld::Widget> mxOwnerPwdPdfa;
339 std::unique_ptr<weld::Widget> mxPrintPermissions;
340 std::unique_ptr<weld::RadioButton> mxRbPrintNone;
341 std::unique_ptr<weld::RadioButton> mxRbPrintLowRes;
342 std::unique_ptr<weld::RadioButton> mxRbPrintHighRes;
343 std::unique_ptr<weld::Widget> mxChangesAllowed;
344 std::unique_ptr<weld::RadioButton> mxRbChangesNone;
345 std::unique_ptr<weld::RadioButton> mxRbChangesInsDel;
346 std::unique_ptr<weld::RadioButton> mxRbChangesFillForm;
347 std::unique_ptr<weld::RadioButton> mxRbChangesComment;
348 std::unique_ptr<weld::RadioButton> mxRbChangesAnyNoCopy;
349 std::unique_ptr<weld::Widget> mxContent;
350 std::unique_ptr<weld::CheckButton> mxCbEnableCopy;
351 std::unique_ptr<weld::CheckButton> mxCbEnableAccessibility;
352 std::unique_ptr<weld::Label> mxPasswordTitle;
354 std::shared_ptr< SfxPasswordDialog > mpPasswordDialog;
355 std::shared_ptr< weld::MessageDialog > mpUnsupportedMsgDialog;
357 DECL_LINK(ClickmaPbSetPwdHdl, weld::Button&, void);
359 void enablePermissionControls();
361 public:
362 ImpPDFTabSecurityPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
363 virtual ~ImpPDFTabSecurityPage() override;
365 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
367 void GetFilterConfigItem( ImpPDFTabDialog* paParent);
368 void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
369 void ImplPDFASecurityControl( bool bEnableSecurity );
370 bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; }
373 /// Implements the relative link stuff
374 class ImpPDFTabLinksPage : public SfxTabPage
376 bool mbOpnLnksDefaultUserState;
377 bool mbOpnLnksLaunchUserState;
378 bool mbOpnLnksBrowserUserState;
380 std::unique_ptr<weld::CheckButton> m_xCbExprtBmkrToNmDst;
381 std::unique_ptr<weld::CheckButton> m_xCbOOoToPDFTargets;
382 std::unique_ptr<weld::CheckButton> m_xCbExportRelativeFsysLinks;
383 std::unique_ptr<weld::RadioButton> m_xRbOpnLnksDefault;
384 std::unique_ptr<weld::RadioButton> m_xRbOpnLnksLaunch;
385 std::unique_ptr<weld::RadioButton> m_xRbOpnLnksBrowser;
387 DECL_LINK(ClickRbOpnLnksDefaultHdl, weld::Toggleable&, void);
388 DECL_LINK(ClickRbOpnLnksBrowserHdl, weld::Toggleable&, void);
390 public:
391 ImpPDFTabLinksPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
392 virtual ~ImpPDFTabLinksPage() override;
394 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet);
396 void GetFilterConfigItem( ImpPDFTabDialog* paParent);
397 void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
399 void ImplPDFALinkControl( bool bEnableLaunch );
402 //class to implement the digital signing
403 class ImpPDFTabSigningPage : public SfxTabPage
405 css::uno::Reference< css::security::XCertificate > maSignCertificate;
407 std::unique_ptr<weld::Entry> mxEdSignCert;
408 std::unique_ptr<weld::Button> mxPbSignCertSelect;
409 std::unique_ptr<weld::Button> mxPbSignCertClear;
410 std::unique_ptr<weld::Entry> mxEdSignPassword;
411 std::unique_ptr<weld::Entry> mxEdSignLocation;
412 std::unique_ptr<weld::Entry> mxEdSignContactInfo;
413 std::unique_ptr<weld::Entry> mxEdSignReason;
414 std::unique_ptr<weld::ComboBox> mxLBSignTSA;
416 DECL_LINK(ClickmaPbSignCertSelect, weld::Button&, void);
417 DECL_LINK(ClickmaPbSignCertClear, weld::Button&, void);
419 public:
420 ImpPDFTabSigningPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
421 virtual ~ImpPDFTabSigningPage() override;
423 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet );
425 void GetFilterConfigItem( ImpPDFTabDialog* paParent);
426 void SetFilterConfigItem( const ImpPDFTabDialog* paParent );
429 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */