LCOV - code coverage report
Current view: top level - libreoffice/filter/source/pdf - impdialog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 884 0.0 %
Date: 2012-12-17 Functions: 0 86 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10