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

Umesh Kadam umesh.kadam at synerzip.com
Mon Aug 4 00:34:37 PDT 2014


 oox/source/vml/vmlshape.cxx                |   16 ++++++++++++++++
 sw/qa/extras/ooxmlimport/data/WordArt.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |   15 +++++++++++++++
 3 files changed, 31 insertions(+)

New commits:
commit ded5b1ecdef42fab84fa57ab504b4cc006a4df91
Author: Umesh Kadam <umesh.kadam at synerzip.com>
Date:   Fri Jul 18 13:02:19 2014 +0530

    fdo#78301 : Size of word-arts change during import.
    
    - Do not resize the fallback geometry for Word-Arts(VML), since the
      overlay geometry is constructed using the properties of the
      fallback geometry.
    - The resize autoshape to fit text attr of FontWork/Word-Art should
      always be false for the fallback geometry(the SdrObject).
    
    Change-Id: If8badb382c525875a07a0a9e6268cec036739001
    Reviewed-on: https://gerrit.libreoffice.org/10486
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index f98c717..842a65c 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -58,6 +58,9 @@
 #include "oox/vml/vmltextbox.hxx"
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/helper/containerhelper.hxx"
+#include "svx/EnhancedCustomShapeTypeNames.hxx"
+#include <svx/unoapi.hxx>
+#include <svx/svdoashp.hxx>
 
 using ::com::sun::star::beans::XPropertySet;
 using ::com::sun::star::uno::Any;
@@ -534,6 +537,19 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
     }
 
     Reference< XShape > xShape = mrDrawing.createAndInsertXShape( maService, rxShapes, aShapeRect );
+    SdrObject* pShape = GetSdrObjectFromXShape( xShape );
+    if( pShape && getShapeType() >= 0 )
+    {
+        OUString aShapeType;
+        aShapeType = EnhancedCustomShapeTypeNames::Get( static_cast< MSO_SPT >(getShapeType()) );
+        //The resize autoshape to fit text attr of FontWork/Word-Art should always be false
+        //for the fallback geometry.
+        if(aShapeType.startsWith("fontwork"))
+        {
+            pShape->SetMergedItem(SdrTextAutoGrowHeightItem(false));
+            pShape->SetMergedItem(SdrTextAutoGrowWidthItem(false));
+        }
+    }
     convertShapeProperties( xShape );
 
     // Handle left/right/top/bottom wrap distance.
diff --git a/sw/qa/extras/ooxmlimport/data/WordArt.docx b/sw/qa/extras/ooxmlimport/data/WordArt.docx
new file mode 100644
index 0000000..3960a15
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/WordArt.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index eca47da..371b303 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -982,6 +982,21 @@ DECLARE_OOXMLIMPORT_TEST(testN792778, "n792778.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(11684), xInnerShape->getPosition().Y);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testWordArtResizing, "WordArt.docx")
+{
+    /* The Word-Arts and watermarks were getting resized automatically, It was as if they were
+       getting glued to the fallback geometry(the sdrObj) and were getting bound to the font size.
+       The test-case esures the original height and width of the word-art is not changed while importing*/
+
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+
+    uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(10105), xShape->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(4755), xShape->getSize().Height);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testGroupshapeLine, "groupshape-line.docx")
 {
     /*


More information about the Libreoffice-commits mailing list