xref: /trunk/main/filter/source/pdf/impdialog.hxx (revision 22e87013)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef IMPDIALOG_HXX
25 #define IMPDIALOG_HXX
26 
27 #include "pdffilter.hxx"
28 
29 #include "vcl/dialog.hxx"
30 #include "vcl/button.hxx"
31 #include "vcl/fixed.hxx"
32 #include "vcl/field.hxx"
33 #include "vcl/edit.hxx"
34 #include "vcl/lstbox.hxx"
35 #include "vcl/combobox.hxx"
36 #include "vcl/group.hxx"
37 #include "vcl/pdfwriter.hxx"
38 
39 #include "svtools/FilterConfigItem.hxx"
40 
41 #include "sfx2/tabdlg.hxx"
42 
43 #include "com/sun/star/beans/NamedValue.hpp"
44 
45 // ----------------
46 // - ImpPDFDialog -
47 // ----------------
48 
49 class ResMgr;
50 class ImpPDFTabGeneralPage;
51 class ImpPDFTabViewerPage;
52 class ImpPDFTabOpnFtrPage;
53 class ImpPDFTabLinksPage;
54 
55 class PDFFilterResId : public ResId
56 {
57 public:
58     PDFFilterResId( sal_uInt32 nId );
59 };
60 
61 class ImplErrorDialog : public ModalDialog
62 {
63     FixedImage      maFI;
64     FixedText       maProcessText;
65     ListBox         maErrors;
66     FixedText       maExplanation;
67 
68     OKButton        maButton;
69 
70     DECL_LINK( SelectHdl, ListBox* );
71     public:
72     ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& );
73     ~ImplErrorDialog();
74 };
75 
76 ////////////////////////////////////////////////////////////////////////
77 //class tabbed dialog
78 class ImpPDFTabDialog : public SfxTabDialog
79 {
80 private:
81     com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
82     FilterConfigItem            maConfigItem;
83     FilterConfigItem            maConfigI18N;
84 
85     Any                         maSelection;
86 
87 protected:
88 //the following data are the configuration used throughout the dialog and pages
89    	sal_Bool                    mbIsPresentation;
90     sal_Bool                    mbIsWriter;
91     sal_Bool                    mbSelectionPresent;
92     sal_Bool                    mbUseCTLFont;
93     sal_Bool                    mbUseLosslessCompression;
94     sal_Int32                   mnQuality;
95     sal_Bool                    mbReduceImageResolution;
96     sal_Int32                   mnMaxImageResolution;
97     sal_Bool                    mbUseTaggedPDF;
98     sal_Int32                   mnPDFTypeSelection;
99     sal_Bool                    mbExportNotes;
100 	sal_Bool					mbExportNotesPages;
101     sal_Bool                    mbUseTransitionEffects;
102     sal_Bool                    mbIsSkipEmptyPages;
103     sal_Bool                    mbAddStream;
104     sal_Bool                    mbEmbedStandardFonts;
105     sal_Int32                   mnFormsType;
106     sal_Bool                    mbExportFormFields;
107     sal_Bool                    mbAllowDuplicateFieldNames;
108     sal_Bool                    mbExportBookmarks;
109     sal_Int32                   mnOpenBookmarkLevels;
110 
111     sal_Bool                    mbHideViewerToolbar;
112     sal_Bool                    mbHideViewerMenubar;
113     sal_Bool                    mbHideViewerWindowControls;
114     sal_Bool                    mbResizeWinToInit;
115     sal_Bool                    mbCenterWindow;
116     sal_Bool                    mbOpenInFullScreenMode;
117     sal_Bool                    mbDisplayPDFDocumentTitle;
118     sal_Int32                   mnMagnification;
119     sal_Int32                   mnInitialView;
120     sal_Int32                   mnZoom;
121     sal_Int32                   mnInitialPage;
122 
123     sal_Int32                   mnPageLayout;
124     sal_Bool                    mbFirstPageLeft;
125 
126     sal_Bool					mbEncrypt;
127 
128     sal_Bool					mbRestrictPermissions;
129     com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword;
130     sal_Int32					mnPrint;
131     sal_Int32					mnChangesAllowed;
132     sal_Bool					mbCanCopyOrExtract;
133     sal_Bool					mbCanExtractForAccessibility;
134     com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords;
135 
136     sal_Bool                    mbIsRangeChecked;
137     String                      msPageRange;
138     sal_Bool                    mbSelectionIsChecked;
139 
140 	sal_Bool                    mbExportRelativeFsysLinks;
141 	sal_Int32                   mnViewPDFMode;
142 	sal_Bool                    mbConvertOOoTargets;
143 	sal_Bool                    mbExportBmkToPDFDestination;
144 
145 public:
146 
147     friend class				ImpPDFTabGeneralPage;
148     friend class				ImpPDFTabViewerPage;
149     friend class				ImpPDFTabOpnFtrPage;
150     friend class				ImpPDFTabSecurityPage;
151     friend class                ImpPDFTabLinksPage;
152 
153     ImpPDFTabDialog( Window* pParent,
154                      Sequence< PropertyValue >& rFilterData,
155                      const Reference< XComponent >& rDoc,
156                      const Reference< lang::XMultiServiceFactory >& xFact
157                      );
158     ~ImpPDFTabDialog();
159 
160     Sequence< PropertyValue >   GetFilterData();
getServiceFactory() const161     const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& getServiceFactory() const { return mxMSF; }
162 
163 protected:
164     virtual void                PageCreated( sal_uInt16 _nId,
165                                              SfxTabPage& _rPage );
166     virtual short               Ok();
167 };
168 
169 //class tab page general
170 class ImpPDFTabGeneralPage : public SfxTabPage
171 {
172     friend class                ImpPDFTabLinksPage;
173 
174     FixedLine                   maFlPages;
175     RadioButton                 maRbAll;
176     RadioButton                 maRbRange;
177     RadioButton                 maRbSelection;
178     Edit                        maEdPages;
179 
180     FixedLine                   maFlCompression;
181     RadioButton                 maRbLosslessCompression;
182     RadioButton                 maRbJPEGCompression;
183     FixedText                   maFtQuality;
184     MetricField                 maNfQuality;
185     CheckBox                    maCbReduceImageResolution;
186     ComboBox                    maCoReduceImageResolution;
187 
188     FixedLine                   maFlGeneral;
189     CheckBox                    maCbPDFA1b;
190     CheckBox                    maCbTaggedPDF;
191     sal_Bool                    mbTaggedPDFUserSelection;
192 
193     CheckBox                    maCbExportFormFields;
194     sal_Bool                    mbExportFormFieldsUserSelection;
195     sal_Bool                    mbEmbedStandardFontsUserSelection;
196     FixedText                   maFtFormsFormat;
197     ListBox                     maLbFormsFormat;
198     CheckBox                    maCbAllowDuplicateFieldNames;
199 
200     CheckBox                    maCbExportBookmarks;
201     CheckBox                    maCbExportNotes;
202 	CheckBox					maCbExportNotesPages;
203 
204     CheckBox                    maCbExportEmptyPages;
205     CheckBox                    maCbAddStream;
206     CheckBox                    maCbEmbedStandardFonts;
207 
208     sal_Bool                    mbIsPresentation;
209     sal_Bool                    mbIsWriter;
210 
211 const ImpPDFTabDialog*          mpaParent;
212 
213     DECL_LINK( TogglePagesHdl, void* );
214     DECL_LINK( ToggleCompressionHdl, void* );
215     DECL_LINK( ToggleReduceImageResolutionHdl, void* );
216     DECL_LINK( ToggleAddStreamHdl, void* );
217     DECL_LINK( ToggleExportFormFieldsHdl, void* );
218 
219 public:
220     DECL_LINK( ToggleExportPDFAHdl, void* );
221 
222     ImpPDFTabGeneralPage( Window* pParent,
223                           const SfxItemSet& rSet );
224 
225     ~ImpPDFTabGeneralPage();
226     static SfxTabPage*          Create( Window* pParent,
227                                         const SfxItemSet& rAttrSet);
228 
229     void                        GetFilterConfigItem( ImpPDFTabDialog* paParent );
230     void                        SetFilterConfigItem( const ImpPDFTabDialog* paParent );
IsPdfaSelected()231     sal_Bool                    IsPdfaSelected() { return maCbPDFA1b.IsChecked(); };
232 };
233 
234 //class tab page viewer
235 class ImpPDFTabOpnFtrPage : public SfxTabPage
236 {
237     FixedLine                   maFlInitialView;
238     RadioButton                 maRbOpnPageOnly;
239     RadioButton                 maRbOpnOutline;
240     RadioButton                 maRbOpnThumbs;
241     FixedText                   maFtInitialPage;
242     NumericField                maNumInitialPage;
243 
244     FixedLine                   maFlMagnification;
245     RadioButton                 maRbMagnDefault;
246     RadioButton                 maRbMagnFitWin;
247     RadioButton                 maRbMagnFitWidth;
248     RadioButton                 maRbMagnFitVisible;
249     RadioButton                 maRbMagnZoom;
250     MetricField                 maNumZoom;
251 
252     FixedLine			        maFlPageLayout;
253     RadioButton                 maRbPgLyDefault;
254     RadioButton                 maRbPgLySinglePage;
255     RadioButton                 maRbPgLyContinue;
256     RadioButton                 maRbPgLyContinueFacing;
257     CheckBox                    maCbPgLyFirstOnLeft;
258 
259     sal_Bool                    mbUseCTLFont;
260 
261     DECL_LINK( ToggleRbPgLyContinueFacingHdl, void* );
262     DECL_LINK( ToggleRbMagnHdl, void* );
263 
264 public:
265     ImpPDFTabOpnFtrPage( Window* pParent,
266                          const SfxItemSet& rSet );
267 
268     ~ImpPDFTabOpnFtrPage();
269     static SfxTabPage*          Create( Window* pParent,
270                                         const SfxItemSet& rAttrSet );
271 
272     void                        GetFilterConfigItem( ImpPDFTabDialog* paParent);
273     void                        SetFilterConfigItem( const ImpPDFTabDialog* paParent );
274 };
275 
276 //class tab page viewer
277 class ImpPDFTabViewerPage : public SfxTabPage
278 {
279     FixedLine                   maFlWindowOptions;
280     CheckBox                    maCbResWinInit;
281     CheckBox                    maCbCenterWindow;
282     CheckBox                    maCbOpenFullScreen;
283     CheckBox                    maCbDispDocTitle;
284 
285     FixedLine                   maFlUIOptions;
286     CheckBox                    maCbHideViewerMenubar;
287     CheckBox                    maCbHideViewerToolbar;
288     CheckBox                    maCbHideViewerWindowControls;
289 
290     FixedLine                   maFlTransitions;
291     CheckBox                    maCbTransitionEffects;
292     sal_Bool                    mbIsPresentation;
293 
294     FixedLine                   maFlBookmarks;
295     RadioButton                 maRbAllBookmarkLevels;
296     RadioButton                 maRbVisibleBookmarkLevels;
297     NumericField                maNumBookmarkLevels;
298 
299     DECL_LINK( ToggleRbBookmarksHdl, void* );
300 public:
301     ImpPDFTabViewerPage( Window* pParent,
302                          const SfxItemSet& rSet );
303 
304     ~ImpPDFTabViewerPage();
305     static SfxTabPage*          Create( Window* pParent,
306                                         const SfxItemSet& rAttrSet );
307 
308     void                        GetFilterConfigItem( ImpPDFTabDialog* paParent);
309     void                        SetFilterConfigItem( const ImpPDFTabDialog* paParent );
310 };
311 
312 //class security tab page
313 class ImpPDFTabSecurityPage : public SfxTabPage
314 {
315     FixedLine                   maFlGroup;
316 	PushButton					maPbSetPwd;
317 	FixedText					maFtUserPwd;
318     String                      maUserPwdSet;
319     String                      maUserPwdUnset;
320     String                      maUserPwdPdfa;
321     String                      maStrSetPwd;
322 
323 	FixedText					maFtOwnerPwd;
324     String                      maOwnerPwdSet;
325     String                      maOwnerPwdUnset;
326     String                      maOwnerPwdPdfa;
327 
328 	FixedLine					maFlPrintPermissions;
329 	RadioButton					maRbPrintNone;
330 	RadioButton					maRbPrintLowRes;
331 	RadioButton					maRbPrintHighRes;
332 
333 	FixedLine					maFlChangesAllowed;
334 	RadioButton					maRbChangesNone;
335 	RadioButton					maRbChangesInsDel;
336 	RadioButton					maRbChangesFillForm;
337 	RadioButton					maRbChangesComment;
338 	RadioButton					maRbChangesAnyNoCopy;
339 
340 	CheckBox					maCbEnableCopy;
341 	CheckBox					maCbEnableAccessibility;
342 
343 	String						msUserPwdTitle;
344 
345 	bool                        mbHaveOwnerPassword;
346 	bool                        mbHaveUserPassword;
347     com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > maPreparedOwnerPassword;
348 	String						msOwnerPwdTitle;
349 
350     com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder > mxPreparedPasswords;
351 
352 	long nWidth;
353 
354 	DECL_LINK( ClickmaPbSetPwdHdl, void* );
355 
356     void enablePermissionControls();
357 
358 	void						ImplPwdPushButton( const String &, String & );
359 
360 public:
361 	ImpPDFTabSecurityPage( Window* pParent,
362 						   const SfxItemSet& rSet );
363 
364 	~ImpPDFTabSecurityPage();
365 	static SfxTabPage*		Create( Window* pParent,
366 									const SfxItemSet& rAttrSet );
367 
368     void	GetFilterConfigItem( ImpPDFTabDialog* paParent);
369 	void	SetFilterConfigItem( const ImpPDFTabDialog* paParent );
370     void    ImplPDFASecurityControl( sal_Bool bEnableSecurity );
hasPassword() const371     bool    hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; }
372 };
373 
374 //class to implement the relative link stuff
375 class ImpPDFTabLinksPage : public SfxTabPage
376 {
377     CheckBox                    maCbExprtBmkrToNmDst;
378     CheckBox                    maCbOOoToPDFTargets;
379     CheckBox                    maCbExportRelativeFsysLinks;
380 
381     FixedLine                   maFlDefaultTitle;
382 	RadioButton                 maRbOpnLnksDefault;
383     sal_Bool                    mbOpnLnksDefaultUserState;
384     RadioButton                 maRbOpnLnksLaunch;
385     sal_Bool                    mbOpnLnksLaunchUserState;
386 	RadioButton                 maRbOpnLnksBrowser;
387     sal_Bool                    mbOpnLnksBrowserUserState;
388 
389 	long nWidth;
390 
391     DECL_LINK( ClickRbOpnLnksDefaultHdl, void* );
392     DECL_LINK( ClickRbOpnLnksBrowserHdl, void* );
393 
394 public:
395 	ImpPDFTabLinksPage( Window* pParent,
396 						   const SfxItemSet& rSet );
397 
398 	~ImpPDFTabLinksPage();
399 	static SfxTabPage*		Create( Window* pParent,
400 									const SfxItemSet& rAttrSet );
401 
402 	void	GetFilterConfigItem( ImpPDFTabDialog* paParent);
403 	void	SetFilterConfigItem( const ImpPDFTabDialog* paParent );
404 
405     void    ImplPDFALinkControl( sal_Bool bEnableLaunch );
406 };
407 
408 #endif // IMPDIALOG_HXX
409 
410 
411