Index: filter/inc/filter.hrc =================================================================== RCS file: /cvs/framework/filter/inc/filter.hrc,v retrieving revision 1.6 diff -u -p -u -r1.6 filter.hrc --- filter/inc/filter.hrc 8 Sep 2005 21:24:26 -0000 1.6 +++ filter/inc/filter.hrc 8 Mar 2006 21:58:14 -0000 @@ -45,10 +45,11 @@ // Help-Ids -------------------------------------------------------------- -#define RID_PDF_EXPORT_DLG (RID_FILTER_START + 0) -#define RID_XSLT_DIALOG_START (RID_FILTER_START + 1) -#define RID_XSLT_DIALOG_END (RID_FILTER_START + 49) -#define RID_PDF_OLD_EXPORT_DLG (RID_FILTER_START + 50) +#define RID_PDF_DIALOG_START (RID_FILTER_START + 0) +#define RID_PDF_DIALOG_END (RID_FILTER_START + 9) +#define RID_XSLT_DIALOG_START (RID_FILTER_START + 10) +#define RID_XSLT_DIALOG_END (RID_FILTER_START + 59) +#define RID_PDF_OLD_EXPORT_DLG (RID_FILTER_START + 60) // warning, next range is RID_FILTER_START + 100 ! Index: filter/source/pdf/impdialog.cxx =================================================================== RCS file: /cvs/framework/filter/source/pdf/impdialog.cxx,v retrieving revision 1.14 diff -u -p -u -r1.14 impdialog.cxx --- filter/source/pdf/impdialog.cxx 21 Dec 2005 15:00:47 -0000 1.14 +++ filter/source/pdf/impdialog.cxx 8 Mar 2006 21:58:15 -0000 @@ -36,6 +36,14 @@ #include "impdialog.hxx" #include "impdialog.hrc" +#ifndef _SV_SVAPP_HXX +#include +#endif + +#ifndef _SV_MSGBOX_HXX +#include +#endif + #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_ #include #endif @@ -61,177 +69,243 @@ using namespace ::com::sun::star; -ImpPDFDialog::ImpPDFDialog( Window* pParent, ResMgr& rResMgr, Sequence< PropertyValue >& rFilterData, const Reference< XComponent >& rxDoc ) : - ModalDialog( pParent, ResId( RID_PDF_EXPORT_DLG, &rResMgr ) ), - maBtnOK( this, ResId( BT_OK ) ), - maBtnCancel( this, ResId( BT_CANCEL ) ), - maBtnHelp( this, ResId( BT_HELP ) ), - maFlPages( this, ResId( FL_PAGES ) ), - maRbAll( this, ResId( RB_ALL ) ), - maRbRange( this, ResId( RB_RANGE ) ), - maRbSelection( this, ResId( RB_SELECTION ) ), - maEdPages( this, ResId( ED_PAGES ) ), - maFlCompression( this, ResId( FL_IMAGES ) ), - maRbLosslessCompression( this, ResId( RB_LOSSLESSCOMPRESSION ) ), - maRbJPEGCompression( this, ResId( RB_JPEGCOMPRESSION ) ), - maFtQuality( this, ResId( FT_QUALITY ) ), - maNfQuality( this, ResId( NF_QUALITY ) ), - maCbReduceImageResolution( this, ResId( CB_REDUCEIMAGERESOLUTION ) ), - maCoReduceImageResolution( this, ResId( CO_REDUCEIMAGERESOLUTION ) ), - maFlGeneral( this, ResId( FL_GENERAL ) ), - maCbTaggedPDF( this, ResId( CB_TAGGEDPDF ) ), - maCbExportNotes( this, ResId( CB_EXPORTNOTES ) ), - maCbTransitionEffects( this, ResId( CB_TRANSITIONEFFECTS ) ), - maFtFormsFormat( this, ResId( FT_FORMSFORMAT ) ), - maLbFormsFormat( this, ResId( LB_FORMSFORMAT ) ), - maCbExportEmptyPages( this, ResId( CB_EXPORTEMPTYPAGES ) ), +////////////////////////////////////////////////////////////////////////////////////////////////////// +// tabbed PDF dialog implementation +// ----------------------------------------------------------------------------- +ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, + ResMgr& rResMgr, + Sequence< PropertyValue >& rFilterData, + const Reference< XComponent >& rxDoc ) : + SfxTabDialog( pParent, ResId( RID_PDF_EXPORT_DLG, &rResMgr ), 0, FALSE, 0 ), + + maFlPages( this, ResId( 1 ) ), + maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/PDF/Export/" ) ), &rFilterData ), mbIsPresentation( sal_False ), - mbIsWriter( sal_False ) -{ - FreeResource(); - maRbRange.SetToggleHdl( LINK( this, ImpPDFDialog, TogglePagesHdl ) ); + mbIsWriter( sal_False ), - maRbAll.Check(); - TogglePagesHdl( NULL ); + mbSelectionPresent( sal_False ), + mbUseLosslessCompression( sal_True ), + mnQuality( 90 ), + mbReduceImageResolution( sal_False ), + mnMaxImageResolution( 300 ), + mbUseTaggedPDF( sal_False ), + mbExportNotesBoth( sal_True ), + mbUseTransitionEffects( sal_False ), + mbIsSkipEmptyPages( sal_False ), + mnFormsType( 0 ), + + mbHideViewerToolbar( sal_False ), + mbHideViewerMenubar( sal_False ), + mbHideViewerWindowControls( sal_False ), + mbResizeWinToInit( sal_False ), + mbCenterWindow( sal_False ), + mbOpenInFullScreenMode( sal_False ), + mbDisplayPDFDocumentTitle( sal_False ), + mbDirectionR2L( sal_False ), + mnMagnification( 0 ), + mnInitialView( 0 ), + mnPageLayout( 0 ), - maNfQuality.SetUnit( FUNIT_PERCENT ); - maNfQuality.SetMin( 1, FUNIT_PERCENT ); - maNfQuality.SetMax( 100, FUNIT_PERCENT ); + mbIsRangeChecked( sal_False ), + msPageRange( ' ' ), - // check for selection + mbSelectionIsChecked( sal_False ) +{ + FreeResource(); + mprResMgr = &rResMgr; +// check for selection try { - Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() ); - if( xController.is() ) - { - Reference< view::XSelectionSupplier > xView( xController, UNO_QUERY ); - if( xView.is() ) - xView->getSelection() >>= maSelection; + Reference< frame::XController > xController( Reference< frame::XModel >( rxDoc, UNO_QUERY )->getCurrentController() ); + if( xController.is() ) + { + Reference< view::XSelectionSupplier > xView( xController, UNO_QUERY ); + if( xView.is() ) + xView->getSelection() >>= maSelection; } } catch( RuntimeException ) { } - sal_Bool bHasSelection = maSelection.hasValue(); - if ( bHasSelection ) - { - Reference< drawing::XShapes > xShapes; - if ( ( maSelection >>= xShapes ) == sal_False ) // XShapes is always a selection - { - // even if nothing is selected in writer the selection is not empty - Reference< container::XIndexAccess > xIndexAccess; - if ( maSelection >>= xIndexAccess ) - { - sal_Int32 nLen = xIndexAccess->getCount(); - if ( !nLen ) - bHasSelection = sal_False; - else if ( nLen == 1 ) - { - Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( 0 ), UNO_QUERY ); - if ( xTextRange.is() && ( xTextRange->getString().getLength() == 0 ) ) - bHasSelection = sal_False; - } - } - } - } - maRbSelection.Enable( bHasSelection ); - - - // check if source document is a presentation - try - { - Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY ); - if ( xInfo.is() ) - { - if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) ) - mbIsPresentation = sal_True; + mbSelectionPresent = maSelection.hasValue(); + if ( mbSelectionPresent ) + { + Reference< drawing::XShapes > xShapes; + if ( ( maSelection >>= xShapes ) == sal_False ) // XShapes is always a selection + { + // even if nothing is selected in writer the selection is not empty + Reference< container::XIndexAccess > xIndexAccess; + if ( maSelection >>= xIndexAccess ) + { + sal_Int32 nLen = xIndexAccess->getCount(); + if ( !nLen ) + mbSelectionPresent = sal_False; + else if ( nLen == 1 ) + { + Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( 0 ), UNO_QUERY ); + if ( xTextRange.is() && ( xTextRange->getString().getLength() == 0 ) ) + mbSelectionPresent = sal_False; + } + } + } + } + +// check if source document is a presentation + try + { + Reference< XServiceInfo > xInfo( rxDoc, UNO_QUERY ); + if ( xInfo.is() ) + { + if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ) ) + mbIsPresentation = sal_True; if ( xInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) ) ) ) mbIsWriter = sal_True; } - } - catch( RuntimeException ) - { - } - maCbTransitionEffects.Enable( mbIsPresentation ); - maCbExportEmptyPages.Enable( mbIsWriter ); - -// SJ: Dont know if there are Notes available also for writer. -// maCbExportNotes.Enable( bIsPresentation ); - - - maRbLosslessCompression.SetToggleHdl( LINK( this, ImpPDFDialog, ToggleCompressionHdl ) ); - const sal_Bool bUseLosslessCompression = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False ); - if ( bUseLosslessCompression ) - maRbLosslessCompression.Check(); - else - maRbJPEGCompression.Check(); - maNfQuality.SetValue( maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 ), FUNIT_PERCENT ); - maNfQuality.Enable( bUseLosslessCompression == sal_False ); - - maCbReduceImageResolution.SetToggleHdl( LINK( this, ImpPDFDialog, ToggleReduceImageResolutionHdl ) ); - const sal_Bool bReduceImageResolution = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False ); - maCbReduceImageResolution.Check( bReduceImageResolution ); - String aStrRes( String::CreateFromInt32( maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 ) ) ); - aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) ); - maCoReduceImageResolution.SetText( aStrRes ); - maCoReduceImageResolution.Enable( bReduceImageResolution ); - - maCbTaggedPDF.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False ) ); - - if ( mbIsPresentation ) - maCbExportNotes.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), sal_False ) ); - else - maCbExportNotes.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), sal_True ) ); - - maCbTransitionEffects.Check( maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True ) ); - maCbExportEmptyPages.Check( !maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False ) ); + } + catch( RuntimeException ) + { + } - sal_Int32 nFormsType = maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 ); - if ( ( nFormsType < 0 ) || ( nFormsType > 3 ) ) - nFormsType = 0; - maLbFormsFormat.SelectEntryPos( (sal_uInt16)nFormsType ); + mbUseLosslessCompression = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), sal_False ); + mnQuality = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 90 ); + mbReduceImageResolution = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), sal_False ); + mnMaxImageResolution = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), 300 ); + + mbUseTaggedPDF = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), sal_False ); + if ( mbIsPresentation ) + mbExportNotesBoth = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), sal_False ); + else + mbExportNotesBoth = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), sal_True ); + + mbUseTransitionEffects = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True ); + mbIsSkipEmptyPages = maConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False ); + + mnFormsType = maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 ); + if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) ) + mnFormsType = 0; + +//prepare values for the Viewer tab page + mbHideViewerToolbar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False ); + mbHideViewerMenubar = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), sal_False ); + mbHideViewerWindowControls = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), sal_False ); + mbResizeWinToInit = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), sal_False ); //********* + mbCenterWindow = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), sal_False ); + mbOpenInFullScreenMode = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), sal_False ); + mbDisplayPDFDocumentTitle = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), sal_False ); + mbDirectionR2L = maConfigItem.ReadBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DirectionR2L" ) ), sal_False ); + + mnInitialView = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), 0 ); //********* + mnMagnification = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), 0 ); //********* + mnPageLayout = maConfigItem.ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), 0 ); //********* + +//queue the tab pages for later creation (created when first shown) + AddTabPage( RID_PDF_TAB_VPREFER, ImpPDFTabViewerPage::Create, 0 ); + AddTabPage( RID_PDF_TAB_OPNFTR, ImpPDFTabOpnFtrPage::Create, 0 ); + +//last queued is the first to be displayed (or so it seems..) + AddTabPage( RID_PDF_TAB_GENER, ImpPDFTabGeneralPage::Create, 0 ); + +//change test on the Ok button: get the relevant string from resources, update it on the button + GetOKButton().SetText( OUString( String( ResId( STR_PDF_EXPORT, &rResMgr ) ) ) ); + +//FIXME +//very, very ugly hack: I don't know how to have the tab pages displayed correctly without this... + maFlPages.Hide(); +///////////////// } // ----------------------------------------------------------------------------- +ImpPDFTabDialog::~ImpPDFTabDialog() +{ +//delete the pages, needed because otherwise the child tab pages +//don't get destroyed + RemoveTabPage( RID_PDF_TAB_GENER ); + RemoveTabPage( RID_PDF_TAB_VPREFER ); + RemoveTabPage( RID_PDF_TAB_OPNFTR ); +} -ImpPDFDialog::~ImpPDFDialog() +// ----------------------------------------------------------------------------- +void ImpPDFTabDialog::PageCreated( USHORT _nId, + SfxTabPage& _rPage ) { + switch( _nId ) + { + case RID_PDF_TAB_GENER: + ( ( ImpPDFTabGeneralPage* )&_rPage )->SetFilterConfigItem( this ); + break; + case RID_PDF_TAB_VPREFER: + ( ( ImpPDFTabViewerPage* )&_rPage )->SetFilterConfigItem( this ); + break; + case RID_PDF_TAB_OPNFTR: + ( ( ImpPDFTabOpnFtrPage* )&_rPage )->SetFilterConfigItem( this ); + break; + } } // ----------------------------------------------------------------------------- +short ImpPDFTabDialog::Ok( ) +{ +//here the whole mechanism of the base class is not used +//when Ok is hit, the user means 'convert to PDF', so simply close with ok + return RET_OK; +} -Sequence< PropertyValue > ImpPDFDialog::GetFilterData() +// ----------------------------------------------------------------------------- +Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() { - // updating the FilterData sequence and storing FilterData to configuration - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), maRbLosslessCompression.IsChecked() ); - maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), maNfQuality.GetValue() ); - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), maCbReduceImageResolution.IsChecked() ); - maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), maCoReduceImageResolution.GetText().ToInt32() ); - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), maCbTaggedPDF.IsChecked() ); - if ( mbIsPresentation ) - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), maCbExportNotes.IsChecked() ); - else - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), maCbExportNotes.IsChecked() ); - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), maCbTransitionEffects.IsChecked() ); - maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), !maCbExportEmptyPages.IsChecked() ); +// updating the FilterData sequence and storing FilterData to configuration + if( GetTabPage( RID_PDF_TAB_GENER ) ) + ( ( ImpPDFTabGeneralPage* )GetTabPage( RID_PDF_TAB_GENER ) )->GetFilterConfigItem( this ); + +//prepare the items to be returned + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLosslessCompression" ) ), mbUseLosslessCompression ); + maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), mnQuality ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReduceImageResolution" ) ), mbReduceImageResolution ); + maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxImageResolution" ) ), mnMaxImageResolution ); + + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTaggedPDF" ) ), mbUseTaggedPDF ); + if ( mbIsPresentation ) + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ), mbExportNotesBoth ); + else + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotes" ) ), mbExportNotesBoth ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), mbUseTransitionEffects ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), mbIsSkipEmptyPages ); /* * FIXME: the entries are only implicitly defined by the resource file. Should there * ever be an additional form submit format this could get invalid. */ - maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), maLbFormsFormat.GetSelectEntryPos() ); + maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), mnFormsType ); + + if( GetTabPage( RID_PDF_TAB_VPREFER ) ) + ( ( ImpPDFTabViewerPage* )GetTabPage( RID_PDF_TAB_VPREFER ) )->GetFilterConfigItem( this ); + + if( GetTabPage( RID_PDF_TAB_OPNFTR ) ) + ( ( ImpPDFTabOpnFtrPage* )GetTabPage( RID_PDF_TAB_OPNFTR ) )->GetFilterConfigItem( this ); + + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), mbHideViewerToolbar ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), mbHideViewerMenubar ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), mbHideViewerWindowControls ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ), mbResizeWinToInit ); //********* + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), mbCenterWindow ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), mbDisplayPDFDocumentTitle ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "DirectionR2L" ) ), mbDirectionR2L ); + maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ), mbOpenInFullScreenMode ); + maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ), mnInitialView ); //********* + maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ), mnMagnification); //********* + maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ), mnPageLayout ); //********* Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() ); aRet.realloc( aRet.getLength() + 1 ); - if( maRbRange.IsChecked() ) + if( mbIsRangeChecked ) { aRet[ aRet.getLength() - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ); - aRet[ aRet.getLength() - 1 ].Value <<= OUString( maEdPages.GetText() ); + aRet[ aRet.getLength() - 1 ].Value <<= OUString( msPageRange ); } - else if( maRbSelection.IsChecked() ) + else if( mbSelectionIsChecked ) { aRet[ aRet.getLength() - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Selection" ) ); aRet[ aRet.getLength() - 1 ].Value <<= maSelection; @@ -240,27 +314,437 @@ Sequence< PropertyValue > ImpPDFDialog:: } // ----------------------------------------------------------------------------- +ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, + const SfxItemSet& rCoreSet, + ResMgr* paResMgr ) : + SfxTabPage( pParent, ResId( RID_PDF_TAB_GENER, paResMgr ), rCoreSet ), + + maFlPages( this, ResId( FL_PAGES, paResMgr ) ), + maRbAll( this, ResId( RB_ALL, paResMgr) ), + maRbRange( this, ResId( RB_RANGE, paResMgr ) ), + maRbSelection( this, ResId( RB_SELECTION, paResMgr ) ), + maEdPages( this, ResId( ED_PAGES, paResMgr ) ), + + maFlCompression( this, ResId( FL_IMAGES, paResMgr ) ), + maRbLosslessCompression( this, ResId( RB_LOSSLESSCOMPRESSION, paResMgr ) ), + maRbJPEGCompression( this, ResId( RB_JPEGCOMPRESSION, paResMgr ) ), + maFtQuality( this, ResId( FT_QUALITY, paResMgr ) ), + maNfQuality( this, ResId( NF_QUALITY, paResMgr ) ), + maCbReduceImageResolution( this, ResId( CB_REDUCEIMAGERESOLUTION, paResMgr ) ), + maCoReduceImageResolution( this, ResId( CO_REDUCEIMAGERESOLUTION, paResMgr ) ), + + maFlGeneral( this, ResId( FL_GENERAL, paResMgr ) ), + maCbTaggedPDF( this, ResId( CB_TAGGEDPDF, paResMgr ) ), + maCbExportNotes( this, ResId( CB_EXPORTNOTES, paResMgr ) ), + maCbTransitionEffects( this, ResId( CB_TRANSITIONEFFECTS, paResMgr ) ), + + maFtFormsFormat( this, ResId( FT_FORMSFORMAT, paResMgr ) ), + maLbFormsFormat( this, ResId( LB_FORMSFORMAT, paResMgr ) ), + maCbExportEmptyPages( this, ResId( CB_EXPORTEMPTYPAGES, paResMgr ) ), + mbIsPresentation( sal_False ), + + mbResetAlreadyCalled( sal_False ) +{ + mpaResMgr = paResMgr; + FreeResource(); +} + +// ----------------------------------------------------------------------------- +ImpPDFTabGeneralPage::~ImpPDFTabGeneralPage() +{ + delete mpaResMgr; +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) +{ +//init this class data + maRbRange.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, TogglePagesHdl ) ); + + maRbAll.Check(); + TogglePagesHdl( NULL ); + + maNfQuality.SetUnit( FUNIT_PERCENT ); + maNfQuality.SetMin( 1, FUNIT_PERCENT ); + maNfQuality.SetMax( 100, FUNIT_PERCENT ); + + maRbSelection.Enable( paParent->mbSelectionPresent ); + mbIsPresentation = paParent->mbIsPresentation; + mbIsWriter = paParent->mbIsWriter; + + maCbTransitionEffects.Enable( mbIsPresentation ); + maCbExportEmptyPages.Enable( mbIsWriter ); + +// SJ: Dont know if there are Notes available also for writer. +// maCbExportNotes.Enable( paParent->mbIsPresentation ); + + maRbLosslessCompression.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleCompressionHdl ) ); + const sal_Bool bUseLosslessCompression = paParent->mbUseLosslessCompression; + if ( bUseLosslessCompression ) + maRbLosslessCompression.Check(); + else + maRbJPEGCompression.Check(); + + maNfQuality.SetValue( paParent->mnQuality, FUNIT_PERCENT ); + maNfQuality.Enable( bUseLosslessCompression == sal_False ); + + maCbReduceImageResolution.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl ) ); + const sal_Bool bReduceImageResolution = paParent->mbReduceImageResolution; + maCbReduceImageResolution.Check( bReduceImageResolution ); + String aStrRes( String::CreateFromInt32( paParent->mnMaxImageResolution ) ); + aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) ); + maCoReduceImageResolution.SetText( aStrRes ); + maCoReduceImageResolution.Enable( bReduceImageResolution ); + + maCbTaggedPDF.Check( paParent->mbUseTaggedPDF ); + + if ( mbIsPresentation ) + maCbExportNotes.Check( paParent->mbExportNotesBoth ); + else + maCbExportNotes.Check( paParent->mbExportNotesBoth ); + + maCbTransitionEffects.Check( paParent->mbUseTransitionEffects ); + maCbExportEmptyPages.Check( !paParent->mbIsSkipEmptyPages ); + + maLbFormsFormat.SelectEntryPos( (sal_uInt16)paParent->mnFormsType ); +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) +{ +// updating the FilterData sequence and storing FilterData to configuration + paParent->mbUseLosslessCompression = maRbLosslessCompression.IsChecked(); + paParent->mnQuality = maNfQuality.GetValue(); + paParent->mbReduceImageResolution = maCbReduceImageResolution.IsChecked(); + paParent->mnMaxImageResolution = maCoReduceImageResolution.GetText().ToInt32(); + paParent->mbUseTaggedPDF = maCbTaggedPDF.IsChecked(); + paParent->mbExportNotesBoth = maCbExportNotes.IsChecked(); + + paParent->mbUseTransitionEffects = maCbTransitionEffects.IsChecked(); + paParent->mbIsSkipEmptyPages = !maCbExportEmptyPages.IsChecked(); + + paParent->mbIsRangeChecked = sal_False; + if( maRbRange.IsChecked() ) + { + paParent->mbIsRangeChecked = sal_True; + paParent->msPageRange = String( maEdPages.GetText() ); //FIXME all right on other languages ? + } + else if( maRbSelection.IsChecked() ) + { + paParent->mbSelectionIsChecked = maRbSelection.IsChecked(); + } + /* + * FIXME: the entries are only implicitly defined by the resource file. Should there + * ever be an additional form submit format this could get invalid. + */ + paParent->mnFormsType = (sal_Int32) maLbFormsFormat.GetSelectEntryPos(); +} + +// ----------------------------------------------------------------------------- +SfxTabPage* ImpPDFTabGeneralPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + ByteString aResMgrName( "pdffilter" ); + aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) ); + ResMgr* paResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + return ( new ImpPDFTabGeneralPage( pParent, rAttrSet, paResMgr ) ); +} -IMPL_LINK( ImpPDFDialog, TogglePagesHdl, void*, p ) +// ----------------------------------------------------------------------------- +void ImpPDFTabGeneralPage::Reset( const SfxItemSet& ignored) +{ +//set the controls to default values +//since this is called just after the data are set from the parent tab dialog +//a bool is needed to enable reset only the second time (while user presses it) + if( mbResetAlreadyCalled ) + { + maCbTransitionEffects.Enable( mbIsPresentation ); + maCbExportEmptyPages.Enable( mbIsWriter ); + maRbAll.Check(); + TogglePagesHdl( NULL ); + maRbLosslessCompression.Check( FALSE ); + maRbJPEGCompression.Check(); + maNfQuality.SetValue( 90 , FUNIT_PERCENT ); + maNfQuality.Enable(); + maCbReduceImageResolution.Check( FALSE ); + maCbTaggedPDF.Check( FALSE ); + if ( mbIsPresentation ) + maCbExportNotes.Check( FALSE ); + else + maCbExportNotes.Check(); + maCbTransitionEffects.Check(); + maCbExportEmptyPages.Check(); + + maLbFormsFormat.SelectEntryPos( 0 ); + } + mbResetAlreadyCalled = sal_True; +} + +// ----------------------------------------------------------------------------- +IMPL_LINK( ImpPDFTabGeneralPage, TogglePagesHdl, void*, p ) { maEdPages.Enable( maRbRange.IsChecked() ); maEdPages.SetReadOnly( !maRbRange.IsChecked() ); - return 0; } // ----------------------------------------------------------------------------- - -IMPL_LINK( ImpPDFDialog, ToggleCompressionHdl, void*, p ) +IMPL_LINK( ImpPDFTabGeneralPage, ToggleCompressionHdl, void*, p ) { maNfQuality.Enable( maRbJPEGCompression.IsChecked() ); return 0; } // ----------------------------------------------------------------------------- - -IMPL_LINK( ImpPDFDialog, ToggleReduceImageResolutionHdl, void*, p ) +IMPL_LINK( ImpPDFTabGeneralPage, ToggleReduceImageResolutionHdl, void*, p ) { maCoReduceImageResolution.Enable( maCbReduceImageResolution.IsChecked() ); return 0; } + +///////////////////////////////////////////////////////////////// +// the option features tab page +// ----------------------------------------------------------------------------- +ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage( Window* pParent, + const SfxItemSet& rCoreSet, + ResMgr* paResMgr ) : + SfxTabPage( pParent, ResId( RID_PDF_TAB_OPNFTR, paResMgr ), rCoreSet ), + + maFlInitialView( this, ResId( FL_INITVIEW, paResMgr ) ), + maRbOpnPageOnly( this, ResId( RB_OPNMODE_PAGEONLY, paResMgr ) ), + maRbOpnOutline( this, ResId( RB_OPNMODE_OUTLINE, paResMgr ) ), + maRbOpnThumbs( this, ResId( RB_OPNMODE_THUMBS, paResMgr ) ), + + maFlMagnification( this, ResId( FL_MAGNIFICATION, paResMgr ) ), + maRbMagnDefault( this, ResId( RB_MAGNF_DEFAULT, paResMgr ) ), + maRbMagnFitWin( this, ResId( RB_MAGNF_WIND, paResMgr ) ), + maRbMagnFitWidth( this, ResId( RB_MAGNF_WIDTH, paResMgr ) ), + maRbMagnFitVisible( this, ResId( RB_MAGNF_VISIBLE, paResMgr ) ), + + maFlPageLayout( this, ResId( FL_PAGE_LAYOUT, paResMgr ) ), + maRbPgLyDefault( this, ResId( RB_PGLY_DEFAULT, paResMgr ) ), + maRbPgLySinglePage( this, ResId( RB_PGLY_SINGPG, paResMgr ) ), + maRbPgLyContinue( this, ResId( RB_PGLY_CONT, paResMgr ) ), + maRbPgLyContinueFacing( this, ResId( RB_PGLY_CONTFAC, paResMgr ) ), + + mbResetAlreadyCalled( sal_False ) +{ + mpaResMgr = paResMgr; + FreeResource(); +} + +// ----------------------------------------------------------------------------- +ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage() +{ + delete mpaResMgr; +} + +// ----------------------------------------------------------------------------- +SfxTabPage* ImpPDFTabOpnFtrPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + ByteString aResMgrName( "pdffilter" ); + aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) ); + ResMgr* paResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + return ( new ImpPDFTabOpnFtrPage( pParent, rAttrSet, paResMgr ) ); +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabOpnFtrPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) +{ + paParent->mnInitialView = 0; + if( maRbOpnOutline.IsChecked() ) + paParent->mnInitialView = 1; + else if( maRbOpnThumbs.IsChecked() ) + paParent->mnInitialView = 2; + + paParent->mnMagnification = 0; + if( maRbMagnFitWin.IsChecked() ) + paParent->mnMagnification = 1; + else if( maRbMagnFitWidth.IsChecked() ) + paParent->mnMagnification = 2; + else if( maRbMagnFitVisible.IsChecked() ) + paParent->mnMagnification = 3; + + paParent->mnPageLayout = 0; + if( maRbPgLySinglePage.IsChecked() ) + paParent->mnPageLayout = 1; + else if( maRbPgLyContinue.IsChecked() ) + paParent->mnPageLayout = 2; + else if( maRbPgLyContinueFacing.IsChecked() ) + paParent->mnPageLayout = 3; + +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabOpnFtrPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) +{ + switch( paParent->mnPageLayout ) + { + default: + case 0: + maRbPgLyDefault.Check(); + break; + case 1: + maRbPgLySinglePage.Check(); + break; + case 2: + maRbPgLyContinue.Check(); + break; + case 3: + maRbPgLyContinueFacing.Check(); + break; + }; + + switch( paParent->mnInitialView ) + { + default: + case 0: + maRbOpnPageOnly.Check(); + break; + case 1: + maRbOpnOutline.Check(); + break; + case 2: + maRbOpnThumbs.Check(); + break; + }; + + switch( paParent->mnMagnification ) + { + default: + case 0: + maRbMagnDefault.Check(); + break; + case 1: + maRbMagnFitWin.Check(); + break; + case 2: + maRbMagnFitWidth.Check(); + break; + case 3: + maRbMagnFitVisible.Check(); + break; + }; +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabOpnFtrPage::Reset( const SfxItemSet& ignored) +{ +//set the controls to default values +//since this is called just after the data are set from the parent tab dialog +//a bool is needed to enable reset only the second time (user pressing it) + if( mbResetAlreadyCalled ) + { + maRbOpnPageOnly.Check(); + maRbOpnOutline.Check(FALSE); + maRbOpnThumbs.Check(FALSE); + + maRbMagnDefault.Check(); + maRbMagnFitWin.Check(FALSE); + maRbMagnFitWidth.Check(FALSE); + maRbMagnFitVisible.Check(FALSE); + + maRbPgLyDefault.Check(); + maRbPgLySinglePage.Check( FALSE ); + maRbPgLyContinue.Check( FALSE ); + maRbPgLyContinueFacing.Check( FALSE ); + } + mbResetAlreadyCalled = sal_True; +} + +//////////////////////////////////////////////////////// +// The Viewer preferences tab page +// ----------------------------------------------------------------------------- +ImpPDFTabViewerPage::ImpPDFTabViewerPage( Window* pParent, + const SfxItemSet& rCoreSet, + ResMgr* paResMgr ) : + SfxTabPage( pParent, ResId( RID_PDF_TAB_VPREFER, paResMgr ), rCoreSet ), + + maFlWindowOptions( this, ResId( FL_WINOPT, paResMgr ) ), + maCbResWinInit( this, ResId( CB_WNDOPT_RESINIT, paResMgr ) ), + maCbCenterWindow( this, ResId( CB_WNDOPT_CNTRWIN, paResMgr ) ), + maCbOpenFullScreen( this, ResId( CB_WNDOPT_OPNFULL, paResMgr ) ), + maCbDispDocTitle( this, ResId( CB_DISPDOCTITLE, paResMgr ) ), + + maFlUIOptions( this, ResId( FL_USRIFOPT, paResMgr ) ), + maCbHideViewerMenubar( this, ResId( CB_UOP_HIDEVMENUBAR, paResMgr ) ), + maCbHideViewerToolbar( this, ResId( CB_UOP_HIDEVTOOLBAR, paResMgr ) ), + maCbHideViewerWindowControls( this, ResId( CB_UOP_HIDEVWINCTRL, paResMgr ) ), + + maFlDirContrl( this, ResId( FL_DIRCONTR, paResMgr ) ), + maRbL2R( this, ResId( RB_LEFTRIGHT, paResMgr ) ), + maRbR2L( this, ResId( RB_RIGHTLEFT, paResMgr ) ), + + mbResetAlreadyCalled( sal_False ) +{ + mpaResMgr = paResMgr; + FreeResource(); +} + +// ----------------------------------------------------------------------------- +ImpPDFTabViewerPage::~ImpPDFTabViewerPage() +{ + delete mpaResMgr; +} + +// ----------------------------------------------------------------------------- +SfxTabPage* ImpPDFTabViewerPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + ByteString aResMgrName( "pdffilter" ); + aResMgrName.Append( ByteString::CreateFromInt32( SOLARUPD ) ); + ResMgr* paResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + return ( new ImpPDFTabViewerPage( pParent, rAttrSet, paResMgr ) ); +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabViewerPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) +{ + paParent->mbHideViewerMenubar = maCbHideViewerMenubar.IsChecked(); + paParent->mbHideViewerToolbar = maCbHideViewerToolbar.IsChecked( ); + paParent->mbHideViewerWindowControls = maCbHideViewerWindowControls.IsChecked(); + paParent->mbResizeWinToInit = maCbResWinInit.IsChecked(); + paParent->mbOpenInFullScreenMode = maCbOpenFullScreen.IsChecked(); + paParent->mbCenterWindow = maCbCenterWindow.IsChecked(); + paParent->mbDisplayPDFDocumentTitle = maCbDispDocTitle.IsChecked(); + paParent->mbDirectionR2L = maRbR2L.IsChecked(); +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) +{ + maCbHideViewerMenubar.Check( paParent->mbHideViewerMenubar ); + maCbHideViewerToolbar.Check( paParent->mbHideViewerToolbar ); + maCbHideViewerWindowControls.Check( paParent->mbHideViewerWindowControls ); + + maCbResWinInit.Check( paParent->mbResizeWinToInit ); + maCbOpenFullScreen.Check( paParent->mbOpenInFullScreenMode ); + maCbCenterWindow.Check( paParent->mbCenterWindow ); + maCbDispDocTitle.Check( paParent->mbDisplayPDFDocumentTitle ); + + maRbR2L.Check( paParent->mbDirectionR2L ); + maRbL2R.Check( !paParent->mbDirectionR2L ); +} + +// ----------------------------------------------------------------------------- +void ImpPDFTabViewerPage::Reset( const SfxItemSet& ignored ) +{ +//set the controls to default values +// since this is called just after the data are set from the parent tab dialog +// a bool is needed to enable reset only the second time (user pressing it) + if( mbResetAlreadyCalled ) + { + maRbL2R.Check(); + maRbR2L.Check(FALSE); + + maCbHideViewerMenubar.Check( FALSE ); + maCbHideViewerToolbar.Check( FALSE ); + maCbHideViewerWindowControls.Check( FALSE ); + maCbResWinInit.Check( FALSE ); + maCbOpenFullScreen.Check( FALSE ); + maCbCenterWindow.Check( FALSE ); + maCbDispDocTitle.Check(); + } + mbResetAlreadyCalled = sal_True; +} Index: filter/source/pdf/impdialog.hrc =================================================================== RCS file: /cvs/framework/filter/source/pdf/impdialog.hrc,v retrieving revision 1.8 diff -u -p -u -r1.8 impdialog.hrc --- filter/source/pdf/impdialog.hrc 21 Dec 2005 15:00:58 -0000 1.8 +++ filter/source/pdf/impdialog.hrc 8 Mar 2006 21:58:15 -0000 @@ -35,6 +35,15 @@ #include +#define RID_PDF_EXPORT_DLG (RID_PDF_DIALOG_START + 0) +#define RID_PDF_TAB_GENER (RID_PDF_DIALOG_START + 1) +#define RID_PDF_TAB_VPREFER (RID_PDF_DIALOG_START + 2) +#define RID_PDF_TAB_OPNFTR (RID_PDF_DIALOG_START + 3) +#define STR_PDF_EXPORT (RID_PDF_DIALOG_START + 4) + +//ATTENTION: maximum above is( RID_PDF_DIALOG_START + 9) + +//controls for General tab page #define FL_PAGES 1 #define RB_ALL 2 #define RB_RANGE 3 @@ -70,3 +79,37 @@ #define RB_OLD_SCREEN 60 #define RB_OLD_PRINT 61 #define RB_OLD_PRESS 62 + +//controls for open options tab page +#define FL_INITVIEW 80 +#define RB_OPNMODE_PAGEONLY 81 +#define RB_OPNMODE_OUTLINE 82 +#define RB_OPNMODE_THUMBS 83 + +#define FL_MAGNIFICATION 84 +#define RB_MAGNF_DEFAULT 85 +#define RB_MAGNF_WIND 86 +#define RB_MAGNF_WIDTH 87 +#define RB_MAGNF_VISIBLE 88 + +#define FL_PAGE_LAYOUT 89 +#define RB_PGLY_DEFAULT 90 +#define RB_PGLY_SINGPG 91 +#define RB_PGLY_CONT 92 +#define RB_PGLY_CONTFAC 93 + +//controls for viewer preferences tab page +#define FL_WINOPT 100 +#define CB_WNDOPT_RESINIT 101 +#define CB_WNDOPT_CNTRWIN 102 +#define CB_WNDOPT_OPNFULL 103 +#define CB_DISPDOCTITLE 104 + +#define FL_USRIFOPT 105 +#define CB_UOP_HIDEVMENUBAR 106 +#define CB_UOP_HIDEVTOOLBAR 107 +#define CB_UOP_HIDEVWINCTRL 108 + +#define FL_DIRCONTR 109 +#define RB_LEFTRIGHT 110 +#define RB_RIGHTLEFT 111 Index: filter/source/pdf/impdialog.hxx =================================================================== RCS file: /cvs/framework/filter/source/pdf/impdialog.hxx,v retrieving revision 1.12 diff -u -p -u -r1.12 impdialog.hxx --- filter/source/pdf/impdialog.hxx 21 Dec 2005 15:01:13 -0000 1.12 +++ filter/source/pdf/impdialog.hxx 8 Mar 2006 21:58:15 -0000 @@ -44,59 +44,217 @@ #include #include #include + +#ifndef _GROUP_HXX +#include +#endif #include +#ifndef _SFXTABDLG_HXX +#include +#endif + // ---------------- // - ImpPDFDialog - // ---------------- class ResMgr; - -class ImpPDFDialog : public ModalDialog +class ImpPDFTabGeneralPage; +class ImpPDFTabViewerPage; +class ImpPDFTabOpnFtrPage; + +//////////////////////////////////////////////////////////////////////// +//class tabbed dialog +class ImpPDFTabDialog : public SfxTabDialog { private: - FixedLine maFlPages; - RadioButton maRbAll; - RadioButton maRbRange; - RadioButton maRbSelection; - Edit maEdPages; - FixedLine maFlCompression; - RadioButton maRbLosslessCompression; - RadioButton maRbJPEGCompression; - FixedText maFtQuality; - MetricField maNfQuality; - CheckBox maCbReduceImageResolution; - ComboBox maCoReduceImageResolution; - FixedLine maFlGeneral; - CheckBox maCbTaggedPDF; - CheckBox maCbExportNotes; - CheckBox maCbTransitionEffects; - FixedText maFtFormsFormat; - ListBox maLbFormsFormat; - CheckBox maCbExportEmptyPages; - - OKButton maBtnOK; - CancelButton maBtnCancel; - HelpButton maBtnHelp; - - FilterConfigItem maConfigItem; - Any maSelection; - sal_Bool mbIsPresentation; - sal_Bool mbIsWriter; - - DECL_LINK( TogglePagesHdl, void* ); - DECL_LINK( ToggleCompressionHdl, void* ); - DECL_LINK( ToggleReduceImageResolutionHdl, void* ); + FixedLine maFlPages; //ugly hack: It seems the dialog is not resizable in any way + + FilterConfigItem maConfigItem; + + Any maSelection; + +protected: + + ResMgr* mprResMgr; +//the following data are the configuration used throughout the dialog and pages + sal_Bool mbIsPresentation; + sal_Bool mbIsWriter; + sal_Bool mbSelectionPresent; + sal_Bool mbUseLosslessCompression; + sal_Int32 mnQuality; + sal_Bool mbReduceImageResolution; + sal_Int32 mnMaxImageResolution; + sal_Bool mbUseTaggedPDF; + sal_Bool mbExportNotesBoth; + sal_Bool mbUseTransitionEffects; + sal_Bool mbIsSkipEmptyPages; + sal_Int32 mnFormsType; + + sal_Bool mbHideViewerToolbar; + sal_Bool mbHideViewerMenubar; + sal_Bool mbHideViewerWindowControls; + sal_Bool mbResizeWinToInit; + sal_Bool mbCenterWindow; + sal_Bool mbOpenInFullScreenMode; + sal_Bool mbDisplayPDFDocumentTitle; + sal_Bool mbDirectionR2L; + sal_Int32 mnMagnification; + sal_Int32 mnInitialView; + + sal_Int32 mnPageLayout; + + sal_Bool mbIsRangeChecked; + String msPageRange; + sal_Bool mbSelectionIsChecked; + + +public: + + friend class ImpPDFTabGeneralPage; + friend class ImpPDFTabViewerPage; + friend class ImpPDFTabOpnFtrPage; + + ImpPDFTabDialog( Window* pParent, ResMgr& rResMgr, + Sequence< PropertyValue >& rFilterData, + const Reference< XComponent >& rDoc ); + ~ImpPDFTabDialog(); + + Sequence< PropertyValue > GetFilterData(); + +protected: + virtual void PageCreated( USHORT _nId, + SfxTabPage& _rPage ); + virtual short Ok(); +}; + +//class tab page general +class ImpPDFTabGeneralPage : public SfxTabPage +{ + FixedLine maFlPages; + RadioButton maRbAll; + RadioButton maRbRange; + RadioButton maRbSelection; + Edit maEdPages; + + FixedLine maFlCompression; + RadioButton maRbLosslessCompression; + RadioButton maRbJPEGCompression; + FixedText maFtQuality; + MetricField maNfQuality; + CheckBox maCbReduceImageResolution; + ComboBox maCoReduceImageResolution; + + FixedLine maFlGeneral; + CheckBox maCbTaggedPDF; + CheckBox maCbExportNotes; + CheckBox maCbTransitionEffects; + + FixedText maFtFormsFormat; + ListBox maLbFormsFormat; + CheckBox maCbExportEmptyPages; + + sal_Bool mbIsPresentation; + sal_Bool mbIsWriter; + + sal_Bool mbResetAlreadyCalled; + + ResMgr* mpaResMgr; + + DECL_LINK( TogglePagesHdl, void* ); + DECL_LINK( ToggleCompressionHdl, void* ); + DECL_LINK( ToggleReduceImageResolutionHdl, void* ); public: + ImpPDFTabGeneralPage( Window* pParent, + const SfxItemSet& rSet, + ResMgr* paResMgr ); + + ~ImpPDFTabGeneralPage(); + static SfxTabPage* Create( Window* pParent, + const SfxItemSet& rAttrSet); + + void GetFilterConfigItem( ImpPDFTabDialog* paParent ); + void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); +//this will set the default + virtual void Reset( const SfxItemSet& ignored); +}; + +//class tab page viewer +class ImpPDFTabOpnFtrPage : public SfxTabPage +{ + FixedLine maFlInitialView; + RadioButton maRbOpnPageOnly; + RadioButton maRbOpnOutline; + RadioButton maRbOpnThumbs; + + FixedLine maFlMagnification; + RadioButton maRbMagnDefault; + RadioButton maRbMagnFitWin; + RadioButton maRbMagnFitWidth; + RadioButton maRbMagnFitVisible; + + FixedLine maFlPageLayout; + RadioButton maRbPgLyDefault; + RadioButton maRbPgLySinglePage; + RadioButton maRbPgLyContinue; + RadioButton maRbPgLyContinueFacing; - ImpPDFDialog( Window* pParent, ResMgr& rResMgr, - Sequence< PropertyValue >& rFilterData, - const Reference< XComponent >& rDoc ); - ~ImpPDFDialog(); + sal_Bool mbResetAlreadyCalled; - Sequence< PropertyValue > GetFilterData(); + ResMgr* mpaResMgr; + +public: + ImpPDFTabOpnFtrPage( Window* pParent, + const SfxItemSet& rSet, + ResMgr* paResMgr ); + + ~ImpPDFTabOpnFtrPage(); + static SfxTabPage* Create( Window* pParent, + const SfxItemSet& rAttrSet ); + + void GetFilterConfigItem( ImpPDFTabDialog* paParent); + void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); +//this will set the default + virtual void Reset( const SfxItemSet& ignored); +}; + +//class tab page viewer +class ImpPDFTabViewerPage : public SfxTabPage +{ + FixedLine maFlWindowOptions; + CheckBox maCbResWinInit; + CheckBox maCbCenterWindow; + CheckBox maCbOpenFullScreen; + CheckBox maCbDispDocTitle; + + FixedLine maFlUIOptions; + CheckBox maCbHideViewerMenubar; + CheckBox maCbHideViewerToolbar; + CheckBox maCbHideViewerWindowControls; + + FixedLine maFlDirContrl; + RadioButton maRbL2R; + RadioButton maRbR2L; + + sal_Bool mbResetAlreadyCalled; + + ResMgr* mpaResMgr; + +public: + ImpPDFTabViewerPage( Window* pParent, + const SfxItemSet& rSet, + ResMgr* paResMgr ); + + ~ImpPDFTabViewerPage(); + static SfxTabPage* Create( Window* pParent, + const SfxItemSet& rAttrSet ); + + void GetFilterConfigItem( ImpPDFTabDialog* paParent); + void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); +//this will set the default + virtual void Reset( const SfxItemSet& ignored); }; #endif // IMPDIALOG_HXX Index: filter/source/pdf/impdialog.src =================================================================== RCS file: /cvs/framework/filter/source/pdf/impdialog.src,v retrieving revision 1.26 diff -u -p -u -r1.26 impdialog.src --- filter/source/pdf/impdialog.src 21 Dec 2005 15:01:24 -0000 1.26 +++ filter/source/pdf/impdialog.src 8 Mar 2006 21:58:15 -0000 @@ -39,15 +39,24 @@ Text [ de ] = "PDF Optionen"; \ Text [ en-US ] = "PDF Options"; \ -ModalDialog RID_PDF_EXPORT_DLG +#define TAB_PDF_SIZE Size = MAP_APPFONT ( 176, 200 ) +//string for TabDialog standard buttons +String STR_PDF_EXPORT { - OutputSize = TRUE ; - SVLook = TRUE ; - HelpId = HID_FILTER_PDF_OPTIONS; - Size = MAP_APPFONT ( 230, 207 ); - Moveable = TRUE ; - Closeable = TRUE ; - WORKARROUND + Text[ de ] = "E~xportieren" ; + Text[ en-US ] = "E~xport"; +}; + +////////////////////////////////////////////////////////////// +//tab page for PDF Export, general preferences +TabPage RID_PDF_TAB_GENER +{ + HelpId = HID_FILTER_PDF_OPTIONS ; + Hide = TRUE ; + Text[ de ] = "Allgemein"; + Text[ en-US ] = "General"; + TAB_PDF_SIZE; + FixedLine FL_PAGES { Pos = MAP_APPFONT ( 6 , 3 ) ; @@ -206,27 +215,267 @@ ModalDialog RID_PDF_EXPORT_DLG Text[ de ] = "Automatisch eingefügte ~Leerseiten exportieren" ; Text[ en-US ] = "Export automatically inserted ~blank pages"; }; - OKButton BT_OK - { - Pos = MAP_APPFONT( 174, 6 ); - Size = MAP_APPFONT( 50 , 14 ); - TabStop = TRUE ; - DefButton = TRUE ; - Text[ de ] = "E~xportieren" ; - Text[ en-US ] = "E~xport"; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT( 174, 23 ); - Size = MAP_APPFONT( 50 , 14 ); - TabStop = TRUE ; - DefButton = TRUE ; - }; - HelpButton BT_HELP - { - Pos = MAP_APPFONT( 174, 43 ); - Size = MAP_APPFONT( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; +}; + +//---------------------------------------------------------- +//tab page for PDF Export, opening features +TabPage RID_PDF_TAB_OPNFTR +{ + HelpId = 0 ; + Text[ de ] = "Document Open Options" ; + Text[ en-US ] = "Document Open Options" ; + TAB_PDF_SIZE; + +//////////////////////////////////////// + FixedLine FL_INITVIEW + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text[ de ] = "Initial view" ; + Text[ en-US ] = "Initial view" ; + }; + RadioButton RB_OPNMODE_PAGEONLY + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Page only" ; + Text[ en-US ] = "Page only" ; + }; + RadioButton RB_OPNMODE_OUTLINE + { + Pos = MAP_APPFONT ( 12 , 26 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Bookmarks and page" ; + Text[ en-US ] = "Bookmarks and page" ; + }; + RadioButton RB_OPNMODE_THUMBS + { + Pos = MAP_APPFONT ( 12 , 38 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "~Thumbnails and page" ; + Text[ en-US ] = "~Thumbnails and page" ; + }; + +/////////////////////////////////////////////////// + FixedLine FL_MAGNIFICATION + { + Pos = MAP_APPFONT ( 6 , 52 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text[ de ] = "Magnification" ; + Text[ en-US ] = "Magnification" ; + }; + RadioButton RB_MAGNF_DEFAULT + { + // see PDF ref v 1.5 tab 8.2, pg. 542 ( /XYZ ) + Pos = MAP_APPFONT ( 12 , 64 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "~Default" ; + Text[ en-US ] = "Default" ; + }; + RadioButton RB_MAGNF_WIND + { + // see PDF ref v 1.5 tab 8.2, pg. 542 ( /Fit ) + Pos = MAP_APPFONT ( 12 , 76 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Fit in window" ; + Text[ en-US ] = "Fit in window" ; + }; + RadioButton RB_MAGNF_WIDTH + { + // see PDF ref v 1.5 tab 8.2, pg. 542 ( /FitH top ) + Pos = MAP_APPFONT ( 12 , 88 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Fit ~width" ; + Text[ en-US ] = "Fit ~width" ; + }; + RadioButton RB_MAGNF_VISIBLE + { + // see PDF ref v 1.5 tab 8.2, pg. 542 ( /FitBH top ) + Pos = MAP_APPFONT ( 12 , 100 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "First ~visible" ; + Text[ en-US ] = "Fit ~visible" ; + Text [ x-comment ] = " "; + }; + +//////////////////////////////////////// + FixedLine FL_PAGE_LAYOUT + { + Pos = MAP_APPFONT ( 6 , 114 ) ; + Size = MAP_APPFONT (162 , 8 ) ; + Text[ de ] = "Page layout" ; + Text[ en-US ] = "Page layout" ; + }; + RadioButton RB_PGLY_DEFAULT + { + Pos = MAP_APPFONT ( 12 , 126 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Default" ; + Text[ en-US ] = "Default" ; + }; + RadioButton RB_PGLY_SINGPG + { + Pos = MAP_APPFONT ( 12 , 138 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Single page" ; + Text[ en-US ] = "Single page" ; + }; + RadioButton RB_PGLY_CONT + { + Pos = MAP_APPFONT ( 12 , 150 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Continuous" ; + Text[ en-US ] = "Continuous" ; + }; + + RadioButton RB_PGLY_CONTFAC + { + Pos = MAP_APPFONT ( 12 , 162 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Continuous facing" ; + Text[ en-US ] = "Continuous facing" ; + }; +}; + +//---------------------------------------------------------- +//tab page for PDF Export, viewer preferences +TabPage RID_PDF_TAB_VPREFER +{ + HelpId = 0 ; + Text[ de ] = "Viewer Options" ; + Text[ en-US ] = "Viewer Options" ; + TAB_PDF_SIZE; + +////////////////////////////////////// + FixedLine FL_WINOPT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT (162 , 8 ) ; + Text[ de ] = "Window Options" ; + Text[ en-US ] = "Window Options" ; + }; + + CheckBox CB_WNDOPT_RESINIT + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + TabStop = TRUE ; + Text[ de ] = "~Resize window to initial page" ; + Text[ en-US ] = "~Resize window to initial page"; + }; + CheckBox CB_WNDOPT_CNTRWIN //was CB_CENTWINDOW + { + Pos = MAP_APPFONT ( 12 , 26 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + TabStop = TRUE ; + Text[ de ] = "~Center window on screen" ; + Text[ en-US ] = "~Center window on screen"; + }; + CheckBox CB_WNDOPT_OPNFULL // was RB_OPNMODE_FULL + { + Pos = MAP_APPFONT ( 12 , 38 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Open in full ~screen mode" ; + Text[ en-US ] = "Open in full ~screen mode" ; + }; + CheckBox CB_DISPDOCTITLE + { + Pos = MAP_APPFONT ( 12 , 50 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + TabStop = TRUE ; + Text[ de ] = "Display document ~title" ; + Text[ en-US ] = "Display document ~title"; + }; + +//////////////////////////////// + FixedLine FL_USRIFOPT + { + Pos = MAP_APPFONT ( 6 , 64 ) ; + Size = MAP_APPFONT (162 , 8 ) ; + Text[ de ] = "User interface options" ; + Text[ en-US ] = "User interface options" ; + }; + CheckBox CB_UOP_HIDEVMENUBAR + { + Pos = MAP_APPFONT ( 12 , 76 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + TabStop = TRUE ; + Text[ de ] = "Hide ~menubar" ; + Text[ en-US ] = "Hide ~menubar"; + }; + CheckBox CB_UOP_HIDEVTOOLBAR + { + Pos = MAP_APPFONT ( 12 , 88 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + TabStop = TRUE ; + Text[ de ] = "Hide tool bar" ; + Text[ en-US ] = "Hide ~toolbar"; + }; + CheckBox CB_UOP_HIDEVWINCTRL + { + Pos = MAP_APPFONT ( 12 , 100 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + TabStop = TRUE ; + Text[ de ] = "Hide window ~controls" ; + Text[ en-US ] = "Hide ~window controls"; + }; + +/////////////////////////// + FixedLine FL_DIRCONTR + { + Pos = MAP_APPFONT ( 6 , 114 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + Text[ de ] = "Main reading order for text" ; + Text[ en-US ] = "Main reading order for text" ; + }; + RadioButton RB_LEFTRIGHT + { + Pos = MAP_APPFONT ( 12 , 126 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Left to ~right" ; + Text[ en-US ] = "Left to ~right" ; + }; + RadioButton RB_RIGHTLEFT + { + Pos = MAP_APPFONT ( 12 , 138 ) ; + Size = MAP_APPFONT ( 155 , 10 ) ; + Text[ de ] = "Right to ~left" ; + Text[ en-US ] = "Right to ~left" ; + }; +}; + +//---------------------------------------------------------- +TabDialog RID_PDF_EXPORT_DLG +{ + HelpId = HID_FILTER_PDF_OPTIONS ; + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + WORKARROUND + TabControl 1 + { + HelpId = HID_FILTER_PDF_OPTIONS ; + OutputSize = TRUE; + PageList = + { + PageItem + { + Identifier = RID_PDF_TAB_GENER; + Text [ de ] = "Allgemein"; + Text [ en-US ] = "General"; + }; + PageItem + { + Identifier = RID_PDF_TAB_OPNFTR; + Text [ de ] = "Document Open Options"; + Text [ en-US ] = "Document Open Options"; + }; + PageItem + { + Identifier = RID_PDF_TAB_VPREFER; + Text [ de ] = "Viewer Options"; + Text [ en-US ] = "Viewer Options"; + }; + }; + }; }; Index: filter/source/pdf/makefile.mk =================================================================== RCS file: /cvs/framework/filter/source/pdf/makefile.mk,v retrieving revision 1.11 diff -u -p -u -r1.11 makefile.mk --- filter/source/pdf/makefile.mk 8 Sep 2005 21:48:41 -0000 1.11 +++ filter/source/pdf/makefile.mk 8 Mar 2006 21:58:15 -0000 @@ -68,6 +68,7 @@ SHL1STDLIBS=\ $(TKLIB) \ $(VCLLIB) \ $(SVLLIB) \ + $(SFX2LIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(COMPHELPERLIB) \ Index: filter/source/pdf/pdfdialog.cxx =================================================================== RCS file: /cvs/framework/filter/source/pdf/pdfdialog.cxx,v retrieving revision 1.8 diff -u -p -u -r1.8 pdfdialog.cxx --- filter/source/pdf/pdfdialog.cxx 8 Sep 2005 21:49:22 -0000 1.8 +++ filter/source/pdf/pdfdialog.cxx 8 Mar 2006 21:58:15 -0000 @@ -50,6 +50,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; +//uncomment this to use the Tabbed PDF dialog (under development !) + // ----------------------- // - PDFDialog functions - // ----------------------- @@ -179,7 +181,7 @@ Dialog* PDFDialog::createDialog( Window* if( mpResMgr && mxSrcDoc.is() ) { - ImpPDFDialog* pDlg = new ImpPDFDialog( pParent, *mpResMgr, maFilterData, mxSrcDoc ); + ImpPDFTabDialog* pDlg = new ImpPDFTabDialog( pParent, *mpResMgr, maFilterData, mxSrcDoc ); pRet = pDlg; } @@ -191,8 +193,7 @@ Dialog* PDFDialog::createDialog( Window* void PDFDialog::executedDialog( sal_Int16 nExecutionResult ) { if( nExecutionResult && m_pDialog ) - maFilterData = static_cast< ImpPDFDialog* >( m_pDialog )->GetFilterData(); - + maFilterData = static_cast< ImpPDFTabDialog* >( m_pDialog )->GetFilterData(); destroyDialog(); } Index: filter/source/pdf/pdfexport.cxx =================================================================== RCS file: /cvs/framework/filter/source/pdf/pdfexport.cxx,v retrieving revision 1.44 diff -u -p -u -r1.44 pdfexport.cxx --- filter/source/pdf/pdfexport.cxx 1 Nov 2005 10:20:43 -0000 1.44 +++ filter/source/pdf/pdfexport.cxx 8 Mar 2006 21:58:16 -0000 @@ -281,6 +281,9 @@ sal_Bool PDFExport::Export( const OUStri aCreator.AppendAscii( "Math" ); } + PDFWriter::PDFWriterContext aContext; + sal_Int32 nPDFDocumentMode = 0, nPDFDocumentAction = 0, nPDFPageLayout = 0; + for( sal_Int32 nData = 0, nDataCount = rFilterData.getLength(); nData < nDataCount; ++nData ) { if( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) @@ -307,11 +310,80 @@ sal_Bool PDFExport::Export( const OUStri rFilterData[ nData ].Value >>= mbUseTransitionEffects; else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ) ) rFilterData[ nData ].Value >>= mnFormsFormat; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ) ) + rFilterData[ nData ].Value >>= aContext.HideViewerToolbar; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ) ) + rFilterData[ nData ].Value >>= aContext.HideViewerMenubar; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ) ) + rFilterData[ nData ].Value >>= aContext.HideViewerWindowControls; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ResizeWindowToInitialPage" ) ) ) + rFilterData[ nData ].Value >>= aContext.FitWindow; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ) ) + rFilterData[ nData ].Value >>= aContext.CenterWindow; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenInFullScreenMode" ) ) ) + rFilterData[ nData ].Value >>= aContext.OpenInFullScreenMode; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ) ) + rFilterData[ nData ].Value >>= aContext.DisplayPDFDocumentTitle; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "DirectionR2L" ) ) ) + rFilterData[ nData ].Value >>= aContext.DirectionR2L; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialView" ) ) ) + rFilterData[ nData ].Value >>= nPDFDocumentMode; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "Magnification" ) ) ) + rFilterData[ nData ].Value >>= nPDFDocumentAction; + else if ( rFilterData[ nData ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "PageLayout" ) ) ) + rFilterData[ nData ].Value >>= nPDFPageLayout; } - PDFWriter::PDFWriterContext aContext; aContext.URL = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); aContext.Version = PDFWriter::PDF_1_4; aContext.Tagged = mbUseTaggedPDF; + + switch( nPDFDocumentMode ) + { + default: + case 0: + aContext.PDFDocumentMode = PDFWriter::ModeDefault; + break; + case 1: + aContext.PDFDocumentMode = PDFWriter::UseOutlines; + break; + case 2: + aContext.PDFDocumentMode = PDFWriter::UseThumbs; + break; + } + switch( nPDFDocumentAction ) + { + default: + case 0: + aContext.PDFDocumentAction = PDFWriter::ActionDefault; + break; + case 1: + aContext.PDFDocumentAction = PDFWriter::FitInWindow; + break; + case 2: + aContext.PDFDocumentAction = PDFWriter::FitWidth; + break; + case 3: + aContext.PDFDocumentAction = PDFWriter::FitVisible; + break; + } + + switch( nPDFPageLayout ) + { + default: + case 0: + aContext.PageLayout = PDFWriter::DefaultLayout; + break; + case 1: + aContext.PageLayout = PDFWriter::SinglePage; + break; + case 2: + aContext.PageLayout = PDFWriter::Continuous; + break; + case 3: + aContext.PageLayout = PDFWriter::ContinuousFacing; + break; + } + /* * FIXME: the entries are only implicitly defined by the resource file. Should there * ever be an additional form submit format this could get invalid. Index: filter/source/pdf/pdffilter.cxx =================================================================== RCS file: /cvs/framework/filter/source/pdf/pdffilter.cxx,v retrieving revision 1.7 diff -u -p -u -r1.7 pdffilter.cxx --- filter/source/pdf/pdffilter.cxx 21 Dec 2005 15:01:37 -0000 1.7 +++ filter/source/pdf/pdffilter.cxx 8 Mar 2006 21:58:16 -0000 @@ -90,6 +90,15 @@ sal_Bool PDFFilter::implExport( const Se aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "UseTransitionEffects" ) ), sal_True ); aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "IsSkipEmptyPages" ) ), sal_False ); aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FormsType" ) ), 0 ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "HideViewerToolbar" ) ), sal_False ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "HideViewerMenubar" ) ), sal_False ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "HideViewerWindowControls" ) ), sal_False ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "FitWindow" ) ), sal_False ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "CenterWindow" ) ), sal_False ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "DisplayPDFDocumentTitle" ) ), sal_False ); + aCfgItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "DirectionR2L" ) ), sal_False ); + aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "OpenPDFDocumentMode" ) ), 0 ); + aCfgItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "OpenPDFDocumentAction" ) ), 0 ); aFilterData = aCfgItem.GetFilterData(); } if( mxSrcDoc.is() && xOStm.is() ) Index: officecfg/registry/schema/org/openoffice/Office/Common.xcs =================================================================== RCS file: /cvs/util/officecfg/registry/schema/org/openoffice/Office/Common.xcs,v retrieving revision 1.112 diff -u -p -u -r1.112 Common.xcs --- officecfg/registry/schema/org/openoffice/Office/Common.xcs 5 Jan 2006 17:54:05 -0000 1.112 +++ officecfg/registry/schema/org/openoffice/Office/Common.xcs 8 Mar 2006 21:58:17 -0000 @@ -4878,6 +4878,144 @@ Dymamic border coloring means that when false + + + beppec56 + Specifies whether to hide the PDF viewer menubar when the document is active. + + false + + + + beppec56 + Specifies whether to hide the PDF viewer toolbar when the document is active. + + false + + + + beppec56 + Specifies whether to hide the PDF viewer controls when the document is active. + + false + + + + beppec56 + Specifies that the PDF viewer window is opened full screen when the document is opened. + + false + + + + beppec56 + Specifies that the PDF viewer window is centered to the screen when the PDF document is opened. + + false + + + + beppec56 + Specifies that the PDF viewer window is opened full screen, on top of all windows.. + + false + + + + beppec56 + Specifies that the title of the document, if present in the document properties, is displayed in the PDF viewer window title bar. + + true + + + + beppec56 + Specifie the + + false + + + + beppec56 + Specifies how the PDF document should be displayed when opened. + + + + + Select the default viewer mode, neither outlines or thumbnails. + + + + + The document is opened with outline pane opened + + + + + The document is opened with thumbnail pane opened + + + + 0 + + + + beppec56 + Specifies the action to be performed when the PDF document is opened. + + + + + Opens with default zoom magnification. + + + + + Opens magnified to fit the entire page within the window. + + + + + Opens magnified to fit the entire page width within the window. + + + + + Opens magnified to fit the entire width of its boundig box within the window (cuts out margins). + + + + 0 + + + + beppec56 + Specifies the page layout to be used when the document is opened. + + + + + Display the pages according to the reader configuration. + + + + + Display one page at a time. + + + + + Display the pages in one column. + + + + + Display the pages in two columns odd pages on the left, to have the odd pages on the right the DirectionR2L properties should be used as well. + + + + 0 + Index: vcl/inc/pdfwriter.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/pdfwriter.hxx,v retrieving revision 1.15 diff -u -p -u -r1.15 pdfwriter.hxx --- vcl/inc/pdfwriter.hxx 19 Oct 2005 11:48:53 -0000 1.15 +++ vcl/inc/pdfwriter.hxx 8 Mar 2006 21:58:17 -0000 @@ -419,6 +419,31 @@ public: }; enum ExportDataFormat { HTML, XML, FDF, PDF }; +// see 3.6.1 of PDF 1.4 ref for details, used for 8.1 PDF v 1.4 ref also +// These emuns are treated as integer while reading/writing to configuration + enum PDFViewerPageMode + { + ModeDefault, + UseOutlines, + UseThumbs + }; +// These emuns are treated as integer while reading/writing to configuration + enum PDFViewerAction + { + ActionDefault, + FitInWindow, + FitWidth, + FitVisible + }; +// These emuns are treated as integer while reading/writing to configuration + enum PDFPageLayout + { + DefaultLayout, + SinglePage, + Continuous, + ContinuousFacing + }; + struct PDFWriterContext { /* must be a valid file: URL usable by osl */ @@ -433,11 +458,42 @@ public: will be submitted. */ PDFWriter::ExportDataFormat SubmitFormat; + /* the following data members are used to customize the PDF viewer + preferences + */ + /* see 3.6.1 PDF v 1.4 ref*/ + PDFWriter::PDFViewerPageMode PDFDocumentMode; + PDFWriter::PDFViewerAction PDFDocumentAction; + + /* see 8.6 PDF v 1.4 ref + specifies whether to hide the viewer tool + bars when the document is active. + */ + bool HideViewerToolbar; + bool HideViewerMenubar; + bool HideViewerWindowControls; + bool FitWindow; + bool OpenInFullScreenMode; + bool CenterWindow; + bool DisplayPDFDocumentTitle; + bool DirectionR2L; + PDFPageLayout PageLayout; PDFWriterContext() : Version( PDFWriter::PDF_1_4 ), Tagged( false ), - SubmitFormat( PDFWriter::FDF ) + SubmitFormat( PDFWriter::FDF ), + PDFDocumentMode( PDFWriter::ModeDefault ), + PDFDocumentAction( PDFWriter::ActionDefault ), + HideViewerToolbar( false ), + HideViewerMenubar( false ), + HideViewerWindowControls( false ), + FitWindow( false ), + OpenInFullScreenMode( false ), + CenterWindow( false ), + DisplayPDFDocumentTitle( false ), + DirectionR2L( false ), + PageLayout( PDFWriter::DefaultLayout ) {} }; Index: vcl/source/gdi/pdfwriter_impl.cxx =================================================================== RCS file: /cvs/gsl/vcl/source/gdi/pdfwriter_impl.cxx,v retrieving revision 1.86 diff -u -p -u -r1.86 pdfwriter_impl.cxx --- vcl/source/gdi/pdfwriter_impl.cxx 25 Nov 2005 10:02:34 -0000 1.86 +++ vcl/source/gdi/pdfwriter_impl.cxx 8 Mar 2006 21:58:19 -0000 @@ -3412,11 +3412,11 @@ bool PDFWriterImpl::emitLinkAnnotations( " /Border [0 0 0]\r\n" " /Rect [" ); - appendFixedInt( rLink.m_aRect.Left(), aLine ); + appendFixedInt( rLink.m_aRect.Left()-7, aLine );//the +7 to have a better shape of the border rectangle aLine.append( ' ' ); appendFixedInt( rLink.m_aRect.Top(), aLine ); aLine.append( ' ' ); - appendFixedInt( rLink.m_aRect.Right(), aLine ); + appendFixedInt( rLink.m_aRect.Right()+7, aLine );//the +7 to have a better shape of the border rectangle aLine.append( ' ' ); appendFixedInt( rLink.m_aRect.Bottom(), aLine ); aLine.append( "]\r\n" ); @@ -4293,7 +4293,7 @@ bool PDFWriterImpl::emitCatalog() return false; // emit tree node - OStringBuffer aLine( 1024 ); + OStringBuffer aLine( 2048 ); aLine.append( nTreeNode ); aLine.append( " 0 obj\r\n" ); aLine.append( "<< /Type /Pages\r\n" ); @@ -4345,6 +4345,97 @@ bool PDFWriterImpl::emitCatalog() " /Pages " ); aLine.append( nTreeNode ); aLine.append( " 0 R\r\n" ); + + if( m_aContext.PageLayout != PDFWriter::DefaultLayout ) + switch( m_aContext.PageLayout ) + { + default : + case PDFWriter::SinglePage : + aLine.append( "/PageLayout/SinglePage\n" ); + break; + case PDFWriter::Continuous : + aLine.append( "/PageLayout/OneColumn\n" ); + break; + case PDFWriter::ContinuousFacing : +//the effect of odd page on the right ( /PageLayout/TwoColumnLeft ) can be achieved with DirectionR2L (see below) + aLine.append( "/PageLayout/TwoColumnRight\n" ); + break; + } + if( m_aContext.PDFDocumentMode != PDFWriter::ModeDefault && !m_aContext.OpenInFullScreenMode ) + switch( m_aContext.PDFDocumentMode ) + { + default : + aLine.append( "/PageMode/UseNone\n" ); + break; + case PDFWriter::UseOutlines : + aLine.append( "/PageMode/UseOutlines\n" ); //document is opened with outline pane open + break; + case PDFWriter::UseThumbs : + aLine.append( "/PageMode/UseThumbs\n" ); //document is opened with thumbnails pane open + break; + } + else if( m_aContext.OpenInFullScreenMode ) + aLine.append( "/PageMode/FullScreen\n" ); //document is opened full screen + + switch( m_aContext.PDFDocumentAction ) + { + case PDFWriter::ActionDefault : + default: + aLine.append( "/OpenAction [0 /XYZ null null null" ); //page 0 (first) open Default, leave without it + break; + case PDFWriter::FitInWindow : + aLine.append( "/OpenAction [0 /Fit" ); //Open fit page + break; + case PDFWriter::FitWidth : + aLine.append( "/OpenAction [0 /FitH " ); + aLine.append( m_nInheritedPageHeight );//Open fit width + break; + case PDFWriter::FitVisible : + aLine.append( "/OpenAction [0 /FitBH " ); + aLine.append( m_nInheritedPageHeight );//Open fit visible + break; + } + aLine.append( "]\n" ); +// viewer preferences, if we had some, then emit + if( m_aContext.HideViewerToolbar || + ( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) || + m_aContext.HideViewerMenubar || + m_aContext.HideViewerWindowControls || m_aContext.FitWindow || + m_aContext.CenterWindow || m_aContext.DirectionR2L || + m_aContext.OpenInFullScreenMode ) + { + aLine.append( "/ViewerPreferences<<" ); + if( m_aContext.HideViewerToolbar ) + aLine.append( "/HideToolbar true\n" ); + if( m_aContext.HideViewerMenubar ) + aLine.append( "/HideMenubar true\n" ); + if( m_aContext.HideViewerWindowControls ) + aLine.append( "/HideWindowUI true\n" ); + if( m_aContext.FitWindow ) + aLine.append("/FitWindow true\n"); + if( m_aContext.CenterWindow ) + aLine.append("/CenterWindow true\n"); + if( m_aContext.Version > PDFWriter::PDF_1_3 && m_aDocInfo.Title.Len() && m_aContext.DisplayPDFDocumentTitle ) + aLine.append( "/DisplayDocTitle true\n" ); + if( m_aContext.DirectionR2L ) + aLine.append("/Direction /R2L\n"); + if( m_aContext.OpenInFullScreenMode ) + switch( m_aContext.PDFDocumentMode ) + { + default : + case PDFWriter::ModeDefault : + aLine.append("/NonFullScreenPageMode/UseNone\n"); + break; + case PDFWriter::UseOutlines : + aLine.append("/NonFullScreenPageMode/UseOutlines\n"); + break; + case PDFWriter::UseThumbs : + aLine.append("/NonFullScreenPageMode/UseThumbs\n"); + break; + } + aLine.append( ">>\n" ); + } + if( nOutlineDict ) { aLine.append( " /Outlines " );