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

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 19 13:55:10 PST 2014


 sw/qa/extras/inc/swmodeltestbase.hxx     |    3 +++
 sw/qa/extras/odfexport/data/fdo86963.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx     |   10 ++++++++--
 sw/source/core/unocore/unodraw.cxx       |   13 +++++++++++--
 4 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 97952280f0adbe195e6a2e0bab8a21a7e352a721
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 19 19:41:52 2014 +0100

    fdo#86963 SwXShape: don't ask SwTextBoxHelper for ZOrder of child shapes
    
    Regression from commit 01fc08c0b5c57fef8ad3755672f4266d85e849a5
    (fdo#85554 SwXShape: fix getting ZOrder property when doc contains
    TextBoxes, 2014-11-20), the problem was that we returned wrong ZOrder of
    shapes inside group shapes.
    
    In SwXShape::getPropertyValue(), pObj points to the Writer-interfacing
    outermost group shape in case of shapes contained by group shapes, while
    GetSvxShape() gives access to the real shape. Given that TextBoxes are
    only possible at the highest level (and not inside group shapes), just
    check if the two pointers are the same: when not, then no need to
    convert anything.
    
    With this, child shapes get back their original ZOrder -- before in case
    the group shape had ZOrder=0, all its child shapes had ZOrder=0 as well.
    
    Change-Id: I9c4097154130cd04f6ab2f2082abafc1d4333872

diff --git a/sw/qa/extras/odfexport/data/fdo86963.odt b/sw/qa/extras/odfexport/data/fdo86963.odt
new file mode 100644
index 0000000..72896e1
Binary files /dev/null and b/sw/qa/extras/odfexport/data/fdo86963.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 9c2200c..41c4ed9 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -402,6 +402,14 @@ DECLARE_ODFEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.odt")
     CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString());
 }
 
+DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt")
+{
+    // Export of this document failed with beans::UnknownPropertyException.
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index ea0dd24..3cc240e 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1763,8 +1763,17 @@ uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
                     const SdrObject* pObj = pFmt->FindRealSdrObject();
                     if (pObj)
                     {
-                        std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pFmt->GetDoc());
-                        aRet <<= SwTextBoxHelper::getOrdNum(pObj, aTextBoxes);
+                        bool bConvert = true;
+                        if (SvxShape* pSvxShape = GetSvxShape())
+                            // In case of group shapes, pSvxShape points to the child shape, while pObj points to the outermost group shape.
+                            if (pSvxShape->GetSdrObject() != pObj)
+                                // Textboxes are not expected inside group shapes, so no conversion is necessary there.
+                                bConvert = false;
+                        if (bConvert)
+                        {
+                            std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pFmt->GetDoc());
+                            aRet <<= SwTextBoxHelper::getOrdNum(pObj, aTextBoxes);
+                        }
                     }
                 }
             }
commit cdb8d7a53e587819044f2b5ea43c6416909686b1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 19 22:31:11 2014 +0100

    CppunitTest_sw_odfexport: allow running a single testcase
    
    Change-Id: Iaaa3d8a4e8ddf419ecaf75dfa30d1b4a9bc984af

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 8e8dea8..30b642c 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -91,6 +91,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
 #define DECLARE_RTFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_ODFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
+#define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 // For testing during development of a test, you want to use
@@ -102,6 +103,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
 #define DECLARE_RTFEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_ODFIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
+#define DECLARE_ODFEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_WW8EXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 #undef DECLARE_OOXMLEXPORT_TEST
@@ -110,6 +112,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #define DECLARE_RTFEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #define DECLARE_ODFIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
+#define DECLARE_ODFEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #define DECLARE_WW8EXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #endif
 
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index dc0c928..9c2200c 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -35,8 +35,6 @@ public:
     }
 };
 
-#define DECLARE_ODFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
-
 DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt")
 {
     // See ooxmlexport's testFdo38244().


More information about the Libreoffice-commits mailing list