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

Caolán McNamara caolanm at redhat.com
Wed Nov 15 09:02:38 UTC 2017


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

New commits:
commit 74030e2aebb68218d829724329744e6992d6543b
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/44729
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
index 5eb68ddac0e1..ec85124980f7 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 d6732961b804..cdaff02db50a 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -294,9 +294,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