diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-14 16:51:56 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-15 10:01:16 +0100 |
commit | 74030e2aebb68218d829724329744e6992d6543b (patch) | |
tree | b208c14eeaa0e8f0534aa2570147e2a8f817d3ae | |
parent | 43e17bdc6efa2ddcb1f08e5d2c40e7dc636c80fb (diff) |
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@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/inc/unodraw.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 20 |
2 files changed, 19 insertions, 2 deletions
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 |