1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_filter.hxx"
31 #include "impdialog.hxx"
32 #include "impdialog.hrc"
33 #include "vcl/svapp.hxx"
34 #include "vcl/msgbox.hxx"
35 #include "sfx2/passwd.hxx"
37 #include "comphelper/storagehelper.hxx"
39 #include "com/sun/star/text/XTextRange.hpp"
40 #include "com/sun/star/drawing/XShapes.hpp"
41 #include "com/sun/star/container/XIndexAccess.hpp"
42 #include "com/sun/star/frame/XController.hpp"
43 #include "com/sun/star/view/XSelectionSupplier.hpp"
45 #include <boost/shared_ptr.hpp>
47 static ResMgr
& getPDFFilterResMgr()
49 static ResMgr
*pRes
= ResMgr::CreateResMgr( "pdffilter", Application::GetSettings().GetUILocale());
53 PDFFilterResId::PDFFilterResId( sal_uInt32 nId
) : ResId( nId
, getPDFFilterResMgr() )
61 using namespace ::com::sun::star
;
63 //////////////////////////////////////////////////////////////////////////////////////////////////////
64 // tabbed PDF dialog implementation
65 // please note: the default used here are the same as per specification,
66 // they should be the same in PDFFilter::implExport and in PDFExport::PDFExport
67 // -----------------------------------------------------------------------------
68 ImpPDFTabDialog::ImpPDFTabDialog( Window
* pParent
,
69 Sequence
< PropertyValue
>& rFilterData
,
70 const Reference
< XComponent
>& rxDoc
,
71 const Reference
< lang::XMultiServiceFactory
>& xFact
73 SfxTabDialog( pParent
, PDFFilterResId( RID_PDF_EXPORT_DLG
), 0, sal_False
, 0 ),
75 maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ), &rFilterData
),
76 maConfigI18N( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/I18N/CTL/" ) ) ),
77 mbIsPresentation( sal_False
),
78 mbIsWriter( sal_False
),
80 mbSelectionPresent( sal_False
),
81 mbUseCTLFont( sal_False
),
82 mbUseLosslessCompression( sal_True
),
84 mbReduceImageResolution( sal_False
),
85 mnMaxImageResolution( 300 ),
86 mbUseTaggedPDF( sal_False
),
87 mbExportNotes( sal_True
),
88 mbExportNotesPages( sal_False
),
89 mbUseTransitionEffects( sal_False
),
90 mbIsSkipEmptyPages( sal_True
),
91 mbAddStream( sal_False
),
92 mbEmbedStandardFonts( sal_False
),
94 mbExportFormFields( sal_True
),
95 mbAllowDuplicateFieldNames( sal_False
),
96 mbExportBookmarks( sal_True
),
97 mnOpenBookmarkLevels( -1 ),
99 mbHideViewerToolbar( sal_False
),
100 mbHideViewerMenubar( sal_False
),
101 mbHideViewerWindowControls( sal_False
),
102 mbResizeWinToInit( sal_False
),
103 mbCenterWindow( sal_False
),
104 mbOpenInFullScreenMode( sal_False
),
105 mbDisplayPDFDocumentTitle( sal_False
),
106 mnMagnification( 0 ),
111 mbFirstPageLeft( sal_False
),
114 mbRestrictPermissions( false ),
116 mnChangesAllowed( 0 ),
117 mbCanCopyOrExtract( false ),
118 mbCanExtractForAccessibility( true ),
120 mbIsRangeChecked( sal_False
),
123 mbSelectionIsChecked( sal_False
),
124 mbExportRelativeFsysLinks( sal_False
),
126 mbConvertOOoTargets( sal_False
),
127 mbExportBmkToPDFDestination( sal_False
)
130 // check for selection
133 Reference
< frame::XController
> xController( Reference
< frame::XModel
>( rxDoc
, UNO_QUERY
)->getCurrentController() );
134 if( xController
.is() )
136 Reference
< view::XSelectionSupplier
> xView( xController
, UNO_QUERY
);
138 xView
->getSelection() >>= maSelection
;
141 catch( RuntimeException
)
144 mbSelectionPresent
= maSelection
.hasValue();
145 if ( mbSelectionPresent
)
147 Reference
< drawing::XShapes
> xShapes
;
148 if ( ( maSelection
>>= xShapes
) == sal_False
) // XShapes is always a selection
150 // even if nothing is selected in writer the selection is not empty
151 Reference
< container::XIndexAccess
> xIndexAccess
;
152 if ( maSelection
>>= xIndexAccess
)
154 sal_Int32 nLen
= xIndexAccess
->getCount();
156 mbSelectionPresent
= sal_False
;
157 else if ( nLen
== 1 )
159 Reference
< text::XTextRange
> xTextRange( xIndexAccess
->getByIndex( 0 ), UNO_QUERY
);
160 if ( xTextRange
.is() && ( xTextRange
->getString().getLength() == 0 ) )
161 mbSelectionPresent
= sal_False
;
167 // check if source document is a presentation
170 Reference
< XServiceInfo
> xInfo( rxDoc
, UNO_QUERY
);
173 if ( xInfo
->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) )
174 mbIsPresentation
= sal_True
;
175 if ( xInfo
->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.GenericTextDocument" ) ) ) )
176 mbIsWriter
= sal_True
;
179 catch( RuntimeException
)
183 //get the CTL (Complex Text Layout) from general options, returns sal_True if we have a CTL font on our hands.
184 mbUseCTLFont
= maConfigI18N
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CTLFont" ) ), sal_False
);
186 mbUseLosslessCompression
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False
);
187 mnQuality
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 );
188 mbReduceImageResolution
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False
);
189 mnMaxImageResolution
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 );
191 mbUseTaggedPDF
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False
);
192 mnPDFTypeSelection
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), 0 );
193 if ( mbIsPresentation
)
194 mbExportNotesPages
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), sal_False
);
195 mbExportNotes
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), sal_False
);
197 mbExportBookmarks
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), sal_True
);
198 mnOpenBookmarkLevels
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), -1 );
199 mbUseTransitionEffects
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True
);
200 mbIsSkipEmptyPages
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False
);
201 mbAddStream
= maConfigItem
.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), sal_False
);
202 mbEmbedStandardFonts
= maConfigItem
.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), sal_False
);
204 mnFormsType
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 );
205 mbExportFormFields
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), sal_True
);
206 if ( ( mnFormsType
< 0 ) || ( mnFormsType
> 3 ) )
208 mbAllowDuplicateFieldNames
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), sal_False
);
210 //prepare values for the Viewer tab page
211 mbHideViewerToolbar
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False
);
212 mbHideViewerMenubar
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), sal_False
);
213 mbHideViewerWindowControls
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), sal_False
);
214 mbResizeWinToInit
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), sal_False
);
215 mbCenterWindow
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), sal_False
);
216 mbOpenInFullScreenMode
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), sal_False
);
217 mbDisplayPDFDocumentTitle
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), sal_True
);
219 mnInitialView
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), 0 );
220 mnMagnification
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), 0 );
221 mnZoom
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), 100 );
222 mnPageLayout
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), 0 );
223 mbFirstPageLeft
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), sal_False
);
224 mnInitialPage
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ), 1 );
225 if( mnInitialPage
< 1 )
228 //prepare values for the security tab page
229 mnPrint
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ), 2 );
230 mnChangesAllowed
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ), 4 );
231 mbCanCopyOrExtract
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), sal_True
);
232 mbCanExtractForAccessibility
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), sal_True
);
234 //prepare values for relative links
235 mbExportRelativeFsysLinks
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), sal_False
);
237 mnViewPDFMode
= maConfigItem
.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), 0 );
239 mbConvertOOoTargets
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), sal_False
);
240 mbExportBmkToPDFDestination
= maConfigItem
.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), sal_False
);
242 //queue the tab pages for later creation (created when first shown)
243 AddTabPage( RID_PDF_TAB_SECURITY
, ImpPDFTabSecurityPage::Create
, 0 );
244 AddTabPage( RID_PDF_TAB_LINKS
, ImpPDFTabLinksPage::Create
, 0 );
245 AddTabPage( RID_PDF_TAB_VPREFER
, ImpPDFTabViewerPage::Create
, 0 );
246 AddTabPage( RID_PDF_TAB_OPNFTR
, ImpPDFTabOpnFtrPage::Create
, 0 );
248 //last queued is the first to be displayed (or so it seems..)
249 AddTabPage( RID_PDF_TAB_GENER
, ImpPDFTabGeneralPage::Create
, 0 );
251 //get the string property value (from sfx2/source/dialog/mailmodel.cxx) to overwrite the text for the Ok button
252 ::rtl::OUString sOkButtonText
= maConfigItem
.ReadString( OUString( RTL_CONSTASCII_USTRINGPARAM( "_OkButtonString" ) ), OUString() );
254 //change text on the Ok button: get the relevant string from resources, update it on the button
255 //according to the exported pdf file destination: send as e-mail or write to file?
256 GetOKButton().SetText( ( sOkButtonText
.getLength() > 0 ) ?
257 sOkButtonText
: OUString( String( PDFFilterResId( STR_PDF_EXPORT
) ) ));
259 //remove the reset button, not needed in this tabbed dialog
264 // -----------------------------------------------------------------------------
265 ImpPDFTabDialog::~ImpPDFTabDialog()
267 //delete the pages, needed because otherwise the child tab pages
268 //don't get destroyed
269 RemoveTabPage( RID_PDF_TAB_GENER
);
270 RemoveTabPage( RID_PDF_TAB_VPREFER
);
271 RemoveTabPage( RID_PDF_TAB_OPNFTR
);
272 RemoveTabPage( RID_PDF_TAB_LINKS
);
273 RemoveTabPage( RID_PDF_TAB_SECURITY
);
276 // -----------------------------------------------------------------------------
277 void ImpPDFTabDialog::PageCreated( sal_uInt16 _nId
,
282 case RID_PDF_TAB_GENER
:
283 ( ( ImpPDFTabGeneralPage
* )&_rPage
)->SetFilterConfigItem( this );
285 case RID_PDF_TAB_VPREFER
:
286 ( ( ImpPDFTabViewerPage
* )&_rPage
)->SetFilterConfigItem( this );
288 case RID_PDF_TAB_OPNFTR
:
289 ( ( ImpPDFTabOpnFtrPage
* )&_rPage
)->SetFilterConfigItem( this );
291 case RID_PDF_TAB_LINKS
:
292 ( ( ImpPDFTabLinksPage
* )&_rPage
)->SetFilterConfigItem( this );
294 case RID_PDF_TAB_SECURITY
:
295 ( ( ImpPDFTabSecurityPage
* )&_rPage
)->SetFilterConfigItem( this );
300 // -----------------------------------------------------------------------------
301 short ImpPDFTabDialog::Ok( )
303 //here the whole mechanism of the base class is not used
304 //when Ok is hit, the user means 'convert to PDF', so simply close with ok
308 // -----------------------------------------------------------------------------
309 Sequence
< PropertyValue
> ImpPDFTabDialog::GetFilterData()
311 // updating the FilterData sequence and storing FilterData to configuration
312 if( GetTabPage( RID_PDF_TAB_GENER
) )
313 ( ( ImpPDFTabGeneralPage
* )GetTabPage( RID_PDF_TAB_GENER
) )->GetFilterConfigItem( this );
314 if( GetTabPage( RID_PDF_TAB_VPREFER
) )
315 ( ( ImpPDFTabViewerPage
* )GetTabPage( RID_PDF_TAB_VPREFER
) )->GetFilterConfigItem( this );
316 if( GetTabPage( RID_PDF_TAB_OPNFTR
) )
317 ( ( ImpPDFTabOpnFtrPage
* )GetTabPage( RID_PDF_TAB_OPNFTR
) )->GetFilterConfigItem( this );
318 if( GetTabPage( RID_PDF_TAB_LINKS
) )
319 ( ( ImpPDFTabLinksPage
* )GetTabPage( RID_PDF_TAB_LINKS
) )->GetFilterConfigItem( this );
320 if( GetTabPage( RID_PDF_TAB_SECURITY
) )
321 ( ( ImpPDFTabSecurityPage
* )GetTabPage( RID_PDF_TAB_SECURITY
) )->GetFilterConfigItem( this );
323 //prepare the items to be returned
324 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), mbUseLosslessCompression
);
325 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), mnQuality
);
326 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), mbReduceImageResolution
);
327 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), mnMaxImageResolution
);
329 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), mbUseTaggedPDF
);
330 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectPdfVersion" ) ), mnPDFTypeSelection
);
332 if ( mbIsPresentation
)
333 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), mbExportNotesPages
);
334 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), mbExportNotes
);
336 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarks" ) ), mbExportBookmarks
);
337 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), mbUseTransitionEffects
);
338 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), mbIsSkipEmptyPages
);
339 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAddStream" ) ), mbAddStream
);
340 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbedStandardFonts" ) ), mbEmbedStandardFonts
);
343 * FIXME: the entries are only implicitly defined by the resource file. Should there
344 * ever be an additional form submit format this could get invalid.
346 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), mnFormsType
);
347 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportFormFields" ) ), mbExportFormFields
);
348 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowDuplicateFieldNames" ) ), mbAllowDuplicateFieldNames
);
350 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), mbHideViewerToolbar
);
351 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), mbHideViewerMenubar
);
352 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), mbHideViewerWindowControls
);
353 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), mbResizeWinToInit
);
354 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), mbCenterWindow
);
355 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), mbOpenInFullScreenMode
);
356 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), mbDisplayPDFDocumentTitle
);
357 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), mnInitialView
);
358 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), mnMagnification
);
359 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), mnZoom
);
360 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialPage" ) ), mnInitialPage
);
361 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), mnPageLayout
);
362 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPageOnLeft" ) ), mbFirstPageLeft
);
363 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenBookmarkLevels" ) ), mnOpenBookmarkLevels
);
365 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportLinksRelativeFsys" ) ), mbExportRelativeFsysLinks
);
366 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PDFViewSelection" ) ), mnViewPDFMode
);
367 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ConvertOOoTargetToPDFTarget" ) ), mbConvertOOoTargets
);
368 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBookmarksToPDFDestination" ) ), mbExportBmkToPDFDestination
);
370 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Printing" ) ), mnPrint
);
371 maConfigItem
.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Changes" ) ), mnChangesAllowed
);
372 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableCopyingOfContent" ) ), mbCanCopyOrExtract
);
373 maConfigItem
.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableTextAccessForAccessibilityTools" ) ), mbCanExtractForAccessibility
);
375 Sequence
< PropertyValue
> aRet( maConfigItem
.GetFilterData() );
377 int nElementAdded
= 5;
379 aRet
.realloc( aRet
.getLength() + nElementAdded
);
381 // add the encryption enable flag
382 aRet
[ aRet
.getLength() - nElementAdded
].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptFile" ) );
383 aRet
[ aRet
.getLength() - nElementAdded
].Value
<<= mbEncrypt
;
386 // add the open password
387 aRet
[ aRet
.getLength() - nElementAdded
].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPasswords" ) );
388 aRet
[ aRet
.getLength() - nElementAdded
].Value
<<= mxPreparedPasswords
;
391 //the restrict permission flag (needed to have the scripting consistent with the dialog)
392 aRet
[ aRet
.getLength() - nElementAdded
].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "RestrictPermissions" ) );
393 aRet
[ aRet
.getLength() - nElementAdded
].Value
<<= mbRestrictPermissions
;
396 //add the permission password
397 aRet
[ aRet
.getLength() - nElementAdded
].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "PreparedPermissionPassword" ) );
398 aRet
[ aRet
.getLength() - nElementAdded
].Value
<<= maPreparedOwnerPassword
;
401 // this should be the last added...
402 if( mbIsRangeChecked
)
404 aRet
[ aRet
.getLength() - nElementAdded
].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) );
405 aRet
[ aRet
.getLength() - nElementAdded
].Value
<<= OUString( msPageRange
);
407 else if( mbSelectionIsChecked
)
409 aRet
[ aRet
.getLength() - nElementAdded
].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) );
410 aRet
[ aRet
.getLength() - nElementAdded
].Value
<<= maSelection
;
416 // -----------------------------------------------------------------------------
417 ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window
* pParent
,
418 const SfxItemSet
& rCoreSet
420 SfxTabPage( pParent
, PDFFilterResId( RID_PDF_TAB_GENER
), rCoreSet
),
422 maFlPages( this, PDFFilterResId( FL_PAGES
) ),
423 maRbAll( this, PDFFilterResId( RB_ALL
) ),
424 maRbRange( this, PDFFilterResId( RB_RANGE
) ),
425 maRbSelection( this, PDFFilterResId( RB_SELECTION
) ),
426 maEdPages( this, PDFFilterResId( ED_PAGES
) ),
428 maFlCompression( this, PDFFilterResId( FL_IMAGES
) ),
429 maRbLosslessCompression( this, PDFFilterResId( RB_LOSSLESSCOMPRESSION
) ),
430 maRbJPEGCompression( this, PDFFilterResId( RB_JPEGCOMPRESSION
) ),
431 maFtQuality( this, PDFFilterResId( FT_QUALITY
) ),
432 maNfQuality( this, PDFFilterResId( NF_QUALITY
) ),
433 maCbReduceImageResolution( this, PDFFilterResId( CB_REDUCEIMAGERESOLUTION
) ),
434 maCoReduceImageResolution( this, PDFFilterResId( CO_REDUCEIMAGERESOLUTION
) ),
436 maFlGeneral( this, PDFFilterResId( FL_GENERAL
) ),
437 maCbPDFA1b( this, PDFFilterResId( CB_PDFA_1B_SELECT
) ),
439 maCbTaggedPDF( this, PDFFilterResId( CB_TAGGEDPDF
) ),
440 mbTaggedPDFUserSelection( sal_False
),
442 maCbExportFormFields( this, PDFFilterResId( CB_EXPORTFORMFIELDS
) ),
443 mbExportFormFieldsUserSelection( sal_False
),
444 mbEmbedStandardFontsUserSelection( sal_False
),
445 maFtFormsFormat( this, PDFFilterResId( FT_FORMSFORMAT
) ),
446 maLbFormsFormat( this, PDFFilterResId( LB_FORMSFORMAT
) ),
447 maCbAllowDuplicateFieldNames( this, PDFFilterResId( CB_ALLOWDUPLICATEFIELDNAMES
) ),
449 maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS
) ),
450 maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES
) ),
451 maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES
) ),
452 maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES
) ),
453 maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM
) ),
454 maCbEmbedStandardFonts( this, PDFFilterResId( CB_EMBEDSTANDARDFONTS
) ),
455 mbIsPresentation( sal_False
),
456 mbIsWriter( sal_False
),
461 // pb: #i91991# maCbExportEmptyPages double-spaced if necessary
462 Size aSize
= maCbExportEmptyPages
.GetSizePixel();
463 Size aMinSize
= maCbExportEmptyPages
.CalcMinimumSize();
464 if ( aSize
.Width() > aMinSize
.Width() )
466 Size aNewSize
= maCbExportNotes
.GetSizePixel();
467 long nDelta
= aSize
.Height() - aNewSize
.Height();
468 maCbExportEmptyPages
.SetSizePixel( aNewSize
);
469 Point aNewPos
= maCbAddStream
.GetPosPixel();
470 aNewPos
.Y() -= nDelta
;
471 maCbAddStream
.SetPosPixel( aNewPos
);
472 aNewPos
= maCbEmbedStandardFonts
.GetPosPixel();
473 aNewPos
.Y() -= nDelta
;
474 maCbEmbedStandardFonts
.SetPosPixel( aNewPos
);
477 maEdPages
.SetAccessibleName(maRbRange
.GetText());
478 maEdPages
.SetAccessibleRelationLabeledBy(&maRbRange
);
480 maCbExportEmptyPages
.SetStyle( maCbExportEmptyPages
.GetStyle() | WB_VCENTER
);
483 // -----------------------------------------------------------------------------
484 ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage()
488 // -----------------------------------------------------------------------------
489 void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog
* paParent
)
491 mpaParent
= paParent
;
493 //init this class data
494 maRbRange
.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage
, TogglePagesHdl
) );
497 TogglePagesHdl( NULL
);
499 maNfQuality
.SetUnit( FUNIT_PERCENT
);
500 maNfQuality
.SetMin( 1, FUNIT_PERCENT
);
501 maNfQuality
.SetMax( 100, FUNIT_PERCENT
);
503 maRbSelection
.Enable( paParent
->mbSelectionPresent
);
504 mbIsPresentation
= paParent
->mbIsPresentation
;
505 mbIsWriter
= paParent
->mbIsWriter
;
507 maCbExportEmptyPages
.Enable( mbIsWriter
);
509 maRbLosslessCompression
.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage
, ToggleCompressionHdl
) );
510 const sal_Bool bUseLosslessCompression
= paParent
->mbUseLosslessCompression
;
511 if ( bUseLosslessCompression
)
512 maRbLosslessCompression
.Check();
514 maRbJPEGCompression
.Check();
516 maNfQuality
.SetValue( paParent
->mnQuality
, FUNIT_PERCENT
);
517 maNfQuality
.Enable( bUseLosslessCompression
== sal_False
);
519 maCbReduceImageResolution
.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage
, ToggleReduceImageResolutionHdl
) );
520 const sal_Bool bReduceImageResolution
= paParent
->mbReduceImageResolution
;
521 maCbReduceImageResolution
.Check( bReduceImageResolution
);
522 String
aStrRes( String::CreateFromInt32( paParent
->mnMaxImageResolution
) );
523 aStrRes
.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) );
524 maCoReduceImageResolution
.SetText( aStrRes
);
525 maCoReduceImageResolution
.Enable( bReduceImageResolution
);
527 maCbPDFA1b
.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage
, ToggleExportPDFAHdl
) );
528 switch( paParent
->mnPDFTypeSelection
)
531 case 0: maCbPDFA1b
.Check( sal_False
); // PDF 1.4
533 case 1: maCbPDFA1b
.Check(); // PDF/A-1a
536 ToggleExportPDFAHdl( NULL
);
538 maCbExportFormFields
.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage
, ToggleExportFormFieldsHdl
) );
540 // get the form values, for use with PDF/A-1 selection interface
541 mbTaggedPDFUserSelection
= paParent
->mbUseTaggedPDF
;
542 mbExportFormFieldsUserSelection
= paParent
->mbExportFormFields
;
543 mbEmbedStandardFontsUserSelection
= paParent
->mbEmbedStandardFonts
;
545 if( !maCbPDFA1b
.IsChecked() )
546 {// the value for PDF/A set by the ToggleExportPDFAHdl method called before
547 maCbTaggedPDF
.Check( mbTaggedPDFUserSelection
);
548 maCbExportFormFields
.Check( mbExportFormFieldsUserSelection
);
549 maCbEmbedStandardFonts
.Check( mbEmbedStandardFontsUserSelection
);
552 maLbFormsFormat
.SelectEntryPos( (sal_uInt16
)paParent
->mnFormsType
);
553 maLbFormsFormat
.Enable( paParent
->mbExportFormFields
);
554 maCbAllowDuplicateFieldNames
.Check( paParent
->mbAllowDuplicateFieldNames
);
555 maCbAllowDuplicateFieldNames
.Enable( paParent
->mbExportFormFields
);
557 maCbExportBookmarks
.Check( paParent
->mbExportBookmarks
);
559 maCbExportNotes
.Check( paParent
->mbExportNotes
);
561 if ( mbIsPresentation
)
563 maCbExportNotesPages
.Show( sal_True
);
564 maCbExportNotesPages
.Check( paParent
->mbExportNotesPages
);
568 long nCheckBoxHeight
=
569 maCbExportNotesPages
.LogicToPixel( Size( 13, 13 ), MAP_APPFONT
).Height();
571 Point aPos
= maCbExportEmptyPages
.GetPosPixel();
572 maCbExportEmptyPages
.SetPosPixel( Point( aPos
.X(), aPos
.Y() - nCheckBoxHeight
) );
573 aPos
= maCbAddStream
.GetPosPixel();
574 maCbAddStream
.SetPosPixel( Point( aPos
.X(), aPos
.Y() - nCheckBoxHeight
) );
575 aPos
= maCbEmbedStandardFonts
.GetPosPixel();
576 maCbEmbedStandardFonts
.SetPosPixel( Point( aPos
.X(), aPos
.Y() - nCheckBoxHeight
) );
577 maCbExportNotesPages
.Show( sal_False
);
578 maCbExportNotesPages
.Check( sal_False
);
581 maCbExportEmptyPages
.Check( !paParent
->mbIsSkipEmptyPages
);
583 Reference
< XMultiServiceFactory
> xFactory
= paParent
->getServiceFactory();
584 Reference
< XInterface
> xIfc
;
587 xIfc
= xFactory
->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.documents.PDFDetector" ) ) );
591 maCbAddStream
.Show( sal_True
);
592 maCbAddStream
.Check( paParent
->mbAddStream
);
596 maCbAddStream
.Show( sal_False
);
597 maCbAddStream
.Check( sal_False
);
599 maCbAddStream
.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage
, ToggleAddStreamHdl
) );
600 // init addstream dependencies
601 ToggleAddStreamHdl( NULL
);
604 // -----------------------------------------------------------------------------
605 void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog
* paParent
)
607 // updating the FilterData sequence and storing FilterData to configuration
608 paParent
->mbUseLosslessCompression
= maRbLosslessCompression
.IsChecked();
609 paParent
->mnQuality
= static_cast<sal_Int32
>(maNfQuality
.GetValue());
610 paParent
->mbReduceImageResolution
= maCbReduceImageResolution
.IsChecked();
611 paParent
->mnMaxImageResolution
= maCoReduceImageResolution
.GetText().ToInt32();
612 paParent
->mbExportNotes
= maCbExportNotes
.IsChecked();
613 if ( mbIsPresentation
)
614 paParent
->mbExportNotesPages
= maCbExportNotesPages
.IsChecked();
615 paParent
->mbExportBookmarks
= maCbExportBookmarks
.IsChecked();
617 paParent
->mbIsSkipEmptyPages
= !maCbExportEmptyPages
.IsChecked();
618 paParent
->mbAddStream
= maCbAddStream
.IsVisible() && maCbAddStream
.IsChecked();
620 paParent
->mbIsRangeChecked
= sal_False
;
621 if( maRbRange
.IsChecked() )
623 paParent
->mbIsRangeChecked
= sal_True
;
624 paParent
->msPageRange
= String( maEdPages
.GetText() ); //FIXME all right on other languages ?
626 else if( maRbSelection
.IsChecked() )
628 paParent
->mbSelectionIsChecked
= maRbSelection
.IsChecked();
631 paParent
->mnPDFTypeSelection
= 0;
632 if( maCbPDFA1b
.IsChecked() )
634 paParent
->mnPDFTypeSelection
= 1;
635 paParent
->mbUseTaggedPDF
= mbTaggedPDFUserSelection
;
636 paParent
->mbExportFormFields
= mbExportFormFieldsUserSelection
;
637 paParent
->mbEmbedStandardFonts
= mbEmbedStandardFontsUserSelection
;
641 paParent
->mbUseTaggedPDF
= maCbTaggedPDF
.IsChecked();
642 paParent
->mbExportFormFields
= maCbExportFormFields
.IsChecked();
643 paParent
->mbEmbedStandardFonts
= maCbEmbedStandardFonts
.IsChecked();
647 * FIXME: the entries are only implicitly defined by the resource file. Should there
648 * ever be an additional form submit format this could get invalid.
650 paParent
->mnFormsType
= (sal_Int32
) maLbFormsFormat
.GetSelectEntryPos();
651 paParent
->mbAllowDuplicateFieldNames
= maCbAllowDuplicateFieldNames
.IsChecked();
654 // -----------------------------------------------------------------------------
655 SfxTabPage
* ImpPDFTabGeneralPage::Create( Window
* pParent
,
656 const SfxItemSet
& rAttrSet
)
658 return ( new ImpPDFTabGeneralPage( pParent
, rAttrSet
) );
661 // -----------------------------------------------------------------------------
662 IMPL_LINK( ImpPDFTabGeneralPage
, TogglePagesHdl
, void*, EMPTYARG
)
664 maEdPages
.Enable( maRbRange
.IsChecked() );
665 //Sym2_5805, When the control is disabled, it is also readonly. So here, it is not necessary to set it as readonly.
666 //maEdPages.SetReadOnly( !maRbRange.IsChecked() );
670 // -----------------------------------------------------------------------------
671 IMPL_LINK( ImpPDFTabGeneralPage
, ToggleExportFormFieldsHdl
, void*, EMPTYARG
)
673 maLbFormsFormat
.Enable( maCbExportFormFields
.IsChecked() );
674 maCbAllowDuplicateFieldNames
.Enable( maCbExportFormFields
.IsChecked() );
678 // -----------------------------------------------------------------------------
679 IMPL_LINK( ImpPDFTabGeneralPage
, ToggleCompressionHdl
, void*, EMPTYARG
)
681 maNfQuality
.Enable( maRbJPEGCompression
.IsChecked() );
685 // -----------------------------------------------------------------------------
686 IMPL_LINK( ImpPDFTabGeneralPage
, ToggleReduceImageResolutionHdl
, void*, EMPTYARG
)
688 maCoReduceImageResolution
.Enable( maCbReduceImageResolution
.IsChecked() );
692 // -----------------------------------------------------------------------------
693 IMPL_LINK( ImpPDFTabGeneralPage
, ToggleAddStreamHdl
, void*, EMPTYARG
)
695 if( maCbAddStream
.IsVisible() )
697 if( maCbAddStream
.IsChecked() )
700 maRbRange
.Enable( sal_False
);
701 maRbSelection
.Enable( sal_False
);
702 maEdPages
.Enable( sal_False
);
703 //Sym2_5805, When the control is disabled, it is also readonly. So here, it is not necessary to set it as readonly.
704 //maEdPages.SetReadOnly( sal_True );
705 maRbAll
.Enable( sal_False
);
709 maRbAll
.Enable( sal_True
);
710 maRbRange
.Enable( sal_True
);
711 maRbSelection
.Enable( sal_True
);
717 // -----------------------------------------------------------------------------
718 IMPL_LINK( ImpPDFTabGeneralPage
, ToggleExportPDFAHdl
, void*, EMPTYARG
)
720 ImpPDFTabSecurityPage
* pSecPage
= NULL
;
721 //set the security page status (and its controls as well)
722 if( mpaParent
&& mpaParent
->GetTabPage( RID_PDF_TAB_SECURITY
) )
724 pSecPage
= static_cast<ImpPDFTabSecurityPage
*>(mpaParent
->GetTabPage( RID_PDF_TAB_SECURITY
));
725 pSecPage
->ImplPDFASecurityControl( !maCbPDFA1b
.IsChecked() );
728 //PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport.
729 sal_Bool bPDFA1Sel
= maCbPDFA1b
.IsChecked();
730 maFtFormsFormat
.Enable( !bPDFA1Sel
);
731 maLbFormsFormat
.Enable( !bPDFA1Sel
);
732 maCbAllowDuplicateFieldNames
.Enable( !bPDFA1Sel
);
735 //store the values of subordinate controls
736 mbTaggedPDFUserSelection
= maCbTaggedPDF
.IsChecked();
737 maCbTaggedPDF
.Check();
738 maCbTaggedPDF
.Enable( sal_False
);
739 mbExportFormFieldsUserSelection
= maCbExportFormFields
.IsChecked();
740 maCbExportFormFields
.Check( sal_False
);
741 maCbExportFormFields
.Enable( sal_False
);
742 mbEmbedStandardFontsUserSelection
= maCbEmbedStandardFonts
.IsChecked();
743 maCbEmbedStandardFonts
.Check( sal_True
);
744 maCbEmbedStandardFonts
.Enable( sal_False
);
748 //retrieve the values of subordinate controls
749 maCbTaggedPDF
.Enable();
750 maCbTaggedPDF
.Check( mbTaggedPDFUserSelection
);
751 maCbExportFormFields
.Check( mbExportFormFieldsUserSelection
);
752 maCbExportFormFields
.Enable();
753 maCbEmbedStandardFonts
.Check( mbEmbedStandardFontsUserSelection
);
754 maCbEmbedStandardFonts
.Enable();
756 // PDF/A-1 doesn't allow launch action, so enable/disable the selection on
758 if( mpaParent
&& mpaParent
->GetTabPage( RID_PDF_TAB_LINKS
) )
759 ( ( ImpPDFTabLinksPage
* )mpaParent
->GetTabPage( RID_PDF_TAB_LINKS
) )->ImplPDFALinkControl( !maCbPDFA1b
.IsChecked() );
761 // if a password was set, inform the user that this will not be used in PDF/A case
762 if( maCbPDFA1b
.IsChecked() && pSecPage
&& pSecPage
->hasPassword() )
764 WarningBox
aBox( this, PDFFilterResId( RID_PDF_WARNPDFAPASSWORD
) );
771 /////////////////////////////////////////////////////////////////
772 // the option features tab page
773 // -----------------------------------------------------------------------------
774 ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage( Window
* pParent
,
775 const SfxItemSet
& rCoreSet
) :
776 SfxTabPage( pParent
, PDFFilterResId( RID_PDF_TAB_OPNFTR
), rCoreSet
),
778 maFlInitialView( this, PDFFilterResId( FL_INITVIEW
) ),
779 maRbOpnPageOnly( this, PDFFilterResId( RB_OPNMODE_PAGEONLY
) ),
780 maRbOpnOutline( this, PDFFilterResId( RB_OPNMODE_OUTLINE
) ),
781 maRbOpnThumbs( this, PDFFilterResId( RB_OPNMODE_THUMBS
) ),
782 maFtInitialPage( this, PDFFilterResId( FT_MAGNF_INITIAL_PAGE
) ),
783 maNumInitialPage( this, PDFFilterResId( NUM_MAGNF_INITIAL_PAGE
) ),
785 maFlMagnification( this, PDFFilterResId( FL_MAGNIFICATION
) ),
786 maRbMagnDefault( this, PDFFilterResId( RB_MAGNF_DEFAULT
) ),
787 maRbMagnFitWin( this, PDFFilterResId( RB_MAGNF_WIND
) ),
788 maRbMagnFitWidth( this, PDFFilterResId( RB_MAGNF_WIDTH
) ),
789 maRbMagnFitVisible( this, PDFFilterResId( RB_MAGNF_VISIBLE
) ),
790 maRbMagnZoom( this, PDFFilterResId( RB_MAGNF_ZOOM
) ),
791 maNumZoom( this, PDFFilterResId( NUM_MAGNF_ZOOM
) ),
793 maFlPageLayout( this, PDFFilterResId( FL_PAGE_LAYOUT
) ),
794 maRbPgLyDefault( this, PDFFilterResId( RB_PGLY_DEFAULT
) ),
795 maRbPgLySinglePage( this, PDFFilterResId( RB_PGLY_SINGPG
) ),
796 maRbPgLyContinue( this, PDFFilterResId( RB_PGLY_CONT
) ),
797 maRbPgLyContinueFacing( this, PDFFilterResId( RB_PGLY_CONTFAC
) ),
798 maCbPgLyFirstOnLeft( this, PDFFilterResId( CB_PGLY_FIRSTLEFT
) ),
799 mbUseCTLFont( sal_False
)
803 maRbMagnDefault
.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage
, ToggleRbMagnHdl
) );
804 maRbMagnFitWin
.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage
, ToggleRbMagnHdl
) );
805 maRbMagnFitWidth
.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage
, ToggleRbMagnHdl
) );
806 maRbMagnFitVisible
.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage
, ToggleRbMagnHdl
) );
807 maRbMagnZoom
.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage
, ToggleRbMagnHdl
) );
808 maNumZoom
.SetAccessibleName(maRbMagnZoom
.GetText());
809 maNumZoom
.SetAccessibleRelationLabeledBy(&maRbMagnZoom
);
812 // -----------------------------------------------------------------------------
813 ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage()
817 // -----------------------------------------------------------------------------
818 SfxTabPage
* ImpPDFTabOpnFtrPage::Create( Window
* pParent
,
819 const SfxItemSet
& rAttrSet
)
821 return ( new ImpPDFTabOpnFtrPage( pParent
, rAttrSet
) );
824 // -----------------------------------------------------------------------------
825 void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog
* paParent
)
827 paParent
->mnInitialView
= 0;
828 if( maRbOpnOutline
.IsChecked() )
829 paParent
->mnInitialView
= 1;
830 else if( maRbOpnThumbs
.IsChecked() )
831 paParent
->mnInitialView
= 2;
833 paParent
->mnMagnification
= 0;
834 if( maRbMagnFitWin
.IsChecked() )
835 paParent
->mnMagnification
= 1;
836 else if( maRbMagnFitWidth
.IsChecked() )
837 paParent
->mnMagnification
= 2;
838 else if( maRbMagnFitVisible
.IsChecked() )
839 paParent
->mnMagnification
= 3;
840 else if( maRbMagnZoom
.IsChecked() )
842 paParent
->mnMagnification
= 4;
843 paParent
->mnZoom
= static_cast<sal_Int32
>(maNumZoom
.GetValue());
846 paParent
->mnInitialPage
= static_cast<sal_Int32
>(maNumInitialPage
.GetValue());
848 paParent
->mnPageLayout
= 0;
849 if( maRbPgLySinglePage
.IsChecked() )
850 paParent
->mnPageLayout
= 1;
851 else if( maRbPgLyContinue
.IsChecked() )
852 paParent
->mnPageLayout
= 2;
853 else if( maRbPgLyContinueFacing
.IsChecked() )
854 paParent
->mnPageLayout
= 3;
856 paParent
->mbFirstPageLeft
= ( mbUseCTLFont
) ? maCbPgLyFirstOnLeft
.IsChecked() : sal_False
;
859 // -----------------------------------------------------------------------------
860 void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog
* paParent
)
862 mbUseCTLFont
= paParent
->mbUseCTLFont
;
863 switch( paParent
->mnPageLayout
)
867 maRbPgLyDefault
.Check();
870 maRbPgLySinglePage
.Check();
873 maRbPgLyContinue
.Check();
876 maRbPgLyContinueFacing
.Check();
880 switch( paParent
->mnInitialView
)
884 maRbOpnPageOnly
.Check();
887 maRbOpnOutline
.Check();
890 maRbOpnThumbs
.Check();
894 switch( paParent
->mnMagnification
)
898 maRbMagnDefault
.Check();
899 maNumZoom
.Enable( sal_False
);
902 maRbMagnFitWin
.Check();
903 maNumZoom
.Enable( sal_False
);
906 maRbMagnFitWidth
.Check();
907 maNumZoom
.Enable( sal_False
);
910 maRbMagnFitVisible
.Check();
911 maNumZoom
.Enable( sal_False
);
914 maRbMagnZoom
.Check();
915 maNumZoom
.Enable( sal_True
);
919 maNumZoom
.SetValue( paParent
->mnZoom
);
920 maNumInitialPage
.SetValue( paParent
->mnInitialPage
);
923 maCbPgLyFirstOnLeft
.Hide( );
926 maRbPgLyContinueFacing
.SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage
, ToggleRbPgLyContinueFacingHdl
) );
927 maCbPgLyFirstOnLeft
.Check( paParent
->mbFirstPageLeft
);
928 ToggleRbPgLyContinueFacingHdl( NULL
);
932 IMPL_LINK( ImpPDFTabOpnFtrPage
, ToggleRbPgLyContinueFacingHdl
, void*, EMPTYARG
)
934 maCbPgLyFirstOnLeft
.Enable( maRbPgLyContinueFacing
.IsChecked() );
938 IMPL_LINK( ImpPDFTabOpnFtrPage
, ToggleRbMagnHdl
, void*, )
940 maNumZoom
.Enable( maRbMagnZoom
.IsChecked() );
944 ////////////////////////////////////////////////////////
945 // The Viewer preferences tab page
946 // -----------------------------------------------------------------------------
947 ImpPDFTabViewerPage::ImpPDFTabViewerPage( Window
* pParent
,
948 const SfxItemSet
& rCoreSet
) :
949 SfxTabPage( pParent
, PDFFilterResId( RID_PDF_TAB_VPREFER
), rCoreSet
),
951 maFlWindowOptions( this, PDFFilterResId( FL_WINOPT
) ),
952 maCbResWinInit( this, PDFFilterResId( CB_WNDOPT_RESINIT
) ),
953 maCbCenterWindow( this, PDFFilterResId( CB_WNDOPT_CNTRWIN
) ),
954 maCbOpenFullScreen( this, PDFFilterResId( CB_WNDOPT_OPNFULL
) ),
955 maCbDispDocTitle( this, PDFFilterResId( CB_DISPDOCTITLE
) ),
957 maFlUIOptions( this, PDFFilterResId( FL_USRIFOPT
) ),
958 maCbHideViewerMenubar( this, PDFFilterResId( CB_UOP_HIDEVMENUBAR
) ),
959 maCbHideViewerToolbar( this, PDFFilterResId( CB_UOP_HIDEVTOOLBAR
) ),
960 maCbHideViewerWindowControls( this, PDFFilterResId( CB_UOP_HIDEVWINCTRL
) ),
961 maFlTransitions( this, PDFFilterResId( FL_TRANSITIONS
) ),
962 maCbTransitionEffects( this, PDFFilterResId( CB_TRANSITIONEFFECTS
) ),
963 mbIsPresentation( sal_True
),
964 maFlBookmarks( this, PDFFilterResId( FL_BOOKMARKS
) ),
965 maRbAllBookmarkLevels( this, PDFFilterResId( RB_ALLBOOKMARKLEVELS
) ),
966 maRbVisibleBookmarkLevels( this, PDFFilterResId( RB_VISIBLEBOOKMARKLEVELS
) ),
967 maNumBookmarkLevels( this, PDFFilterResId( NUM_BOOKMARKLEVELS
) )
970 maRbAllBookmarkLevels
.SetToggleHdl( LINK( this, ImpPDFTabViewerPage
, ToggleRbBookmarksHdl
) );
971 maRbVisibleBookmarkLevels
.SetToggleHdl( LINK( this, ImpPDFTabViewerPage
, ToggleRbBookmarksHdl
) );
972 maNumBookmarkLevels
.SetAccessibleName(maRbVisibleBookmarkLevels
.GetText());
973 maNumBookmarkLevels
.SetAccessibleRelationLabeledBy(&maRbVisibleBookmarkLevels
);
976 // -----------------------------------------------------------------------------
977 ImpPDFTabViewerPage::~ImpPDFTabViewerPage()
981 // -----------------------------------------------------------------------------
982 IMPL_LINK( ImpPDFTabViewerPage
, ToggleRbBookmarksHdl
, void*, )
984 maNumBookmarkLevels
.Enable( maRbVisibleBookmarkLevels
.IsChecked() );
987 // -----------------------------------------------------------------------------
988 SfxTabPage
* ImpPDFTabViewerPage::Create( Window
* pParent
,
989 const SfxItemSet
& rAttrSet
)
991 return ( new ImpPDFTabViewerPage( pParent
, rAttrSet
) );
994 // -----------------------------------------------------------------------------
995 void ImpPDFTabViewerPage::GetFilterConfigItem( ImpPDFTabDialog
* paParent
)
997 paParent
->mbHideViewerMenubar
= maCbHideViewerMenubar
.IsChecked();
998 paParent
->mbHideViewerToolbar
= maCbHideViewerToolbar
.IsChecked( );
999 paParent
->mbHideViewerWindowControls
= maCbHideViewerWindowControls
.IsChecked();
1000 paParent
->mbResizeWinToInit
= maCbResWinInit
.IsChecked();
1001 paParent
->mbOpenInFullScreenMode
= maCbOpenFullScreen
.IsChecked();
1002 paParent
->mbCenterWindow
= maCbCenterWindow
.IsChecked();
1003 paParent
->mbDisplayPDFDocumentTitle
= maCbDispDocTitle
.IsChecked();
1004 paParent
->mbUseTransitionEffects
= maCbTransitionEffects
.IsChecked();
1005 paParent
->mnOpenBookmarkLevels
= maRbAllBookmarkLevels
.IsChecked() ?
1006 -1 : static_cast<sal_Int32
>(maNumBookmarkLevels
.GetValue());
1009 // -----------------------------------------------------------------------------
1010 void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog
* paParent
)
1012 maCbHideViewerMenubar
.Check( paParent
->mbHideViewerMenubar
);
1013 maCbHideViewerToolbar
.Check( paParent
->mbHideViewerToolbar
);
1014 maCbHideViewerWindowControls
.Check( paParent
->mbHideViewerWindowControls
);
1016 maCbResWinInit
.Check( paParent
->mbResizeWinToInit
);
1017 maCbOpenFullScreen
.Check( paParent
->mbOpenInFullScreenMode
);
1018 maCbCenterWindow
.Check( paParent
->mbCenterWindow
);
1019 maCbDispDocTitle
.Check( paParent
->mbDisplayPDFDocumentTitle
);
1020 mbIsPresentation
= paParent
->mbIsPresentation
;
1021 maCbTransitionEffects
.Check( paParent
->mbUseTransitionEffects
);
1022 maCbTransitionEffects
.Enable( mbIsPresentation
);
1023 if( paParent
->mnOpenBookmarkLevels
< 0 )
1025 maRbAllBookmarkLevels
.Check( sal_True
);
1026 maNumBookmarkLevels
.Enable( sal_False
);
1030 maRbVisibleBookmarkLevels
.Check( sal_True
);
1031 maNumBookmarkLevels
.Enable( sal_True
);
1032 maNumBookmarkLevels
.SetValue( paParent
->mnOpenBookmarkLevels
);
1036 ////////////////////////////////////////////////////////
1037 // The Security preferences tab page
1038 // -----------------------------------------------------------------------------
1039 ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window
* i_pParent
,
1040 const SfxItemSet
& i_rCoreSet
) :
1041 SfxTabPage( i_pParent
, PDFFilterResId( RID_PDF_TAB_SECURITY
), i_rCoreSet
),
1042 maFlGroup( this, PDFFilterResId( FL_PWD_GROUP
) ),
1043 maPbSetPwd( this, PDFFilterResId( BTN_SET_PWD
) ),
1044 maFtUserPwd( this, PDFFilterResId( FT_USER_PWD
) ),
1045 maUserPwdSet( PDFFilterResId( STR_USER_PWD_SET
) ),
1046 maUserPwdUnset( PDFFilterResId( STR_USER_PWD_UNSET
) ),
1047 maUserPwdPdfa( PDFFilterResId( STR_USER_PWD_PDFA
) ),
1049 maStrSetPwd( PDFFilterResId( STR_SET_PWD
) ),
1050 maFtOwnerPwd( this, PDFFilterResId( FT_OWNER_PWD
) ),
1051 maOwnerPwdSet( PDFFilterResId( STR_OWNER_PWD_SET
) ),
1052 maOwnerPwdUnset( PDFFilterResId( STR_OWNER_PWD_UNSET
) ),
1053 maOwnerPwdPdfa( PDFFilterResId( STR_OWNER_PWD_PDFA
) ),
1055 maFlPrintPermissions( this, PDFFilterResId( FL_PRINT_PERMISSIONS
) ),
1056 maRbPrintNone( this, PDFFilterResId( RB_PRINT_NONE
) ),
1057 maRbPrintLowRes( this, PDFFilterResId( RB_PRINT_LOWRES
) ),
1058 maRbPrintHighRes( this, PDFFilterResId( RB_PRINT_HIGHRES
) ),
1060 maFlChangesAllowed( this, PDFFilterResId( FL_CHANGES_ALLOWED
) ),
1061 maRbChangesNone( this, PDFFilterResId( RB_CHANGES_NONE
) ),
1062 maRbChangesInsDel( this, PDFFilterResId( RB_CHANGES_INSDEL
) ),
1063 maRbChangesFillForm( this, PDFFilterResId( RB_CHANGES_FILLFORM
) ),
1064 maRbChangesComment( this, PDFFilterResId( RB_CHANGES_COMMENT
) ),
1065 maRbChangesAnyNoCopy( this, PDFFilterResId( RB_CHANGES_ANY_NOCOPY
) ),
1067 maCbEnableCopy( this, PDFFilterResId( CB_ENDAB_COPY
) ),
1068 maCbEnableAccessibility( this, PDFFilterResId( CB_ENAB_ACCESS
) ),
1070 msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD
) ),
1071 mbHaveOwnerPassword( false ),
1072 mbHaveUserPassword( false ),
1074 msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD
) )
1076 maUserPwdSet
.Append( sal_Unicode( '\n' ) );
1077 maUserPwdSet
.Append( String( PDFFilterResId( STR_USER_PWD_ENC
) ) );
1079 maUserPwdUnset
.Append( sal_Unicode( '\n' ) );
1080 maUserPwdUnset
.Append( String( PDFFilterResId( STR_USER_PWD_UNENC
) ) );
1082 maOwnerPwdSet
.Append( sal_Unicode( '\n' ) );
1083 maOwnerPwdSet
.Append( String( PDFFilterResId( STR_OWNER_PWD_REST
) ) );
1085 maOwnerPwdUnset
.Append( sal_Unicode( '\n' ) );
1086 maOwnerPwdUnset
.Append( String( PDFFilterResId( STR_OWNER_PWD_UNREST
) ) );
1090 maFtUserPwd
.SetText( maUserPwdUnset
);
1091 maFtOwnerPwd
.SetText( maOwnerPwdUnset
);
1093 // pb: #i91991# maRbChangesComment double-spaced if necessary
1094 Size aSize
= maRbChangesComment
.GetSizePixel();
1095 Size aMinSize
= maRbChangesComment
.CalcMinimumSize();
1096 if ( aSize
.Width() > aMinSize
.Width() )
1098 Size aNewSize
= maRbChangesFillForm
.GetSizePixel();
1099 long nDelta
= aSize
.Height() - aNewSize
.Height();
1100 maRbChangesComment
.SetSizePixel( aNewSize
);
1102 { &maRbChangesAnyNoCopy
, &maCbEnableCopy
, &maCbEnableAccessibility
, NULL
};
1103 Window
** pCurrent
= pWins
;
1106 Point aNewPos
= (*pCurrent
)->GetPosPixel();
1107 aNewPos
.Y() -= nDelta
;
1108 (*pCurrent
++)->SetPosPixel( aNewPos
);
1112 maPbSetPwd
.SetClickHdl( LINK( this, ImpPDFTabSecurityPage
, ClickmaPbSetPwdHdl
) );
1115 // -----------------------------------------------------------------------------
1116 ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage()
1120 // -----------------------------------------------------------------------------
1121 SfxTabPage
* ImpPDFTabSecurityPage::Create( Window
* pParent
,
1122 const SfxItemSet
& rAttrSet
)
1124 return ( new ImpPDFTabSecurityPage( pParent
, rAttrSet
) );
1127 // -----------------------------------------------------------------------------
1128 void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog
* paParent
)
1130 // please note that in PDF/A-1a mode even if this are copied back,
1131 // the security settings are forced disabled in PDFExport::Export
1132 paParent
->mbEncrypt
= mbHaveUserPassword
;
1133 paParent
->mxPreparedPasswords
= mxPreparedPasswords
;
1135 paParent
->mbRestrictPermissions
= mbHaveOwnerPassword
;
1136 paParent
->maPreparedOwnerPassword
= maPreparedOwnerPassword
;
1138 //verify print status
1139 paParent
->mnPrint
= 0;
1140 if( maRbPrintLowRes
.IsChecked() )
1141 paParent
->mnPrint
= 1;
1142 else if( maRbPrintHighRes
.IsChecked() )
1143 paParent
->mnPrint
= 2;
1145 //verify changes permitted
1146 paParent
->mnChangesAllowed
= 0;
1148 if( maRbChangesInsDel
.IsChecked() )
1149 paParent
->mnChangesAllowed
= 1;
1150 else if( maRbChangesFillForm
.IsChecked() )
1151 paParent
->mnChangesAllowed
= 2;
1152 else if( maRbChangesComment
.IsChecked() )
1153 paParent
->mnChangesAllowed
= 3;
1154 else if( maRbChangesAnyNoCopy
.IsChecked() )
1155 paParent
->mnChangesAllowed
= 4;
1157 paParent
->mbCanCopyOrExtract
= maCbEnableCopy
.IsChecked();
1158 paParent
->mbCanExtractForAccessibility
= maCbEnableAccessibility
.IsChecked();
1162 // -----------------------------------------------------------------------------
1163 void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog
* paParent
)
1165 switch( paParent
->mnPrint
)
1169 maRbPrintNone
.Check();
1172 maRbPrintLowRes
.Check();
1175 maRbPrintHighRes
.Check();
1179 switch( paParent
->mnChangesAllowed
)
1183 maRbChangesNone
.Check();
1186 maRbChangesInsDel
.Check();
1189 maRbChangesFillForm
.Check();
1192 maRbChangesComment
.Check();
1195 maRbChangesAnyNoCopy
.Check();
1199 maCbEnableCopy
.Check( paParent
->mbCanCopyOrExtract
);
1200 maCbEnableAccessibility
.Check( paParent
->mbCanExtractForAccessibility
);
1202 // set the status of this windows, according to the PDFA selection
1203 enablePermissionControls();
1205 if( paParent
&& paParent
->GetTabPage( RID_PDF_TAB_GENER
) )
1206 ImplPDFASecurityControl(
1207 !( ( ImpPDFTabGeneralPage
* )paParent
->GetTabPage( RID_PDF_TAB_GENER
) )->IsPdfaSelected() );
1210 IMPL_LINK( ImpPDFTabSecurityPage
, ClickmaPbSetPwdHdl
, void*, EMPTYARG
)
1212 SfxPasswordDialog
aPwdDialog( this, &msUserPwdTitle
);
1213 aPwdDialog
.SetMinLen( 0 );
1214 aPwdDialog
.ShowExtras( SHOWEXTRAS_CONFIRM
| SHOWEXTRAS_PASSWORD2
| SHOWEXTRAS_CONFIRM2
);
1215 aPwdDialog
.SetText( maStrSetPwd
);
1216 aPwdDialog
.SetGroup2Text( msOwnerPwdTitle
);
1217 aPwdDialog
.AllowAsciiOnly();
1218 if( aPwdDialog
.Execute() == RET_OK
) //OK issued get password and set it
1220 rtl::OUString
aUserPW( aPwdDialog
.GetPassword() );
1221 rtl::OUString
aOwnerPW( aPwdDialog
.GetPassword2() );
1223 mbHaveUserPassword
= (aUserPW
.getLength() != 0);
1224 mbHaveOwnerPassword
= (aOwnerPW
.getLength() != 0);
1226 mxPreparedPasswords
= vcl::PDFWriter::InitEncryption( aOwnerPW
, aUserPW
, true );
1228 if( mbHaveOwnerPassword
)
1230 maPreparedOwnerPassword
= comphelper::OStorageHelper::CreatePackageEncryptionData( aOwnerPW
);
1233 maPreparedOwnerPassword
= Sequence
< NamedValue
>();
1235 // trash clear text passwords string memory
1236 rtl_zeroMemory( (void*)aUserPW
.getStr(), aUserPW
.getLength() );
1237 rtl_zeroMemory( (void*)aOwnerPW
.getStr(), aOwnerPW
.getLength() );
1239 enablePermissionControls();
1243 void ImpPDFTabSecurityPage::enablePermissionControls()
1245 sal_Bool bIsPDFASel
= sal_False
;
1246 ImpPDFTabDialog
* pParent
= static_cast<ImpPDFTabDialog
*>(GetTabDialog());
1247 if( pParent
&& pParent
->GetTabPage( RID_PDF_TAB_GENER
) )
1248 bIsPDFASel
= ( ( ImpPDFTabGeneralPage
* )pParent
->
1249 GetTabPage( RID_PDF_TAB_GENER
) )->IsPdfaSelected();
1251 maFtUserPwd
.SetText( maUserPwdPdfa
);
1253 maFtUserPwd
.SetText( (mbHaveUserPassword
&& IsEnabled()) ? maUserPwdSet
: maUserPwdUnset
);
1255 sal_Bool bLocalEnable
= mbHaveOwnerPassword
&& IsEnabled();
1257 maFtOwnerPwd
.SetText( maOwnerPwdPdfa
);
1259 maFtOwnerPwd
.SetText( bLocalEnable
? maOwnerPwdSet
: maOwnerPwdUnset
);
1261 maFlPrintPermissions
.Enable( bLocalEnable
);
1262 maRbPrintNone
.Enable( bLocalEnable
);
1263 maRbPrintLowRes
.Enable( bLocalEnable
);
1264 maRbPrintHighRes
.Enable( bLocalEnable
);
1266 maFlChangesAllowed
.Enable( bLocalEnable
);
1267 maRbChangesNone
.Enable( bLocalEnable
);
1268 maRbChangesInsDel
.Enable( bLocalEnable
);
1269 maRbChangesFillForm
.Enable( bLocalEnable
);
1270 maRbChangesComment
.Enable( bLocalEnable
);
1271 maRbChangesAnyNoCopy
.Enable( bLocalEnable
);
1273 maCbEnableCopy
.Enable( bLocalEnable
);
1274 maCbEnableAccessibility
.Enable( bLocalEnable
);
1277 ////////////////////////////////////////////////////////
1278 // This tab page is under control of the PDF/A-1a checkbox:
1279 // implement a method to do it.
1280 // -----------------------------------------------------------------------------
1281 void ImpPDFTabSecurityPage::ImplPDFASecurityControl( sal_Bool bEnableSecurity
)
1283 if( bEnableSecurity
)
1286 //after enable, check the status of control as if the dialog was initialized
1289 Enable( sal_False
);
1291 enablePermissionControls();
1294 ////////////////////////////////////////////////////////
1295 // The link preferences tab page (relative and other stuff)
1296 // -----------------------------------------------------------------------------
1297 ImpPDFTabLinksPage::ImpPDFTabLinksPage( Window
* pParent
,
1298 const SfxItemSet
& rCoreSet
) :
1299 SfxTabPage( pParent
, PDFFilterResId( RID_PDF_TAB_LINKS
), rCoreSet
),
1301 maCbExprtBmkrToNmDst( this, PDFFilterResId( CB_EXP_BMRK_TO_DEST
) ),
1302 maCbOOoToPDFTargets( this, PDFFilterResId( CB_CNV_OOO_DOCTOPDF
) ),
1303 maCbExportRelativeFsysLinks( this, PDFFilterResId( CB_ENAB_RELLINKFSYS
) ),
1305 maFlDefaultTitle( this, PDFFilterResId( FL_DEFAULT_LINK_ACTION
) ),
1306 maRbOpnLnksDefault( this, PDFFilterResId( CB_VIEW_PDF_DEFAULT
) ),
1307 mbOpnLnksDefaultUserState( sal_False
),
1308 maRbOpnLnksLaunch( this, PDFFilterResId( CB_VIEW_PDF_APPLICATION
) ),
1309 mbOpnLnksLaunchUserState( sal_False
),
1310 maRbOpnLnksBrowser( this, PDFFilterResId( CB_VIEW_PDF_BROWSER
) ),
1311 mbOpnLnksBrowserUserState( sal_False
)
1315 // pb: #i91991# checkboxes only double-spaced if necessary
1317 Size aSize
= maCbExprtBmkrToNmDst
.GetSizePixel();
1318 Size aMinSize
= maCbExprtBmkrToNmDst
.CalcMinimumSize();
1320 maCbExprtBmkrToNmDst
.LogicToPixel( Size( 10, 10 ), MAP_APPFONT
).Height();
1321 if ( aSize
.Width() > aMinSize
.Width() )
1323 Size
aNewSize( aSize
.Width(), nLineHeight
);
1324 nDelta
+= ( aSize
.Height() - nLineHeight
);
1325 maCbExprtBmkrToNmDst
.SetSizePixel( aNewSize
);
1326 Point aNewPos
= maCbOOoToPDFTargets
.GetPosPixel();
1327 aNewPos
.Y() -= nDelta
;
1328 maCbOOoToPDFTargets
.SetPosPixel( aNewPos
);
1331 aSize
= maCbOOoToPDFTargets
.GetSizePixel();
1332 aMinSize
= maCbOOoToPDFTargets
.CalcMinimumSize();
1333 if ( aSize
.Width() > aMinSize
.Width() )
1335 Size
aNewSize( aSize
.Width(), nLineHeight
);
1336 nDelta
+= ( aSize
.Height() - nLineHeight
);
1337 maCbOOoToPDFTargets
.SetSizePixel( aNewSize
);
1338 Point aNewPos
= maCbExportRelativeFsysLinks
.GetPosPixel();
1339 aNewPos
.Y() -= nDelta
;
1340 maCbExportRelativeFsysLinks
.SetPosPixel( aNewPos
);
1343 aSize
= maCbExportRelativeFsysLinks
.GetSizePixel();
1344 aMinSize
= maCbExportRelativeFsysLinks
.CalcMinimumSize();
1345 if ( aSize
.Width() > aMinSize
.Width() )
1347 Size
aNewSize( aSize
.Width(), nLineHeight
);
1348 nDelta
+= ( aSize
.Height() - nLineHeight
);
1349 maCbExportRelativeFsysLinks
.SetSizePixel( aNewSize
);
1355 { &maFlDefaultTitle
, &maRbOpnLnksDefault
, &maRbOpnLnksLaunch
, &maRbOpnLnksBrowser
, NULL
};
1356 Window
** pCurrent
= pWins
;
1359 Point aNewPos
= (*pCurrent
)->GetPosPixel();
1360 aNewPos
.Y() -= nDelta
;
1361 (*pCurrent
++)->SetPosPixel( aNewPos
);
1366 // -----------------------------------------------------------------------------
1367 ImpPDFTabLinksPage::~ImpPDFTabLinksPage()
1371 // -----------------------------------------------------------------------------
1372 SfxTabPage
* ImpPDFTabLinksPage::Create( Window
* pParent
,
1373 const SfxItemSet
& rAttrSet
)
1375 return ( new ImpPDFTabLinksPage( pParent
, rAttrSet
) );
1378 // -----------------------------------------------------------------------------
1379 void ImpPDFTabLinksPage::GetFilterConfigItem( ImpPDFTabDialog
* paParent
)
1381 paParent
->mbExportRelativeFsysLinks
= maCbExportRelativeFsysLinks
.IsChecked();
1383 sal_Bool bIsPDFASel
= sal_False
;
1384 if( paParent
&& paParent
->GetTabPage( RID_PDF_TAB_GENER
) )
1385 bIsPDFASel
= ( ( ImpPDFTabGeneralPage
* )paParent
->
1386 GetTabPage( RID_PDF_TAB_GENER
) )->IsPdfaSelected();
1387 // if PDF/A-1 was not selected while exiting dialog...
1390 // ...get the control states
1391 mbOpnLnksDefaultUserState
= maRbOpnLnksDefault
.IsChecked();
1392 mbOpnLnksLaunchUserState
= maRbOpnLnksLaunch
.IsChecked();
1393 mbOpnLnksBrowserUserState
= maRbOpnLnksBrowser
.IsChecked();
1395 // the control states, or the saved is used
1396 // to form the stored selection
1397 paParent
->mnViewPDFMode
= 0;
1398 if( mbOpnLnksBrowserUserState
)
1399 paParent
->mnViewPDFMode
= 2;
1400 else if( mbOpnLnksLaunchUserState
)
1401 paParent
->mnViewPDFMode
= 1;
1403 paParent
->mbConvertOOoTargets
= maCbOOoToPDFTargets
.IsChecked();
1404 paParent
->mbExportBmkToPDFDestination
= maCbExprtBmkrToNmDst
.IsChecked();
1407 // -----------------------------------------------------------------------------
1408 void ImpPDFTabLinksPage::SetFilterConfigItem( const ImpPDFTabDialog
* paParent
)
1410 maCbOOoToPDFTargets
.Check( paParent
->mbConvertOOoTargets
);
1411 maCbExprtBmkrToNmDst
.Check( paParent
->mbExportBmkToPDFDestination
);
1413 maRbOpnLnksDefault
.SetClickHdl( LINK( this, ImpPDFTabLinksPage
, ClickRbOpnLnksDefaultHdl
) );
1414 maRbOpnLnksBrowser
.SetClickHdl( LINK( this, ImpPDFTabLinksPage
, ClickRbOpnLnksBrowserHdl
) );
1416 maCbExportRelativeFsysLinks
.Check( paParent
->mbExportRelativeFsysLinks
);
1417 switch( paParent
->mnViewPDFMode
)
1421 maRbOpnLnksDefault
.Check();
1422 mbOpnLnksDefaultUserState
= sal_True
;
1425 maRbOpnLnksLaunch
.Check();
1426 mbOpnLnksLaunchUserState
= sal_True
;
1429 maRbOpnLnksBrowser
.Check();
1430 mbOpnLnksBrowserUserState
= sal_True
;
1433 // now check the status of PDF/A selection
1434 // and set the link action accordingly
1435 // PDF/A-1 doesn't allow launch action on links
1437 if( paParent
&& paParent
->GetTabPage( RID_PDF_TAB_GENER
) )
1438 ImplPDFALinkControl(
1439 !( ( ImpPDFTabGeneralPage
* )paParent
->
1440 GetTabPage( RID_PDF_TAB_GENER
) )->maCbPDFA1b
.IsChecked() );
1443 // -----------------------------------------------------------------------------
1444 // called from general tab, with PDFA/1 selection status
1445 // retrieves/store the status of Launch action selection
1446 void ImpPDFTabLinksPage::ImplPDFALinkControl( sal_Bool bEnableLaunch
)
1448 // set the value and position of link type selection
1451 maRbOpnLnksLaunch
.Enable();
1452 //restore user state with no PDF/A-1 selected
1453 maRbOpnLnksDefault
.Check( mbOpnLnksDefaultUserState
);
1454 maRbOpnLnksLaunch
.Check( mbOpnLnksLaunchUserState
);
1455 maRbOpnLnksBrowser
.Check( mbOpnLnksBrowserUserState
);
1459 //save user state with no PDF/A-1 selected
1460 mbOpnLnksDefaultUserState
= maRbOpnLnksDefault
.IsChecked();
1461 mbOpnLnksLaunchUserState
= maRbOpnLnksLaunch
.IsChecked();
1462 mbOpnLnksBrowserUserState
= maRbOpnLnksBrowser
.IsChecked();
1463 maRbOpnLnksLaunch
.Enable( sal_False
);
1464 if( mbOpnLnksLaunchUserState
)
1465 maRbOpnLnksBrowser
.Check();
1469 // -----------------------------------------------------------------------------
1470 // reset the memory of Launch action present
1471 // when PDF/A-1 was requested
1472 IMPL_LINK( ImpPDFTabLinksPage
, ClickRbOpnLnksDefaultHdl
, void*, EMPTYARG
)
1474 mbOpnLnksDefaultUserState
= maRbOpnLnksDefault
.IsChecked();
1475 mbOpnLnksLaunchUserState
= maRbOpnLnksLaunch
.IsChecked();
1476 mbOpnLnksBrowserUserState
= maRbOpnLnksBrowser
.IsChecked();
1480 // -----------------------------------------------------------------------------
1481 // reset the memory of a launch action present
1482 // when PDF/A-1 was requested
1483 IMPL_LINK( ImpPDFTabLinksPage
, ClickRbOpnLnksBrowserHdl
, void*, EMPTYARG
)
1485 mbOpnLnksDefaultUserState
= maRbOpnLnksDefault
.IsChecked();
1486 mbOpnLnksLaunchUserState
= maRbOpnLnksLaunch
.IsChecked();
1487 mbOpnLnksBrowserUserState
= maRbOpnLnksBrowser
.IsChecked();
1491 ImplErrorDialog::ImplErrorDialog( const std::set
< vcl::PDFWriter::ErrorCode
>& rErrors
) :
1492 ModalDialog( NULL
, PDFFilterResId( RID_PDF_ERROR_DLG
) ),
1494 maProcessText( this, PDFFilterResId( FT_PROCESS
) ),
1495 maErrors( this, WB_BORDER
| WB_AUTOVSCROLL
),
1496 maExplanation( this, WB_WORDBREAK
),
1497 maButton( this, WB_DEFBUTTON
)
1501 Image
aWarnImg( BitmapEx( PDFFilterResId( IMG_WARN
) ) );
1502 Image
aErrImg( BitmapEx( PDFFilterResId( IMG_ERR
) ) );
1504 for( std::set
<vcl::PDFWriter::ErrorCode
>::const_iterator it
= rErrors
.begin();
1505 it
!= rErrors
.end(); ++it
)
1509 case vcl::PDFWriter::Warning_Transparency_Omitted_PDFA
:
1511 sal_uInt16 nPos
= maErrors
.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_PDFA_SHORT
) ),
1513 maErrors
.SetEntryData( nPos
, new String( PDFFilterResId( STR_WARN_TRANSP_PDFA
) ) );
1516 case vcl::PDFWriter::Warning_Transparency_Omitted_PDF13
:
1518 sal_uInt16 nPos
= maErrors
.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_VERSION_SHORT
) ),
1520 maErrors
.SetEntryData( nPos
, new String( PDFFilterResId( STR_WARN_TRANSP_VERSION
) ) );
1523 case vcl::PDFWriter::Warning_FormAction_Omitted_PDFA
:
1525 sal_uInt16 nPos
= maErrors
.InsertEntry( String( PDFFilterResId( STR_WARN_FORMACTION_PDFA_SHORT
) ),
1527 maErrors
.SetEntryData( nPos
, new String( PDFFilterResId( STR_WARN_FORMACTION_PDFA
) ) );
1530 case vcl::PDFWriter::Warning_Transparency_Converted
:
1532 sal_uInt16 nPos
= maErrors
.InsertEntry( String( PDFFilterResId( STR_WARN_TRANSP_CONVERTED_SHORT
) ),
1534 maErrors
.SetEntryData( nPos
, new String( PDFFilterResId( STR_WARN_TRANSP_CONVERTED
) ) );
1544 if( maErrors
.GetEntryCount() > 0 )
1546 maErrors
.SelectEntryPos( 0 );
1547 String
* pStr
= reinterpret_cast<String
*>(maErrors
.GetEntryData( 0 ));
1548 maExplanation
.SetText( pStr
? *pStr
: String() );
1552 Image
aWarnImage( WarningBox::GetStandardImage() );
1553 Size
aImageSize( aWarnImage
.GetSizePixel() );
1554 Size
aDlgSize( GetSizePixel() );
1555 aImageSize
.Width() += 6;
1556 aImageSize
.Height() += 6;
1557 maFI
.SetImage( aWarnImage
);
1558 maFI
.SetPosSizePixel( Point( 5, 5 ), aImageSize
);
1561 maProcessText
.SetStyle( maProcessText
.GetStyle() | WB_VCENTER
);
1562 maProcessText
.SetPosSizePixel( Point( aImageSize
.Width() + 10, 5 ),
1563 Size( aDlgSize
.Width() - aImageSize
.Width() - 15, aImageSize
.Height() ) );
1565 Point
aErrorLBPos( 5, aImageSize
.Height() + 10 );
1566 Size
aErrorLBSize( aDlgSize
.Width()/2 - 10, aDlgSize
.Height() - aErrorLBPos
.Y() - 35 );
1567 maErrors
.SetPosSizePixel( aErrorLBPos
, aErrorLBSize
);
1568 maErrors
.SetSelectHdl( LINK( this, ImplErrorDialog
, SelectHdl
) );
1571 maExplanation
.SetPosSizePixel( Point( aErrorLBPos
.X() + aErrorLBSize
.Width() + 5, aErrorLBPos
.Y() ),
1572 Size( aDlgSize
.Width() - aErrorLBPos
.X() - aErrorLBSize
.Width() - 10, aErrorLBSize
.Height() ) );
1573 maExplanation
.Show();
1575 maButton
.SetPosSizePixel( Point( (aDlgSize
.Width() - 50)/2, aDlgSize
.Height() - 30 ),
1580 ImplErrorDialog::~ImplErrorDialog()
1582 // free strings again
1583 for( sal_uInt16 n
= 0; n
< maErrors
.GetEntryCount(); n
++ )
1584 delete (String
*)maErrors
.GetEntryData( n
);
1587 IMPL_LINK( ImplErrorDialog
, SelectHdl
, ListBox
*, EMPTYARG
)
1589 String
* pStr
= reinterpret_cast<String
*>(maErrors
.GetEntryData( maErrors
.GetSelectEntryPos() ));
1590 maExplanation
.SetText( pStr
? *pStr
: String() );