[Libreoffice-commits] core.git: 5 commits - include/oox oox/source sd/qa

Muthu Subramanian sumuthu at collabora.com
Thu Mar 27 01:05:42 PDT 2014


 include/oox/drawingml/textbodyproperties.hxx       |    1 
 oox/source/drawingml/textbodyproperties.cxx        |    4 -
 oox/source/drawingml/textbodypropertiescontext.cxx |   10 +---
 oox/source/drawingml/transform2dcontext.cxx        |    3 -
 sd/qa/unit/data/pptx/n862510_2.pptx                |binary
 sd/qa/unit/data/pptx/n862510_3.pptx                |binary
 sd/qa/unit/import-tests.cxx                        |   44 +++++++++++++++++++++
 7 files changed, 53 insertions(+), 9 deletions(-)

New commits:
commit b566aa7f16bf5ec389f27f4b7a9c9872fffc3d69
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Mar 26 16:28:23 2014 +0530

    Add unit test for left spacing (anchorCtr)
    
    Change-Id: I8fa347497c9509285c5f0422c618efcb360dbd34

diff --git a/sd/qa/unit/data/pptx/n862510_3.pptx b/sd/qa/unit/data/pptx/n862510_3.pptx
new file mode 100644
index 0000000..cf0b7b5
Binary files /dev/null and b/sd/qa/unit/data/pptx/n862510_3.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 30e5910..382fe69 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -19,6 +19,7 @@
 #include <editeng/fontitem.hxx>
 #include <editeng/wghtitem.hxx>
 #include <editeng/numitem.hxx>
+#include <editeng/lrspitem.hxx>
 #include <rsc/rscsfx.hxx>
 
 #include <svx/svdotext.hxx>
@@ -64,6 +65,7 @@ public:
     void testStrictOOXML();
     void testN862510_1();
     void testN862510_2();
+    void testN862510_3();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -83,6 +85,7 @@ public:
     CPPUNIT_TEST(testStrictOOXML);
     CPPUNIT_TEST(testN862510_1);
     CPPUNIT_TEST(testN862510_2);
+    CPPUNIT_TEST(testN862510_3);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -284,6 +287,25 @@ void SdFiltersTest::testN862510_2()
     }
 }
 
+void SdFiltersTest::testN862510_3()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_3.pptx") );
+    CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+    CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() );
+
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+    const SdrPage *pPage = pDoc->GetPage( 1 );
+    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+    {
+        SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 1 ) );
+        CPPUNIT_ASSERT( pGrpObj );
+        SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) );
+        CPPUNIT_ASSERT( pObj );
+        CPPUNIT_ASSERT_MESSAGE( "Left Spacing is wrong! check attribute anchorCtr", pObj->GetTextLeftDistance() < 30);
+    }
+}
+
 void SdFiltersTest::testN828390()
 {
     bool bPassed = false;
commit 31b8ce1153bb513613cc7b9cc755b2b4abe4852c
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Mar 26 16:26:08 2014 +0530

    Add unit test for text rotation.
    
    Change-Id: Iba4e002c461f00807f277e6032afcdaaf25ea4a2

diff --git a/sd/qa/unit/data/pptx/n862510_2.pptx b/sd/qa/unit/data/pptx/n862510_2.pptx
new file mode 100644
index 0000000..b46cea5
Binary files /dev/null and b/sd/qa/unit/data/pptx/n862510_2.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8ea16b5..30e5910 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -23,6 +23,7 @@
 
 #include <svx/svdotext.hxx>
 #include <svx/svdoashp.hxx>
+#include <svx/svdogrp.hxx>
 #include <animations/animationnodehelper.hxx>
 
 #include <com/sun/star/drawing/XDrawPage.hpp>
@@ -62,6 +63,7 @@ public:
     void testFdo72998();
     void testStrictOOXML();
     void testN862510_1();
+    void testN862510_2();
 
     CPPUNIT_TEST_SUITE(SdFiltersTest);
     CPPUNIT_TEST(testDocumentLayout);
@@ -80,6 +82,7 @@ public:
     CPPUNIT_TEST(testFdo72998);
     CPPUNIT_TEST(testStrictOOXML);
     CPPUNIT_TEST(testN862510_1);
+    CPPUNIT_TEST(testN862510_2);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -262,6 +265,25 @@ void SdFiltersTest::testN862510_1()
     }
 }
 
+void SdFiltersTest::testN862510_2()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_2.pptx") );
+    CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+    CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() );
+
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+    const SdrPage *pPage = pDoc->GetPage(1);
+    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+    {
+        SdrObjGroup *pGrpObj = dynamic_cast<SdrObjGroup *>( pPage->GetObj( 1 ) );
+        CPPUNIT_ASSERT( pGrpObj );
+        SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>( pGrpObj->GetSubList()->GetObj( 0 ) );
+        CPPUNIT_ASSERT( pObj );
+        CPPUNIT_ASSERT_MESSAGE( "Wrong Text Rotation!", pObj->GetExtraTextRotation( true ) == 90 );
+    }
+}
+
 void SdFiltersTest::testN828390()
 {
     bool bPassed = false;
commit 45c91575e7b528119124f574cb78e21158fc2652
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Mar 26 16:14:58 2014 +0530

    Cleanup a bit.
    
    Change-Id: I90e15389a76c34d6b7a93cf8b059029795ef8891

diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index a26c75c..5370350 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -57,11 +57,9 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper& rPa
     }
 
     mrTextBodyProp.mbAnchorCtr = rAttribs.getBool( XML_anchorCtr, false );
-    if( rAttribs.hasAttribute( XML_anchorCtr ) ) {
-        if( mrTextBodyProp.mbAnchorCtr )
-            mrTextBodyProp.maPropertyMap.setProperty( PROP_TextHorizontalAdjust,
-                TextHorizontalAdjust_CENTER);
-    }
+    if( mrTextBodyProp.mbAnchorCtr )
+        mrTextBodyProp.maPropertyMap.setProperty( PROP_TextHorizontalAdjust, TextHorizontalAdjust_CENTER );
+
 //   bool bCompatLineSpacing = rAttribs.getBool( XML_compatLnSpc, false );
 //   bool bForceAA = rAttribs.getBool( XML_forceAA, false );
 //   bool bFromWordArt = rAttribs.getBool( XML_fromWordArt, false );
commit c17eb67460293fbe72ffa8e80cd10743df493afa
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Mar 26 16:13:08 2014 +0530

    n#862510: anchorCtr controls the anchoring as well.
    
    Change-Id: Ib244d89a9f7d400b3891d477314cd5f0193552e0

diff --git a/include/oox/drawingml/textbodyproperties.hxx b/include/oox/drawingml/textbodyproperties.hxx
index 4a3be87..e6f23d7 100644
--- a/include/oox/drawingml/textbodyproperties.hxx
+++ b/include/oox/drawingml/textbodyproperties.hxx
@@ -34,6 +34,7 @@ struct TextBodyProperties
 {
     PropertyMap                                     maPropertyMap;
     OptValue< sal_Int32 >                           moRotation;
+    bool                                            mbAnchorCtr;
     OptValue< sal_Int32 >                           moVert;
     boost::optional< sal_Int32 >                    moInsets[4];
     boost::optional< sal_Int32 >                    moTextOffX;
diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx
index fadeb93..73fb9fb 100644
--- a/oox/source/drawingml/textbodyproperties.cxx
+++ b/oox/source/drawingml/textbodyproperties.cxx
@@ -80,8 +80,8 @@ void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation )
         // Hack for n#760986
         // TODO: Preferred method would be to have a textbox on top
         // of the shape and the place it according to the (off,ext)
-        if( nOff == 0 && moTextOffX ) nVal = *moTextOffX;
-        if( nOff == 1 && moTextOffY ) nVal = *moTextOffY;
+        if( nOff == 0 && moTextOffX && mbAnchorCtr ) nVal = *moTextOffX;
+        if( nOff == 1 && moTextOffY && mbAnchorCtr ) nVal = *moTextOffY;
         if( nVal < 0 ) nVal = 0;
 
         if( moInsets[i] )
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index 1d707d7..a26c75c 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -56,9 +56,9 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper& rPa
             mrTextBodyProp.moInsets[i] = GetCoordinate( sValue );
     }
 
-    bool bAnchorCenter = rAttribs.getBool( XML_anchorCtr, false );
+    mrTextBodyProp.mbAnchorCtr = rAttribs.getBool( XML_anchorCtr, false );
     if( rAttribs.hasAttribute( XML_anchorCtr ) ) {
-        if( bAnchorCenter )
+        if( mrTextBodyProp.mbAnchorCtr )
             mrTextBodyProp.maPropertyMap.setProperty( PROP_TextHorizontalAdjust,
                 TextHorizontalAdjust_CENTER);
     }
commit e3e12b1d1e36e1a0d4fc4c6423b584d677693897
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Wed Mar 26 16:05:44 2014 +0530

    n#862510: Fix text rotation.
    
    Fix breaks document in n#783433 - the one there is
    damaged - resaving it using mso 2010 should fix the problem there.
    
    Change-Id: Ib2ee7ab20489d716dc189ac6810d705763a16476

diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx
index e232b4d..0a1bb59 100644
--- a/oox/source/drawingml/transform2dcontext.cxx
+++ b/oox/source/drawingml/transform2dcontext.cxx
@@ -46,7 +46,8 @@ Transform2DContext::Transform2DContext( ContextHandler2Helper& rParent, const At
     }
     else
     {
-        mrShape.getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot );
+        if( rAttribs.hasAttribute( XML_rot ) )
+            mrShape.getTextBody()->getTextProperties().moRotation = -rAttribs.getInteger( XML_rot ).get();
     }
 }
 


More information about the Libreoffice-commits mailing list