[Libreoffice-commits] core.git: oox/inc oox/source

Pallavi Jadhav pallavi.jadhav at synerzip.com
Wed Mar 6 00:26:37 PST 2013


 oox/inc/oox/export/drawingml.hxx |    1 +
 oox/source/export/drawingml.cxx  |   24 ++++++++++++++++++++++++
 oox/source/export/shapes.cxx     |    2 ++
 3 files changed, 27 insertions(+)

New commits:
commit 5d10a0180f5e9922ca197cdea00ee84bc4b2d313
Author: Pallavi Jadhav <pallavi.jadhav at synerzip.com>
Date:   Fri Feb 8 10:11:42 2013 +0530

    fdo#48735: Save crop information in PPTX.
    
    fdo#48735: Save crop information in PPTX.
    
    Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb

diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 6198ec6..09da104 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 d26002a..ead3ed2 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 89e6440..f26a527 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;


More information about the Libreoffice-commits mailing list