diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-14 16:51:56 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-11-22 16:53:54 +0100 |
commit | f2eb40825cf66a0e01bb94171d7b0cbe86daa3f2 (patch) | |
tree | 899bfe8483cce307882a292ac904d4f5ac01e784 | |
parent | 1c93732e98c4ce1182a132eef416adbf6ae1fffa (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/44730
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@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 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 |