Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <string.h>
30 : :
31 : : #include "impdialog.hxx"
32 : : #include "impdialog.hrc"
33 : : #include "vcl/svapp.hxx"
34 : : #include "vcl/msgbox.hxx"
35 : : #include "sfx2/passwd.hxx"
36 : : #include "svtools/miscopt.hxx"
37 : : //#include "xmlsecurity/certificatechooser.hxx"
38 : :
39 : : #include "comphelper/storagehelper.hxx"
40 : :
41 : : #include "com/sun/star/text/XTextRange.hpp"
42 : : #include "com/sun/star/drawing/XShapes.hpp"
43 : : #include "com/sun/star/container/XIndexAccess.hpp"
44 : : #include "com/sun/star/frame/XController.hpp"
45 : : #include "com/sun/star/view/XSelectionSupplier.hpp"
46 : : #include "com/sun/star/security/XDocumentDigitalSignatures.hpp"
47 : : #include "com/sun/star/security/XCertificate.hpp"
48 : :
49 : : #include <boost/shared_ptr.hpp>
50 : :
51 : 0 : static ResMgr& getPDFFilterResMgr()
52 : : {
53 : 0 : static ResMgr *pRes = ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILocale());
54 : 0 : return *pRes;
55 : : }
56 : :
57 : 0 : PDFFilterResId::PDFFilterResId( sal_uInt32 nId ) : ResId( nId, getPDFFilterResMgr() )
58 : : {
59 : 0 : }
60 : :
61 : : // ----------------
62 : : // - ImpPDFDialog -
63 : : // ----------------
64 : :
65 : : using namespace ::com::sun::star;
66 : :
67 : : //////////////////////////////////////////////////////////////////////////////////////////////////////
68 : : // tabbed PDF dialog implementation
69 : : // please note: the default used here are the same as per specification,
70 : : // they should be the same in PDFFilter::implExport and in PDFExport::PDFExport
71 : : // -----------------------------------------------------------------------------
72 : 0 : ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
73 : : Sequence< PropertyValue >& rFilterData,
74 : : const Reference< XComponent >& rxDoc,
75 : : const Reference< lang::XMultiServiceFactory >& xFact
76 : : ) :
77 : : SfxTabDialog( pParent, PDFFilterResId( RID_PDF_EXPORT_DLG ), 0, sal_False, 0 ),
78 : : mxMSF( xFact ),
79 : : maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ), &rFilterData ),
80 : : maConfigI18N( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/I18N/CTL/" ) ) ),
81 : : mbIsPresentation( sal_False ),
82 : : mbIsWriter( sal_False ),
83 : :
84 : : mbSelectionPresent( sal_False ),
85 : : mbUseCTLFont( sal_False ),
86 : : mbUseLosslessCompression( sal_True ),
87 : : mnQuality( 90 ),
88 : : mbReduceImageResolution( sal_False ),
89 : : mnMaxImageResolution( 300 ),
90 : : mbUseTaggedPDF( sal_False ),
91 : : mbExportNotes( sal_True ),
92 : : mbExportNotesPages( sal_False ),
93 : : mbUseTransitionEffects( sal_False ),
94 : : mbIsSkipEmptyPages( sal_True ),
95 : : mbAddStream( sal_False ),
96 : : mbEmbedStandardFonts( sal_False ),
97 : : mnFormsType( 0 ),
98 : : mbExportFormFields( sal_True ),
99 : : mbAllowDuplicateFieldNames( sal_False ),
100 : : mbExportBookmarks( sal_True ),
101 : : mbExportHiddenSlides ( sal_False),
102 : : mnOpenBookmarkLevels( -1 ),
103 : :
104 : : mbHideViewerToolbar( sal_False ),
105 : : mbHideViewerMenubar( sal_False ),
106 : : mbHideViewerWindowControls( sal_False ),
107 : : mbResizeWinToInit( sal_False ),
108 : : mbCenterWindow( sal_False ),
109 : : mbOpenInFullScreenMode( sal_False ),
110 : : mbDisplayPDFDocumentTitle( sal_False ),
111 : : mnMagnification( 0 ),
112 : : mnInitialView( 0 ),
113 : : mnZoom( 0 ),
114 : : mnInitialPage( 1 ),
115 : : mnPageLayout( 0 ),
116 : : mbFirstPageLeft( sal_False ),
117 : :
118 : : mbEncrypt( false ),
119 : : mbRestrictPermissions( false ),
120 : : mnPrint( 0 ),
121 : : mnChangesAllowed( 0 ),
122 : : mbCanCopyOrExtract( false ),
123 : : mbCanExtractForAccessibility( true ),
124 : :
125 : : mbIsRangeChecked( sal_False ),
126 : : msPageRange( ' ' ),
127 : :
128 : : mbSelectionIsChecked( sal_False ),
129 : : mbExportRelativeFsysLinks( sal_False ),
130 : : mnViewPDFMode( 0 ),
131 : : mbConvertOOoTargets( sal_False ),
132 : : mbExportBmkToPDFDestination( sal_False ),
133 : :
134 : 0 : mbSignPDF( sal_False )
135 : :
136 : : {
137 : 0 : FreeResource();
138 : : // check for selection
139 : : try
140 : : {
141 : 0 : Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() );
142 : 0 : if( xController.is() )
143 : : {
144 : 0 : Reference< view::XSelectionSupplier > xView( xController, UNO_QUERY );
145 : 0 : if( xView.is() )
146 : 0 : xView->getSelection() >>= maSelection;
147 : 0 : }
148 : : }
149 : 0 : catch(const RuntimeException &)
150 : : {
151 : : }
152 : 0 : mbSelectionPresent = maSelection.hasValue();
153 : 0 : if ( mbSelectionPresent )
154 : : {
155 : 0 : Reference< drawing::XShapes > xShapes;
156 : 0 : if ( ( maSelection >>= xShapes ) == sal_False ) // XShapes is always a selection
157 : : {
158 : : // even if nothing is selected in writer the selection is not empty
159 : 0 : Reference< container::XIndexAccess > xIndexAccess;
160 : 0 : if ( maSelection >>= xIndexAccess )
161 : : {
162 : 0 : sal_Int32 nLen = xIndexAccess->getCount();
163 : 0 : if ( !nLen )
164 : 0 : mbSelectionPresent = sal_False;
165 : 0 : else if ( nLen == 1 )
166 : : {
167 : 0 : Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( 0 ), UNO_QUERY );
168 : 0 : if ( xTextRange.is() && ( xTextRange->getString().isEmpty() ) )
169 : 0 : mbSelectionPresent = sal_False;
170 : : }
171 : 0 : }
172 : 0 : }
173 : : }
174 : :
175 : : // check if source document is a presentation
176 : : try
177 : : {
178 : 0 : Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY );
179 : 0 : if ( xInfo.is() )
180 : : {
181 : 0 : if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
182 : 0 : mbIsPresentation = sal_True;
183 : 0 : if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.GenericTextDocument" ) ) ) )
184 : 0 : mbIsWriter = sal_True;
185 : 0 : }
186 : : }
187 : 0 : catch(const RuntimeException &)
188 : : {
189 : : }
190 : :
191 : : //get the CTL (Complex Text Layout) from general options, returns sal_True if we have a CTL font on our hands.
192 : 0 : mbUseCTLFont = maConfigI18N.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CTLFont" ) ), sal_False );
193 : :
194 : 0 : mbUseLosslessCompression = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False );
195 : 0 : mnQuality = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 );
196 : 0 : mbReduceImageResolution = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False );
197 : 0 : mnMaxImageResolution = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 );
198 : :
199 : 0 : mbUseTaggedPDF = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False );
200 : 0 : mnPDFTypeSelection = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), 0 );
201 : 0 : if ( mbIsPresentation )
202 : 0 : mbExportNotesPages = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), sal_False );
203 : 0 : mbExportNotes = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), sal_False );
204 : :
205 : 0 : mbExportBookmarks = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), sal_True );
206 : 0 : if ( mbIsPresentation )
207 : 0 : mbExportHiddenSlides = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportHiddenSlides" ) ), sal_False );
208 : 0 : mnOpenBookmarkLevels = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), -1 );
209 : 0 : mbUseTransitionEffects = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True );
210 : 0 : mbIsSkipEmptyPages = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False );
211 : 0 : mbAddStream = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), sal_False );
212 : 0 : mbEmbedStandardFonts = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), sal_False );
213 : :
214 : 0 : mnFormsType = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
215 : 0 : mbExportFormFields = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), sal_True );
216 : 0 : if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) )
217 : 0 : mnFormsType = 0;
218 : 0 : mbAllowDuplicateFieldNames = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), sal_False );
219 : :
220 : : //prepare values for the Viewer tab page
221 : 0 : mbHideViewerToolbar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False );
222 : 0 : mbHideViewerMenubar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), sal_False );
223 : 0 : mbHideViewerWindowControls = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), sal_False );
224 : 0 : mbResizeWinToInit = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), sal_False );
225 : 0 : mbCenterWindow = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), sal_False );
226 : 0 : mbOpenInFullScreenMode = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), sal_False );
227 : 0 : mbDisplayPDFDocumentTitle = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), sal_True );
228 : :
229 : 0 : mnInitialView = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), 0 );
230 : 0 : mnMagnification = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), 0 );
231 : 0 : mnZoom = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), 100 );
232 : 0 : mnPageLayout = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), 0 );
233 : 0 : mbFirstPageLeft = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), sal_False );
234 : 0 : mnInitialPage = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ), 1 );
235 : 0 : if( mnInitialPage < 1 )
236 : 0 : mnInitialPage = 1;
237 : :
238 : : //prepare values for the security tab page
239 : 0 : mnPrint = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ), 2 );
240 : 0 : mnChangesAllowed = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ), 4 );
241 : 0 : mbCanCopyOrExtract = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), sal_True );
242 : 0 : mbCanExtractForAccessibility = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), sal_True );
243 : :
244 : : //prepare values for relative links
245 : 0 : mbExportRelativeFsysLinks = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), sal_False );
246 : :
247 : 0 : mnViewPDFMode = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), 0 );
248 : :
249 : 0 : mbConvertOOoTargets = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), sal_False );
250 : 0 : mbExportBmkToPDFDestination = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), sal_False );
251 : :
252 : : //prepare values for digital signatures
253 : 0 : mbSignPDF = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "SignPDF" ) ), sal_False );
254 : :
255 : : //queue the tab pages for later creation (created when first shown)
256 : 0 : AddTabPage( RID_PDF_TAB_SIGNING, ImpPDFTabSigningPage::Create, 0 );
257 : 0 : AddTabPage( RID_PDF_TAB_SECURITY, ImpPDFTabSecurityPage::Create, 0 );
258 : 0 : AddTabPage( RID_PDF_TAB_LINKS, ImpPDFTabLinksPage::Create, 0 );
259 : 0 : AddTabPage( RID_PDF_TAB_VPREFER, ImpPDFTabViewerPage::Create, 0 );
260 : 0 : AddTabPage( RID_PDF_TAB_OPNFTR, ImpPDFTabOpnFtrPage::Create, 0 );
261 : :
262 : : //remove tabpage if experimentalmode is not set
263 : 0 : SvtMiscOptions aMiscOptions;
264 : 0 : if (!aMiscOptions.IsExperimentalMode())
265 : 0 : RemoveTabPage( RID_PDF_TAB_SIGNING );
266 : :
267 : : //last queued is the first to be displayed (or so it seems..)
268 : 0 : AddTabPage( RID_PDF_TAB_GENER, ImpPDFTabGeneralPage::Create, 0 );
269 : :
270 : : //get the string property value (from sfx2/source/dialog/mailmodel.cxx) to overwrite the text for the Ok button
271 : 0 : ::rtl::OUString sOkButtonText = maConfigItem.ReadString( OUString( RTL_CONSTASCII_USTRINGPARAM( "_OkButtonString" ) ), OUString() );
272 : :
273 : : //change text on the Ok button: get the relevant string from resources, update it on the button
274 : : //according to the exported pdf file destination: send as e-mail or write to file?
275 : 0 : GetOKButton().SetText( ( sOkButtonText.isEmpty() ) ?
276 : 0 : OUString( String( PDFFilterResId( STR_PDF_EXPORT ) ) ) : sOkButtonText );
277 : :
278 : 0 : GetCancelButton().SetClickHdl(LINK(this, ImpPDFTabDialog, CancelHdl));
279 : :
280 : : //remove the reset button, not needed in this tabbed dialog
281 : 0 : RemoveResetButton();
282 : : /////////////////
283 : 0 : }
284 : :
285 : 0 : IMPL_LINK_NOARG(ImpPDFTabDialog, CancelHdl)
286 : : {
287 : 0 : EndDialog( sal_False );
288 : 0 : return 0;
289 : : }
290 : :
291 : : // -----------------------------------------------------------------------------
292 : 0 : ImpPDFTabDialog::~ImpPDFTabDialog()
293 : : {
294 : : //delete the pages, needed because otherwise the child tab pages
295 : : //don't get destroyed
296 : 0 : RemoveTabPage( RID_PDF_TAB_GENER );
297 : 0 : RemoveTabPage( RID_PDF_TAB_VPREFER );
298 : 0 : RemoveTabPage( RID_PDF_TAB_OPNFTR );
299 : 0 : RemoveTabPage( RID_PDF_TAB_LINKS );
300 : 0 : RemoveTabPage( RID_PDF_TAB_SECURITY );
301 : :
302 : : //remove tabpage if experimentalmode is set
303 : 0 : SvtMiscOptions aMiscOptions;
304 : 0 : if (aMiscOptions.IsExperimentalMode())
305 : 0 : RemoveTabPage( RID_PDF_TAB_SIGNING );
306 : 0 : }
307 : :
308 : : // -----------------------------------------------------------------------------
309 : 0 : void ImpPDFTabDialog::PageCreated( sal_uInt16 _nId,
310 : : SfxTabPage& _rPage )
311 : : {
312 : 0 : switch( _nId )
313 : : {
314 : : case RID_PDF_TAB_GENER:
315 : 0 : ( ( ImpPDFTabGeneralPage* )&_rPage )->SetFilterConfigItem( this );
316 : 0 : break;
317 : : case RID_PDF_TAB_VPREFER:
318 : 0 : ( ( ImpPDFTabViewerPage* )&_rPage )->SetFilterConfigItem( this );
319 : 0 : break;
320 : : case RID_PDF_TAB_OPNFTR:
321 : 0 : ( ( ImpPDFTabOpnFtrPage* )&_rPage )->SetFilterConfigItem( this );
322 : 0 : break;
323 : : case RID_PDF_TAB_LINKS:
324 : 0 : ( ( ImpPDFTabLinksPage* )&_rPage )->SetFilterConfigItem( this );
325 : 0 : break;
326 : : case RID_PDF_TAB_SECURITY:
327 : 0 : ( ( ImpPDFTabSecurityPage* )&_rPage )->SetFilterConfigItem( this );
328 : 0 : break;
329 : : case RID_PDF_TAB_SIGNING:
330 : 0 : ( ( ImpPDFTabSigningPage* )&_rPage )->SetFilterConfigItem( this );
331 : 0 : break;
332 : : }
333 : 0 : }
334 : :
335 : : // -----------------------------------------------------------------------------
336 : 0 : short ImpPDFTabDialog::Ok( )
337 : : {
338 : : //here the whole mechanism of the base class is not used
339 : : //when Ok is hit, the user means 'convert to PDF', so simply close with ok
340 : 0 : return RET_OK;
341 : : }
342 : :
343 : : // -----------------------------------------------------------------------------
344 : 0 : Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
345 : : {
346 : : // updating the FilterData sequence and storing FilterData to configuration
347 : 0 : if( GetTabPage( RID_PDF_TAB_GENER ) )
348 : 0 : ( ( ImpPDFTabGeneralPage* )GetTabPage( RID_PDF_TAB_GENER ) )->GetFilterConfigItem( this );
349 : 0 : if( GetTabPage( RID_PDF_TAB_VPREFER ) )
350 : 0 : ( ( ImpPDFTabViewerPage* )GetTabPage( RID_PDF_TAB_VPREFER ) )->GetFilterConfigItem( this );
351 : 0 : if( GetTabPage( RID_PDF_TAB_OPNFTR ) )
352 : 0 : ( ( ImpPDFTabOpnFtrPage* )GetTabPage( RID_PDF_TAB_OPNFTR ) )->GetFilterConfigItem( this );
353 : 0 : if( GetTabPage( RID_PDF_TAB_LINKS ) )
354 : 0 : ( ( ImpPDFTabLinksPage* )GetTabPage( RID_PDF_TAB_LINKS ) )->GetFilterConfigItem( this );
355 : 0 : if( GetTabPage( RID_PDF_TAB_SECURITY ) )
356 : 0 : ( ( ImpPDFTabSecurityPage* )GetTabPage( RID_PDF_TAB_SECURITY ) )->GetFilterConfigItem( this );
357 : 0 : if( GetTabPage( RID_PDF_TAB_SIGNING ) )
358 : 0 : ( ( ImpPDFTabSigningPage* )GetTabPage( RID_PDF_TAB_SIGNING ) )->GetFilterConfigItem( this );
359 : :
360 : : //prepare the items to be returned
361 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), mbUseLosslessCompression );
362 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), mnQuality );
363 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), mbReduceImageResolution );
364 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), mnMaxImageResolution );
365 : :
366 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), mbUseTaggedPDF );
367 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), mnPDFTypeSelection );
368 : :
369 : 0 : if ( mbIsPresentation )
370 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), mbExportNotesPages );
371 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), mbExportNotes );
372 : :
373 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), mbExportBookmarks );
374 : 0 : if ( mbIsPresentation )
375 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportHiddenSlides" ) ), mbExportHiddenSlides );
376 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), mbUseTransitionEffects );
377 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), mbIsSkipEmptyPages );
378 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), mbAddStream );
379 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), mbEmbedStandardFonts );
380 : :
381 : : /*
382 : : * FIXME: the entries are only implicitly defined by the resource file. Should there
383 : : * ever be an additional form submit format this could get invalid.
384 : : */
385 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), mnFormsType );
386 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), mbExportFormFields );
387 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), mbAllowDuplicateFieldNames );
388 : :
389 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), mbHideViewerToolbar );
390 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), mbHideViewerMenubar );
391 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), mbHideViewerWindowControls );
392 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), mbResizeWinToInit );
393 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), mbCenterWindow );
394 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), mbOpenInFullScreenMode );
395 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), mbDisplayPDFDocumentTitle );
396 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), mnInitialView );
397 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), mnMagnification);
398 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), mnZoom );
399 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ), mnInitialPage );
400 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), mnPageLayout );
401 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), mbFirstPageLeft );
402 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), mnOpenBookmarkLevels );
403 : :
404 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), mbExportRelativeFsysLinks );
405 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), mnViewPDFMode );
406 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), mbConvertOOoTargets );
407 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), mbExportBmkToPDFDestination );
408 : :
409 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "SignPDF" ) ), mbSignPDF );
410 : :
411 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ), mnPrint );
412 : 0 : maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ), mnChangesAllowed );
413 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), mbCanCopyOrExtract );
414 : 0 : maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), mbCanExtractForAccessibility );
415 : :
416 : 0 : Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
417 : :
418 : 0 : int nElementAdded = 11;
419 : :
420 : 0 : aRet.realloc( aRet.getLength() + nElementAdded );
421 : :
422 : : // add the encryption enable flag
423 : 0 : sal_uInt32 const nLength(aRet.getLength());
424 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Watermark" ) );
425 : 0 : aRet[ nLength - nElementAdded ].Value <<= maWatermarkText;
426 : 0 : nElementAdded--;
427 : :
428 : : // add the encryption enable flag
429 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptFile" ) );
430 : 0 : aRet[ nLength - nElementAdded ].Value <<= mbEncrypt;
431 : 0 : nElementAdded--;
432 : :
433 : : // add the open password
434 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPasswords" ) );
435 : 0 : aRet[ nLength - nElementAdded ].Value <<= mxPreparedPasswords;
436 : 0 : nElementAdded--;
437 : :
438 : : //the restrict permission flag (needed to have the scripting consistent with the dialog)
439 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "RestrictPermissions" ) );
440 : 0 : aRet[ nLength - nElementAdded ].Value <<= mbRestrictPermissions;
441 : 0 : nElementAdded--;
442 : :
443 : : //add the permission password
444 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPermissionPassword" ) );
445 : 0 : aRet[ nLength - nElementAdded ].Value <<= maPreparedOwnerPassword;
446 : 0 : nElementAdded--;
447 : :
448 : : // this should be the last added...
449 : 0 : if( mbIsRangeChecked )
450 : : {
451 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
452 : 0 : aRet[ nLength - nElementAdded ].Value <<= msPageRange;
453 : 0 : nElementAdded--;
454 : : }
455 : 0 : else if( mbSelectionIsChecked )
456 : : {
457 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) );
458 : 0 : aRet[ nLength - nElementAdded ].Value <<= maSelection;
459 : 0 : nElementAdded--;
460 : : }
461 : :
462 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SignatureLocation" ) );
463 : 0 : aRet[ nLength - nElementAdded ].Value <<= msSignLocation;
464 : 0 : nElementAdded--;
465 : :
466 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SignatureReason" ) );
467 : 0 : aRet[ nLength - nElementAdded ].Value <<= msSignReason;
468 : 0 : nElementAdded--;
469 : :
470 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SignatureContactInfo" ) );
471 : 0 : aRet[ nLength - nElementAdded ].Value <<= msSignContact;
472 : 0 : nElementAdded--;
473 : :
474 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SignaturePassword" ) );
475 : 0 : aRet[ nLength - nElementAdded ].Value <<= msSignPassword;
476 : 0 : nElementAdded--;
477 : :
478 : 0 : aRet[ nLength - nElementAdded ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SignatureCertificate" ) );
479 : 0 : aRet[ nLength - nElementAdded ].Value <<= maSignCertificate;
480 : 0 : nElementAdded--;
481 : :
482 : 0 : return aRet;
483 : : }
484 : :
485 : : // -----------------------------------------------------------------------------
486 : 0 : ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
487 : : const SfxItemSet& rCoreSet
488 : : ) :
489 : : SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_GENER ), rCoreSet ),
490 : :
491 : : maFlPages( this, PDFFilterResId( FL_PAGES ) ),
492 : : maRbAll( this, PDFFilterResId( RB_ALL ) ),
493 : : maRbRange( this, PDFFilterResId( RB_RANGE ) ),
494 : : maRbSelection( this, PDFFilterResId( RB_SELECTION ) ),
495 : : maEdPages( this, PDFFilterResId( ED_PAGES ) ),
496 : :
497 : : maFlCompression( this, PDFFilterResId( FL_IMAGES ) ),
498 : : maRbLosslessCompression( this, PDFFilterResId( RB_LOSSLESSCOMPRESSION ) ),
499 : : maRbJPEGCompression( this, PDFFilterResId( RB_JPEGCOMPRESSION ) ),
500 : : maFtQuality( this, PDFFilterResId( FT_QUALITY ) ),
501 : : maNfQuality( this, PDFFilterResId( NF_QUALITY ) ),
502 : : maCbReduceImageResolution( this, PDFFilterResId( CB_REDUCEIMAGERESOLUTION ) ),
503 : : maCoReduceImageResolution( this, PDFFilterResId( CO_REDUCEIMAGERESOLUTION ) ),
504 : :
505 : : m_aVerticalLine(this, PDFFilterResId(FL_GENERAL_VERTICAL)),
506 : :
507 : : maFlGeneral( this, PDFFilterResId( FL_GENERAL ) ),
508 : : maCbPDFA1b( this, PDFFilterResId( CB_PDFA_1B_SELECT ) ),
509 : :
510 : : maCbTaggedPDF( this, PDFFilterResId( CB_TAGGEDPDF ) ),
511 : : mbTaggedPDFUserSelection( sal_False ),
512 : :
513 : : maCbExportFormFields( this, PDFFilterResId( CB_EXPORTFORMFIELDS ) ),
514 : : mbExportFormFieldsUserSelection( sal_False ),
515 : : mbEmbedStandardFontsUserSelection( sal_False ),
516 : : maFtFormsFormat( this, PDFFilterResId( FT_FORMSFORMAT ) ),
517 : : maLbFormsFormat( this, PDFFilterResId( LB_FORMSFORMAT ) ),
518 : : maCbAllowDuplicateFieldNames( this, PDFFilterResId( CB_ALLOWDUPLICATEFIELDNAMES ) ),
519 : :
520 : : maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS ) ),
521 : : maCbExportHiddenSlides( this, PDFFilterResId( CB_EXPORTHIDDENSLIDES ) ),
522 : : maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES ) ),
523 : : maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ),
524 : : maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ),
525 : : maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ),
526 : : maFtAddStreamDescription( this, PDFFilterResId( FT_ADDSTREAMDESCRIPTION ) ),
527 : : maCbEmbedStandardFonts( this, PDFFilterResId( CB_EMBEDSTANDARDFONTS ) ),
528 : :
529 : : maFlWatermark( this, PDFFilterResId( FL_WATERMARK ) ),
530 : : maCbWatermark( this, PDFFilterResId( CB_WATERMARK ) ),
531 : : maFtWatermark( this, PDFFilterResId(FT_WATERMARK)),
532 : : maEdWatermark( this, PDFFilterResId(ED_WATERMARK)),
533 : : mbIsPresentation( sal_False ),
534 : : mbIsWriter( sal_False),
535 : 0 : mpaParent( 0 )
536 : : {
537 : 0 : FreeResource();
538 : :
539 : : // pb: #i91991# maCbExportEmptyPages double-spaced if necessary
540 : 0 : Size aSize = maCbExportEmptyPages.GetSizePixel();
541 : 0 : Size aMinSize = maCbExportEmptyPages.CalcMinimumSize();
542 : 0 : if ( aSize.Width() > aMinSize.Width() )
543 : : {
544 : 0 : Size aNewSize = maCbExportNotes.GetSizePixel();
545 : 0 : long nDelta = aSize.Height() - aNewSize.Height();
546 : 0 : maCbExportEmptyPages.SetSizePixel( aNewSize );
547 : 0 : Point aNewPos = maCbEmbedStandardFonts.GetPosPixel();
548 : 0 : aNewPos.Y() -= nDelta;
549 : 0 : maCbEmbedStandardFonts.SetPosPixel( aNewPos );
550 : : }
551 : :
552 : 0 : maEdPages.SetAccessibleName(maRbRange.GetText());
553 : 0 : maEdPages.SetAccessibleRelationLabeledBy(&maRbRange);
554 : :
555 : 0 : maCbExportEmptyPages.SetStyle( maCbExportEmptyPages.GetStyle() | WB_VCENTER );
556 : 0 : }
557 : :
558 : : // -----------------------------------------------------------------------------
559 : 0 : ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage()
560 : : {
561 : 0 : }
562 : :
563 : : // -----------------------------------------------------------------------------
564 : 0 : void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
565 : : {
566 : 0 : mpaParent = paParent;
567 : :
568 : : //init this class data
569 : 0 : maRbRange.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, TogglePagesHdl ) );
570 : :
571 : 0 : maRbAll.Check();
572 : 0 : TogglePagesHdl( NULL );
573 : :
574 : 0 : maNfQuality.SetUnit( FUNIT_PERCENT );
575 : 0 : maNfQuality.SetMin( 1, FUNIT_PERCENT );
576 : 0 : maNfQuality.SetMax( 100, FUNIT_PERCENT );
577 : :
578 : 0 : maRbSelection.Enable( paParent->mbSelectionPresent );
579 : 0 : mbIsPresentation = paParent->mbIsPresentation;
580 : 0 : mbIsWriter = paParent->mbIsWriter;
581 : :
582 : 0 : maCbExportEmptyPages.Enable( mbIsWriter );
583 : :
584 : 0 : maRbLosslessCompression.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleCompressionHdl ) );
585 : 0 : const sal_Bool bUseLosslessCompression = paParent->mbUseLosslessCompression;
586 : 0 : if ( bUseLosslessCompression )
587 : 0 : maRbLosslessCompression.Check();
588 : : else
589 : 0 : maRbJPEGCompression.Check();
590 : :
591 : 0 : maNfQuality.SetValue( paParent->mnQuality, FUNIT_PERCENT );
592 : 0 : maNfQuality.Enable( bUseLosslessCompression == sal_False );
593 : :
594 : 0 : maCbReduceImageResolution.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl ) );
595 : 0 : const sal_Bool bReduceImageResolution = paParent->mbReduceImageResolution;
596 : 0 : maCbReduceImageResolution.Check( bReduceImageResolution );
597 : 0 : String aStrRes( String::CreateFromInt32( paParent->mnMaxImageResolution ) );
598 : 0 : aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) );
599 : 0 : maCoReduceImageResolution.SetText( aStrRes );
600 : 0 : maCoReduceImageResolution.Enable( bReduceImageResolution );
601 : 0 : maCbWatermark.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleWatermarkHdl ) );
602 : 0 : maFtWatermark.Enable(false );
603 : 0 : maEdWatermark.Enable( false );
604 : 0 : maCbPDFA1b.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportPDFAHdl) );
605 : 0 : switch( paParent->mnPDFTypeSelection )
606 : : {
607 : : default:
608 : 0 : case 0: maCbPDFA1b.Check( sal_False ); // PDF 1.4
609 : 0 : break;
610 : 0 : case 1: maCbPDFA1b.Check(); // PDF/A-1a
611 : 0 : break;
612 : : }
613 : 0 : ToggleExportPDFAHdl( NULL );
614 : :
615 : 0 : maCbExportFormFields.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) );
616 : :
617 : : // get the form values, for use with PDF/A-1 selection interface
618 : 0 : mbTaggedPDFUserSelection = paParent->mbUseTaggedPDF;
619 : 0 : mbExportFormFieldsUserSelection = paParent->mbExportFormFields;
620 : 0 : mbEmbedStandardFontsUserSelection = paParent->mbEmbedStandardFonts;
621 : :
622 : 0 : if( !maCbPDFA1b.IsChecked() )
623 : : {// the value for PDF/A set by the ToggleExportPDFAHdl method called before
624 : 0 : maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
625 : 0 : maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
626 : 0 : maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
627 : : }
628 : :
629 : 0 : maLbFormsFormat.SelectEntryPos( (sal_uInt16)paParent->mnFormsType );
630 : 0 : maLbFormsFormat.Enable( paParent->mbExportFormFields );
631 : 0 : maCbAllowDuplicateFieldNames.Check( paParent->mbAllowDuplicateFieldNames );
632 : 0 : maCbAllowDuplicateFieldNames.Enable( paParent->mbExportFormFields );
633 : :
634 : 0 : maCbExportBookmarks.Check( paParent->mbExportBookmarks );
635 : :
636 : 0 : maCbExportNotes.Check( paParent->mbExportNotes );
637 : :
638 : 0 : if ( mbIsPresentation )
639 : : {
640 : 0 : maCbExportNotesPages.Show( sal_True );
641 : 0 : maCbExportNotesPages.Check( paParent->mbExportNotesPages );
642 : 0 : maCbExportHiddenSlides.Show( sal_True);
643 : 0 : maCbExportHiddenSlides.Check( paParent->mbExportHiddenSlides );
644 : :
645 : : }
646 : : else
647 : : {
648 : : long nCheckBoxHeight =
649 : 0 : maCbExportNotesPages.LogicToPixel( Size( 13, 13 ), MAP_APPFONT ).Height();
650 : :
651 : 0 : Point aPos = maCbExportEmptyPages.GetPosPixel();
652 : 0 : maCbExportEmptyPages.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
653 : 0 : aPos = maCbEmbedStandardFonts.GetPosPixel();
654 : 0 : maCbEmbedStandardFonts.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
655 : 0 : maCbExportNotesPages.Show( sal_False );
656 : 0 : maCbExportNotesPages.Check( sal_False );
657 : 0 : maCbExportHiddenSlides.Show( sal_False);
658 : 0 : maCbExportHiddenSlides.Check( sal_False );
659 : : }
660 : :
661 : 0 : maCbExportEmptyPages.Check( !paParent->mbIsSkipEmptyPages );
662 : :
663 : 0 : maCbAddStream.Show( sal_True );
664 : 0 : maCbAddStream.Check( paParent->mbAddStream );
665 : 0 : maFtAddStreamDescription.Show( sal_True );
666 : :
667 : 0 : maCbAddStream.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleAddStreamHdl ) );
668 : : // init addstream dependencies
669 : 0 : ToggleAddStreamHdl( NULL );
670 : 0 : }
671 : :
672 : : // -----------------------------------------------------------------------------
673 : 0 : void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
674 : : {
675 : : // updating the FilterData sequence and storing FilterData to configuration
676 : 0 : paParent->mbUseLosslessCompression = maRbLosslessCompression.IsChecked();
677 : 0 : paParent->mnQuality = static_cast<sal_Int32>(maNfQuality.GetValue());
678 : 0 : paParent->mbReduceImageResolution = maCbReduceImageResolution.IsChecked();
679 : 0 : paParent->mnMaxImageResolution = maCoReduceImageResolution.GetText().ToInt32();
680 : 0 : paParent->mbExportNotes = maCbExportNotes.IsChecked();
681 : 0 : if ( mbIsPresentation )
682 : 0 : paParent->mbExportNotesPages = maCbExportNotesPages.IsChecked();
683 : 0 : paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked();
684 : 0 : if ( mbIsPresentation )
685 : 0 : paParent->mbExportHiddenSlides = maCbExportHiddenSlides.IsChecked();
686 : :
687 : 0 : paParent->mbIsSkipEmptyPages = !maCbExportEmptyPages.IsChecked();
688 : 0 : paParent->mbAddStream = maCbAddStream.IsVisible() && maCbAddStream.IsChecked();
689 : :
690 : 0 : paParent->mbIsRangeChecked = sal_False;
691 : 0 : if( maRbRange.IsChecked() )
692 : : {
693 : 0 : paParent->mbIsRangeChecked = sal_True;
694 : 0 : paParent->msPageRange = maEdPages.GetText(); //FIXME all right on other languages ?
695 : : }
696 : 0 : else if( maRbSelection.IsChecked() )
697 : : {
698 : 0 : paParent->mbSelectionIsChecked = maRbSelection.IsChecked();
699 : : }
700 : :
701 : 0 : paParent->mnPDFTypeSelection = 0;
702 : 0 : if( maCbPDFA1b.IsChecked() )
703 : : {
704 : 0 : paParent->mnPDFTypeSelection = 1;
705 : 0 : paParent->mbUseTaggedPDF = mbTaggedPDFUserSelection;
706 : 0 : paParent->mbExportFormFields = mbExportFormFieldsUserSelection;
707 : 0 : paParent->mbEmbedStandardFonts = mbEmbedStandardFontsUserSelection;
708 : : }
709 : : else
710 : : {
711 : 0 : paParent->mbUseTaggedPDF = maCbTaggedPDF.IsChecked();
712 : 0 : paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
713 : 0 : paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
714 : : }
715 : 0 : paParent->maWatermarkText = maEdWatermark.GetText();
716 : :
717 : : /*
718 : : * FIXME: the entries are only implicitly defined by the resource file. Should there
719 : : * ever be an additional form submit format this could get invalid.
720 : : */
721 : 0 : paParent->mnFormsType = (sal_Int32) maLbFormsFormat.GetSelectEntryPos();
722 : 0 : paParent->mbAllowDuplicateFieldNames = maCbAllowDuplicateFieldNames.IsChecked();
723 : 0 : }
724 : :
725 : : // -----------------------------------------------------------------------------
726 : 0 : SfxTabPage* ImpPDFTabGeneralPage::Create( Window* pParent,
727 : : const SfxItemSet& rAttrSet)
728 : : {
729 : 0 : return ( new ImpPDFTabGeneralPage( pParent, rAttrSet ) );
730 : : }
731 : :
732 : : // -----------------------------------------------------------------------------
733 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePagesHdl)
734 : : {
735 : 0 : maEdPages.Enable( maRbRange.IsChecked() );
736 : 0 : if ( maRbRange.IsChecked() )
737 : 0 : maEdPages.GrabFocus();
738 : 0 : return 0;
739 : : }
740 : :
741 : : // -----------------------------------------------------------------------------
742 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl)
743 : : {
744 : 0 : maLbFormsFormat.Enable( maCbExportFormFields.IsChecked() );
745 : 0 : maCbAllowDuplicateFieldNames.Enable( maCbExportFormFields.IsChecked() );
746 : 0 : return 0;
747 : : }
748 : :
749 : : // -----------------------------------------------------------------------------
750 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleCompressionHdl)
751 : : {
752 : 0 : maNfQuality.Enable( maRbJPEGCompression.IsChecked() );
753 : 0 : return 0;
754 : : }
755 : :
756 : : // -----------------------------------------------------------------------------
757 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl)
758 : : {
759 : 0 : maCoReduceImageResolution.Enable( maCbReduceImageResolution.IsChecked() );
760 : 0 : return 0;
761 : : }
762 : :
763 : :
764 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleWatermarkHdl)
765 : : {
766 : 0 : maEdWatermark.Enable( maCbWatermark.IsChecked() );
767 : 0 : maFtWatermark.Enable (maCbWatermark.IsChecked() );
768 : 0 : if ( maCbWatermark.IsChecked() )
769 : 0 : maEdWatermark.GrabFocus();
770 : :
771 : 0 : return 0;
772 : : }
773 : :
774 : : // -----------------------------------------------------------------------------
775 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleAddStreamHdl)
776 : : {
777 : 0 : if( maCbAddStream.IsVisible() )
778 : : {
779 : 0 : if( maCbAddStream.IsChecked() )
780 : : {
781 : 0 : maRbAll.Check();
782 : 0 : maRbRange.Enable( sal_False );
783 : 0 : maRbSelection.Enable( sal_False );
784 : 0 : maEdPages.Enable( sal_False );
785 : 0 : maRbAll.Enable( sal_False );
786 : : }
787 : : else
788 : : {
789 : 0 : maRbAll.Enable( sal_True );
790 : 0 : maRbRange.Enable( sal_True );
791 : 0 : maRbSelection.Enable( sal_True );
792 : : }
793 : : }
794 : 0 : return 0;
795 : : }
796 : :
797 : : // -----------------------------------------------------------------------------
798 : 0 : IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl)
799 : : {
800 : 0 : ImpPDFTabSecurityPage* pSecPage = NULL;
801 : : //set the security page status (and its controls as well)
802 : 0 : if( mpaParent && mpaParent->GetTabPage( RID_PDF_TAB_SECURITY ) )
803 : : {
804 : 0 : pSecPage = static_cast<ImpPDFTabSecurityPage*>(mpaParent->GetTabPage( RID_PDF_TAB_SECURITY ));
805 : 0 : pSecPage->ImplPDFASecurityControl( !maCbPDFA1b.IsChecked() );
806 : : }
807 : :
808 : : //PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport.
809 : 0 : sal_Bool bPDFA1Sel = maCbPDFA1b.IsChecked();
810 : 0 : maFtFormsFormat.Enable( !bPDFA1Sel );
811 : 0 : maLbFormsFormat.Enable( !bPDFA1Sel );
812 : 0 : maCbAllowDuplicateFieldNames.Enable( !bPDFA1Sel );
813 : 0 : if(bPDFA1Sel)
814 : : {
815 : : //store the values of subordinate controls
816 : 0 : mbTaggedPDFUserSelection = maCbTaggedPDF.IsChecked();
817 : 0 : maCbTaggedPDF.Check();
818 : 0 : maCbTaggedPDF.Enable( sal_False );
819 : 0 : mbExportFormFieldsUserSelection = maCbExportFormFields.IsChecked();
820 : 0 : maCbExportFormFields.Check( sal_False );
821 : 0 : maCbExportFormFields.Enable( sal_False );
822 : 0 : mbEmbedStandardFontsUserSelection = maCbEmbedStandardFonts.IsChecked();
823 : 0 : maCbEmbedStandardFonts.Check( sal_True );
824 : 0 : maCbEmbedStandardFonts.Enable( sal_False );
825 : : }
826 : : else
827 : : {
828 : : //retrieve the values of subordinate controls
829 : 0 : maCbTaggedPDF.Enable();
830 : 0 : maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
831 : 0 : maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
832 : 0 : maCbExportFormFields.Enable();
833 : 0 : maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
834 : 0 : maCbEmbedStandardFonts.Enable();
835 : : }
836 : : // PDF/A-1 doesn't allow launch action, so enable/disable the selection on
837 : : // Link page
838 : 0 : if( mpaParent && mpaParent->GetTabPage( RID_PDF_TAB_LINKS ) )
839 : 0 : ( ( ImpPDFTabLinksPage* )mpaParent->GetTabPage( RID_PDF_TAB_LINKS ) )->ImplPDFALinkControl( !maCbPDFA1b.IsChecked() );
840 : :
841 : : // if a password was set, inform the user that this will not be used in PDF/A case
842 : 0 : if( maCbPDFA1b.IsChecked() && pSecPage && pSecPage->hasPassword() )
843 : : {
844 : 0 : WarningBox aBox( this, PDFFilterResId( RID_PDF_WARNPDFAPASSWORD ) );
845 : 0 : aBox.Execute();
846 : : }
847 : :
848 : 0 : return 0;
849 : : }
850 : :
851 : : /////////////////////////////////////////////////////////////////
852 : : // the option features tab page
853 : : // -----------------------------------------------------------------------------
854 : 0 : ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage( Window* pParent,
855 : : const SfxItemSet& rCoreSet ) :
856 : : SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_OPNFTR ), rCoreSet ),
857 : :
858 : : maFlInitialView( this, PDFFilterResId( FL_INITVIEW ) ),
859 : : maRbOpnPageOnly( this, PDFFilterResId( RB_OPNMODE_PAGEONLY ) ),
860 : : maRbOpnOutline( this, PDFFilterResId( RB_OPNMODE_OUTLINE ) ),
861 : : maRbOpnThumbs( this, PDFFilterResId( RB_OPNMODE_THUMBS ) ),
862 : : maFtInitialPage( this, PDFFilterResId( FT_MAGNF_INITIAL_PAGE ) ),
863 : : maNumInitialPage( this, PDFFilterResId( NUM_MAGNF_INITIAL_PAGE ) ),
864 : :
865 : : maFlMagnification( this, PDFFilterResId( FL_MAGNIFICATION ) ),
866 : : maRbMagnDefault( this, PDFFilterResId( RB_MAGNF_DEFAULT ) ),
867 : : maRbMagnFitWin( this, PDFFilterResId( RB_MAGNF_WIND ) ),
868 : : maRbMagnFitWidth( this, PDFFilterResId( RB_MAGNF_WIDTH ) ),
869 : : maRbMagnFitVisible( this, PDFFilterResId( RB_MAGNF_VISIBLE ) ),
870 : : maRbMagnZoom( this, PDFFilterResId( RB_MAGNF_ZOOM ) ),
871 : : maNumZoom( this, PDFFilterResId( NUM_MAGNF_ZOOM ) ),
872 : :
873 : : m_aVerticalLine(this, PDFFilterResId(FL_INITVIEW_VERTICAL)),
874 : :
875 : : maFlPageLayout( this, PDFFilterResId( FL_PAGE_LAYOUT ) ),
876 : : maRbPgLyDefault( this, PDFFilterResId( RB_PGLY_DEFAULT ) ),
877 : : maRbPgLySinglePage( this, PDFFilterResId( RB_PGLY_SINGPG ) ),
878 : : maRbPgLyContinue( this, PDFFilterResId( RB_PGLY_CONT ) ),
879 : : maRbPgLyContinueFacing( this, PDFFilterResId( RB_PGLY_CONTFAC ) ),
880 : : maCbPgLyFirstOnLeft( this, PDFFilterResId( CB_PGLY_FIRSTLEFT ) ),
881 : 0 : mbUseCTLFont( sal_False )
882 : : {
883 : 0 : FreeResource();
884 : :
885 : 0 : maRbMagnDefault.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
886 : 0 : maRbMagnFitWin.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
887 : 0 : maRbMagnFitWidth.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
888 : 0 : maRbMagnFitVisible.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
889 : 0 : maRbMagnZoom.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
890 : 0 : maNumZoom.SetAccessibleName(maRbMagnZoom.GetText());
891 : 0 : maNumZoom.SetAccessibleRelationLabeledBy(&maRbMagnZoom);
892 : 0 : }
893 : :
894 : : // -----------------------------------------------------------------------------
895 : 0 : ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage()
896 : : {
897 : 0 : }
898 : :
899 : : // -----------------------------------------------------------------------------
900 : 0 : SfxTabPage* ImpPDFTabOpnFtrPage::Create( Window* pParent,
901 : : const SfxItemSet& rAttrSet)
902 : : {
903 : 0 : return ( new ImpPDFTabOpnFtrPage( pParent, rAttrSet ) );
904 : : }
905 : :
906 : : // -----------------------------------------------------------------------------
907 : 0 : void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
908 : : {
909 : 0 : paParent->mnInitialView = 0;
910 : 0 : if( maRbOpnOutline.IsChecked() )
911 : 0 : paParent->mnInitialView = 1;
912 : 0 : else if( maRbOpnThumbs.IsChecked() )
913 : 0 : paParent->mnInitialView = 2;
914 : :
915 : 0 : paParent->mnMagnification = 0;
916 : 0 : if( maRbMagnFitWin.IsChecked() )
917 : 0 : paParent->mnMagnification = 1;
918 : 0 : else if( maRbMagnFitWidth.IsChecked() )
919 : 0 : paParent->mnMagnification = 2;
920 : 0 : else if( maRbMagnFitVisible.IsChecked() )
921 : 0 : paParent->mnMagnification = 3;
922 : 0 : else if( maRbMagnZoom.IsChecked() )
923 : : {
924 : 0 : paParent->mnMagnification = 4;
925 : 0 : paParent->mnZoom = static_cast<sal_Int32>(maNumZoom.GetValue());
926 : : }
927 : :
928 : 0 : paParent->mnInitialPage = static_cast<sal_Int32>(maNumInitialPage.GetValue());
929 : :
930 : 0 : paParent->mnPageLayout = 0;
931 : 0 : if( maRbPgLySinglePage.IsChecked() )
932 : 0 : paParent->mnPageLayout = 1;
933 : 0 : else if( maRbPgLyContinue.IsChecked() )
934 : 0 : paParent->mnPageLayout = 2;
935 : 0 : else if( maRbPgLyContinueFacing.IsChecked() )
936 : 0 : paParent->mnPageLayout = 3;
937 : :
938 : 0 : paParent->mbFirstPageLeft = ( mbUseCTLFont ) ? maCbPgLyFirstOnLeft.IsChecked() : sal_False;
939 : 0 : }
940 : :
941 : : // -----------------------------------------------------------------------------
942 : 0 : void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
943 : : {
944 : 0 : mbUseCTLFont = paParent->mbUseCTLFont;
945 : 0 : switch( paParent->mnPageLayout )
946 : : {
947 : : default:
948 : : case 0:
949 : 0 : maRbPgLyDefault.Check();
950 : 0 : break;
951 : : case 1:
952 : 0 : maRbPgLySinglePage.Check();
953 : 0 : break;
954 : : case 2:
955 : 0 : maRbPgLyContinue.Check();
956 : 0 : break;
957 : : case 3:
958 : 0 : maRbPgLyContinueFacing.Check();
959 : 0 : break;
960 : : };
961 : :
962 : 0 : switch( paParent->mnInitialView )
963 : : {
964 : : default:
965 : : case 0:
966 : 0 : maRbOpnPageOnly.Check();
967 : 0 : break;
968 : : case 1:
969 : 0 : maRbOpnOutline.Check();
970 : 0 : break;
971 : : case 2:
972 : 0 : maRbOpnThumbs.Check();
973 : 0 : break;
974 : : };
975 : :
976 : 0 : switch( paParent->mnMagnification )
977 : : {
978 : : default:
979 : : case 0:
980 : 0 : maRbMagnDefault.Check();
981 : 0 : maNumZoom.Enable( sal_False );
982 : 0 : break;
983 : : case 1:
984 : 0 : maRbMagnFitWin.Check();
985 : 0 : maNumZoom.Enable( sal_False );
986 : 0 : break;
987 : : case 2:
988 : 0 : maRbMagnFitWidth.Check();
989 : 0 : maNumZoom.Enable( sal_False );
990 : 0 : break;
991 : : case 3:
992 : 0 : maRbMagnFitVisible.Check();
993 : 0 : maNumZoom.Enable( sal_False );
994 : 0 : break;
995 : : case 4:
996 : 0 : maRbMagnZoom.Check();
997 : 0 : maNumZoom.Enable( sal_True );
998 : 0 : break;
999 : : };
1000 : :
1001 : 0 : maNumZoom.SetValue( paParent->mnZoom );
1002 : 0 : maNumInitialPage.SetValue( paParent->mnInitialPage );
1003 : :
1004 : 0 : if( !mbUseCTLFont )
1005 : 0 : maCbPgLyFirstOnLeft.Hide( );
1006 : : else
1007 : : {
1008 : 0 : maRbPgLyContinueFacing.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl ) );
1009 : 0 : maCbPgLyFirstOnLeft.Check( paParent->mbFirstPageLeft );
1010 : 0 : ToggleRbPgLyContinueFacingHdl( NULL );
1011 : : }
1012 : 0 : }
1013 : :
1014 : 0 : IMPL_LINK_NOARG(ImpPDFTabOpnFtrPage, ToggleRbPgLyContinueFacingHdl)
1015 : : {
1016 : 0 : maCbPgLyFirstOnLeft.Enable( maRbPgLyContinueFacing.IsChecked() );
1017 : 0 : return 0;
1018 : : }
1019 : :
1020 : 0 : IMPL_LINK( ImpPDFTabOpnFtrPage, ToggleRbMagnHdl, void*, )
1021 : : {
1022 : 0 : maNumZoom.Enable( maRbMagnZoom.IsChecked() );
1023 : 0 : return 0;
1024 : : }
1025 : :
1026 : : ////////////////////////////////////////////////////////
1027 : : // The Viewer preferences tab page
1028 : : // -----------------------------------------------------------------------------
1029 : 0 : ImpPDFTabViewerPage::ImpPDFTabViewerPage( Window* pParent,
1030 : : const SfxItemSet& rCoreSet ) :
1031 : : SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_VPREFER ), rCoreSet ),
1032 : :
1033 : : maFlWindowOptions( this, PDFFilterResId( FL_WINOPT ) ),
1034 : : maCbResWinInit( this, PDFFilterResId( CB_WNDOPT_RESINIT ) ),
1035 : : maCbCenterWindow( this, PDFFilterResId( CB_WNDOPT_CNTRWIN ) ),
1036 : : maCbOpenFullScreen( this, PDFFilterResId( CB_WNDOPT_OPNFULL ) ),
1037 : : maCbDispDocTitle( this, PDFFilterResId( CB_DISPDOCTITLE ) ),
1038 : :
1039 : : m_aVerticalLine(this, PDFFilterResId(FL_VPREFER_VERTICAL)),
1040 : :
1041 : : maFlUIOptions( this, PDFFilterResId( FL_USRIFOPT ) ),
1042 : : maCbHideViewerMenubar( this, PDFFilterResId( CB_UOP_HIDEVMENUBAR ) ),
1043 : : maCbHideViewerToolbar( this, PDFFilterResId( CB_UOP_HIDEVTOOLBAR ) ),
1044 : : maCbHideViewerWindowControls( this, PDFFilterResId( CB_UOP_HIDEVWINCTRL ) ),
1045 : : maFlTransitions( this, PDFFilterResId( FL_TRANSITIONS ) ),
1046 : : maCbTransitionEffects( this, PDFFilterResId( CB_TRANSITIONEFFECTS ) ),
1047 : : mbIsPresentation( sal_True ),
1048 : : maFlBookmarks( this, PDFFilterResId( FL_BOOKMARKS ) ),
1049 : : maRbAllBookmarkLevels( this, PDFFilterResId( RB_ALLBOOKMARKLEVELS ) ),
1050 : : maRbVisibleBookmarkLevels( this, PDFFilterResId( RB_VISIBLEBOOKMARKLEVELS ) ),
1051 : 0 : maNumBookmarkLevels( this, PDFFilterResId( NUM_BOOKMARKLEVELS ) )
1052 : : {
1053 : 0 : FreeResource();
1054 : 0 : maRbAllBookmarkLevels.SetToggleHdl( LINK( this, ImpPDFTabViewerPage, ToggleRbBookmarksHdl ) );
1055 : 0 : maRbVisibleBookmarkLevels.SetToggleHdl( LINK( this, ImpPDFTabViewerPage, ToggleRbBookmarksHdl ) );
1056 : 0 : maNumBookmarkLevels.SetAccessibleName(maRbVisibleBookmarkLevels.GetText());
1057 : 0 : maNumBookmarkLevels.SetAccessibleRelationLabeledBy(&maRbVisibleBookmarkLevels);
1058 : 0 : }
1059 : :
1060 : : // -----------------------------------------------------------------------------
1061 : 0 : ImpPDFTabViewerPage::~ImpPDFTabViewerPage()
1062 : : {
1063 : 0 : }
1064 : :
1065 : : // -----------------------------------------------------------------------------
1066 : 0 : IMPL_LINK( ImpPDFTabViewerPage, ToggleRbBookmarksHdl, void*, )
1067 : : {
1068 : 0 : maNumBookmarkLevels.Enable( maRbVisibleBookmarkLevels.IsChecked() );
1069 : 0 : return 0;
1070 : : }
1071 : : // -----------------------------------------------------------------------------
1072 : 0 : SfxTabPage* ImpPDFTabViewerPage::Create( Window* pParent,
1073 : : const SfxItemSet& rAttrSet)
1074 : : {
1075 : 0 : return ( new ImpPDFTabViewerPage( pParent, rAttrSet ) );
1076 : : }
1077 : :
1078 : : // -----------------------------------------------------------------------------
1079 : 0 : void ImpPDFTabViewerPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
1080 : : {
1081 : 0 : paParent->mbHideViewerMenubar = maCbHideViewerMenubar.IsChecked();
1082 : 0 : paParent->mbHideViewerToolbar = maCbHideViewerToolbar.IsChecked( );
1083 : 0 : paParent->mbHideViewerWindowControls = maCbHideViewerWindowControls.IsChecked();
1084 : 0 : paParent->mbResizeWinToInit = maCbResWinInit.IsChecked();
1085 : 0 : paParent->mbOpenInFullScreenMode = maCbOpenFullScreen.IsChecked();
1086 : 0 : paParent->mbCenterWindow = maCbCenterWindow.IsChecked();
1087 : 0 : paParent->mbDisplayPDFDocumentTitle = maCbDispDocTitle.IsChecked();
1088 : 0 : paParent->mbUseTransitionEffects = maCbTransitionEffects.IsChecked();
1089 : 0 : paParent->mnOpenBookmarkLevels = maRbAllBookmarkLevels.IsChecked() ?
1090 : 0 : -1 : static_cast<sal_Int32>(maNumBookmarkLevels.GetValue());
1091 : 0 : }
1092 : :
1093 : : // -----------------------------------------------------------------------------
1094 : 0 : void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
1095 : : {
1096 : 0 : maCbHideViewerMenubar.Check( paParent->mbHideViewerMenubar );
1097 : 0 : maCbHideViewerToolbar.Check( paParent->mbHideViewerToolbar );
1098 : 0 : maCbHideViewerWindowControls.Check( paParent->mbHideViewerWindowControls );
1099 : :
1100 : 0 : maCbResWinInit.Check( paParent->mbResizeWinToInit );
1101 : 0 : maCbOpenFullScreen.Check( paParent->mbOpenInFullScreenMode );
1102 : 0 : maCbCenterWindow.Check( paParent->mbCenterWindow );
1103 : 0 : maCbDispDocTitle.Check( paParent->mbDisplayPDFDocumentTitle );
1104 : 0 : mbIsPresentation = paParent->mbIsPresentation;
1105 : 0 : maCbTransitionEffects.Check( paParent->mbUseTransitionEffects );
1106 : 0 : maCbTransitionEffects.Enable( mbIsPresentation );
1107 : 0 : if( paParent->mnOpenBookmarkLevels < 0 )
1108 : : {
1109 : 0 : maRbAllBookmarkLevels.Check( sal_True );
1110 : 0 : maNumBookmarkLevels.Enable( sal_False );
1111 : : }
1112 : : else
1113 : : {
1114 : 0 : maRbVisibleBookmarkLevels.Check( sal_True );
1115 : 0 : maNumBookmarkLevels.Enable( sal_True );
1116 : 0 : maNumBookmarkLevels.SetValue( paParent->mnOpenBookmarkLevels );
1117 : : }
1118 : 0 : }
1119 : :
1120 : : ////////////////////////////////////////////////////////
1121 : : // The Security preferences tab page
1122 : : // -----------------------------------------------------------------------------
1123 : 0 : ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent,
1124 : : const SfxItemSet& i_rCoreSet ) :
1125 : : SfxTabPage( i_pParent, PDFFilterResId( RID_PDF_TAB_SECURITY ), i_rCoreSet ),
1126 : : maFlGroup( this, PDFFilterResId( FL_PWD_GROUP ) ),
1127 : : maPbSetPwd( this, PDFFilterResId( BTN_SET_PWD ) ),
1128 : : maFtUserPwd( this, PDFFilterResId( FT_USER_PWD ) ),
1129 : : maUserPwdSet( PDFFilterResId( STR_USER_PWD_SET ) ),
1130 : : maUserPwdUnset( PDFFilterResId( STR_USER_PWD_UNSET ) ),
1131 : : maUserPwdPdfa( PDFFilterResId( STR_USER_PWD_PDFA ) ),
1132 : :
1133 : : maStrSetPwd( PDFFilterResId( STR_SET_PWD ) ),
1134 : : maFtOwnerPwd( this, PDFFilterResId( FT_OWNER_PWD ) ),
1135 : : maOwnerPwdSet( PDFFilterResId( STR_OWNER_PWD_SET ) ),
1136 : : maOwnerPwdUnset( PDFFilterResId( STR_OWNER_PWD_UNSET ) ),
1137 : : maOwnerPwdPdfa( PDFFilterResId( STR_OWNER_PWD_PDFA ) ),
1138 : :
1139 : : m_aVerticalLine(this, PDFFilterResId(FL_SECURITY_VERTICAL)),
1140 : :
1141 : : maFlPrintPermissions( this, PDFFilterResId( FL_PRINT_PERMISSIONS ) ),
1142 : : maRbPrintNone( this, PDFFilterResId( RB_PRINT_NONE ) ),
1143 : : maRbPrintLowRes( this, PDFFilterResId( RB_PRINT_LOWRES ) ),
1144 : : maRbPrintHighRes( this, PDFFilterResId( RB_PRINT_HIGHRES ) ),
1145 : :
1146 : : maFlChangesAllowed( this, PDFFilterResId( FL_CHANGES_ALLOWED ) ),
1147 : : maRbChangesNone( this, PDFFilterResId( RB_CHANGES_NONE ) ),
1148 : : maRbChangesInsDel( this, PDFFilterResId( RB_CHANGES_INSDEL ) ),
1149 : : maRbChangesFillForm( this, PDFFilterResId( RB_CHANGES_FILLFORM ) ),
1150 : : maRbChangesComment( this, PDFFilterResId( RB_CHANGES_COMMENT ) ),
1151 : : maRbChangesAnyNoCopy( this, PDFFilterResId( RB_CHANGES_ANY_NOCOPY ) ),
1152 : :
1153 : : maCbEnableCopy( this, PDFFilterResId( CB_ENDAB_COPY ) ),
1154 : : maCbEnableAccessibility( this, PDFFilterResId( CB_ENAB_ACCESS ) ),
1155 : :
1156 : : msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) ),
1157 : : mbHaveOwnerPassword( false ),
1158 : : mbHaveUserPassword( false ),
1159 : :
1160 : 0 : msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD ) )
1161 : : {
1162 : 0 : maUserPwdSet.Append( sal_Unicode( '\n' ) );
1163 : 0 : maUserPwdSet.Append( String( PDFFilterResId( STR_USER_PWD_ENC ) ) );
1164 : :
1165 : 0 : maUserPwdUnset.Append( sal_Unicode( '\n' ) );
1166 : 0 : maUserPwdUnset.Append( String( PDFFilterResId( STR_USER_PWD_UNENC ) ) );
1167 : :
1168 : 0 : maOwnerPwdSet.Append( sal_Unicode( '\n' ) );
1169 : 0 : maOwnerPwdSet.Append( String( PDFFilterResId( STR_OWNER_PWD_REST ) ) );
1170 : :
1171 : 0 : maOwnerPwdUnset.Append( sal_Unicode( '\n' ) );
1172 : 0 : maOwnerPwdUnset.Append( String( PDFFilterResId( STR_OWNER_PWD_UNREST ) ) );
1173 : :
1174 : 0 : FreeResource();
1175 : :
1176 : 0 : maFtUserPwd.SetText( maUserPwdUnset );
1177 : 0 : maFtOwnerPwd.SetText( maOwnerPwdUnset );
1178 : :
1179 : : // pb: #i91991# maRbChangesComment double-spaced if necessary
1180 : 0 : Size aSize = maRbChangesComment.GetSizePixel();
1181 : 0 : Size aMinSize = maRbChangesComment.CalcMinimumSize();
1182 : 0 : if ( aSize.Width() > aMinSize.Width() )
1183 : : {
1184 : 0 : Size aNewSize = maRbChangesFillForm.GetSizePixel();
1185 : 0 : long nDelta = aSize.Height() - aNewSize.Height();
1186 : 0 : maRbChangesComment.SetSizePixel( aNewSize );
1187 : : Window* pWins[] =
1188 : 0 : { &maRbChangesAnyNoCopy, &maCbEnableCopy, &maCbEnableAccessibility, NULL };
1189 : 0 : Window** pCurrent = pWins;
1190 : 0 : while ( *pCurrent )
1191 : : {
1192 : 0 : Point aNewPos = (*pCurrent)->GetPosPixel();
1193 : 0 : aNewPos.Y() -= nDelta;
1194 : 0 : (*pCurrent++)->SetPosPixel( aNewPos );
1195 : : }
1196 : : }
1197 : :
1198 : 0 : maPbSetPwd.SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl ) );
1199 : 0 : }
1200 : :
1201 : : // -----------------------------------------------------------------------------
1202 : 0 : ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage()
1203 : : {
1204 : 0 : }
1205 : :
1206 : : // -----------------------------------------------------------------------------
1207 : 0 : SfxTabPage* ImpPDFTabSecurityPage::Create( Window* pParent,
1208 : : const SfxItemSet& rAttrSet)
1209 : : {
1210 : 0 : return ( new ImpPDFTabSecurityPage( pParent, rAttrSet ) );
1211 : : }
1212 : :
1213 : : // -----------------------------------------------------------------------------
1214 : 0 : void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
1215 : : {
1216 : : // please note that in PDF/A-1a mode even if this are copied back,
1217 : : // the security settings are forced disabled in PDFExport::Export
1218 : 0 : paParent->mbEncrypt = mbHaveUserPassword;
1219 : 0 : paParent->mxPreparedPasswords = mxPreparedPasswords;
1220 : :
1221 : 0 : paParent->mbRestrictPermissions = mbHaveOwnerPassword;
1222 : 0 : paParent->maPreparedOwnerPassword = maPreparedOwnerPassword;
1223 : :
1224 : : //verify print status
1225 : 0 : paParent->mnPrint = 0;
1226 : 0 : if( maRbPrintLowRes.IsChecked() )
1227 : 0 : paParent->mnPrint = 1;
1228 : 0 : else if( maRbPrintHighRes.IsChecked() )
1229 : 0 : paParent->mnPrint = 2;
1230 : :
1231 : : //verify changes permitted
1232 : 0 : paParent->mnChangesAllowed = 0;
1233 : :
1234 : 0 : if( maRbChangesInsDel.IsChecked() )
1235 : 0 : paParent->mnChangesAllowed = 1;
1236 : 0 : else if( maRbChangesFillForm.IsChecked() )
1237 : 0 : paParent->mnChangesAllowed = 2;
1238 : 0 : else if( maRbChangesComment.IsChecked() )
1239 : 0 : paParent->mnChangesAllowed = 3;
1240 : 0 : else if( maRbChangesAnyNoCopy.IsChecked() )
1241 : 0 : paParent->mnChangesAllowed = 4;
1242 : :
1243 : 0 : paParent->mbCanCopyOrExtract = maCbEnableCopy.IsChecked();
1244 : 0 : paParent->mbCanExtractForAccessibility = maCbEnableAccessibility.IsChecked();
1245 : 0 : }
1246 : :
1247 : :
1248 : : // -----------------------------------------------------------------------------
1249 : 0 : void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
1250 : : {
1251 : 0 : switch( paParent->mnPrint )
1252 : : {
1253 : : default:
1254 : : case 0:
1255 : 0 : maRbPrintNone.Check();
1256 : 0 : break;
1257 : : case 1:
1258 : 0 : maRbPrintLowRes.Check();
1259 : 0 : break;
1260 : : case 2:
1261 : 0 : maRbPrintHighRes.Check();
1262 : 0 : break;
1263 : : };
1264 : :
1265 : 0 : switch( paParent->mnChangesAllowed )
1266 : : {
1267 : : default:
1268 : : case 0:
1269 : 0 : maRbChangesNone.Check();
1270 : 0 : break;
1271 : : case 1:
1272 : 0 : maRbChangesInsDel.Check();
1273 : 0 : break;
1274 : : case 2:
1275 : 0 : maRbChangesFillForm.Check();
1276 : 0 : break;
1277 : : case 3:
1278 : 0 : maRbChangesComment.Check();
1279 : 0 : break;
1280 : : case 4:
1281 : 0 : maRbChangesAnyNoCopy.Check();
1282 : 0 : break;
1283 : : };
1284 : :
1285 : 0 : maCbEnableCopy.Check( paParent->mbCanCopyOrExtract );
1286 : 0 : maCbEnableAccessibility.Check( paParent->mbCanExtractForAccessibility );
1287 : :
1288 : : // set the status of this windows, according to the PDFA selection
1289 : 0 : enablePermissionControls();
1290 : :
1291 : 0 : if( paParent && paParent->GetTabPage( RID_PDF_TAB_GENER ) )
1292 : : ImplPDFASecurityControl(
1293 : 0 : !( ( ImpPDFTabGeneralPage* )paParent->GetTabPage( RID_PDF_TAB_GENER ) )->IsPdfaSelected() );
1294 : 0 : }
1295 : :
1296 : 0 : IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl)
1297 : : {
1298 : 0 : SfxPasswordDialog aPwdDialog( this, &msUserPwdTitle );
1299 : 0 : aPwdDialog.SetMinLen( 0 );
1300 : 0 : aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM | SHOWEXTRAS_PASSWORD2 | SHOWEXTRAS_CONFIRM2 );
1301 : 0 : aPwdDialog.SetText( maStrSetPwd );
1302 : 0 : aPwdDialog.SetGroup2Text( msOwnerPwdTitle );
1303 : 0 : aPwdDialog.AllowAsciiOnly();
1304 : 0 : if( aPwdDialog.Execute() == RET_OK ) //OK issued get password and set it
1305 : : {
1306 : 0 : rtl::OUString aUserPW( aPwdDialog.GetPassword() );
1307 : 0 : rtl::OUString aOwnerPW( aPwdDialog.GetPassword2() );
1308 : :
1309 : 0 : mbHaveUserPassword = !aUserPW.isEmpty();
1310 : 0 : mbHaveOwnerPassword = !aOwnerPW.isEmpty();
1311 : :
1312 : 0 : mxPreparedPasswords = vcl::PDFWriter::InitEncryption( aOwnerPW, aUserPW, true );
1313 : :
1314 : 0 : if( mbHaveOwnerPassword )
1315 : : {
1316 : 0 : maPreparedOwnerPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aOwnerPW );
1317 : : }
1318 : : else
1319 : 0 : maPreparedOwnerPassword = Sequence< NamedValue >();
1320 : :
1321 : : // trash clear text passwords string memory
1322 : 0 : memset( (void*)aUserPW.getStr(), 0, aUserPW.getLength() );
1323 : 0 : memset( (void*)aOwnerPW.getStr(), 0, aOwnerPW.getLength() );
1324 : : }
1325 : 0 : enablePermissionControls();
1326 : 0 : return 0;
1327 : : }
1328 : :
1329 : 0 : void ImpPDFTabSecurityPage::enablePermissionControls()
1330 : : {
1331 : 0 : sal_Bool bIsPDFASel = sal_False;
1332 : 0 : ImpPDFTabDialog* pParent = static_cast<ImpPDFTabDialog*>(GetTabDialog());
1333 : 0 : if( pParent && pParent->GetTabPage( RID_PDF_TAB_GENER ) )
1334 : : bIsPDFASel = ( ( ImpPDFTabGeneralPage* )pParent->
1335 : 0 : GetTabPage( RID_PDF_TAB_GENER ) )->IsPdfaSelected();
1336 : 0 : if( bIsPDFASel )
1337 : 0 : maFtUserPwd.SetText( maUserPwdPdfa );
1338 : : else
1339 : 0 : maFtUserPwd.SetText( (mbHaveUserPassword && IsEnabled()) ? maUserPwdSet : maUserPwdUnset );
1340 : :
1341 : 0 : sal_Bool bLocalEnable = mbHaveOwnerPassword && IsEnabled();
1342 : 0 : if( bIsPDFASel )
1343 : 0 : maFtOwnerPwd.SetText( maOwnerPwdPdfa );
1344 : : else
1345 : 0 : maFtOwnerPwd.SetText( bLocalEnable ? maOwnerPwdSet : maOwnerPwdUnset );
1346 : :
1347 : 0 : maFlPrintPermissions.Enable( bLocalEnable );
1348 : 0 : maRbPrintNone.Enable( bLocalEnable );
1349 : 0 : maRbPrintLowRes.Enable( bLocalEnable );
1350 : 0 : maRbPrintHighRes.Enable( bLocalEnable );
1351 : :
1352 : 0 : maFlChangesAllowed.Enable( bLocalEnable );
1353 : 0 : maRbChangesNone.Enable( bLocalEnable );
1354 : 0 : maRbChangesInsDel.Enable( bLocalEnable );
1355 : 0 : maRbChangesFillForm.Enable( bLocalEnable );
1356 : 0 : maRbChangesComment.Enable( bLocalEnable );
1357 : 0 : maRbChangesAnyNoCopy.Enable( bLocalEnable );
1358 : :
1359 : 0 : maCbEnableCopy.Enable( bLocalEnable );
1360 : 0 : maCbEnableAccessibility.Enable( bLocalEnable );
1361 : 0 : }
1362 : :
1363 : : ////////////////////////////////////////////////////////
1364 : : // This tab page is under control of the PDF/A-1a checkbox:
1365 : : // implement a method to do it.
1366 : : // -----------------------------------------------------------------------------
1367 : 0 : void ImpPDFTabSecurityPage::ImplPDFASecurityControl( sal_Bool bEnableSecurity )
1368 : : {
1369 : 0 : if( bEnableSecurity )
1370 : : {
1371 : 0 : Enable();
1372 : : //after enable, check the status of control as if the dialog was initialized
1373 : : }
1374 : : else
1375 : 0 : Enable( sal_False );
1376 : :
1377 : 0 : enablePermissionControls();
1378 : 0 : }
1379 : :
1380 : : ////////////////////////////////////////////////////////
1381 : : // The link preferences tab page (relative and other stuff)
1382 : : // -----------------------------------------------------------------------------
1383 : 0 : ImpPDFTabLinksPage::ImpPDFTabLinksPage( Window* pParent,
1384 : : const SfxItemSet& rCoreSet ) :
1385 : : SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_LINKS ), rCoreSet ),
1386 : :
1387 : : maCbExprtBmkrToNmDst( this, PDFFilterResId( CB_EXP_BMRK_TO_DEST ) ),
1388 : : maCbOOoToPDFTargets( this, PDFFilterResId( CB_CNV_OOO_DOCTOPDF ) ),
1389 : : maCbExportRelativeFsysLinks( this, PDFFilterResId( CB_ENAB_RELLINKFSYS ) ),
1390 : :
1391 : : maFlDefaultTitle( this, PDFFilterResId( FL_DEFAULT_LINK_ACTION ) ),
1392 : : maRbOpnLnksDefault( this, PDFFilterResId( CB_VIEW_PDF_DEFAULT ) ),
1393 : : mbOpnLnksDefaultUserState( sal_False ),
1394 : : maRbOpnLnksLaunch( this, PDFFilterResId( CB_VIEW_PDF_APPLICATION ) ),
1395 : : mbOpnLnksLaunchUserState( sal_False ),
1396 : : maRbOpnLnksBrowser( this, PDFFilterResId( CB_VIEW_PDF_BROWSER ) ),
1397 : 0 : mbOpnLnksBrowserUserState( sal_False )
1398 : : {
1399 : 0 : FreeResource();
1400 : :
1401 : : // pb: #i91991# checkboxes only double-spaced if necessary
1402 : 0 : long nDelta = 0;
1403 : 0 : Size aSize = maCbExprtBmkrToNmDst.GetSizePixel();
1404 : 0 : Size aMinSize = maCbExprtBmkrToNmDst.CalcMinimumSize();
1405 : : long nLineHeight =
1406 : 0 : maCbExprtBmkrToNmDst.LogicToPixel( Size( 10, 10 ), MAP_APPFONT ).Height();
1407 : 0 : if ( aSize.Width() > aMinSize.Width() )
1408 : : {
1409 : 0 : Size aNewSize( aSize.Width(), nLineHeight );
1410 : 0 : nDelta += ( aSize.Height() - nLineHeight );
1411 : 0 : maCbExprtBmkrToNmDst.SetSizePixel( aNewSize );
1412 : 0 : Point aNewPos = maCbOOoToPDFTargets.GetPosPixel();
1413 : 0 : aNewPos.Y() -= nDelta;
1414 : 0 : maCbOOoToPDFTargets.SetPosPixel( aNewPos );
1415 : : }
1416 : :
1417 : 0 : aSize = maCbOOoToPDFTargets.GetSizePixel();
1418 : 0 : aMinSize = maCbOOoToPDFTargets.CalcMinimumSize();
1419 : 0 : if ( aSize.Width() > aMinSize.Width() )
1420 : : {
1421 : 0 : Size aNewSize( aSize.Width(), nLineHeight );
1422 : 0 : nDelta += ( aSize.Height() - nLineHeight );
1423 : 0 : maCbOOoToPDFTargets.SetSizePixel( aNewSize );
1424 : 0 : Point aNewPos = maCbExportRelativeFsysLinks.GetPosPixel();
1425 : 0 : aNewPos.Y() -= nDelta;
1426 : 0 : maCbExportRelativeFsysLinks.SetPosPixel( aNewPos );
1427 : : }
1428 : :
1429 : 0 : aSize = maCbExportRelativeFsysLinks.GetSizePixel();
1430 : 0 : aMinSize = maCbExportRelativeFsysLinks.CalcMinimumSize();
1431 : 0 : if ( aSize.Width() > aMinSize.Width() )
1432 : : {
1433 : 0 : Size aNewSize( aSize.Width(), nLineHeight );
1434 : 0 : nDelta += ( aSize.Height() - nLineHeight );
1435 : 0 : maCbExportRelativeFsysLinks.SetSizePixel( aNewSize );
1436 : : }
1437 : :
1438 : 0 : if ( nDelta > 0 )
1439 : : {
1440 : : Window* pWins[] =
1441 : 0 : { &maFlDefaultTitle, &maRbOpnLnksDefault, &maRbOpnLnksLaunch, &maRbOpnLnksBrowser, NULL };
1442 : 0 : Window** pCurrent = pWins;
1443 : 0 : while ( *pCurrent )
1444 : : {
1445 : 0 : Point aNewPos = (*pCurrent)->GetPosPixel();
1446 : 0 : aNewPos.Y() -= nDelta;
1447 : 0 : (*pCurrent++)->SetPosPixel( aNewPos );
1448 : : }
1449 : : }
1450 : 0 : }
1451 : :
1452 : : // -----------------------------------------------------------------------------
1453 : 0 : ImpPDFTabLinksPage::~ImpPDFTabLinksPage()
1454 : : {
1455 : 0 : }
1456 : :
1457 : : // -----------------------------------------------------------------------------
1458 : 0 : SfxTabPage* ImpPDFTabLinksPage::Create( Window* pParent,
1459 : : const SfxItemSet& rAttrSet)
1460 : : {
1461 : 0 : return ( new ImpPDFTabLinksPage( pParent, rAttrSet ) );
1462 : : }
1463 : :
1464 : : // -----------------------------------------------------------------------------
1465 : 0 : void ImpPDFTabLinksPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
1466 : : {
1467 : 0 : paParent->mbExportRelativeFsysLinks = maCbExportRelativeFsysLinks.IsChecked();
1468 : :
1469 : 0 : sal_Bool bIsPDFASel = sal_False;
1470 : 0 : if( paParent && paParent->GetTabPage( RID_PDF_TAB_GENER ) )
1471 : : bIsPDFASel = ( ( ImpPDFTabGeneralPage* )paParent->
1472 : 0 : GetTabPage( RID_PDF_TAB_GENER ) )->IsPdfaSelected();
1473 : : // if PDF/A-1 was not selected while exiting dialog...
1474 : 0 : if( !bIsPDFASel )
1475 : : {
1476 : : // ...get the control states
1477 : 0 : mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
1478 : 0 : mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
1479 : 0 : mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
1480 : : }
1481 : : // the control states, or the saved is used
1482 : : // to form the stored selection
1483 : 0 : paParent->mnViewPDFMode = 0;
1484 : 0 : if( mbOpnLnksBrowserUserState )
1485 : 0 : paParent->mnViewPDFMode = 2;
1486 : 0 : else if( mbOpnLnksLaunchUserState )
1487 : 0 : paParent->mnViewPDFMode = 1;
1488 : :
1489 : 0 : paParent->mbConvertOOoTargets = maCbOOoToPDFTargets.IsChecked();
1490 : 0 : paParent->mbExportBmkToPDFDestination = maCbExprtBmkrToNmDst.IsChecked();
1491 : 0 : }
1492 : :
1493 : : // -----------------------------------------------------------------------------
1494 : 0 : void ImpPDFTabLinksPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
1495 : : {
1496 : 0 : maCbOOoToPDFTargets.Check( paParent->mbConvertOOoTargets );
1497 : 0 : maCbExprtBmkrToNmDst.Check( paParent->mbExportBmkToPDFDestination );
1498 : :
1499 : 0 : maRbOpnLnksDefault.SetClickHdl( LINK( this, ImpPDFTabLinksPage, ClickRbOpnLnksDefaultHdl ) );
1500 : 0 : maRbOpnLnksBrowser.SetClickHdl( LINK( this, ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl ) );
1501 : :
1502 : 0 : maCbExportRelativeFsysLinks.Check( paParent->mbExportRelativeFsysLinks );
1503 : 0 : switch( paParent->mnViewPDFMode )
1504 : : {
1505 : : default:
1506 : : case 0:
1507 : 0 : maRbOpnLnksDefault.Check();
1508 : 0 : mbOpnLnksDefaultUserState = sal_True;
1509 : 0 : break;
1510 : : case 1:
1511 : 0 : maRbOpnLnksLaunch.Check();
1512 : 0 : mbOpnLnksLaunchUserState = sal_True;
1513 : 0 : break;
1514 : : case 2:
1515 : 0 : maRbOpnLnksBrowser.Check();
1516 : 0 : mbOpnLnksBrowserUserState = sal_True;
1517 : 0 : break;
1518 : : }
1519 : : // now check the status of PDF/A selection
1520 : : // and set the link action accordingly
1521 : : // PDF/A-1 doesn't allow launch action on links
1522 : : //
1523 : 0 : if( paParent && paParent->GetTabPage( RID_PDF_TAB_GENER ) )
1524 : : ImplPDFALinkControl(
1525 : : !( ( ImpPDFTabGeneralPage* )paParent->
1526 : 0 : GetTabPage( RID_PDF_TAB_GENER ) )->maCbPDFA1b.IsChecked() );
1527 : 0 : }
1528 : :
1529 : : // -----------------------------------------------------------------------------
1530 : : // called from general tab, with PDFA/1 selection status
1531 : : // retrieves/store the status of Launch action selection
1532 : 0 : void ImpPDFTabLinksPage::ImplPDFALinkControl( sal_Bool bEnableLaunch )
1533 : : {
1534 : : // set the value and position of link type selection
1535 : 0 : if( bEnableLaunch )
1536 : : {
1537 : 0 : maRbOpnLnksLaunch.Enable();
1538 : : //restore user state with no PDF/A-1 selected
1539 : 0 : maRbOpnLnksDefault.Check( mbOpnLnksDefaultUserState );
1540 : 0 : maRbOpnLnksLaunch.Check( mbOpnLnksLaunchUserState );
1541 : 0 : maRbOpnLnksBrowser.Check( mbOpnLnksBrowserUserState );
1542 : : }
1543 : : else
1544 : : {
1545 : : //save user state with no PDF/A-1 selected
1546 : 0 : mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
1547 : 0 : mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
1548 : 0 : mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
1549 : 0 : maRbOpnLnksLaunch.Enable( sal_False );
1550 : 0 : if( mbOpnLnksLaunchUserState )
1551 : 0 : maRbOpnLnksBrowser.Check();
1552 : : }
1553 : 0 : }
1554 : :
1555 : : // -----------------------------------------------------------------------------
1556 : : // reset the memory of Launch action present
1557 : : // when PDF/A-1 was requested
1558 : 0 : IMPL_LINK_NOARG(ImpPDFTabLinksPage, ClickRbOpnLnksDefaultHdl)
1559 : : {
1560 : 0 : mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
1561 : 0 : mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
1562 : 0 : mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
1563 : 0 : return 0;
1564 : : }
1565 : :
1566 : : // -----------------------------------------------------------------------------
1567 : : // reset the memory of a launch action present
1568 : : // when PDF/A-1 was requested
1569 : 0 : IMPL_LINK_NOARG(ImpPDFTabLinksPage, ClickRbOpnLnksBrowserHdl)
1570 : : {
1571 : 0 : mbOpnLnksDefaultUserState = maRbOpnLnksDefault.IsChecked();
1572 : 0 : mbOpnLnksLaunchUserState = maRbOpnLnksLaunch.IsChecked();
1573 : 0 : mbOpnLnksBrowserUserState = maRbOpnLnksBrowser.IsChecked();
1574 : 0 : return 0;
1575 : : }
1576 : :
1577 : 0 : ImplErrorDialog::ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& rErrors ) :
1578 : : ModalDialog( NULL, PDFFilterResId( RID_PDF_ERROR_DLG ) ),
1579 : : maFI( this, 0 ),
1580 : : maProcessText( this, PDFFilterResId( FT_PROCESS ) ),
1581 : : maErrors( this, WB_BORDER | WB_AUTOVSCROLL ),
1582 : : maExplanation( this, WB_WORDBREAK ),
1583 : 0 : maButton( this, WB_DEFBUTTON )
1584 : :
1585 : : {
1586 : : // load images
1587 : 0 : Image aWarnImg( BitmapEx( PDFFilterResId( IMG_WARN ) ) );
1588 : 0 : Image aErrImg( BitmapEx( PDFFilterResId( IMG_ERR ) ) );
1589 : :
1590 : 0 : for( std::set<vcl::PDFWriter::ErrorCode>::const_iterator it = rErrors.begin();
1591 : 0 : it != rErrors.end(); ++it )
1592 : : {
1593 : 0 : switch( *it )
1594 : : {
1595 : : case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA:
1596 : : {
1597 : : sal_uInt16 nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_PDFA_SHORT ) ),
1598 : 0 : aWarnImg );
1599 : 0 : maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_TRANSP_PDFA ) ) );
1600 : : }
1601 : 0 : break;
1602 : : case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13:
1603 : : {
1604 : : sal_uInt16 nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_VERSION_SHORT ) ),
1605 : 0 : aWarnImg );
1606 : 0 : maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_TRANSP_VERSION ) ) );
1607 : : }
1608 : 0 : break;
1609 : : case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA:
1610 : : {
1611 : : sal_uInt16 nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_FORMACTION_PDFA_SHORT ) ),
1612 : 0 : aWarnImg );
1613 : 0 : maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_FORMACTION_PDFA ) ) );
1614 : : }
1615 : 0 : break;
1616 : : case vcl::PDFWriter::Warning_Transparency_Converted:
1617 : : {
1618 : : sal_uInt16 nPos = maErrors.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_CONVERTED_SHORT ) ),
1619 : 0 : aWarnImg );
1620 : 0 : maErrors.SetEntryData( nPos, new String( PDFFilterResId( STR_WARN_TRANSP_CONVERTED ) ) );
1621 : : }
1622 : 0 : break;
1623 : : default:
1624 : 0 : break;
1625 : : }
1626 : : }
1627 : :
1628 : 0 : FreeResource();
1629 : :
1630 : 0 : if( maErrors.GetEntryCount() > 0 )
1631 : : {
1632 : 0 : maErrors.SelectEntryPos( 0 );
1633 : 0 : String* pStr = reinterpret_cast<String*>(maErrors.GetEntryData( 0 ));
1634 : 0 : maExplanation.SetText( pStr ? *pStr : String() );
1635 : : }
1636 : :
1637 : : // adjust layout
1638 : 0 : Image aWarnImage( WarningBox::GetStandardImage() );
1639 : 0 : Size aImageSize( aWarnImage.GetSizePixel() );
1640 : 0 : Size aDlgSize( GetSizePixel() );
1641 : 0 : aImageSize.Width() += 6;
1642 : 0 : aImageSize.Height() += 6;
1643 : 0 : maFI.SetImage( aWarnImage );
1644 : 0 : maFI.SetPosSizePixel( Point( 5, 5 ), aImageSize );
1645 : 0 : maFI.Show();
1646 : :
1647 : 0 : maProcessText.SetStyle( maProcessText.GetStyle() | WB_VCENTER );
1648 : 0 : maProcessText.SetPosSizePixel( Point( aImageSize.Width() + 10, 5 ),
1649 : 0 : Size( aDlgSize.Width() - aImageSize.Width() - 15, aImageSize.Height() ) );
1650 : :
1651 : 0 : Point aErrorLBPos( 5, aImageSize.Height() + 10 );
1652 : 0 : Size aErrorLBSize( aDlgSize.Width()/2 - 10, aDlgSize.Height() - aErrorLBPos.Y() - 35 );
1653 : 0 : maErrors.SetPosSizePixel( aErrorLBPos, aErrorLBSize );
1654 : 0 : maErrors.SetSelectHdl( LINK( this, ImplErrorDialog, SelectHdl ) );
1655 : 0 : maErrors.Show();
1656 : :
1657 : 0 : maExplanation.SetPosSizePixel( Point( aErrorLBPos.X() + aErrorLBSize.Width() + 5, aErrorLBPos.Y() ),
1658 : 0 : Size( aDlgSize.Width() - aErrorLBPos.X() - aErrorLBSize.Width() - 10, aErrorLBSize.Height() ) );
1659 : 0 : maExplanation.Show();
1660 : :
1661 : 0 : maButton.SetPosSizePixel( Point( (aDlgSize.Width() - 50)/2, aDlgSize.Height() - 30 ),
1662 : 0 : Size( 50, 25 ) );
1663 : 0 : maButton.Show();
1664 : 0 : }
1665 : :
1666 : 0 : ImplErrorDialog::~ImplErrorDialog()
1667 : : {
1668 : : // free strings again
1669 : 0 : for( sal_uInt16 n = 0; n < maErrors.GetEntryCount(); n++ )
1670 : 0 : delete (String*)maErrors.GetEntryData( n );
1671 : 0 : }
1672 : :
1673 : 0 : IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl)
1674 : : {
1675 : 0 : String* pStr = reinterpret_cast<String*>(maErrors.GetEntryData( maErrors.GetSelectEntryPos() ));
1676 : 0 : maExplanation.SetText( pStr ? *pStr : String() );
1677 : 0 : return 0;
1678 : : }
1679 : :
1680 : : ////////////////////////////////////////////////////////
1681 : : // The digital signatures tab page
1682 : : // -----------------------------------------------------------------------------
1683 : 0 : ImpPDFTabSigningPage::ImpPDFTabSigningPage( Window* pParent,
1684 : : const SfxItemSet& rCoreSet ) :
1685 : : SfxTabPage( pParent, PDFFilterResId( RID_PDF_TAB_SIGNING ), rCoreSet ),
1686 : :
1687 : : maFtSignCert( this, PDFFilterResId( FT_SIGN_CERT_TEXT ) ),
1688 : : maEdSignCert( this, PDFFilterResId( ED_SIGN_CERT ) ),
1689 : : maPbSignCertSelect( this, PDFFilterResId( BTN_SIGN_CERT_SELECT ) ),
1690 : : maPbSignCertClear( this, PDFFilterResId( BTN_SIGN_CERT_CLEAR ) ),
1691 : : maFtSignPassword( this, PDFFilterResId( FT_SIGN_PASSWORD ) ),
1692 : : maEdSignPassword( this, PDFFilterResId( ED_SIGN_PASSWORD ) ),
1693 : : maFtSignLocation( this, PDFFilterResId( FT_SIGN_LOCATION ) ),
1694 : : maEdSignLocation( this, PDFFilterResId( ED_SIGN_LOCATION ) ),
1695 : : maFtSignContactInfo( this, PDFFilterResId( FT_SIGN_CONTACT ) ),
1696 : : maEdSignContactInfo( this, PDFFilterResId( ED_SIGN_CONTACT ) ),
1697 : : maFtSignReason( this, PDFFilterResId( FT_SIGN_REASON ) ),
1698 : : maEdSignReason( this, PDFFilterResId( ED_SIGN_REASON ) ),
1699 : 0 : maSignCertificate()
1700 : : {
1701 : 0 : FreeResource();
1702 : :
1703 : 0 : maPbSignCertSelect.Enable( true );
1704 : 0 : maPbSignCertSelect.SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertSelect ) );
1705 : 0 : maPbSignCertClear.SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertClear ) );
1706 : 0 : }
1707 : :
1708 : : // -----------------------------------------------------------------------------
1709 : 0 : ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
1710 : : {
1711 : 0 : }
1712 : :
1713 : 0 : IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect )
1714 : : {
1715 : :
1716 : 0 : uno::Sequence< uno::Any > aArgs( 2 );
1717 : 0 : aArgs[0] <<= rtl::OUString("1.2");
1718 : 0 : aArgs[1] <<= sal_False;
1719 : :
1720 : : Reference< security::XDocumentDigitalSignatures > xSigner(
1721 : 0 : comphelper::getProcessServiceFactory()->createInstanceWithArguments(
1722 : 0 : rtl::OUString( "com.sun.star.security.DocumentDigitalSignatures" ), aArgs ),
1723 : 0 : uno::UNO_QUERY );
1724 : :
1725 : 0 : if ( !xSigner.is() )
1726 : 0 : return 0;
1727 : :
1728 : 0 : maSignCertificate = xSigner->chooseCertificate();
1729 : :
1730 : 0 : if (maSignCertificate.is())
1731 : : {
1732 : 0 : maEdSignCert.SetText(maSignCertificate->getSubjectName());
1733 : 0 : maPbSignCertClear.Enable( true );
1734 : 0 : maEdSignLocation.Enable( true );
1735 : 0 : maEdSignPassword.Enable( true );
1736 : 0 : maEdSignContactInfo.Enable( true );
1737 : 0 : maEdSignReason.Enable( true );
1738 : : }
1739 : :
1740 : 0 : return 0;
1741 : : }
1742 : :
1743 : 0 : IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertClear )
1744 : : {
1745 : 0 : maEdSignCert.SetText(OUString(""));
1746 : 0 : maSignCertificate.clear();
1747 : 0 : maPbSignCertClear.Enable( false );
1748 : 0 : maEdSignLocation.Enable( false );
1749 : 0 : maEdSignPassword.Enable( false );
1750 : 0 : maEdSignContactInfo.Enable( false );
1751 : 0 : maEdSignReason.Enable( false );
1752 : :
1753 : 0 : return 0;
1754 : : }
1755 : :
1756 : : // -----------------------------------------------------------------------------
1757 : 0 : SfxTabPage* ImpPDFTabSigningPage::Create( Window* pParent,
1758 : : const SfxItemSet& rAttrSet)
1759 : : {
1760 : 0 : return ( new ImpPDFTabSigningPage( pParent, rAttrSet ) );
1761 : : }
1762 : :
1763 : : // -----------------------------------------------------------------------------
1764 : 0 : void ImpPDFTabSigningPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
1765 : : {
1766 : 0 : paParent->mbSignPDF = maSignCertificate.is();
1767 : 0 : paParent->maSignCertificate = maSignCertificate;
1768 : 0 : paParent->msSignLocation = maEdSignLocation.GetText();
1769 : 0 : paParent->msSignPassword = maEdSignPassword.GetText();
1770 : 0 : paParent->msSignContact = maEdSignContactInfo.GetText();
1771 : 0 : paParent->msSignReason = maEdSignReason.GetText();
1772 : :
1773 : 0 : }
1774 : :
1775 : : // -----------------------------------------------------------------------------
1776 : 0 : void ImpPDFTabSigningPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
1777 : : {
1778 : :
1779 : 0 : maEdSignLocation.Enable( false );
1780 : 0 : maEdSignPassword.Enable( false );
1781 : 0 : maEdSignContactInfo.Enable( false );
1782 : 0 : maEdSignReason.Enable( false );
1783 : 0 : maPbSignCertClear.Enable( false );
1784 : :
1785 : 0 : if (paParent->mbSignPDF)
1786 : : {
1787 : 0 : maEdSignPassword.SetText(paParent->msSignPassword);
1788 : 0 : maEdSignLocation.SetText(paParent->msSignLocation);
1789 : 0 : maEdSignContactInfo.SetText(paParent->msSignContact);
1790 : 0 : maEdSignReason.SetText(paParent->msSignReason);
1791 : 0 : maSignCertificate = paParent->maSignCertificate;
1792 : : }
1793 : 0 : }
1794 : :
1795 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|