diff options
author | sb <sb@openoffice.org> | 2010-09-22 15:59:47 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-09-22 15:59:47 +0200 |
commit | cdfb2f1e99bb6905a76a65896eb1b98a37bf65d9 (patch) | |
tree | 52ca9c1b8728c4e1a173ddb8f1ae46b970abd707 /svtools/source | |
parent | ed31d7faf70a2b5f197cc7e0172244d9139c54cf (diff) | |
parent | bb5c1664ffed54f323c42d9d1d5211ba7b33f119 (diff) |
sb123: merged in DEV300_m88
Diffstat (limited to 'svtools/source')
29 files changed, 2439 insertions, 1861 deletions
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 484584828b9f..35324d551858 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -2172,14 +2172,6 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt ) SelAllDestrAnch( FALSE, TRUE ); // DeselectAll(); SetCursor( pEntry ); - DBG_ERROR( "Please report what you did to get this assertion to FS!" ); - // The entry which has been double-clicked changed - and we select it, again. - // I have situations where this behaviour does not make any sense at all - even more, it - // leads to hacks to revert it's results. - // So I'm not sure if this behaviour here is nonsense (which I believe at the moment), - // or if there are really scenarious where it dones make sense .... - // 07.12.2001 - 95727 - fs@openoffice.org - return; } if( pEntry->HasChilds() || pEntry->HasChildsOnDemand() ) diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index b11a3f12ddf3..a8635c99d127 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -2516,6 +2516,11 @@ void SvTreeListBox::DataChanged( const DataChangedEvent& rDCEvt ) Control::DataChanged( rDCEvt ); } +void SvTreeListBox::StateChanged( StateChangedType i_nStateChange ) +{ + SvLBox::StateChanged( i_nStateChange ); +} + void SvTreeListBox::InitSettings(BOOL bFont,BOOL bForeground,BOOL bBackground) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx index 8ca6ba2b124e..1c4eeeff1bbf 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx @@ -36,9 +36,7 @@ #include <osl/module.hxx> #include <svl/solar.hrc> #include <svtools/fltcall.hxx> -#include "dlgexpor.hxx" -#include "dlgejpg.hxx" -#include "dlgepng.hxx" +#include "exportdialog.hxx" #include <uno/mapping.hxx> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> @@ -49,12 +47,6 @@ #include <unotools/syslocale.hxx> #include "vcl/svapp.hxx" -#if (defined OS2 && !defined ICC) -#define EXPDLG_FUNCTION_NAME "_DoExportDialog" -#else -#define EXPDLG_FUNCTION_NAME "DoExportDialog" -#endif - using namespace ::rtl; using namespace ::com::sun::star; @@ -93,9 +85,10 @@ uno::Sequence< OUString > SAL_CALL SvFilterOptionsDialog_getSupportedServiceName // ----------------------------------------------------------------------------- -SvFilterOptionsDialog::SvFilterOptionsDialog( const uno::Reference< lang::XMultiServiceFactory > & xMgr ) : - rxMgr ( xMgr ), - eFieldUnit ( FUNIT_CM ) +SvFilterOptionsDialog::SvFilterOptionsDialog( const uno::Reference< lang::XMultiServiceFactory > xMgr ) : + mxMgr ( xMgr ), + meFieldUnit ( FUNIT_CM ), + mbExportSelection ( sal_False ) { } @@ -148,18 +141,18 @@ uno::Sequence< beans::PropertyValue > SvFilterOptionsDialog::getPropertyValues() throw ( uno::RuntimeException ) { sal_Int32 i, nCount; - for ( i = 0, nCount = aMediaDescriptor.getLength(); i < nCount; i++ ) + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( aMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) break; } if ( i == nCount ) - aMediaDescriptor.realloc( ++nCount ); + maMediaDescriptor.realloc( ++nCount ); // the "FilterData" Property is an Any that will contain our PropertySequence of Values - aMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); - aMediaDescriptor[ i ].Value <<= aFilterDataSequence; - return aMediaDescriptor; + maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); + maMediaDescriptor[ i ].Value <<= maFilterDataSequence; + return maMediaDescriptor; } void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::PropertyValue > & aProps ) @@ -167,15 +160,18 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) { - aMediaDescriptor = aProps; + maMediaDescriptor = aProps; sal_Int32 i, nCount; - for ( i = 0, nCount = aMediaDescriptor.getLength(); i < nCount; i++ ) + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( aMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) + if ( maMediaDescriptor[ i ].Name.equalsAscii( "FilterData" ) ) { - aMediaDescriptor[ i ].Value >>= aFilterDataSequence; - break; + maMediaDescriptor[ i ].Value >>= maFilterDataSequence; + } + else if ( maMediaDescriptor[ i ].Name.equalsAscii( "SelectionOnly" ) ) + { + maMediaDescriptor[ i ].Value >>= mbExportSelection; } } } @@ -184,7 +180,7 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope void SvFilterOptionsDialog::setTitle( const OUString& aTitle ) throw ( uno::RuntimeException ) { - aDialogTitle = aTitle; + maDialogTitle = aTitle; } sal_Int16 SvFilterOptionsDialog::execute() @@ -194,13 +190,13 @@ sal_Int16 SvFilterOptionsDialog::execute() String aFilterNameStr( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ); String aInternalFilterName; - sal_Int32 j, nCount = aMediaDescriptor.getLength(); + sal_Int32 j, nCount = maMediaDescriptor.getLength(); for ( j = 0; j < nCount; j++ ) { - if ( aMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) + if ( maMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) { OUString aStr; - aMediaDescriptor[ j ].Value >>= aStr; + maMediaDescriptor[ j ].Value >>= aStr; aInternalFilterName = aStr; aInternalFilterName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "draw_" ) ), String(), 0 ); aInternalFilterName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "impress_" ) ), String(), 0 ); @@ -219,79 +215,24 @@ sal_Int16 SvFilterOptionsDialog::execute() } if ( nFormat < nFilterCount ) { - FltCallDialogParameter aFltCallDlgPara( Application::GetDefDialogParent(), NULL, eFieldUnit ); - aFltCallDlgPara.aFilterData = aFilterDataSequence; - - String aFilterName( aGraphicFilter.pConfig->GetExportFilterName( nFormat ) ); - if ( aGraphicFilter.pConfig->IsExportInternalFilter( nFormat ) ) - { - // Export-Dialog fuer Bitmap's, SVM's und WMF's - if( ( aFilterName.EqualsIgnoreCaseAscii( EXP_BMP ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_SVMETAFILE ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )|| - ( aFilterName.EqualsIgnoreCaseAscii( EXP_PNG ) ) ) - { - ByteString aResMgrName( "svt", 3 ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - aFltCallDlgPara.pResMgr = pResMgr; - // JPEG-Dialog - if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) - { - if ( DlgExportEJPG( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_PNG ) ) - { - if ( DlgExportEPNG( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else if( aFilterName.EqualsIgnoreCaseAscii( EXP_BMP ) ) - { - // Fuer Vektorformate nehmen wir den Vektor-Dialog - aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); - if ( DlgExportPix( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else - { - aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); - if ( DlgExportVec( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - delete pResMgr; - } - } - else // ladbare Filter - { - xub_StrLen i, nTokenCount = aGraphicFilter.aFilterPath.GetTokenCount( ';' ); - for ( i = 0; i < nTokenCount; i++ ) - { - - OUString aPathURL; - - ::osl::FileBase::getFileURLFromSystemPath( aGraphicFilter.aFilterPath.GetToken( i ), aPathURL ); - aPathURL += String( '/' ); - - OUString aSystemPath; - ::osl::FileBase::getSystemPathFromFileURL( aPathURL, aSystemPath ); - aSystemPath += OUString( aFilterName ); - - osl::Module aLibrary( aSystemPath ); - PFilterDlgCall pFunc = (PFilterDlgCall) aLibrary.getFunctionSymbol( UniString::CreateFromAscii( EXPDLG_FUNCTION_NAME ) ); - // Dialog in DLL ausfuehren - if( pFunc ) - { - if ( (*pFunc)( aFltCallDlgPara ) ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - } - } + FltCallDialogParameter aFltCallDlgPara( Application::GetDefDialogParent(), NULL, meFieldUnit ); + aFltCallDlgPara.aFilterData = maFilterDataSequence; + + ByteString aResMgrName( "svt", 3 ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + aFltCallDlgPara.pResMgr = pResMgr; + + aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); + sal_Bool bIsPixelFormat( aGraphicFilter.pConfig->IsExportPixelFormat( nFormat ) ); + if ( ExportDialog( aFltCallDlgPara, mxMgr, mxSourceDocument, mbExportSelection, bIsPixelFormat ).Execute() == RET_OK ) + nRet = ui::dialogs::ExecutableDialogResults::OK; + + delete pResMgr; + // taking the out parameter from the dialog - aFilterDataSequence = aFltCallDlgPara.aFilterData; + maFilterDataSequence = aFltCallDlgPara.aFilterData; } } return nRet; @@ -301,6 +242,8 @@ sal_Int16 SvFilterOptionsDialog::execute() void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) throw ( lang::IllegalArgumentException, uno::RuntimeException ) { + mxSourceDocument = xDoc; + // try to set the corresponding metric unit String aConfigPath; uno::Reference< lang::XServiceInfo > xServiceInfo @@ -320,7 +263,7 @@ void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComp aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); else aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "NonMetric" ) ); - eFieldUnit = (FieldUnit)aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); + meFieldUnit = (FieldUnit)aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); } } } diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx index a55fc4c84520..16592bac8df7 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx @@ -46,18 +46,22 @@ class SvFilterOptionsDialog : public cppu::WeakImplHelper5 com::sun::star::lang::XServiceInfo > { - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & - rxMgr; + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + mxMgr; com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - aMediaDescriptor; + maMediaDescriptor; com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - aFilterDataSequence; - rtl::OUString aDialogTitle; - FieldUnit eFieldUnit; + maFilterDataSequence; + com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + mxSourceDocument; + + rtl::OUString maDialogTitle; + FieldUnit meFieldUnit; + sal_Bool mbExportSelection; public: - SvFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + SvFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB ); ~SvFilterOptionsDialog(); // XInterface diff --git a/svtools/source/filter.vcl/filter/dlgejpg.cxx b/svtools/source/filter.vcl/filter/dlgejpg.cxx deleted file mode 100644 index 377697023de3..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "dlgejpg.hxx" -#include "dlgejpg.hrc" -#include "strings.hrc" -#include <svtools/FilterConfigItem.hxx> - -#define KEY_QUALITY "Quality" -#define KEY_GRAYSCALES "ColorMode" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEJPG::DlgExportEJPG( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_JPG, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aFiDescr ( this, ResId( FI_DESCR, *rPara.pResMgr ) ), - aNumFldQuality ( this, ResId( NUM_FLD_QUALITY, *rPara.pResMgr ) ), - aGrpQuality ( this, ResId( GRP_QUALITY, *rPara.pResMgr ) ), - aRbGray ( this, ResId( RB_GRAY, *rPara.pResMgr ) ), - aRbRGB ( this, ResId( RB_RGB, *rPara.pResMgr ) ), - aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ) -{ - FreeResource(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - // reading filter options - sal_Int32 nQuality = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 ); - sal_Int32 nColorMode = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), 0 ); - aNumFldQuality.SetValue( nQuality ); - - if ( nColorMode ) - aRbGray.Check( sal_True ); - else - aRbRGB.Check( sal_True ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEJPG, OK ) ); -} - - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEJPG, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), (sal_Int32)aNumFldQuality.GetValue() ); - pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), aRbGray.IsChecked() ? 1 : 0 ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - return 0; -} - -DlgExportEJPG::~DlgExportEJPG() -{ - delete pConfigItem; -} - - diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc deleted file mode 100644 index 90a3c1d162be..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FI_DESCR 1 -#define NUM_FLD_QUALITY 1 -#define GRP_QUALITY 1 -#define GRP_COLORS 2 -#define RB_GRAY 1 -#define RB_RGB 2 - - diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hxx b/svtools/source/filter.vcl/filter/dlgejpg.hxx deleted file mode 100644 index d80682574a54..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEJPG_HXX_ -#define _DLGEJPG_HXX_ - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/stdctrl.hxx> -#include <svtools/fltcall.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ -class FilterConfigItem; -class DlgExportEJPG : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedInfo aFiDescr; - NumericField aNumFldQuality; - FixedLine aGrpQuality; - RadioButton aRbGray; - RadioButton aRbRGB; - FixedLine aGrpColors; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - FilterConfigItem* pConfigItem; - - DECL_LINK( OK, void * ); - -public: - DlgExportEJPG( FltCallDialogParameter& rDlgPara ); - ~DlgExportEJPG(); -}; - -#endif // _DLGEJPG_HXX_ - diff --git a/svtools/source/filter.vcl/filter/dlgejpg.src b/svtools/source/filter.vcl/filter/dlgejpg.src deleted file mode 100644 index fd224f22c409..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.src +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgejpg.hrc" -ModalDialog DLG_EXPORT_JPG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 159 , 92 ) ; - Text [ en-US ] = "JPEG Options" ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 103 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 103 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 103 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_QUALITY - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Quality" ; - }; - FixedText FI_DESCR - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 81 , 16 ) ; - Text [ en-US ] = "1: min. quality\n100: max. quality" ; - }; - NumericField NUM_FLD_QUALITY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Minimum = 1; - Maximum = 100 ; - StrictFormat = TRUE ; - Last = 100 ; - Repeat = TRUE ; - }; - FixedLine GRP_COLORS - { - Pos = MAP_APPFONT ( 6 , 51 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Color resolution" ; - }; - RadioButton RB_GRAY - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Grayscale" ; - }; - RadioButton RB_RGB - { - Pos = MAP_APPFONT ( 12 , 76 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "True Colors" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/filter.vcl/filter/dlgepng.cxx b/svtools/source/filter.vcl/filter/dlgepng.cxx deleted file mode 100644 index bd551e9a4bda..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.cxx +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <tools/ref.hxx> -#include <vcl/msgbox.hxx> -#include "dlgepng.hxx" -#include "dlgepng.hrc" - -using namespace ::rtl; -using namespace ::com::sun::star::uno; - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPNG::DlgExportEPNG( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPNG, *rPara.pResMgr ) ), - FilterConfigItem ( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PNG" ) ), &rPara.aFilterData ), - rFltCallPara ( rPara ), - aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ), - aFiCompression ( this, ResId( FI_COMPRESSION, *rPara.pResMgr ) ), - aNumCompression ( this, ResId( NUM_COMPRESSION, *rPara.pResMgr ) ), - aCbxInterlaced ( this, ResId( CBX_INTERLACED, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - // Config-Parameter lesen - sal_Int32 nCompression = ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 ); - if ( ( nCompression < 0 ) || ( nCompression > 9 ) ) - nCompression = 6; - aNumCompression.SetValue( nCompression ); - - sal_Int32 nInterlaced = ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ); - sal_Bool bInterlaced = nInterlaced != 0; - aCbxInterlaced.Check( bInterlaced ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPNG, OK ) ); -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPNG, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast<sal_Int32>(aNumCompression.GetValue()) ); - sal_Int32 nInterlace = 0; - if ( aCbxInterlaced.IsChecked() ) - nInterlace++; - WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace ); - rFltCallPara.aFilterData = GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc deleted file mode 100644 index b3ffaab3ab1e..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_COMPRESSION 1 -#define FI_COMPRESSION 1 -#define NUM_COMPRESSION 1 -#define CBX_INTERLACED 1 diff --git a/svtools/source/filter.vcl/filter/dlgepng.hxx b/svtools/source/filter.vcl/filter/dlgepng.hxx deleted file mode 100644 index 469985afee59..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPNG_HXX_ -#define _DLGEPNG_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> -#include <svtools/FilterConfigItem.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class ResMgr; - -class DlgExportEPNG : public ModalDialog, FilterConfigItem -{ - - private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpCompression; - FixedInfo aFiCompression; - NumericField aNumCompression; - CheckBox aCbxInterlaced; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - - public: - - DlgExportEPNG( FltCallDialogParameter& rPara ); -}; - -#endif // _DLGEPNG_HXX_ diff --git a/svtools/source/filter.vcl/filter/dlgepng.src b/svtools/source/filter.vcl/filter/dlgepng.src deleted file mode 100644 index aa778842dc48..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.src +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgepng.hrc" -ModalDialog DLG_EXPORT_EPNG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 169 , 64 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "PNG Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 113 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 113 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 113 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_COMPRESSION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text[ en-US ] = "Mode"; - }; - FixedText FI_COMPRESSION - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text[ en-US ] = "~Compression 0..9"; - }; - NumericField NUM_COMPRESSION - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 9 ; - First = 0 ; - Last = 9 ; - StrictFormat = TRUE ; - Repeat = TRUE ; - }; - CheckBox CBX_INTERLACED - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 80 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Interlaced" ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/filter.vcl/filter/dlgexpor.cxx b/svtools/source/filter.vcl/filter/dlgexpor.cxx deleted file mode 100644 index b4b7c0fc949d..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.cxx +++ /dev/null @@ -1,442 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -# pragma hdrstop -#endif - -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <com/sun/star/awt/Size.hpp> -#include <vcl/msgbox.hxx> -#include "dlgexpor.hxx" -#include "dlgexpor.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportPix::DlgExportPix( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_PIX, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK_PIX, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL_PIX, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP_PIX, *rPara.pResMgr ) ), - aLbColors ( this, ResId( LB_COLORS, *rPara.pResMgr ) ), - aCbxRLE ( this, ResId( CBX_RLE, *rPara.pResMgr ) ), - aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL_PIX, *rPara.pResMgr ) ), - aRbRes ( this, ResId( RB_RES_PIX, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE_PIX, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX_PIX, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX_PIX, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY_PIX, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY_PIX, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE_PIX, *rPara.pResMgr ) ), - aCbbRes ( this, ResId( CBB_RES_PIX, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ), - aExt ( rPara.aFilterExt ) -{ - aExt.ToUpperAscii(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); - aFilterConfigPath.Append( aExt ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aTitle( aExt ); - FreeResource(); - - aBtnOK.SetClickHdl( LINK( this, DlgExportPix, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportPix, ClickRbOriginal ) ); - aRbRes.SetClickHdl( LINK( this, DlgExportPix, ClickRbRes ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportPix, ClickRbSize ) ); - aLbColors.SetSelectHdl( LINK( this, DlgExportPix, SelectLbColors ) ); - - aTitle.ToUpperAscii(); - aTitle += String( ResId( EXPORT_DIALOG_TITLE, *pMgr ) ); - SetText( aTitle ); - - // Config-Parameter lesen - sal_Int32 nColors = pConfigItem->ReadInt32( String( ResId( KEY_COLORS, *pMgr ) ), 0 ); - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - sal_Int32 nRes = pConfigItem->ReadInt32( String( ResId( KEY_RES, *pMgr ) ), 75 ); - sal_Bool bRleCoding = pConfigItem->ReadBool( String( ResId( KEY_RLE_CODING, *pMgr ) ), sal_True ); - - aLbColors.SelectEntryPos( Min( (sal_uInt16) 7, (sal_uInt16)nColors ) ); - - String aStrRes( String::CreateFromInt32( nRes ) ); - aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) ); - aCbbRes.SetText( aStrRes ); - - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aCbxRLE.Check( bRleCoding ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : -// case FUNIT_M : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - - default: - break; // -Wall multiple values not handled. - } - - switch ( nMode ) - { - case 2 : - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - break; - case 1 : - { - aRbRes.Check( TRUE ); - ClickRbRes( NULL ); - } - break; - default : - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } - break; - } - SelectLbColors( &aLbColors ); -} - -DlgExportPix::~DlgExportPix() -{ - delete pConfigItem; -} - - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - - sal_Int32 nRes = Max( Min( aCbbRes.GetText().ToInt32(), sal_Int32( 600 ) ), sal_Int32( 75 ) ); - ::com::sun::star::awt::Size aSize( - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeX.GetValue()), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM )), - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeY.GetValue()), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM )) ); - - sal_Int32 nMode; - if ( aRbRes.IsChecked() ) - nMode = 1; - else if ( aRbSize.IsChecked() ) - nMode = 2; - else - nMode = 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nMode ); - pConfigItem->WriteInt32( String( ResId( KEY_RES, *pMgr ) ), nRes ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - pConfigItem->WriteInt32( String( ResId( KEY_COLORS, *pMgr ) ), (sal_Int32)aLbColors.GetSelectEntryPos() ); - pConfigItem->WriteBool( String( ResId( KEY_RLE_CODING, *pMgr ) ), aCbxRLE.IsChecked() ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbOriginal, void*, EMPTYARG ) -{ - aCbbRes.Disable(); - - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbRes, void*, EMPTYARG ) -{ - aCbbRes.Enable(); - - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbSize, void*, EMPTYARG ) -{ - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - aCbbRes.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, SelectLbColors, void*, EMPTYARG ) -{ - const USHORT nLbPos = aLbColors.GetSelectEntryPos(); - - if ( ( nLbPos >= 3 ) && ( nLbPos <= 6 ) ) - aCbxRLE.Enable(); - else - aCbxRLE.Disable(); - - return 0L; -} - - -/******************************************************************************/ - - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportVec::DlgExportVec( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_VEC, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK_VEC, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL_VEC, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP_VEC, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL_VEC, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE_VEC, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE_VEC, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX_VEC, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX_VEC, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY_VEC, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY_VEC, *rPara.pResMgr ) ), - aGrpSize ( this, ResId( GRP_SIZE_VEC, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ), - aExt ( rPara.aFilterExt ) -{ - aExt.ToUpperAscii(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); - aFilterConfigPath.Append( aExt ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aTitle( aExt ); - FreeResource(); - - aBtnOK.SetClickHdl( LINK( this, DlgExportVec, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportVec, ClickRbOriginal ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportVec, ClickRbSize ) ); - - aTitle.ToUpperAscii(); - aTitle += String( ResId( EXPORT_DIALOG_TITLE, *pMgr ) ); - SetText( aTitle ); - - // reading config-parameter - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_M : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - default: - break; // -Wall Multiple values not handled. - } - - switch ( nMode ) - { - case 1 : - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - break; - - default : - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } - break; - } -} - -DlgExportVec::~DlgExportVec() -{ - delete pConfigItem; -} -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - ::com::sun::star::awt::Size aSize( - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeX.GetValue()), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM )), - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeY.GetValue()), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM )) ); - - sal_Int32 nMode; - if ( aRbSize.IsChecked() ) - nMode = 1; - else - nMode = 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nMode ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, ClickRbOriginal, void*, EMPTYARG ) -{ - aGrpSize.Disable(); - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, ClickRbSize, void*, EMPTYARG ) -{ - aGrpSize.Enable(); - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - return 0; -} - - - diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc deleted file mode 100644 index 69870c9b00b0..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK_PIX 1 -#define BTN_CANCEL_PIX 1 -#define BTN_HELP_PIX 1 -#define CBX_RES_PIX 1 -#define CBX_SIZE_PIX 2 -#define CBX_RLE 3 -#define CBB_RES_PIX 1 -#define LB_COLORS 1 -#define MTF_SIZEX_PIX 1 -#define MTF_SIZEY_PIX 2 -#define FT_SIZEX_PIX 1 -#define FT_SIZEY_PIX 2 -#define GRP_MODE_PIX 1 -#define GRP_COLORS 4 -#define RB_ORIGINAL_PIX 1 -#define RB_RES_PIX 2 -#define RB_SIZE_PIX 3 - -#define BTN_OK_VEC 1 -#define BTN_CANCEL_VEC 1 -#define BTN_HELP_VEC 1 -#define CBX_SIZE_VEC 2 -#define MTF_SIZEX_VEC 1 -#define MTF_SIZEY_VEC 2 -#define FT_SIZEX_VEC 1 -#define FT_SIZEY_VEC 2 -#define GRP_SIZE_VEC 1 -#define GRP_MODE_VEC 2 -#define RB_ORIGINAL_VEC 1 -#define RB_SIZE_VEC 2 diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hxx b/svtools/source/filter.vcl/filter/dlgexpor.hxx deleted file mode 100644 index 8c7b2d462e70..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.hxx +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEXPOR_HXX_ -#define _DLGEXPOR_HXX_ - -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten -|* -\************************************************************************/ - -class FilterConfigItem; -class DlgExportPix : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - ListBox aLbColors; - CheckBox aCbxRLE; - FixedLine aGrpColors; - - RadioButton aRbOriginal; - RadioButton aRbRes; - RadioButton aRbSize; - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpMode; - ComboBox aCbbRes; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - String aExt; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbRes,void* p ); - DECL_LINK( ClickRbSize,void* p ); - DECL_LINK( SelectLbColors, void* p ); - -public: - DlgExportPix( FltCallDialogParameter& rPara ); - ~DlgExportPix(); -}; - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten -|* -\************************************************************************/ -class DlgExportVec : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - RadioButton aRbOriginal; - RadioButton aRbSize; - FixedLine aGrpMode; - - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpSize; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - String aExt; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbSize,void* p ); - -public: - DlgExportVec( FltCallDialogParameter& rPara ); - ~DlgExportVec(); -}; - -#endif // _DLGEXPOR_HXX_ - diff --git a/svtools/source/filter.vcl/filter/dlgexpor.src b/svtools/source/filter.vcl/filter/dlgexpor.src deleted file mode 100644 index 7573b394d72f..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.src +++ /dev/null @@ -1,315 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "dlgexpor.hrc" - -ModalDialog DLG_EXPORT_PIX -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 135 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedLine GRP_COLORS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Color resolution" ; - }; - ListBox LB_COLORS - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 90 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - StringList [ en-US ] = - { - < "Original" ; Default ; > ; - < "1 Bit - Threshold Value" ; Default ; > ; - < "1 Bit - Dithering" ; Default ; > ; - < "4 Bit - Grayscale" ; Default ; > ; - < "4 Bit - Color Palette" ; Default ; > ; - < "8 Bit - Grayscales" ; Default ; > ; - < "8 Bit - Color Palette" ; Default ; > ; - < "24 Bit - True Colors" ; Default ; > ; - }; - }; - CheckBox CBX_RLE - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 98 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "RLE coding" ; - }; - FixedLine GRP_MODE_PIX - { - Pos = MAP_APPFONT ( 6 , 48 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - RadioButton RB_ORIGINAL_PIX - { - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_RES_PIX - { - Pos = MAP_APPFONT ( 12 , 73 ) ; - Size = MAP_APPFONT ( 55 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Resolution" ; - }; - ComboBox CBB_RES_PIX - { - Pos = MAP_APPFONT ( 70 , 73 ) ; - Size = MAP_APPFONT ( 40 , 50 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList = - { - "75 DPI" ; - "150 DPI" ; - "300 DPI" ; - "600 DPI" ; - }; - }; - RadioButton RB_SIZE_PIX - { - Pos = MAP_APPFONT ( 12 , 87 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - MetricField MTF_SIZEX_PIX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 101 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEX_PIX - { - Pos = MAP_APPFONT ( 18 , 102 ) ; - Size = MAP_APPFONT ( 41 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MTF_SIZEY_PIX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 117 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEY_PIX - { - Pos = MAP_APPFONT ( 18 , 118 ) ; - Size = MAP_APPFONT ( 41 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - OKButton BTN_OK_PIX - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL_PIX - { - Pos = MAP_APPFONT ( 122 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP_PIX - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; -ModalDialog DLG_EXPORT_VEC -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 89 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedLine GRP_MODE_VEC - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - RadioButton RB_ORIGINAL_VEC - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_SIZE_VEC - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - FixedLine GRP_SIZE_VEC - { - Pos = MAP_APPFONT ( 6 , 44 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_SIZEX_VEC - { - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MTF_SIZEX_VEC - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 55 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEY_VEC - { - Pos = MAP_APPFONT ( 12 , 72 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - MetricField MTF_SIZEY_VEC - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - OKButton BTN_OK_VEC - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL_VEC - { - Pos = MAP_APPFONT ( 122 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP_VEC - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx new file mode 100755 index 000000000000..c04b587b6278 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -0,0 +1,1513 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +# pragma hdrstop +#endif + +#include <tools/ref.hxx> +#include <tools/stream.hxx> +#include <svtools/filter.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/drawing/XDrawView.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> +#include <com/sun/star/geometry/AffineMatrix2D.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <unotools/streamwrap.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> +#include <vcl/graph.hxx> +#include <rtl/ustrbuf.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "exportdialog.hxx" +#include "exportdialog.hrc" + +#define FORMAT_UNKNOWN 0 +#define FORMAT_JPG 1 +#define FORMAT_PNG 2 +#define FORMAT_BMP 3 +#define FORMAT_GIF 4 +#define FORMAT_PBM 5 +#define FORMAT_PGM 6 +#define FORMAT_PPM 7 +#define FORMAT_PCT 8 +#define FORMAT_RAS 9 +#define FORMAT_TIF 10 +#define FORMAT_XPM 11 +#define FORMAT_WMF 12 +#define FORMAT_EMF 13 +#define FORMAT_EPS 14 +#define FORMAT_MET 15 +#define FORMAT_SVG 16 +#define FORMAT_SVM 17 + +#define UNIT_DEFAULT -1 +#define UNIT_INCH 0 +#define UNIT_CM 1 +#define UNIT_MM 2 +#define UNIT_POINT 3 +#define UNIT_PIXEL 4 +#define UNIT_MAX_ID UNIT_PIXEL + +using namespace ::com::sun::star; + +static sal_Int16 GetFilterFormat( String& rExt ) +{ + sal_Int16 nFormat = FORMAT_UNKNOWN; + ByteString aExt( rExt, RTL_TEXTENCODING_UTF8 ); + if ( aExt.Equals( "JPG" ) ) + nFormat = FORMAT_JPG; + else if ( aExt.Equals( "PNG" ) ) + nFormat = FORMAT_PNG; + else if ( aExt.Equals( "BMP" ) ) + nFormat = FORMAT_BMP; + else if ( aExt.Equals( "GIF" ) ) + nFormat = FORMAT_GIF; + else if ( aExt.Equals( "PBM" ) ) + nFormat = FORMAT_PBM; + else if ( aExt.Equals( "PGM" ) ) + nFormat = FORMAT_PGM; + else if ( aExt.Equals( "PPM" ) ) + nFormat = FORMAT_PPM; + else if ( aExt.Equals( "PCT" ) ) + nFormat = FORMAT_PCT; + else if ( aExt.Equals( "RAS" ) ) + nFormat = FORMAT_RAS; + else if ( aExt.Equals( "TIF" ) ) + nFormat = FORMAT_TIF; + else if ( aExt.Equals( "XPM" ) ) + nFormat = FORMAT_XPM; + else if ( aExt.Equals( "WMF" ) ) + nFormat = FORMAT_WMF; + else if ( aExt.Equals( "EMF" ) ) + nFormat = FORMAT_EMF; + else if ( aExt.Equals( "EPS" ) ) + nFormat = FORMAT_EPS; + else if ( aExt.Equals( "MET" ) ) + nFormat = FORMAT_MET; + else if ( aExt.Equals( "SVG" ) ) + nFormat = FORMAT_SVG; + else if ( aExt.Equals( "SVM" ) ) + nFormat = FORMAT_SVM; + return nFormat; +} + +static MapUnit GetMapUnit( sal_Int32 nUnit ) +{ + MapUnit aMapUnit( MAP_PIXEL ); + switch( nUnit ) + { + case UNIT_INCH : aMapUnit = MAP_INCH; break; + case UNIT_CM : aMapUnit = MAP_CM; break; + case UNIT_MM : aMapUnit = MAP_MM; break; + case UNIT_POINT : aMapUnit = MAP_POINT; break; + case UNIT_PIXEL : aMapUnit = MAP_PIXEL; break; + } + return aMapUnit; +} + +sal_Int32 ExportDialog::GetDefaultUnit() +{ + sal_Int32 nDefaultUnit = UNIT_CM; + switch( mrFltCallPara.eFieldUnit ) + { +// case FUNIT_NONE : +// case FUNIT_PERCENT : +// case FUNIT_CUSTOM : + default: nDefaultUnit = UNIT_CM; break; + + case FUNIT_MILE : // PASSTHROUGH INTENDED + case FUNIT_FOOT : + case FUNIT_TWIP : + case FUNIT_PICA : nDefaultUnit = UNIT_INCH; break; + + case FUNIT_KM : // PASSTHROUGH INTENDED + case FUNIT_M : + case FUNIT_100TH_MM : nDefaultUnit = UNIT_CM; break; + + case FUNIT_INCH : nDefaultUnit = UNIT_INCH; break; + case FUNIT_CM : nDefaultUnit = UNIT_CM; break; + case FUNIT_MM : nDefaultUnit = UNIT_MM; break; + case FUNIT_POINT : nDefaultUnit = UNIT_POINT; break; + } + return nDefaultUnit; +} + +static basegfx::B2DRange GetShapeRangeForXShape( const uno::Reference< drawing::XShape >& rxShape, + const uno::Reference< graphic::XPrimitiveFactory2D >& rxPrimitiveFactory2D, const uno::Sequence< beans::PropertyValue >& rViewInformation ) +{ + basegfx::B2DRange aShapeRange; + + const uno::Sequence< beans::PropertyValue > aParams; + const uno::Sequence< uno::Reference< graphic::XPrimitive2D > > aPrimitiveSequence( rxPrimitiveFactory2D->createPrimitivesFromXShape( rxShape, aParams ) ); + + const sal_Int32 nCount = aPrimitiveSequence.getLength(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + const geometry::RealRectangle2D aRect( aPrimitiveSequence[ nIndex ]->getRange( rViewInformation ) ); + aShapeRange.expand( basegfx::B2DTuple( aRect.X1, aRect.Y1 ) ); + aShapeRange.expand( basegfx::B2DTuple( aRect.X2, aRect.Y2 ) ); + } + return aShapeRange; +} + +uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( sal_Bool bUpdateConfig ) +{ + if ( bUpdateConfig ) + { + sal_Int32 nUnit = maLbSizeX.GetSelectEntryPos(); + if ( nUnit < 0 ) + nUnit = UNIT_CM; + + if ( ( mnInitialResolutionUnit == UNIT_DEFAULT ) && ( nUnit == GetDefaultUnit() ) ) + nUnit = UNIT_DEFAULT; + + // updating ui configuration + if ( mbIsPixelFormat ) + { + if ( nUnit > UNIT_MAX_ID ) + nUnit = UNIT_PIXEL; + + sal_Int32 nResolution = maNfResolution.GetValue(); + if ( nResolution < 1 ) + nResolution = 96; + + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), nUnit ); + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), nResolution ); + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), maLbResolution.GetSelectEntryPos() ); + } + else + { + if ( nUnit >= UNIT_PIXEL ) + nUnit = UNIT_CM; + + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), nUnit ); + } + } + + FilterConfigItem* pFilterOptions; + if ( bUpdateConfig ) + pFilterOptions = mpFilterOptionsItem; + else + { + uno::Sequence< beans::PropertyValue > aFilterData( mpFilterOptionsItem->GetFilterData() ); + pFilterOptions = new FilterConfigItem( &aFilterData ); + } + + const String sLogicalWidth( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalWidth" ) ) ); + const String sLogicalHeight( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalHeight" ) ) ); + if ( mbIsPixelFormat ) + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelWidth" ) ), static_cast< sal_Int32 >( maSize.Width ) ); + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelHeight" ) ), static_cast< sal_Int32 >( maSize.Height ) ); + if ( maResolution.Width && maResolution.Height ) + { + const double f100thmmPerPixelX = 100000.0 / maResolution.Width; + const double f100thmmPerPixelY = 100000.0 / maResolution.Height; + sal_Int32 nLogicalWidth = static_cast< sal_Int32 >( f100thmmPerPixelX * maSize.Width ); + sal_Int32 nLogicalHeight= static_cast< sal_Int32 >( f100thmmPerPixelY * maSize.Height ); + if ( nLogicalWidth && nLogicalHeight ) + { + pFilterOptions->WriteInt32( sLogicalWidth, nLogicalWidth ); + pFilterOptions->WriteInt32( sLogicalHeight, nLogicalHeight ); + } + } + } + else + { + pFilterOptions->WriteInt32( sLogicalWidth, static_cast< sal_Int32 >( maSize.Width ) ); + pFilterOptions->WriteInt32( sLogicalHeight, static_cast< sal_Int32 >( maSize.Height ) ); + } + switch ( mnFormat ) + { + case FORMAT_JPG : + { + sal_Int32 nColor = maLbColorDepth.GetSelectEntryPos(); + if ( nColor == 1 ) + nColor = 0; + else + nColor = 1; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), nColor ); + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) ); + } + break; + + case FORMAT_PNG : + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) ); + sal_Int32 nInterlace = 0; + if ( maCbInterlaced.IsChecked() ) + nInterlace++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace ); + } + break; + + case FORMAT_BMP : + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), maLbColorDepth.GetSelectEntryPos() + 1 ); + pFilterOptions->WriteBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), maCbRLEEncoding.IsChecked() ); + } + break; + + case FORMAT_GIF : + { + sal_Int32 nValue = 0; + if ( maCbInterlaced.IsChecked() ) + nValue++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nValue ); + + nValue = 0; + if ( maCbSaveTransparency.IsChecked() ) + nValue++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), nValue ); + } + break; + + case FORMAT_PBM : + case FORMAT_PGM : + case FORMAT_PPM : + { + sal_Int32 nFormat = 0; + if ( maRbText.IsChecked() ) + nFormat++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), nFormat ); + } + break; + + case FORMAT_EPS : + { + sal_Int32 nCheck = 0; + if ( maCbEPSPreviewTIFF.IsChecked() ) + nCheck++; + if ( maCbEPSPreviewEPSI.IsChecked() ) + nCheck += 2; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSLevel2.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSColorFormat2.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSCompressionNone.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), nCheck ); + } + break; + } + + uno::Sequence< beans::PropertyValue > aRet( pFilterOptions->GetFilterData() ); + if ( bUpdateConfig == sal_False ) + delete pFilterOptions; + return aRet; +} + +// +awt::Size ExportDialog::GetOriginalSize() +{ + basegfx::B2DRange aShapesRange; + + if ( mxPage.is () ) + { + uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY ); + if ( xPagePropSet.is() ) + { + sal_Int32 nWidth = 0; + sal_Int32 nHeight= 0; + com::sun::star::uno::Any aAny; + aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ); + aAny >>= nWidth; + aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ); + aAny >>= nHeight; + aShapesRange = basegfx::B2DRange( 0, 0, nWidth, nHeight ); + } + } + else + { + uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory( + mxMgr->createInstance( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.PrimitiveFactory2D" ) ) ), uno::UNO_QUERY ); + if ( xPrimitiveFactory.is() ) + { + basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() ); + com::sun::star::geometry::AffineMatrix2D aTransformation; + aTransformation.m00 = aViewTransformation.get(0,0); + aTransformation.m01 = aViewTransformation.get(0,1); + aTransformation.m02 = aViewTransformation.get(0,2); + aTransformation.m10 = aViewTransformation.get(1,0); + aTransformation.m11 = aViewTransformation.get(1,1); + aTransformation.m12 = aViewTransformation.get(1,2); + + const rtl::OUString sViewTransformation( RTL_CONSTASCII_USTRINGPARAM( "ViewTransformation" ) ); + uno::Sequence< beans::PropertyValue > aViewInformation( 1 ); + aViewInformation[ 0 ].Value <<= aTransformation; + aViewInformation[ 0 ].Name = sViewTransformation; + + if ( mxShape.is() ) + aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation ); + else if ( mxShapes.is() ) + { + const sal_Int32 nCount = mxShapes->getCount(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + uno::Reference< drawing::XShape > xShape; + mxShapes->getByIndex( nIndex ) >>= xShape; + aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) ); + } + } + } + } + return awt::Size( aShapesRange.getWidth(), aShapesRange.getHeight() ); +} + +void ExportDialog::GetGraphicSource() +{ + if ( mxSourceDocument.is() ) + { + uno::Reference< frame::XModel > xModel( mxSourceDocument, uno::UNO_QUERY ); + if ( xModel.is() ) + { + uno::Reference< frame::XController > xController( xModel->getCurrentController() ); + if ( xController.is() ) + { + if ( mbExportSelection ) // check if there is a selection + { + uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY ); + if ( xSelectionSupplier.is() ) + { + uno::Any aAny( xSelectionSupplier->getSelection() ); + if ( ! ( aAny >>= mxShapes ) ) + aAny >>= mxShape; + } + } + if ( !mxShape.is() && !mxShapes.is() ) + { + uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY ); + if ( xDrawView.is() ) + { + uno::Reference< drawing::XDrawPage > xCurrentPage( xDrawView->getCurrentPage() ); + if ( xCurrentPage.is() ) + { + mxPage = xCurrentPage; // exporting whole page + } + } + } + } + } + } +} + +sal_Bool ExportDialog::GetGraphicStream() +{ + sal_Bool bRet = sal_False; + + if ( !IsTempExportAvailable() ) + { + delete mpTempStream, mpTempStream = new SvMemoryStream(); + maBitmap = Bitmap(); + return bRet; + } + + sal_Bool bRecreateOutputStream = mpTempStream->Tell() == 0; + + static uno::Sequence< beans::PropertyValue > aOldFilterData; + uno::Sequence< beans::PropertyValue > aNewFilterData( GetFilterData( sal_False ) ); + if ( aOldFilterData != aNewFilterData ) + { + aOldFilterData = aNewFilterData; + bRecreateOutputStream = sal_True; + } + try + { + if ( bRecreateOutputStream ) + { + delete mpTempStream, mpTempStream = new SvMemoryStream(); + maBitmap = Bitmap(); + + uno::Reference < io::XStream > xStream( new utl::OStreamWrapper( *mpTempStream ) ); + uno::Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() ); + + uno::Reference< document::XExporter > xGraphicExporter( + mxMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ), uno::UNO_QUERY_THROW ); + uno::Reference< document::XFilter > xFilter( xGraphicExporter, uno::UNO_QUERY_THROW ); + + sal_Int32 nProperties = 2; + uno::Sequence< beans::PropertyValue > aFilterData( nProperties ); + + + rtl::OUString sFormat( maExt ); + uno::Sequence< beans::PropertyValue > aDescriptor( 3 ); + aDescriptor[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OutputStream") ); + aDescriptor[0].Value <<= xOutputStream; + aDescriptor[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") ); + aDescriptor[1].Value <<= sFormat; + aDescriptor[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") ); + aDescriptor[2].Value <<= aNewFilterData; + + uno::Reference< lang::XComponent > xSourceDoc; + if ( mxPage.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxPage, uno::UNO_QUERY_THROW ); + else if ( mxShapes.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxShapes, uno::UNO_QUERY_THROW ); + else if ( mxShape.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxShape, uno::UNO_QUERY_THROW );; + if ( xSourceDoc.is() ) + { + xGraphicExporter->setSourceDocument( xSourceDoc ); + xFilter->filter( aDescriptor ); + bRet = sal_True; + + if ( mnFormat == FORMAT_JPG ) + { + mpTempStream->Seek( STREAM_SEEK_TO_BEGIN ); + maBitmap = GetGraphicBitmap( *mpTempStream ); + mpTempStream->Seek( STREAM_SEEK_TO_END ); + } + } + } + else + bRet = sal_True; + } + catch( uno::Exception& ) + { + + // ups + + } + return bRet; +} + +Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) +{ + Bitmap aRet; + Graphic aGraphic; + GraphicFilter aFilter( sal_False ); + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + { + aRet = aGraphic.GetBitmap(); + } + return aRet; +} + +sal_uInt32 ExportDialog::GetRawFileSize() const +{ + sal_uInt64 nRawFileSize = 0; + if ( mbIsPixelFormat ) + { + sal_Int32 nBitsPerPixel = 24; + String aEntry( maLbColorDepth.GetSelectEntry() ); + if ( ms1BitTreshold == aEntry ) + nBitsPerPixel = 1; + else if ( ms1BitDithered == aEntry ) + nBitsPerPixel = 1; + else if ( ms4BitGrayscale == aEntry ) + nBitsPerPixel = 4; + else if ( ms4BitColorPalette == aEntry ) + nBitsPerPixel = 8; + else if ( ms8BitGrayscale == aEntry ) + nBitsPerPixel = 8; + else if ( ms8BitColorPalette == aEntry ) + nBitsPerPixel = 8; + else if ( ms24BitColor == aEntry ) + nBitsPerPixel = 24; + + if ( mbIsPixelFormat ) + { + nRawFileSize = ( maSize.Width * nBitsPerPixel + 7 ) &~ 7; // rounding up to 8 bits + nRawFileSize /= 8; // in bytes + nRawFileSize *= maSize.Height; + } + if ( nRawFileSize > SAL_MAX_UINT32 ) + nRawFileSize = 0; + } + return static_cast< sal_uInt32 >( nRawFileSize ); +} + +// checks if the source dimension/resolution is not too big +// to determine the exact graphic output size and preview for jpg +sal_Bool ExportDialog::IsTempExportAvailable() const +{ + return GetRawFileSize() < static_cast< sal_uInt32 >( mnMaxFilesizeForRealtimePreview ); +} + +ExportDialog::ExportDialog( FltCallDialogParameter& rPara, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, + sal_Bool bExportSelection, sal_Bool bIsPixelFormat ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT, *rPara.pResMgr ) ), + mrFltCallPara ( rPara ), + mpMgr ( rPara.pResMgr ), + mxMgr ( rxMgr ), + mxSourceDocument ( rxSourceDocument ), + maFlExportSize ( this, ResId( FL_EXPORT_SIZE, *rPara.pResMgr ) ), + maFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), + maMfSizeX ( this, ResId( MF_SIZEX, *rPara.pResMgr ) ), + maLbSizeX ( this, ResId( LB_SIZEX, *rPara.pResMgr ) ), + maFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), + maMfSizeY ( this, ResId( MF_SIZEY, *rPara.pResMgr ) ), + maLbSizeY ( this, ResId( LB_SIZEY, *rPara.pResMgr ) ), + maFtResolution ( this, ResId( FT_RESOLUTION, *rPara.pResMgr ) ), + maNfResolution ( this, ResId( NF_RESOLUTION, *rPara.pResMgr ) ), + maLbResolution ( this, ResId( LB_RESOLUTION, *rPara.pResMgr ) ), + maFlColorDepth ( this, ResId( FL_COLOR_DEPTH, *rPara.pResMgr ) ), + maLbColorDepth ( this, ResId( LB_COLOR_DEPTH, *rPara.pResMgr ) ), + maFlJPGQuality ( this, ResId( FL_JPG_QUALITY, *rPara.pResMgr ) ), + maFlMode ( this, ResId( FL_MODE, *rPara.pResMgr ) ), + maFlPBMOptions ( this, ResId( FL_PBM_OPTIONS, *rPara.pResMgr ) ), + maSbCompression ( this, ResId( SB_COMPRESSION, *rPara.pResMgr ) ), + maNfCompression ( this, ResId( NF_COMPRESSION, *rPara.pResMgr ) ), + maFtJPGMin ( this, ResId( FT_JPG_MIN, *rPara.pResMgr ) ), + maFtJPGMax ( this, ResId( FT_JPG_MAX, *rPara.pResMgr ) ), + maFtPNGMin ( this, ResId( FT_PNG_MIN, *rPara.pResMgr ) ), + maFtPNGMax ( this, ResId( FT_PNG_MAX, *rPara.pResMgr ) ), + maCbJPGPreview ( this, ResId( CB_JPG_PREVIEW, *rPara.pResMgr ) ), + maCbInterlaced ( this, ResId( CB_INTERLACED, *rPara.pResMgr ) ), + maCbRLEEncoding ( this, ResId( CB_RLE_ENCODING, *rPara.pResMgr ) ), + maFlGIFDrawingObjects ( this, ResId( FL_GIF_DRAWING_OBJECTS, *rPara.pResMgr ) ), + maCbSaveTransparency ( this, ResId( CB_SAVE_TRANSPARENCY, *rPara.pResMgr ) ), + maRbBinary ( this, ResId( RB_BINARY, *rPara.pResMgr ) ), + maRbText ( this, ResId( RB_TEXT, *rPara.pResMgr ) ), + maFlEPSPreview ( this, ResId( FL_EPS_PREVIEW, *rPara.pResMgr ) ), + maCbEPSPreviewTIFF ( this, ResId( CB_EPS_PREVIEW_TIFF, *rPara.pResMgr ) ), + maCbEPSPreviewEPSI ( this, ResId( CB_EPS_PREVIEW_EPSI, *rPara.pResMgr ) ), + maFlEPSVersion ( this, ResId( FL_EPS_VERSION, *rPara.pResMgr ) ), + maRbEPSLevel1 ( this, ResId( RB_EPS_LEVEL1, *rPara.pResMgr ) ), + maRbEPSLevel2 ( this, ResId( RB_EPS_LEVEL2, *rPara.pResMgr ) ), + maFlEPSColorFormat ( this, ResId( FL_EPS_COLOR_FORMAT, *rPara.pResMgr ) ), + maRbEPSColorFormat1 ( this, ResId( RB_EPS_COLOR_FORMAT1, *rPara.pResMgr ) ), + maRbEPSColorFormat2 ( this, ResId( RB_EPS_COLOR_FORMAT2, *rPara.pResMgr ) ), + maFlCompression ( this, ResId( FL_COMPRESSION, *rPara.pResMgr ) ), + maRbEPSCompressionLZW ( this, ResId( RB_EPS_COMPRESSION_LZW, *rPara.pResMgr ) ), + maRbEPSCompressionNone ( this, ResId( RB_EPS_COMPRESSION_NONE, *rPara.pResMgr ) ), + maFlEstimatedSize ( this, ResId( FL_ESTIMATED_SIZE, *rPara.pResMgr ) ), + maFtEstimatedSize ( this, ResId( FT_ESTIMATED_SIZE, *rPara.pResMgr ) ), + msEstimatedSizePix1 ( ResId( STR_ESTIMATED_SIZE_PIX_1, *rPara.pResMgr ) ), + msEstimatedSizePix2 ( ResId( STR_ESTIMATED_SIZE_PIX_2, *rPara.pResMgr ) ), + msEstimatedSizeVec ( ResId( STR_ESTIMATED_SIZE_VEC, *rPara.pResMgr ) ), + maFlButtons ( this, ResId( FL_BUTTONS, *rPara.pResMgr ) ), + maFbJPGPreview ( this, ResId( FB_JPG_PREVIEW, *rPara.pResMgr ) ), + maSbZoom ( this, ResId( SB_ZOOM, *rPara.pResMgr ) ), + maNfZoom ( this, ResId( NF_ZOOM, *rPara.pResMgr ) ), + maSbJPGPreviewHorz ( this, ResId( SB_JPG_PREVIEW_HORZ, *rPara.pResMgr ) ), + maSbJPGPreviewVert ( this, ResId( SB_JPG_PREVIEW_VERT, *rPara.pResMgr ) ), + maBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + maBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + maBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + ms1BitTreshold ( ResId( STR_1BIT_THRESHOLD, *rPara.pResMgr ) ), + ms1BitDithered ( ResId( STR_1BIT_DITHERED, *rPara.pResMgr ) ), + ms4BitGrayscale ( ResId( STR_4BIT_GRAYSCALE, *rPara.pResMgr ) ), + ms4BitColorPalette ( ResId( STR_4BIT_COLOR_PALETTE, *rPara.pResMgr ) ), + ms8BitGrayscale ( ResId( STR_8BIT_GRAYSCALE, *rPara.pResMgr ) ), + ms8BitColorPalette ( ResId( STR_8BIT_COLOR_PALETTE, *rPara.pResMgr ) ), + ms24BitColor ( ResId( STR_24BIT_TRUE_COLOR, *rPara.pResMgr ) ), + maExt ( rPara.aFilterExt ), + mnFormat ( FORMAT_UNKNOWN ), + mnMaxFilesizeForRealtimePreview( 0 ), + mpTempStream ( new SvMemoryStream() ), + maOriginalSize ( awt::Size( 0, 0 ) ), + mbPreview ( sal_False ), + mbIsPixelFormat ( bIsPixelFormat ), + mbExportSelection ( bExportSelection ), + mbPreserveAspectRatio ( sal_True ) +{ + GetGraphicSource(); + + maExt.ToUpperAscii(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); + mpOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + aFilterConfigPath.Append( maExt ); + mpFilterOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + mnInitialResolutionUnit = mbIsPixelFormat + ? mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), UNIT_DEFAULT ) + : mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), UNIT_DEFAULT ); + + mnMaxFilesizeForRealtimePreview = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxFilesizeForRealtimePreview" ) ), 0 ); + maFtEstimatedSize.SetText( String( RTL_CONSTASCII_USTRINGPARAM( " \n " ) ) ); + + String aTitle( maExt ); + aTitle += String( ResId( DLG_EXPORT_TITLE, *mpMgr ) ); + SetText( aTitle ); + + mnFormat = GetFilterFormat( maExt ); + + Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) ); + maResolution.Width = aResolution.Width(); + maResolution.Height= aResolution.Height(); + maOriginalSize = GetOriginalSize(); + if ( bIsPixelFormat ) + { + double fPixelsPer100thmm = static_cast< double >( maResolution.Width ) / 100000.0; + maSize = awt::Size( static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Width ) + 0.5 ), + static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Height ) + 0.5 ) ); + } + else + { + maSize = maOriginalSize; + } + + // Size + maLbSizeX.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maSbCompression.SetScrollHdl( LINK( this, ExportDialog, SbCompressionUpdateHdl ) ); + maNfCompression.SetModifyHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maMfSizeX.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeX ) ); + maMfSizeY.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeY ) ); + + maNfResolution.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlNfResolution ) ); + maLbResolution.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maLbColorDepth.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbInterlaced.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbSaveTransparency.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbEPSPreviewTIFF.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maCbEPSPreviewEPSI.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maRbEPSCompressionLZW.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbEPSCompressionNone.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maRbBinary.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbText.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + + // JPG Preview +// maCbJPGPreview.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); +maCbJPGPreview.Enable( sal_False ); + + maSbJPGPreviewVert.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maSbJPGPreviewHorz.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maSbZoom.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + // BMP + maCbRLEEncoding.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + // EPS + maRbEPSLevel1.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbEPSLevel2.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maBtnOK.SetClickHdl( LINK( this, ExportDialog, OK ) ); + + setupLayout(); + updateControls(); + + FreeResource(); +} + +void ExportDialog::createSizeControls( vcl::RowOrColumn& rLayout ) +{ + size_t nIndex; + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + // Size controls + rLayout.addWindow( &maFlExportSize ); + + Size aLbMax( maLbSizeX.GetSizePixel() ); + aLbMax.Width() = Max( aLbMax.Width(), maLbResolution.GetSizePixel().Width() ); + + boost::shared_ptr< vcl::LabelColumn > xSizeColumns( new vcl::LabelColumn( &rLayout ) ); + rLayout.addChild( xSizeColumns ); + + // row 1 + boost::shared_ptr< vcl::RowOrColumn > xColumn( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtSizeX, xColumn, nIndent ); + Size aMinSize( maMfSizeX.GetSizePixel() ); + nIndex = xColumn->addWindow( &maMfSizeX ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbSizeX ); + xColumn->setMinimumSize( nIndex, aLbMax ); + + // row 2 + xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtSizeY, xColumn, nIndent ); + nIndex = xColumn->addWindow( &maMfSizeY ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbSizeY ); + xColumn->setMinimumSize( nIndex, aLbMax ); + + // row 3 + if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) + { + xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtResolution, xColumn, nIndent ); + nIndex = xColumn->addWindow( &maNfResolution ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbResolution ); + xColumn->setMinimumSize( nIndex, aLbMax ); + } + + sal_Int32 nUnit = mnInitialResolutionUnit; + if ( nUnit == UNIT_DEFAULT ) + nUnit = GetDefaultUnit(); + + if ( !mbIsPixelFormat ) + { + maLbSizeX.RemoveEntry( UNIT_PIXEL ); // removing pixel + if ( nUnit >= UNIT_PIXEL ) + nUnit = UNIT_CM; + } + else if ( nUnit > UNIT_MAX_ID ) + nUnit = UNIT_PIXEL; + if ( nUnit < 0 ) + nUnit = UNIT_CM; + maLbSizeX.SelectEntryPos( static_cast< USHORT >( nUnit ) ); + + if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) should be supported for vector formats also... this makes + { // sense eg for bitmap fillings in metafiles, to preserve high dpi output + // (atm without special vector support the bitmaps are rendered with 96dpi) + sal_Int32 nResolution = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), 96 ); + if ( nResolution < 1 ) + nResolution = 96; + maNfResolution.SetValue( nResolution ); + + sal_Int32 nResolutionUnit = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), 1 ); + if ( ( nResolutionUnit < 0 ) || ( nResolutionUnit > 2 ) ) + nResolutionUnit = 1; + maLbResolution.SelectEntryPos( static_cast< USHORT >( nResolutionUnit ) ); + } + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); +} + +void ExportDialog::createColorDepthControls( vcl::RowOrColumn& rLayout ) +{ + // Color Depth + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + xRow->addWindow( &maFlColorDepth ); + + xRow = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + xRow->addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maLbColorDepth ); + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); +} + +void ExportDialog::createScrollBar( vcl::RowOrColumn& rLayout ) +{ + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + + Size aMinSize( maSbCompression.GetSizePixel() ); + size_t nIndex = xRow->addWindow( &maSbCompression ); + xRow->setMinimumSize( nIndex, aMinSize ); + aMinSize = maNfCompression.GetSizePixel(); + nIndex = xRow->addWindow( &maNfCompression ); + xRow->setMinimumSize( nIndex, aMinSize ); +} + +void ExportDialog::createFilterOptions( vcl::RowOrColumn& rLayout ) +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + switch( mnFormat ) + { + case FORMAT_JPG : + { + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ); + if ( nColor == 1 ) + nColor = 0; + else + nColor = 1; + maLbColorDepth.InsertEntry( ms8BitGrayscale ); + maLbColorDepth.InsertEntry( ms24BitColor ); + maLbColorDepth.SelectEntryPos( nColor ); + createColorDepthControls( maLayout ); + + rLayout.addWindow( &maFlJPGQuality ); + + // Quality + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + createScrollBar( *xRows.get() ); + xRows->addWindow( &maFtJPGMin ); + xRows->addWindow( &maFtJPGMax ); + if ( maCbJPGPreview.IsEnabled() ) + xRows->addWindow( &maCbJPGPreview ); + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 75 ); + if ( ( nQuality < 1 ) || ( nQuality > 100 ) ) + nQuality = 75; + + maSbCompression.SetRangeMin( 1 ); + maSbCompression.SetRangeMax( 100 ); + maNfCompression.SetMin( 1 ); + maNfCompression.SetMax( 100 ); + maNfCompression.SetValue( nQuality ); + maNfCompression.SetStrictFormat( sal_True ); + if ( maCbJPGPreview.IsEnabled() ) + maCbJPGPreview.Check( sal_False ); + } + break; + case FORMAT_PNG : + { + rLayout.addWindow( &maFlCompression ); + + // Compression 1..9 + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + createScrollBar( *xRows.get() ); + xRows->addWindow( &maFtPNGMin ); + xRows->addWindow( &maFtPNGMax ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + // Interlaced + rLayout.addWindow( &maFlMode ); + xIndenter.reset( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + xRows.reset( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbInterlaced ); + + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 ); + if ( ( nCompression < 1 ) || ( nCompression > 9 ) ) + nCompression = 6; + maSbCompression.SetRangeMin( 1 ); + maSbCompression.SetRangeMax( 9 ); + maNfCompression.SetMin( 1 ); + maNfCompression.SetMax( 9 ); + maNfCompression.SetValue( 9 ); + maNfCompression.SetStrictFormat( sal_True ); + + maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ) != 0 ); + } + break; + case FORMAT_BMP : + { + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 ); + if ( nColor == 0 ) + nColor = 6; + else + nColor--; + maLbColorDepth.InsertEntry( ms1BitTreshold ); + maLbColorDepth.InsertEntry( ms1BitDithered ); + maLbColorDepth.InsertEntry( ms4BitGrayscale ); + maLbColorDepth.InsertEntry( ms4BitColorPalette ); + maLbColorDepth.InsertEntry( ms8BitGrayscale ); + maLbColorDepth.InsertEntry( ms8BitColorPalette ); + maLbColorDepth.InsertEntry( ms24BitColor ); + maLbColorDepth.SelectEntryPos( nColor ); + createColorDepthControls( maLayout ); + + rLayout.addWindow( &maFlCompression ); + // RLE coding + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbRLEEncoding ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + maCbRLEEncoding.Check( mpFilterOptionsItem->ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ) ); + } + break; + case FORMAT_GIF : + { + rLayout.addWindow( &maFlMode ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbInterlaced ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + rLayout.addWindow( &maFlGIFDrawingObjects ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbSaveTransparency ); + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 1 ) != 0 ); + maCbSaveTransparency.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), 1 ) != 0 ); + } + break; + case FORMAT_PBM : + case FORMAT_PGM : + case FORMAT_PPM : + { + rLayout.addWindow( &maFlJPGQuality ); + + // RB Binary / Text + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbBinary ); + xRows->addWindow( &maRbText ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nFormat = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 1 ); + maRbBinary.Check( nFormat == 0 ); + maRbText.Check( nFormat != 0 ); + } + break; + case FORMAT_EPS : + { + boost::shared_ptr< vcl::RowOrColumn > xColumns( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xColumns ); + boost::shared_ptr< vcl::RowOrColumn > xLeft( new vcl::RowOrColumn( &rLayout, true ) ); + xColumns->addChild( xLeft ); + + xLeft->addWindow( &maFlEPSPreview ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( xLeft.get(), nIndent ) ); + xLeft->addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( xLeft.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbEPSPreviewTIFF ); + xRows->addWindow( &maCbEPSPreviewEPSI ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( xLeft.get(), 2 ) ); + xLeft->addChild( xSpacer ); + + xLeft->addWindow( &maFlEPSVersion ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xLeft.get(), nIndent ) ); + xLeft->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xLeft.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSLevel1 ); + xRows->addWindow( &maRbEPSLevel2 ); + xSpacer.reset( new vcl::Spacer( xLeft.get(), 2 ) ); + xLeft->addChild( xSpacer ); + + boost::shared_ptr< vcl::RowOrColumn > xRight( new vcl::RowOrColumn( &rLayout, true ) ); + xColumns->addChild( xRight ); + + xRight->addWindow( &maFlEPSColorFormat ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) ); + xRight->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSColorFormat1 ); + xRows->addWindow( &maRbEPSColorFormat2 ); + xSpacer.reset( new vcl::Spacer( xRight.get(), 2 ) ); + xRight->addChild( xSpacer ); + + xRight->addWindow( &maFlCompression ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) ); + xRight->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSCompressionLZW ); + xRows->addWindow( &maRbEPSCompressionNone ); + + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nPreview = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), 0 ); + sal_Int32 nVersion = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 2 ); + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), 0 ); + sal_Int32 nCompr = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), 2 ); + + mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ), 0 ); + + maCbEPSPreviewTIFF.Check( ( nPreview & 1 ) != 0 ); + maCbEPSPreviewEPSI.Check( ( nPreview & 2 ) != 0 ); + + maRbEPSLevel1.Check( nVersion == 1 ); + maRbEPSLevel2.Check( nVersion == 2 ); + + maRbEPSColorFormat1.Check( nColor == 1 ); + maRbEPSColorFormat2.Check( nColor != 1 ); + + maRbEPSCompressionLZW.Check( nCompr == 1 ); + maRbEPSCompressionNone.Check( nCompr != 1 ); + } + break; + } +} + +void ExportDialog::createButtons( vcl::RowOrColumn& rLayout ) +{ + rLayout.addWindow( &maFlButtons ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &rLayout, false ) ); + size_t nIndex = rLayout.addChild( xButtons ); + rLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() ); + + Size aMinSize( maBtnCancel.GetSizePixel() ); + // insert help button + xButtons->setMinimumSize( xButtons->addWindow( &maBtnHelp ), aMinSize ); + + // insert a spacer, cancel and OK buttons are right aligned + + xSpacer.reset( new vcl::Spacer( xButtons.get(), 2 ) ); + xButtons->addChild( xSpacer ); + xButtons->setMinimumSize( xButtons->addWindow( &maBtnOK ), aMinSize ); + xButtons->setMinimumSize( xButtons->addWindow( &maBtnCancel ), aMinSize ); +} + +void ExportDialog::setupLayout() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + createSizeControls( maLayout ); + createFilterOptions( maLayout ); + + if ( mnMaxFilesizeForRealtimePreview || mbIsPixelFormat ) + { + maLayout.addWindow( &maFlEstimatedSize ); + maLayout.addWindow( &maFtEstimatedSize ); + } + createButtons( maLayout ); + + maLayout.show(); + maDialogSize = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); + maLayout.setManagedArea( Rectangle( Point(), maDialogSize ) ); + SetOutputSizePixel( Size( mbPreview ? maDialogSize.Width() * 2 : maDialogSize.Width(), maDialogSize.Height() ) ); + + maRectFlButtons = Rectangle( maFlButtons.GetPosPixel(), maFlButtons.GetSizePixel() ); + maRectBtnHelp = Rectangle( maBtnHelp.GetPosPixel(), maBtnHelp.GetSizePixel() ); + maRectBtnOK = Rectangle( maBtnOK.GetPosPixel(), maBtnOK.GetSizePixel() ); + maRectBtnCancel = Rectangle( maBtnCancel.GetPosPixel(), maBtnOK.GetSizePixel() ); + + maLbSizeY.Hide(); +} + +static rtl::OUString ImpValueOfInKB( const sal_Int64& rVal ) +{ + double fVal( static_cast<double>( rVal ) ); + fVal /= ( 1 << 10 ); + fVal += 0.05; + rtl::OUStringBuffer aVal( rtl::OUString::valueOf( fVal ) ); + sal_Int32 nX( rtl::OUString( aVal.getStr() ).indexOf( '.', 0 ) ); + if ( nX > 0 ) + aVal.setLength( nX + 2 ); + return aVal.makeStringAndClear(); +} + +sal_Int32 static GetZoomValueFromThumbPos( sal_Int32 nThumbPos ) +{ + sal_Int32 nProz = 0; + if ( nThumbPos <= 50 ) + nProz = nThumbPos * 2; // so a range of 50 represents 100% + else + nProz = ( ( nThumbPos - 50 ) * 60 ) + 100; // we want to scale up to 3000% + return nProz; +} + +void ExportDialog::updatePreview() +{ + // JPG +// maCbJPGPreview.Enable( IsTempExportAvailable() ); + +// if ( maCbJPGPreview.IsEnabled() && maCbJPGPreview.IsChecked() ) + if ( mbPreview ) + { + long nScrollBarSize = Application::GetSettings().GetStyleSettings().GetScrollBarSize(); + + Point aPreviewPos( maDialogSize.Width(), 0 ); + Size aPreviewSize( maDialogSize.Width(), maFlButtons.GetPosPixel().Y() ); + + Point aFixedBitmapPos( aPreviewPos ); + Size aFixedBitmapSize( aPreviewSize ); + + maSbZoom.Show( sal_False ); + maSbZoom.SetPosPixel( Point( aPreviewPos.X(), aPreviewPos.Y() ) ); + maSbZoom.SetSizePixel( Size( aPreviewSize.Width() / 4, nScrollBarSize ) ); + maNfZoom.Show( sal_False ); + maNfZoom.SetPosPixel( Point( aPreviewPos.X() + aPreviewSize.Width() / 4, aPreviewPos.Y() ) ); + maNfZoom.SetSizePixel( Size( aPreviewSize.Width() / 6, nScrollBarSize ) ); + maNfZoom.SetValue( GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ) ); + maFbJPGPreview.Show( sal_True ); + + sal_Int32 nZoom = GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ); + double fSizePixelX = static_cast< double >( maSize.Width * nZoom ) / 100.0; + double fSizePixelY = static_cast< double >( maSize.Height * nZoom ) / 100.0; + + double fXRatio = fSizePixelX / maSize.Width; // the size of each pixel + double fYRatio = fSizePixelY / maSize.Height; + + sal_Bool bHorzSb = fSizePixelX > aFixedBitmapSize.Width(); + sal_Bool bVertSb = fSizePixelY > aFixedBitmapSize.Height(); + if ( bHorzSb ) + { + aFixedBitmapSize.Height() -= nScrollBarSize; + + maSbJPGPreviewHorz.Show( sal_True ); + maSbJPGPreviewHorz.SetPosPixel( Point( aFixedBitmapPos.X(), aFixedBitmapPos.Y() + aFixedBitmapSize.Height() ) ); + maSbJPGPreviewHorz.SetSizePixel( Size( aFixedBitmapSize.Width(), nScrollBarSize ) ); + } + else + { + maSbJPGPreviewHorz.Show( sal_False ); + } + + + if ( bVertSb ) + { + aFixedBitmapSize.Width() -= nScrollBarSize; + + maSbJPGPreviewVert.Show( sal_True ); + maSbJPGPreviewVert.SetPosPixel( Point( aFixedBitmapPos.X() + aFixedBitmapSize.Width(), aFixedBitmapPos.Y() ) ); + maSbJPGPreviewVert.SetSizePixel( Size( nScrollBarSize, aFixedBitmapSize.Height() ) ); + } + else + { + maSbJPGPreviewVert.Show( sal_False ); + } + + Point aPos( 0, 0 ); + Size aSize; + if ( fXRatio > 1.0 ) + { + aSize.Width() = maSize.Width > aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width(); + aSize.Width() /= fXRatio; + } + else + { + aSize.Width() = maSize.Width < aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width(); + aSize.Width() /= fXRatio; + } + + if ( fYRatio > 1.0 ) + { + aSize.Height() = maSize.Height > aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height(); + aSize.Height() /= fYRatio; + } + else + { + aSize.Height() = maSize.Height < aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height(); + aSize.Height() /= fYRatio; + } + + if ( aSize.Width() < maSize.Width ) + { + sal_Int32 nXDiff = static_cast< sal_Int32 >( ( ( ( maSize.Width - aSize.Width() ) * maSbJPGPreviewHorz.GetThumbPos() ) / 100.0 ) ); + aPos.X() += nXDiff; + } + if ( aSize.Height() < maSize.Height ) + { + sal_Int32 nYDiff = static_cast< sal_Int32 >( ( ( ( maSize.Height - aSize.Height() ) * maSbJPGPreviewVert.GetThumbPos() ) / 100.0 ) ); + aPos.Y() += nYDiff; + } + + Bitmap aCroppedBitmap( maBitmap ); + aCroppedBitmap.Crop( Rectangle( aPos, aSize ) ); + aSize = aCroppedBitmap.GetSizePixel(); + aSize = Size( aSize.Width() * fXRatio, aSize.Height() * fYRatio ); + aCroppedBitmap.Scale( aSize ); + + if ( aSize.Width() > aFixedBitmapSize.Width() ) + aSize.Width() = aFixedBitmapSize.Width(); + if ( aSize.Height() > aFixedBitmapSize.Height() ) + aSize.Height() = aFixedBitmapSize.Height(); + Point aPoint( aFixedBitmapPos ); + if ( aSize.Width() < aFixedBitmapSize.Width() ) + aPoint.X() += ( aFixedBitmapSize.Width() - aSize.Width() ) / 2; + if ( aSize.Height() < aFixedBitmapSize.Height() ) + aPoint.Y() += ( aFixedBitmapSize.Height() - aSize.Height() ) / 2; + + maFbJPGPreview.SetPosPixel( aPoint ); + maFbJPGPreview.SetSizePixel( aSize ); + maFbJPGPreview.SetBitmap( aCroppedBitmap ); + + SetOutputSizePixel( Size( maDialogSize.Width() * 2, maDialogSize.Height() ) ); + + maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth() * 2, maRectFlButtons.GetHeight() ) ); + maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left() + maDialogSize.Width(), maRectBtnHelp.Top() ) ); + maBtnOK.SetPosPixel( Point( maRectBtnOK.Left() + maDialogSize.Width(), maRectBtnOK.Top() ) ); + maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left() + maDialogSize.Width(), maRectBtnCancel.Top() ) ); + } + else + { + maSbZoom.Show( sal_False ); + maNfZoom.Show( sal_False ); + maFbJPGPreview.Show( sal_False ); + maSbJPGPreviewHorz.Show( sal_False ); + maSbJPGPreviewVert.Show( sal_False ); + + SetOutputSizePixel( maDialogSize ); + + maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth(), maRectFlButtons.GetHeight() ) ); + maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left(), maRectBtnHelp.Top() ) ); + maBtnOK.SetPosPixel( Point( maRectBtnOK.Left(), maRectBtnOK.Top() ) ); + maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left(), maRectBtnCancel.Top() ) ); + } +} + +void ExportDialog::updateControls() +{ + GetGraphicStream(); + + // Size Controls + if ( !mbIsPixelFormat ) + { + awt::Size aSize100thmm( maSize ); + Size aSize( LogicToLogic( Size( aSize100thmm.Width * 100, aSize100thmm.Height * 100 ), MAP_100TH_MM, + MapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) ) ); + maMfSizeX.SetValue( aSize.Width() ); + maMfSizeY.SetValue( aSize.Height() ); + } + else + { + MapUnit aMapUnit( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ); + if ( aMapUnit == MAP_PIXEL ) + { // calculating pixel count via resolution and original graphic size + maMfSizeX.SetDecimalDigits( 0 ); + maMfSizeY.SetDecimalDigits( 0 ); + maMfSizeX.SetValue( maSize.Width ); + maMfSizeY.SetValue( maSize.Height ); + } + else + { + maMfSizeX.SetDecimalDigits( 2 ); + maMfSizeY.SetDecimalDigits( 2 ); + double fRatio; + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break; + case MAP_MM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break; + case MAP_POINT :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break; + default: + case MAP_CM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break; + } + maMfSizeX.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Width * 100 ) / fRatio ) + 0.5 ) ); + maMfSizeY.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Height * 100 ) / fRatio ) + 0.5 ) ); + } + } + sal_Int32 nResolution = 0; + switch( maLbResolution.GetSelectEntryPos() ) + { + case 0 : nResolution = maResolution.Width / 100; break; // pixels / cm + case 2 : nResolution = maResolution.Width; break; // pixels / meter + default: + case 1 : nResolution = maResolution.Width * 0.0254; break; // pixels / inch + } + maNfResolution.SetValue( nResolution ); + + if ( maSbCompression.IsVisible() ) + maSbCompression.SetThumbPos( maNfCompression.GetValue() ); + + // updating estimated size + sal_Int64 nRealFileSize( mpTempStream->Tell() ); + if ( mbIsPixelFormat ) + { + String aEst( nRealFileSize ? msEstimatedSizePix2 : msEstimatedSizePix1 ); + sal_Int64 nRawFileSize( GetRawFileSize() ); + xub_StrLen nInd = aEst.Search( '%' ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRawFileSize ) ); + + if ( nRealFileSize ) + { + nInd = aEst.Search( '%', nInd ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) ); + } + maFtEstimatedSize.SetText( aEst ); + } + else + { + if ( mnMaxFilesizeForRealtimePreview ) + { + String aEst( msEstimatedSizeVec ); + xub_StrLen nInd = aEst.Search( '%', 0 ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) ); + maFtEstimatedSize.SetText( aEst ); + } + } + updatePreview(); + + // EPS + if ( maRbEPSLevel1.IsVisible() ) + { + sal_Bool bEnabled = maRbEPSLevel1.IsChecked() == sal_False; + maRbEPSColorFormat1.Enable( bEnabled ); + maRbEPSColorFormat2.Enable( bEnabled ); + maRbEPSCompressionLZW.Enable( bEnabled ); + maRbEPSCompressionNone.Enable( bEnabled ); + } +} + +ExportDialog::~ExportDialog() +{ + delete mpFilterOptionsItem; + delete mpOptionsItem; +} + + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ +IMPL_LINK( ExportDialog, UpdateHdl, void *, EMPTYARG ) +{ + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlMtfSizeX, void *, EMPTYARG ) +{ + double fRatio = static_cast< double >( maOriginalSize.Height ) / maOriginalSize.Width; + + if ( mbIsPixelFormat ) + { + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_CM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_MM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_POINT : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 * 72 + 0.5 ); break; + default: + case MAP_PIXEL : maSize.Width = maMfSizeX.GetValue(); break; + } + maSize.Height = static_cast< sal_Int32 >( fRatio * maSize.Width + 0.5 ); + } + else + { + Fraction aFract( 1, 100 ); + sal_Int32 nWidth = maMfSizeX.GetValue(); + sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio ); + const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + + maSize.Width = aDest.Width(); + if ( mbPreserveAspectRatio ) + maSize.Height = aDest.Height(); + } + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlMtfSizeY, void *, EMPTYARG ) +{ + double fRatio = static_cast< double >( maOriginalSize.Width ) / maOriginalSize.Height; + + if ( mbIsPixelFormat ) + { + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_CM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_MM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_POINT : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 * 72 + 0.5 ); break; + default: + case MAP_PIXEL : maSize.Height = maMfSizeY.GetValue(); break; + } + maSize.Width = static_cast< sal_Int32 >( fRatio * maSize.Height + 0.5 ); + } + else + { + Fraction aFract( 1, 100 ); + sal_Int32 nHeight= maMfSizeY.GetValue(); + sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio ); + const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + + maSize.Height = aDest.Height(); + if ( mbPreserveAspectRatio ) + maSize.Width = aDest.Width(); + } + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlNfResolution, void *, EMPTYARG ) +{ + sal_Int32 nResolution = maNfResolution.GetValue(); + if ( maLbResolution.GetSelectEntryPos() == 0 ) // pixels / cm + nResolution *= 100; + else if ( maLbResolution.GetSelectEntryPos() == 1 ) // pixels / inch + nResolution = static_cast< sal_Int32 >( ( ( static_cast< double >( nResolution ) + 0.5 ) / 0.0254 ) ); + maResolution.Width = nResolution; + maResolution.Height= nResolution; + + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, SbCompressionUpdateHdl, void *, EMPTYARG ) +{ + maNfCompression.SetValue( maSbCompression.GetThumbPos() ); + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) +{ + // writing config parameter + + + mrFltCallPara.aFilterData = GetFilterData( sal_True ); + EndDialog( RET_OK ); + + return 0; +} + diff --git a/svtools/source/filter.vcl/filter/exportdialog.hrc b/svtools/source/filter.vcl/filter/exportdialog.hrc new file mode 100755 index 000000000000..e230bcd2c5c3 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.hrc @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <svtools/svtools.hrc> + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 + +#define FL_EXPORT_SIZE 1 +#define FL_COLOR_DEPTH 2 +#define FL_JPG_QUALITY 3 +#define FL_COMPRESSION 4 +#define FL_MODE 5 +#define FL_GIF_DRAWING_OBJECTS 6 +#define FL_PBM_OPTIONS 7 +#define FL_EPS_PREVIEW 8 +#define FL_EPS_VERSION 9 +#define FL_EPS_COLOR_FORMAT 10 +#define FL_ESTIMATED_SIZE 11 +#define FL_BUTTONS 12 + +#define FT_SIZEX 1 +#define FT_SIZEY 2 +#define FT_RESOLUTION 3 +#define FT_JPG_MIN 4 +#define FT_JPG_MAX 5 +#define FT_PNG_MIN 6 +#define FT_PNG_MAX 7 +#define FT_ESTIMATED_SIZE 8 + +#define NF_RESOLUTION 1 +#define NF_COMPRESSION 2 +#define NF_ZOOM 3 + +#define MF_SIZEX 1 +#define MF_SIZEY 2 + +#define LB_SIZEX 1 +#define LB_SIZEY 2 +#define LB_RESOLUTION 3 +#define LB_COLOR_DEPTH 4 + +#define RB_BINARY 1 +#define RB_TEXT 2 +#define RB_EPS_LEVEL1 3 +#define RB_EPS_LEVEL2 4 +#define RB_EPS_COLOR_FORMAT1 5 +#define RB_EPS_COLOR_FORMAT2 6 +#define RB_EPS_COMPRESSION_LZW 7 +#define RB_EPS_COMPRESSION_NONE 8 + +#define CB_JPG_PREVIEW 1 +#define CB_INTERLACED 2 +#define CB_RLE_ENCODING 3 +#define CB_SAVE_TRANSPARENCY 4 +#define CB_EPS_PREVIEW_TIFF 5 +#define CB_EPS_PREVIEW_EPSI 6 + +#define FB_JPG_PREVIEW 1 + +#define SB_COMPRESSION 1 +#define SB_JPG_PREVIEW_HORZ 2 +#define SB_JPG_PREVIEW_VERT 3 +#define SB_ZOOM 4 + +#define STR_1BIT_THRESHOLD 1 +#define STR_1BIT_DITHERED 2 +#define STR_4BIT_GRAYSCALE 3 +#define STR_4BIT_COLOR_PALETTE 4 +#define STR_8BIT_GRAYSCALE 5 +#define STR_8BIT_COLOR_PALETTE 6 +#define STR_24BIT_TRUE_COLOR 7 +#define STR_ESTIMATED_SIZE_PIX_1 8 +#define STR_ESTIMATED_SIZE_PIX_2 9 +#define STR_ESTIMATED_SIZE_VEC 10 diff --git a/svtools/source/filter.vcl/filter/exportdialog.hxx b/svtools/source/filter.vcl/filter/exportdialog.hxx new file mode 100755 index 000000000000..20a9ac3ea832 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _EXPORTDIALOG_HXX_ +#define _EXPORTDIALOG_HXX_ + +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/arrange.hxx> +#include <vcl/scrbar.hxx> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten +|* +\************************************************************************/ + +class FilterConfigItem; +class ExportDialog : public ModalDialog +{ +private: + + FltCallDialogParameter& + mrFltCallPara; + + ResMgr* mpMgr; + + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + mxMgr; + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& + mxSourceDocument; + + FixedLine maFlExportSize; + FixedText maFtSizeX; + MetricField maMfSizeX; + ListBox maLbSizeX; + FixedText maFtSizeY; + MetricField maMfSizeY; + ListBox maLbSizeY; + FixedText maFtResolution; + NumericField maNfResolution; + ListBox maLbResolution; + FixedLine maFlColorDepth; + ListBox maLbColorDepth; + FixedLine maFlJPGQuality; + FixedLine maFlMode; + FixedLine maFlPBMOptions; + ScrollBar maSbCompression; + NumericField maNfCompression; + FixedText maFtJPGMin; + FixedText maFtJPGMax; + FixedText maFtPNGMin; + FixedText maFtPNGMax; + CheckBox maCbJPGPreview; + CheckBox maCbInterlaced; + CheckBox maCbRLEEncoding; + FixedLine maFlGIFDrawingObjects; + CheckBox maCbSaveTransparency; + RadioButton maRbBinary; + RadioButton maRbText; + FixedLine maFlEPSPreview; + CheckBox maCbEPSPreviewTIFF; + CheckBox maCbEPSPreviewEPSI; + FixedLine maFlEPSVersion; + RadioButton maRbEPSLevel1; + RadioButton maRbEPSLevel2; + FixedLine maFlEPSColorFormat; + RadioButton maRbEPSColorFormat1; + RadioButton maRbEPSColorFormat2; + FixedLine maFlCompression; + RadioButton maRbEPSCompressionLZW; + RadioButton maRbEPSCompressionNone; + FixedLine maFlEstimatedSize; + FixedText maFtEstimatedSize; + String msEstimatedSizePix1; + String msEstimatedSizePix2; + String msEstimatedSizeVec; + FixedLine maFlButtons; + FixedBitmap maFbJPGPreview; + ScrollBar maSbZoom; + NumericField maNfZoom; + ScrollBar maSbJPGPreviewHorz; + ScrollBar maSbJPGPreviewVert; + OKButton maBtnOK; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + + String ms1BitTreshold; + String ms1BitDithered; + String ms4BitGrayscale; + String ms4BitColorPalette; + String ms8BitGrayscale; + String ms8BitColorPalette; + String ms24BitColor; + + vcl::RowOrColumn maLayout; + Size maDialogSize; + + FilterConfigItem* mpOptionsItem; + FilterConfigItem* mpFilterOptionsItem; + + String maExt; + String maEstimatedSizeText; + sal_Int16 mnFormat; + sal_Int32 mnMaxFilesizeForRealtimePreview; + + Rectangle maRectFlButtons; + Rectangle maRectBtnHelp; + Rectangle maRectBtnOK; + Rectangle maRectBtnCancel; + + SvStream* mpTempStream; + Bitmap maBitmap; + + com::sun::star::awt::Size + maOriginalSize; // the original graphic size in 1/100mm + com::sun::star::awt::Size + maSize; // for vector graphics it always contains the logical size in 1/100mm + + sal_Bool mbPreview; + sal_Bool mbIsPixelFormat; + sal_Bool mbExportSelection; + sal_Bool mbPreserveAspectRatio; + + sal_Int32 mnInitialResolutionUnit; + + // for pixel graphics it always contains the pixel count + com::sun::star::awt::Size + maResolution; // it always contains the number of pixels per meter + + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > + mxShape; + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > + mxShapes; + com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > + mxPage; + + + DECL_LINK( UpdateHdl,void* p ); + DECL_LINK( UpdateHdlMtfSizeX,void* p ); + DECL_LINK( UpdateHdlMtfSizeY,void* p ); + DECL_LINK( UpdateHdlNfResolution,void* p ); + DECL_LINK( SbCompressionUpdateHdl,void* p ); + DECL_LINK( NfCompressionUpdateHdlX,void* p ); + + DECL_LINK( OK, void* p ); + + void createSizeControls( vcl::RowOrColumn& ); + void createColorDepthControls( vcl::RowOrColumn& ); + void createFilterOptions( vcl::RowOrColumn& ); + void createButtons( vcl::RowOrColumn& ); + void createScrollBar( vcl::RowOrColumn& ); + void setupLayout(); + void updatePreview(); + void updateControls(); + + void GetGraphicSource(); + sal_Bool GetGraphicStream(); + Bitmap GetGraphicBitmap( SvStream& rStream ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + GetFilterData( sal_Bool bUpdateConfig ); + + sal_uInt32 GetRawFileSize() const; + sal_Bool IsTempExportAvailable() const; + + com::sun::star::awt::Size + GetOriginalSize(); + + sal_Int32 GetDefaultUnit(); + +public: + ExportDialog( FltCallDialogParameter& rPara, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, + sal_Bool bExportSelection, sal_Bool bIsExportVectorFormat ); + ~ExportDialog(); +}; + + + +#endif // _EXPORTDIALOG_HXX_ + diff --git a/svtools/source/filter.vcl/filter/exportdialog.src b/svtools/source/filter.vcl/filter/exportdialog.src new file mode 100755 index 000000000000..065fcee6ba18 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.src @@ -0,0 +1,505 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "exportdialog.hrc" + +String DLG_EXPORT_TITLE +{ + Text [ en-US ] = " Options" ; +}; + +ModalDialog DLG_EXPORT +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 178 , 135 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + + FixedLine FL_EXPORT_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_SIZEX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Width:" ; + }; + MetricField MF_SIZEX + { + Hide = TRUE; + Border = TRUE; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE; + Repeat = TRUE; + Spin = FALSE; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_NONE; + Maximum = 99999; + Last = 255; + }; + ListBox LB_SIZEX + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "inches" ; > ; + < "cm" ; Default ; > ; + < "mm" ; > ; + < "points" ; > ; + < "pixels" ; > ; + }; + }; + FixedText FT_SIZEY + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Height:" ; + }; + MetricField MF_SIZEY + { + Hide = TRUE; + Border = TRUE; + Size = MAP_APPFONT ( 30, 12 ); + TabStop = TRUE; + Repeat = TRUE; + Spin = FALSE; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_NONE; + Maximum = 99999; + Last = 255 ; + }; + ListBox LB_SIZEY + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "inches" ; > ; + < "cm" ; Default ; > ; + < "mm" ; > ; + < "points" ; > ; + < "pixels" ; > ; + }; + }; + FixedText FT_RESOLUTION + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Resolution:" ; + }; + NumericField NF_RESOLUTION + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 99999; + Last = 255 ; + }; + ListBox LB_RESOLUTION + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "pixels/cm" ; > ; + < "pixels/inch" ; Default ; > ; + < "pixels/meter" ; > ; + }; + }; + FixedLine FL_COLOR_DEPTH + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Color Depth" ; + }; + ListBox LB_COLOR_DEPTH + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + }; + String STR_1BIT_THRESHOLD + { + Text [ en-US ] = "1 bit threshold"; + }; + String STR_1BIT_DITHERED + { + Text [ en-US ] = "1 bit dithered"; + }; + String STR_4BIT_GRAYSCALE + { + Text [ en-US ] = "4 bit grayscale"; + }; + String STR_4BIT_COLOR_PALETTE + { + Text [ en-US ] = "4 bit color"; + }; + String STR_8BIT_GRAYSCALE + { + Text [ en-US ] = "8 bit grayscale"; + }; + String STR_8BIT_COLOR_PALETTE + { + Text [ en-US ] = "8 bit color"; + }; + String STR_24BIT_TRUE_COLOR + { + Text [ en-US ] = "24 bit true color"; + }; + FixedLine FL_JPG_QUALITY + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Quality" ; + }; + FixedLine FL_COMPRESSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Compression" ; + }; + FixedLine FL_MODE + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Mode" ; + }; + FixedLine FL_PBM_OPTIONS + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "File Format" ; + }; + ScrollBar SB_COMPRESSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ) ; + VScroll = FALSE ; + HScroll = TRUE; + Drag = TRUE ; + }; + NumericField NF_COMPRESSION + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 99999; + Last = 255 ; + }; + FixedText FT_JPG_MIN + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "1 is minimum Quality and smallest file size." ; + }; + FixedText FT_JPG_MAX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "100 is maximum Quality and biggest file size." ; + }; + FixedText FT_PNG_MIN + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "0 is biggest file size and fastest loading." ; + }; + FixedText FT_PNG_MAX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "9 is smallest file size and slowest loading." ; + }; + CheckBox CB_JPG_PREVIEW + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Preview" ; + }; + CheckBox CB_INTERLACED + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Interlaced" ; + }; + CheckBox CB_RLE_ENCODING + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "RLE encoding" ; + }; + FixedLine FL_GIF_DRAWING_OBJECTS + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Drawing Objects" ; + }; + CheckBox CB_SAVE_TRANSPARENCY + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Save transparency" ; + }; + RadioButton RB_BINARY + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Binary" ; + }; + RadioButton RB_TEXT + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Text" ; + }; + FixedLine FL_EPS_PREVIEW + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Preview" ; + }; + CheckBox CB_EPS_PREVIEW_TIFF + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Image Preview (TIFF)" ; + }; + CheckBox CB_EPS_PREVIEW_EPSI + { + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Interchange (EPSI)" ; + }; + FixedLine FL_EPS_VERSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Version" ; + }; + RadioButton RB_EPS_LEVEL1 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Level 1" ; + }; + RadioButton RB_EPS_LEVEL2 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Level 2" ; + }; + FixedLine FL_EPS_COLOR_FORMAT + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Color format" ; + }; + RadioButton RB_EPS_COLOR_FORMAT1 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Color" ; + }; + RadioButton RB_EPS_COLOR_FORMAT2 + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Grayscale" ; + }; + RadioButton RB_EPS_COMPRESSION_LZW + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "LZW encoding" ; + }; + RadioButton RB_EPS_COMPRESSION_NONE + { + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "None" ; + }; + FixedLine FL_ESTIMATED_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + FixedText FT_ESTIMATED_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + String STR_ESTIMATED_SIZE_PIX_1 + { + Text [ en-US ] = "The picture needs about %1 KB of memory."; + }; + String STR_ESTIMATED_SIZE_PIX_2 + { + Text [ en-US ] = "The picture needs about %1 KB of memory,\n the file size is %2 KB."; + }; + String STR_ESTIMATED_SIZE_VEC + { + Text [ en-US ] = "The file size is %1 KB."; + }; + FixedLine FL_BUTTONS + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + FixedBitmap FB_JPG_PREVIEW + { + Hide = TRUE; + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + }; + ScrollBar SB_ZOOM + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = FALSE; + HScroll = TRUE; + Drag = TRUE; + MinPos = 5; + MaxPos = 100; + ThumbPos = 50; + }; + NumericField NF_ZOOM + { + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 3000; + Last = 255 ; + }; + ScrollBar SB_JPG_PREVIEW_HORZ + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = FALSE; + HScroll = TRUE; + Drag = TRUE; + MinPos = 0; + MaxPos = 100; + ThumbPos = 50; + }; + ScrollBar SB_JPG_PREVIEW_VERT + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = TRUE; + HScroll = FALSE; + Drag = TRUE; + MinPos = 0; + MaxPos = 100; + ThumbPos = 50; + }; + OKButton BTN_OK + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index db1f4c11cf94..65f51ce212f4 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -52,7 +52,7 @@ #include "xbmread.hxx" #include "xpmread.hxx" #include <svl/solar.hrc> -#include "strings.hrc" +#include <svtools/svtools.hrc> #include "sgffilt.hxx" #include "osl/module.hxx" #include <com/sun/star/uno/Reference.h> @@ -752,7 +752,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r if ( rGraphic.GetType() != GRAPHIC_NONE ) { - sal_Int32 nMode = rConfigItem.ReadInt32( String( ResId( KEY_MODE, *pResMgr ) ), -1 ); + sal_Int32 nMode = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ExportMode" ) ), -1 ); if ( nMode == -1 ) // the property is not there, this is possible, if the graphic filter { // is called via UnoGraphicExporter and not from a graphic export Dialog @@ -782,7 +782,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r Bitmap aBitmap( rGraphic.GetBitmap() ); MapMode aMap( MAP_100TH_INCH ); - sal_Int32 nDPI = rConfigItem.ReadInt32( String( ResId( KEY_RES, *pResMgr ) ), 75 ); + sal_Int32 nDPI = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), 75 ); Fraction aFrac( 1, Min( Max( nDPI, sal_Int32( 75 ) ), sal_Int32( 600 ) ) ); aMap.SetScaleX( aFrac ); @@ -806,7 +806,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r else aGraphic = rGraphic; - sal_Int32 nColors = rConfigItem.ReadInt32( String( ResId( KEY_COLORS, *pResMgr ) ), 0 ); // #92767# + sal_Int32 nColors = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 ); // #92767# if ( nColors ) // graphic conversion necessary ? { BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); @@ -1771,7 +1771,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat aBmp = aGraphic.GetBitmap(); } ResMgr* pResMgr = CREATERESMGR( svt ); - sal_Bool bRleCoding = aConfigItem.ReadBool( String( ResId( KEY_RLE_CODING, *pResMgr ) ), sal_True ); + sal_Bool bRleCoding = aConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ); // Wollen wir RLE-Kodiert speichern? aBmp.Write( rOStm, bRleCoding ); delete pResMgr; diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk index 272bb9a76b03..11d35150bda8 100644 --- a/svtools/source/filter.vcl/filter/makefile.mk +++ b/svtools/source/filter.vcl/filter/makefile.mk @@ -41,16 +41,11 @@ SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- SRS1NAME=$(TARGET) -SRC1FILES= strings.src \ - dlgexpor.src \ - dlgepng.src \ - dlgejpg.src +SRC1FILES=exportdialog.src SLOFILES= $(SLO)$/filter.obj \ $(SLO)$/filter2.obj \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ + $(SLO)$/exportdialog.obj \ $(SLO)$/sgfbram.obj \ $(SLO)$/sgvmain.obj \ $(SLO)$/sgvtext.obj \ @@ -59,28 +54,26 @@ SLOFILES= $(SLO)$/filter.obj \ $(SLO)$/FilterConfigCache.obj \ $(SLO)$/SvFilterOptionsDialog.obj +EXCEPTIONSFILES= $(SLO)$/exportdialog.obj + EXCEPTIONSNOOPTFILES= $(SLO)$/filter.obj \ $(SLO)$/FilterConfigItem.obj \ $(SLO)$/FilterConfigCache.obj \ $(SLO)$/SvFilterOptionsDialog.obj LIB1TARGET= $(SLB)$/$(TARGET).uno.lib -LIB1OBJFILES= \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ - $(SLO)$/SvFilterOptionsDialog.obj +LIB1OBJFILES= $(SLO)$/exportdialog.obj \ + $(SLO)$/SvFilterOptionsDialog.obj LIB2TARGET= $(SLB)$/$(TARGET).lib -LIB2OBJFILES= \ - $(SLO)$/filter.obj \ - $(SLO)$/filter2.obj \ - $(SLO)$/sgfbram.obj \ - $(SLO)$/sgvmain.obj \ - $(SLO)$/sgvtext.obj \ - $(SLO)$/sgvspln.obj \ - $(SLO)$/FilterConfigItem.obj \ - $(SLO)$/FilterConfigCache.obj +LIB2OBJFILES= $(SLO)$/filter.obj \ + $(SLO)$/filter2.obj \ + $(SLO)$/sgfbram.obj \ + $(SLO)$/sgvmain.obj \ + $(SLO)$/sgvtext.obj \ + $(SLO)$/sgvspln.obj \ + $(SLO)$/FilterConfigItem.obj \ + $(SLO)$/FilterConfigCache.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc deleted file mode 100644 index 0eea67fb2338..000000000000 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> diff --git a/svtools/source/filter.vcl/filter/strings.src b/svtools/source/filter.vcl/filter/strings.src deleted file mode 100644 index 60e628ee0b5c..000000000000 --- a/svtools/source/filter.vcl/filter/strings.src +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "strings.hrc" - -String EXPORT_DIALOG_TITLE -{ - Text [ en-US ] = " Options" ; -}; - -String KEY_MODE -{ - Text = "ExportMode" ; -}; - -String KEY_RES -{ - Text = "Resolution" ; -}; - -String KEY_SIZE -{ - Text = "Size" ; -}; - -String KEY_COLORS -{ - Text = "Color" ; -}; - -String KEY_RLE_CODING -{ - Text = "RLE_Coding" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index fbf95406a63a..f1674dcd7d4a 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -231,19 +231,19 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co if( ( 0 == rResourceURL.getToken( 0, '/', nIndex ).compareToAscii( "private:standardimage" ) ) ) { rtl::OUString sImageName( rResourceURL.copy( nIndex ) ); - if ( sImageName.compareToAscii( "info" ) ) + if ( sImageName.equalsAscii( "info" ) ) { xRet = InfoBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.compareToAscii( "warning" ) ) + else if ( sImageName.equalsAscii( "warning" ) ) { xRet = WarningBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.compareToAscii( "error" ) ) + else if ( sImageName.equalsAscii( "error" ) ) { xRet = ErrorBox::GetStandardImage().GetXGraphic(); } - else if ( sImageName.compareToAscii( "query" ) ) + else if ( sImageName.equalsAscii( "query" ) ) { xRet = QueryBox::GetStandardImage().GetXGraphic(); } diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx index ad8f7a7562d3..f6a58ad17efe 100644 --- a/svtools/source/table/defaultinputhandler.cxx +++ b/svtools/source/table/defaultinputhandler.cxx @@ -173,6 +173,7 @@ namespace svt { namespace table if ( ( pActions->nKeyCode == nKeyCode ) && ( pActions->nKeyModifier == rKeyCode.GetAllModifier() ) ) { bHandled = _rControl.dispatchAction( pActions->eAction ); + bHandled = true; // always handled issue #i114340 break; } } diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index e2e1ce5353fe..bbd7f6829369 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -45,7 +45,6 @@ namespace svt { namespace table TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl ) :Window( &_rTableControl.getAntiImpl() ) ,m_rTableControl ( _rTableControl ) - ,m_nRowAlreadySelected( -1 ) { // by default, use the background as determined by the style settings const Color aWindowColor( GetSettings().GetStyleSettings().GetFieldColor() ); @@ -110,15 +109,17 @@ namespace svt { namespace table { Point aPoint = rMEvt.GetPosPixel(); RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint); + std::vector<RowPos> selectedRows(m_rTableControl.getSelectedRows()); if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) ) Window::MouseButtonDown( rMEvt ); else { if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION) { - if( m_nRowAlreadySelected != nCurRow ) + bool found = std::find(selectedRows.begin(),selectedRows.end(), nCurRow) != selectedRows.end(); + + if( !found ) { - m_nRowAlreadySelected = nCurRow; m_aSelectHdl.Call( NULL ); } } diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 7fb1a007960f..d1ea854cce61 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -1322,6 +1322,21 @@ void TreeControlPeer::setProperty( const ::rtl::OUString& PropertyName, const An switch( GetPropertyId( PropertyName ) ) { + case BASEPROPERTY_HIDEINACTIVESELECTION: + { + sal_Bool bEnabled = sal_False; + if ( aValue >>= bEnabled ) + { + WinBits nStyle = rTree.GetWindowBits(); + if ( bEnabled ) + nStyle |= WB_HIDESELECTION; + else + nStyle &= ~WB_HIDESELECTION; + rTree.SetWindowBits( nStyle ); + } + } + break; + case BASEPROPERTY_TREE_SELECTIONTYPE: { SelectionType eSelectionType; @@ -1412,6 +1427,9 @@ Any TreeControlPeer::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru UnoTreeListBoxImpl& rTree = getTreeListBoxOrThrow(); switch(nPropId) { + case BASEPROPERTY_HIDEINACTIVESELECTION: + return Any( ( rTree.GetWindowBits() & WB_HIDESELECTION ) != 0 ? sal_True : sal_False ); + case BASEPROPERTY_TREE_SELECTIONTYPE: { SelectionType eSelectionType; diff --git a/svtools/source/uno/wizard/unowizard.cxx b/svtools/source/uno/wizard/unowizard.cxx index 9440c0e69f26..147b11aceb11 100644 --- a/svtools/source/uno/wizard/unowizard.cxx +++ b/svtools/source/uno/wizard/unowizard.cxx @@ -414,7 +414,7 @@ namespace svt { namespace uno ::osl::MutexGuard aGuard( m_aMutex ); WizardShell* pWizardImpl = dynamic_cast< WizardShell* >( m_pDialog ); - ENSURE_OR_RETURN_FALSE( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!" ); + ENSURE_OR_RETURN( pWizardImpl, "Wizard::getCurrentPage: invalid dialog implementation!", Reference< XWizardPage >() ); return pWizardImpl->getCurrentWizardPage(); } |