diff options
Diffstat (limited to 'sw/source/core/unocore/unodraw.cxx')
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 698b05b5ac96..fed0e4a55d6a 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -708,19 +708,18 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape) pTemp = pPam.get(); UnoActionContext aAction(pDoc); pDoc->getIDocumentContentOperations().InsertDrawObj( *pTemp, *pObj, aSet ); + + if (pSvxShape->GetSdrObject()->GetName().isEmpty()) + { + pSvxShape->GetSdrObject()->SetName(pDoc->GetUniqueShapeName()); + } + SwFrameFormat* pFormat = ::FindFrameFormat( pObj ); if (pFormat) { if (pFormat->GetName().isEmpty()) { - if (pSvxShape->GetSdrObject()->GetName().isEmpty()) - { - pFormat->SetName(pDoc->GetUniqueShapeName(), false); - } - else - { - pFormat->SetName(pSvxShape->GetSdrObject()->GetName(), false); - } + pFormat->SetName(pSvxShape->GetSdrObject()->GetName(), false); } pShape->SetFrameFormat(pFormat); } @@ -753,7 +752,7 @@ uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference< { // mark and return MarkList const SdrMarkList& rMarkList = pPage->PreGroup(xShapes); - if ( rMarkList.GetMarkCount() > 1 ) + if ( rMarkList.GetMarkCount() > 0 ) { for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i) { @@ -2069,7 +2068,14 @@ uno::Reference< text::XTextRange > SwXShape::getAnchor() (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum())) { const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor()); - aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr); + if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA) + { // ensure that SwXTextRange has SwIndex + aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), SwPosition(rPos.nNode), nullptr); + } + else + { + aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr); + } } } else |