summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2013-02-08 10:11:42 +0530
committerJan Holesovsky <kendy@suse.cz>2013-03-06 09:22:36 +0100
commit5d10a0180f5e9922ca197cdea00ee84bc4b2d313 (patch)
treea07d9e006101dcc0d86c1f3bddf862cf7e010e93
parent4ceb66d86f508629bd663d16563809524398551e (diff)
fdo#48735: Save crop information in PPTX.
fdo#48735: Save crop information in PPTX. Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb
-rw-r--r--oox/inc/oox/export/drawingml.hxx1
-rw-r--r--oox/source/export/drawingml.cxx24
-rw-r--r--oox/source/export/shapes.cxx2
3 files changed, 27 insertions, 0 deletions
diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 6198ec608537..09da104d84e3 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -106,6 +106,7 @@ public:
void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace );
void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+ void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteStretch();
void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d26002af3d07..ead3ed2c490f 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -44,12 +44,14 @@
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextField.hpp>
@@ -83,6 +85,7 @@ using ::com::sun::star::beans::XPropertyState;
using ::com::sun::star::container::XEnumeration;
using ::com::sun::star::container::XEnumerationAccess;
using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::geometry::IntegerRectangle2D;
using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::style::LineSpacing;
using ::com::sun::star::text::XText;
@@ -604,6 +607,27 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, OUString sUR
}
}
+void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, const OUString& rURL )
+{
+ Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( rURL ).GetPrefSize() );
+
+ if ( GetProperty( rXPropSet, "GraphicCrop" ) )
+ {
+ ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+ mAny >>= aGraphicCropStruct;
+
+ 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()),
+ FSEND );
+ }
+ }
+}
+
void DrawingML::WriteStretch()
{
mpFS->startElementNS( XML_a, XML_stretch, FSEND );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 89e6440e47c7..f26a5278cb57 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -872,6 +872,8 @@ void ShapeExport::WriteGraphicObjectShapePart( Reference< XShape > xShape, const
WriteBlip( xShapeProps, sGraphicURL, pGraphic );
+ WriteSrcRect( xShapeProps, sGraphicURL );
+
// now we stretch always when we get pGraphic (when changing that
// behavior, test n#780830 for regression, where the OLE sheet might get tiled
bool bStretch = false;