diff options
author | sj <sj@openoffice.org> | 2010-08-19 18:12:04 +0200 |
---|---|---|
committer | sj <sj@openoffice.org> | 2010-08-19 18:12:04 +0200 |
commit | c86fd8453e7fc925cb8f0f8ffff7990896da71ec (patch) | |
tree | 4071350131c5eb542b46123fa3ff4ba8bb46cc67 /svtools | |
parent | 1352676b8173290c3aa828596e01bfe76ad5545a (diff) |
impress186: #i4499# added default resolution unit (metric/non-metric) depending to the tools/options setting
Diffstat (limited to 'svtools')
-rwxr-xr-x | svtools/source/filter.vcl/filter/exportdialog.cxx | 42 | ||||
-rwxr-xr-x | svtools/source/filter.vcl/filter/exportdialog.hxx | 4 |
2 files changed, 43 insertions, 3 deletions
diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx index 1e2c669afa33..36ce7b63c87d 100755 --- a/svtools/source/filter.vcl/filter/exportdialog.cxx +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -76,6 +76,7 @@ #define FORMAT_SVG 16 #define FORMAT_SVM 17 +#define UNIT_DEFAULT -1 #define UNIT_INCH 0 #define UNIT_CM 1 #define UNIT_MM 2 @@ -140,6 +141,33 @@ static MapUnit GetMapUnit( sal_Int32 nUnit ) 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 ) { @@ -166,6 +194,9 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( sal_Bool bUpd if ( nUnit < 0 ) nUnit = UNIT_CM; + if ( ( mnInitialResolutionUnit == UNIT_DEFAULT ) && ( nUnit == GetDefaultUnit() ) ) + nUnit = UNIT_DEFAULT; + // updating ui configuration if ( mbIsPixelFormat ) { @@ -627,6 +658,10 @@ ExportDialog::ExportDialog( FltCallDialogParameter& rPara, 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 " ) ) ); @@ -745,9 +780,10 @@ void ExportDialog::createSizeControls( vcl::RowOrColumn& rLayout ) xColumn->setMinimumSize( nIndex, aLbMax ); } - sal_Int32 nUnit = mbIsPixelFormat - ? mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), UNIT_PIXEL ) - : mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), UNIT_CM ); + sal_Int32 nUnit = mnInitialResolutionUnit; + if ( nUnit == UNIT_DEFAULT ) + nUnit = GetDefaultUnit(); + if ( !mbIsPixelFormat ) { maLbSizeX.RemoveEntry( UNIT_PIXEL ); // removing pixel diff --git a/svtools/source/filter.vcl/filter/exportdialog.hxx b/svtools/source/filter.vcl/filter/exportdialog.hxx index a9692e646746..20a9ac3ea832 100755 --- a/svtools/source/filter.vcl/filter/exportdialog.hxx +++ b/svtools/source/filter.vcl/filter/exportdialog.hxx @@ -156,6 +156,8 @@ private: 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 @@ -198,6 +200,8 @@ private: 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, |