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

Caolán McNamara caolanm at redhat.com
Wed Nov 22 15:54:19 UTC 2017


 sw/inc/unodraw.hxx                 |    1 +
 sw/source/core/unocore/unodraw.cxx |   20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit f2eb40825cf66a0e01bb94171d7b0cbe86daa3f2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 14 16:51:56 2017 +0000

    Resolves: tdf#113615 wrong SwXShape from three possibilities returned
    
    There is the group object itself and the two subobjects all registered
    with this SwFrameFormat and the right line is randomly returned
    instead of the wanted one.
    
    Its possibly the presence of working a11y under gtk3 causing it to be
    the only platform apparently with this trouble with a11y querying
    for details of the grouped object
    
    Change-Id: I4d1bd3f826b630dd7734eb1decaf0211cd896894
    Reviewed-on: https://gerrit.libreoffice.org/44730
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
index 123b4e771745..c824414c4859 100644
--- a/sw/inc/unodraw.hxx
+++ b/sw/inc/unodraw.hxx
@@ -127,6 +127,7 @@ class SwXShape : public SwXShapeBaseClass,
 {
     friend class SwXGroupShape;
     friend class SwXDrawPage;
+    friend class SwFmDrawPage;
 
     css::uno::Reference< css::uno::XAggregation > xShapeAgg;
     // reference to <XShape>, determined in the
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 4d9e3a29df3d..2e23d35e48e2 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -296,9 +296,25 @@ uno::Reference< uno::XInterface >   SwFmDrawPage::GetInterface( SdrObject* pObj
     if( pObj )
     {
         SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
-        SwXShape* pxShape = SwIterator<SwXShape,SwFormat>( *pFormat ).First();
-        if(pxShape)
+
+        SwIterator<SwXShape,SwFormat> aIter(*pFormat);
+        SwXShape* pxShape = aIter.First();
+        if (pxShape)
         {
+            //tdf#113615 when mapping from SdrObject to XShape via
+            //SwFrameFormat check all the SdrObjects belonging to this
+            //SwFrameFormat to find the right one. In the case of Grouped
+            //objects there can be both the group and the elements of the group
+            //registered here so the first one isn't necessarily the right one
+            while (SwXShape* pNext = aIter.Next())
+            {
+                SvxShape* pSvxShape = pNext->GetSvxShape();
+                if (pSvxShape && pSvxShape->GetSdrObject() == pObj)
+                {
+                    pxShape = pNext;
+                    break;
+                }
+            }
             xShape =  *static_cast<cppu::OWeakObject*>(pxShape);
         }
         else


More information about the Libreoffice-commits mailing list