sw/source/core/undo/undobj.cxx | 12 +++++++----- sw/source/filter/ww8/wrtw8nds.cxx | 24 +++++++++++++++++++++++- 2 files changed, 30 insertions(+), 6 deletions(-)
New commits: commit 68cc91cd2c461b7062c3f3b89b2c677e41c9a8d4 Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed Aug 12 17:07:18 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Thu Aug 13 16:58:17 2020 +0200 sw: MS Word export: don't insert section breaks in field instructions MSWordExportBase::NeedTextNodeSplit() simply uses the soft-page-break positions to potentially insert section breaks - but now that Writer can display field instructions, it's quite silly to insert section breaks inside them. Change-Id: Ie57e6281a0287aac36984e5467920852db19a8ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100661 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 4dd1f15395bb..3492549c6d73 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2149,7 +2149,29 @@ bool MSWordExportBase::NeedSectionBreak( const SwNode& rNd ) const bool MSWordExportBase::NeedTextNodeSplit( const SwTextNode& rNd, SwSoftPageBreakList& pList ) const { - rNd.fillSoftPageBreakList( pList ); + SwSoftPageBreakList tmp; + rNd.fillSoftPageBreakList(tmp); + // hack: move the break behind any field marks; currently we can't hide the + // field mark instruction so the layout position is quite meaningless + IDocumentMarkAccess const& rIDMA(*rNd.GetDoc()->getIDocumentMarkAccess()); + sal_Int32 pos(-1); + for (auto const& it : tmp) + { + if (pos < it) // previous one might have skipped over it + { + pos = it; + while (auto const*const pMark = rIDMA.getFieldmarkFor(SwPosition(const_cast<SwTextNode&>(rNd), pos))) + { + if (pMark->GetMarkEnd().nNode != rNd) + { + pos = rNd.Len(); // skip everything + break; + } + pos = pMark->GetMarkEnd().nContent.GetIndex(); // no +1, it's behind the char + } + pList.insert(pos); + } + } pList.insert(0); pList.insert( rNd.GetText().getLength() ); return pList.size() > 2 && NeedSectionBreak( rNd ); commit 5364c0815734d864e3c26090f1219d58a4022f8b Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Wed Aug 12 16:32:07 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Thu Aug 13 16:58:09 2020 +0200 sw: avoid assert when deletion starts at fieldmark end This hit assert(bSavePos && bSaveOtherPos); Tweak SwUndoSaveContent::DelContentIndex() for fieldmarks to only accept an equal end position if the start position was in range as well. (regression from 24fd14b387dca458a1b6e9415e936d26562ddb1e) Change-Id: If6c9b049193bb7f1bc39ec66d1c965512f9d6ec1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100660 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@cib.de> diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 268e0ea5e3d6..9e043b1b1e23 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1118,12 +1118,14 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark, if( pBkmk->IsExpanded() && *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd ) { - if ( bSavePos || bSaveOtherPos + assert(!bSaveOtherPos); + if ( bSavePos || (*pStt < pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() < *pEnd) - || type == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK - || type == IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK - || type == IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK - || type == IDocumentMarkAccess::MarkType::DATE_FIELDMARK) + || (bMaybe + && ( type == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK + || type == IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK + || type == IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK + || type == IDocumentMarkAccess::MarkType::DATE_FIELDMARK))) { if( bMaybe ) bSavePos = true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits