diff options
Diffstat (limited to 'sw/source/core/unocore/unotext.cxx')
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index cd31f50fcd42..25dd3f5639d8 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1658,14 +1658,21 @@ SwXText::convertToTextFrame( // see if there are frames already anchored to this node std::set<OUString> aAnchoredFrames; + // for shapes, we have to work with the SdrObjects, as unique name is not guaranteed in their frame format + std::set<const SdrObject*> aAnchoredShapes; for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i) { SwFrmFmt* pFrmFmt = (*m_pImpl->m_pDoc->GetSpzFrmFmts())[i]; const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor(); - if (FLY_AT_PARA == rAnchor.GetAnchorId() && + if ((FLY_AT_PARA == rAnchor.GetAnchorId() || FLY_AT_CHAR == rAnchor.GetAnchorId()) && aStartPam.Start()->nNode.GetIndex() <= rAnchor.GetCntntAnchor()->nNode.GetIndex() && aStartPam.End()->nNode.GetIndex() >= rAnchor.GetCntntAnchor()->nNode.GetIndex()) - aAnchoredFrames.insert(pFrmFmt->GetName()); + { + if (pFrmFmt->Which() == RES_DRAWFRMFMT) + aAnchoredShapes.insert(pFrmFmt->FindSdrObject()); + else + aAnchoredFrames.insert(pFrmFmt->GetName()); + } } SwXTextFrame *const pNewFrame = new SwXTextFrame(m_pImpl->m_pDoc); @@ -1708,7 +1715,7 @@ SwXText::convertToTextFrame( for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i) { SwFrmFmt* pFrmFmt = (*m_pImpl->m_pDoc->GetSpzFrmFmts())[i]; - if( aAnchoredFrames.find( pFrmFmt->GetName() ) != aAnchoredFrames.end() ) + if (aAnchoredFrames.find(pFrmFmt->GetName()) != aAnchoredFrames.end() || aAnchoredShapes.find(pFrmFmt->FindSdrObject()) != aAnchoredShapes.end()) { // copy the anchor to the next paragraph SwFmtAnchor aAnchor(pFrmFmt->GetAnchor()); |