[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Jan 7 07:49:27 PST 2015


 sw/qa/extras/odfexport/data/fdo86963.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx     |    8 ++++++++
 sw/source/core/unocore/unodraw.cxx       |   13 +++++++++++--
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 6227d2fc60564f847a2ffd0b5f5d0fbf8ab49f5b
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.
    
    (cherry picked from commit 97952280f0adbe195e6a2e0bab8a21a7e352a721)
    
    Conflicts:
    	sw/qa/extras/odfexport/odfexport.cxx
    
    Change-Id: I9c4097154130cd04f6ab2f2082abafc1d4333872
    Reviewed-on: https://gerrit.libreoffice.org/13562
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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 d7360ba..2a706b6 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -451,6 +451,14 @@ DECLARE_ODFEXPORT_TEST(testImageWithSpecialID, "document_with_two_images_with_sp
     }
 }
 
+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 b4e0b0b..9b09764 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1764,8 +1764,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);
+                        }
                     }
                 }
             }


More information about the Libreoffice-commits mailing list