summaryrefslogtreecommitdiff
path: root/sw/source/filter/html/htmltab.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/filter/html/htmltab.cxx')
-rw-r--r--sw/source/filter/html/htmltab.cxx53
1 files changed, 45 insertions, 8 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index dbe5a5b7429b..74a2c0951c98 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -5033,19 +5033,13 @@ namespace
};
}
-void SwHTMLParser::DeleteSection(SwStartNode* pSttNd)
+void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const SwNodeIndex& rPtNdIdx)
{
- //if section to be deleted contains a pending m_pMarquee, it will be deleted
- //so clear m_pMarquee pointer if that's the case
- SwFrameFormat* pObjectFormat = m_pMarquee ? ::FindFrameFormat(m_pMarquee) : nullptr;
- FrameDeleteWatch aWatch(pObjectFormat);
-
//similarly for footnotes
if (m_pFootEndNoteImpl)
{
- SwNodeIndex aSttIdx(*pSttNd), aEndIdx(*pSttNd->EndOfSectionNode());
m_pFootEndNoteImpl->aTextFootnotes.erase(std::remove_if(m_pFootEndNoteImpl->aTextFootnotes.begin(),
- m_pFootEndNoteImpl->aTextFootnotes.end(), IndexInRange(aSttIdx, aEndIdx)), m_pFootEndNoteImpl->aTextFootnotes.end());
+ m_pFootEndNoteImpl->aTextFootnotes.end(), IndexInRange(rMkNdIdx, rPtNdIdx)), m_pFootEndNoteImpl->aTextFootnotes.end());
if (m_pFootEndNoteImpl->aTextFootnotes.empty())
{
delete m_pFootEndNoteImpl;
@@ -5053,6 +5047,49 @@ void SwHTMLParser::DeleteSection(SwStartNode* pSttNd)
}
}
+ //follow DelFlyInRange pattern here
+ const bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
+
+ SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
+ SwFrameFormats& rTable = *pDoc->GetSpzFrameFormats();
+ for ( auto i = rTable.size(); i; )
+ {
+ SwFrameFormat *pFormat = rTable[--i];
+ const SwFormatAnchor &rAnch = pFormat->GetAnchor();
+ SwPosition const*const pAPos = rAnch.GetContentAnchor();
+ if (pAPos &&
+ ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
+ (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)) &&
+ ( bDelFwrd
+ ? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
+ : rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx ))
+ {
+ if( rPtNdIdx != pAPos->nNode )
+ {
+ // If the Fly is deleted, all Flys in its content have to be deleted too.
+ const SwFormatContent &rContent = pFormat->GetContent();
+ // But only fly formats own their content, not draw formats.
+ if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
+ {
+ ClearFootnotesInRange(*rContent.GetContentIdx(),
+ SwNodeIndex(*rContent.GetContentIdx()->GetNode().EndOfSectionNode()));
+ }
+ }
+ }
+ }
+}
+
+void SwHTMLParser::DeleteSection(SwStartNode* pSttNd)
+{
+ //if section to be deleted contains a pending m_pMarquee, it will be deleted
+ //so clear m_pMarquee pointer if that's the case
+ SwFrameFormat* pObjectFormat = m_pMarquee ? ::FindFrameFormat(m_pMarquee) : nullptr;
+ FrameDeleteWatch aWatch(pObjectFormat);
+
+ //similarly for footnotes
+ SwNodeIndex aSttIdx(*pSttNd), aEndIdx(*pSttNd->EndOfSectionNode());
+ ClearFootnotesInRange(aSttIdx, aEndIdx);
+
m_xDoc->getIDocumentContentOperations().DeleteSection(pSttNd);
if (pObjectFormat)