[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 17 08:32:08 UTC 2020
sw/source/filter/ww8/wrtw8nds.cxx | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
New commits:
commit 81e661c1e34e24fb46ccf9456cb127be0ad629ff
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Aug 12 17:07:18 2020 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Aug 17 10:31:37 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.stahl at cib.de>
(cherry picked from commit 68cc91cd2c461b7062c3f3b89b2c677e41c9a8d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100690
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index f7dc3e2207d2..36026312a332 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2165,7 +2165,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 );
More information about the Libreoffice-commits
mailing list