diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/fillproperties.cxx | 8 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 8 | ||||
-rw-r--r-- | oox/source/helper/graphichelper.cxx | 7 |
3 files changed, 14 insertions, 9 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index d25f8bfb10a0..2c0d40f0ccd9 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -726,13 +726,13 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe { text::GraphicCrop aGraphCrop( 0, 0, 0, 0 ); if ( oClipRect.X1 ) - aGraphCrop.Left = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 ); + aGraphCrop.Left = rtl::math::round( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 ); if ( oClipRect.Y1 ) - aGraphCrop.Top = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 ); + aGraphCrop.Top = rtl::math::round( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 ); if ( oClipRect.X2 ) - aGraphCrop.Right = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 ); + aGraphCrop.Right = rtl::math::round( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 ); if ( oClipRect.Y2 ) - aGraphCrop.Bottom = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 ); + aGraphCrop.Bottom = rtl::math::round( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 ); rPropMap.setProperty(PROP_GraphicCrop, aGraphCrop); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index fcacb7a88c02..214652ddf462 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1063,10 +1063,10 @@ void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, const OUStrin if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 != aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) ) { mpFS->singleElementNS( XML_a, XML_srcRect, - XML_l, I32S(((aGraphicCropStruct.Left) * 100000) / aOriginalSize.Width()), - XML_t, I32S(((aGraphicCropStruct.Top) * 100000) / aOriginalSize.Height()), - XML_r, I32S(((aGraphicCropStruct.Right) * 100000) / aOriginalSize.Width()), - XML_b, I32S(((aGraphicCropStruct.Bottom) * 100000) / aOriginalSize.Height()), + XML_l, I32S(rtl::math::round(static_cast<double>(aGraphicCropStruct.Left) * 100000 / aOriginalSize.Width())), + XML_t, I32S(rtl::math::round(static_cast<double>(aGraphicCropStruct.Top) * 100000 / aOriginalSize.Height())), + XML_r, I32S(rtl::math::round(static_cast<double>(aGraphicCropStruct.Right) * 100000 / aOriginalSize.Width())), + XML_b, I32S(rtl::math::round(static_cast<double>(aGraphicCropStruct.Bottom) * 100000 / aOriginalSize.Height())), FSEND ); } } diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 0638ffe6350b..2714cf5d25f2 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -34,6 +34,8 @@ #include <osl/diagnose.h> #include <comphelper/seqstream.hxx> #include <vcl/wmf.hxx> +#include <vcl/svapp.hxx> +#include <tools/gen.hxx> #include "oox/helper/containerhelper.hxx" #include "oox/helper/propertyset.hxx" #include "oox/token/properties.hxx" @@ -113,7 +115,10 @@ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, c // get the metric of the output device OSL_ENSURE( xFrame.is(), "GraphicHelper::GraphicHelper - cannot get target frame" ); - maDeviceInfo.PixelPerMeterX = maDeviceInfo.PixelPerMeterY = 3500.0; // some default just in case + // some default just in case, 100 000 is 1 meter in MM100 + Size aDefault = Application::GetDefaultDevice()->LogicToPixel(Size(100000, 100000), MapMode(MAP_100TH_MM)); + maDeviceInfo.PixelPerMeterX = aDefault.Width(); + maDeviceInfo.PixelPerMeterY = aDefault.Height(); if( xFrame.is() ) try { Reference< awt::XDevice > xDevice( xFrame->getContainerWindow(), UNO_QUERY_THROW ); |