Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2118

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/18/2118/1

Resolved :  FILESAVE save as pptx discard crop information

Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb
---
M oox/inc/oox/export/drawingml.hxx
M oox/source/export/drawingml.cxx
M oox/source/export/shapes.cxx
3 files changed, 53 insertions(+), 0 deletions(-)



diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 6198ec6..5dc79b0 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -106,6 +106,7 @@
     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 >, 
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 8389b3a..5230c54 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -69,6 +69,7 @@
 #include <editeng/svxenum.hxx>
 #include <svx/unoapi.hxx>
 #include <svx/svdoashp.hxx>
+#include <com/sun/star/text/GraphicCrop.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
@@ -605,6 +606,51 @@
     }
 }
 
+
+void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, OUString& rURL )
+{
+    
+    Size aOriginalSize;
+    const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
+
+        rtl::OString aURLBS(rtl::OUStringToOString(rURL, RTL_TEXTENCODING_UTF8));
+
+        sal_Int32 index = aURLBS.indexOfL(RTL_CONSTASCII_STRINGPARAM(aURLBegin));
+
+        if ( index != -1 )
+        {
+            DBG(printf ("begin: %ld %s\n", long( sizeof( aURLBegin ) ), USS( rURL ) + 
RTL_CONSTASCII_LENGTH( aURLBegin ) ));
+            GraphicObject aGraphic = GraphicObject( aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)) 
);
+
+            aOriginalSize = aGraphic.GetPrefSize();
+        }
+
+    bool bCrop,IsCropped=true;
+    ::com::sun::star::text::GraphicCrop aGraphicCropStruct;    
+
+    if ( ( bCrop= GetProperty( rXPropSet, "GraphicCrop"  ) ) )
+     {      
+        mAny >>= aGraphicCropStruct; 
+        
+        /* element <a:srcRect> should not be written into an xml file if cropping is NOT performed 
on an image. 
+           IsCropped=false specifies this condition. */
+        if( (0 == aGraphicCropStruct.Left) && (0 == aGraphicCropStruct.Top) && (0 == 
aGraphicCropStruct.Right) && (0 == aGraphicCropStruct.Bottom) )
+        {    
+            IsCropped=false;
+        }    
+        else
+        {    
+            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 41d505a..f9e6d8d5 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -873,6 +873,12 @@
 
     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;

-- 
To view, visit https://gerrit.libreoffice.org/2118
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: pallavi jadhav <pallavi.jadhav@synerzip.com>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.