summaryrefslogtreecommitdiff
path: root/oox/source/export/drawingml.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/export/drawingml.cxx')
-rw-r--r--oox/source/export/drawingml.cxx33
1 files changed, 24 insertions, 9 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d56077c5240a..0503a088faf7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1325,18 +1325,16 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
mpFS->endElementNS( XML_a , XML_pattFill );
}
-void DrawingML::WriteSrcRect( const Reference< XPropertySet >& rXPropSet, const OUString& rURL )
+void DrawingML::WriteGraphicCropProperties(uno::Reference<beans::XPropertySet> const & rXPropSet, Size const & rOriginalSize, MapMode const & rMapMode)
{
- GraphicObject aGraphicObject = GraphicObject::CreateGraphicObjectFromURL(rURL);
- Size aOriginalSize = aGraphicObject.GetPrefSize();
- const MapMode& rMapMode = aGraphicObject.GetPrefMapMode();
+ if (GetProperty(rXPropSet, "GraphicCrop"))
+ {
+ Size aOriginalSize(rOriginalSize);
- // GraphicCrop is in mm100, so in case the original size is in pixels, convert it over.
- if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
- aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, MapMode(MapUnit::Map100thMM));
+ // GraphicCrop is in mm100, so in case the original size is in pixels, convert it over.
+ if (rMapMode.GetMapUnit() == MapUnit::MapPixel)
+ aOriginalSize = Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, MapMode(MapUnit::Map100thMM));
- if ( GetProperty( rXPropSet, "GraphicCrop" ) )
- {
css::text::GraphicCrop aGraphicCropStruct;
mAny >>= aGraphicCropStruct;
@@ -1352,6 +1350,23 @@ void DrawingML::WriteSrcRect( const Reference< XPropertySet >& rXPropSet, const
}
}
+void DrawingML::WriteSrcRect(const uno::Reference<beans::XPropertySet>& rxPropertySet, const OUString& rURL)
+{
+ GraphicObject aGraphicObject = GraphicObject::CreateGraphicObjectFromURL(rURL);
+ Size aOriginalSize = aGraphicObject.GetPrefSize();
+ const MapMode& rMapMode = aGraphicObject.GetPrefMapMode();
+ WriteGraphicCropProperties(rxPropertySet, aOriginalSize, rMapMode);
+}
+
+void DrawingML::WriteSrcRectXGraphic(uno::Reference<beans::XPropertySet> const & rxPropertySet,
+ uno::Reference<graphic::XGraphic> const & rxGraphic)
+{
+ Graphic aGraphic(rxGraphic);
+ Size aOriginalSize = aGraphic.GetPrefSize();
+ const MapMode& rMapMode = aGraphic.GetPrefMapMode();
+ WriteGraphicCropProperties(rxPropertySet, aOriginalSize, rMapMode);
+}
+
void DrawingML::WriteStretch( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& rURL )
{
mpFS->startElementNS( XML_a, XML_stretch, FSEND );