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