diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-03 12:29:21 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-03 18:36:21 +0000 |
commit | 38f2b8b3b16aab19a2564ec699d253d3dccecc3c (patch) | |
tree | a84fd69df94e7defb6958e12c96375b34f69d7b9 /sw/source/core/unocore/unotext.cxx | |
parent | 60a64d1807b075fb630774adf950612d71734171 (diff) |
tdf#88811 SwXText::convertToTextFrame: handle shapes anchored to us
Change-Id: Iedf8eacd37b8ed8e307a10e8ade32f53c7417c4a
Reviewed-on: https://gerrit.libreoffice.org/14306
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
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 63dafb435de9..52e73c1645fe 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1663,14 +1663,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) { const 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()); + } } const uno::Reference<text::XTextFrame> xNewFrame( @@ -1714,7 +1721,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()); |