[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 23 11:05:20 UTC 2019
sw/source/filter/ww8/docxexport.cxx | 3 ---
sw/source/filter/ww8/wrtw8nds.cxx | 28 ++++++++++++++++++++++++----
2 files changed, 24 insertions(+), 7 deletions(-)
New commits:
commit e0e0109f01929024f7dd60a97616bb3b25de3b92
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 14 19:15:52 2019 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Oct 23 13:03:36 2019 +0200
sw: WW8/RTF/DOCX export: only export actual bookmarks as bookmarks
Don't export all the other cruft that happens to be represented as
some IMark derived type in Writer in MSWordExportBase::GetBookmarks().
Change-Id: I4fc05e84b9fc80bb2186899c58bf140dd3779f83
Reviewed-on: https://gerrit.libreoffice.org/80915
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 91a962490314..0185e98b5f0a 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -162,9 +162,6 @@ void DocxExport::AppendBookmarks( const SwTextNode& rNode, sal_Int32 nCurrentPos
const sal_Int32 nStart = pMark->GetMarkStart().nContent.GetIndex();
const sal_Int32 nEnd = pMark->GetMarkEnd().nContent.GetIndex();
- if (dynamic_cast<sw::mark::IDateFieldmark*>(pMark))
- continue;
-
if ( nStart == nCurrentPos )
aStarts.push_back( pMark->GetName() );
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 08e29ddb1a8f..4ad6d3a721ec 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -249,7 +249,15 @@ static sal_Int32 lcl_getMinPos( sal_Int32 pos1, sal_Int32 pos2 )
sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
{
const OUString aText = rNd.GetText();
- sal_Int32 fieldEndPos = aText.indexOf(CH_TXT_ATR_FIELDEND, nStartPos);
+ sal_Int32 fieldEndPos = aText.indexOf(CH_TXT_ATR_FIELDEND, nStartPos - 1);
+ // HACK: for (so far) mysterious reasons the sdtContent element closes
+ // too late in testDateFormField() unless an empty run is exported at
+ // the end of the fieldmark; hence find *also* the position after the
+ // CH_TXT_ATR_FIELDEND here
+ if (0 <= fieldEndPos && fieldEndPos < nStartPos)
+ {
+ ++fieldEndPos;
+ }
sal_Int32 fieldStartPos = aText.indexOf(CH_TXT_ATR_FIELDSTART, nStartPos);
sal_Int32 formElementPos = aText.indexOf(CH_TXT_ATR_FORMELEMENT, nStartPos);
@@ -1867,9 +1875,21 @@ bool MSWordExportBase::GetBookmarks( const SwTextNode& rNd, sal_Int32 nStt,
{
IMark* pMark = pMarkAccess->getAllMarksBegin()[i];
- if ( IDocumentMarkAccess::GetType( *pMark ) == IDocumentMarkAccess::MarkType::ANNOTATIONMARK )
- {
- continue;
+ switch (IDocumentMarkAccess::GetType( *pMark ))
+ {
+ case IDocumentMarkAccess::MarkType::UNO_BOOKMARK:
+ case IDocumentMarkAccess::MarkType::DDE_BOOKMARK:
+ case IDocumentMarkAccess::MarkType::ANNOTATIONMARK:
+ case IDocumentMarkAccess::MarkType::TEXT_FIELDMARK:
+ case IDocumentMarkAccess::MarkType::CHECKBOX_FIELDMARK:
+ case IDocumentMarkAccess::MarkType::DROPDOWN_FIELDMARK:
+ case IDocumentMarkAccess::MarkType::DATE_FIELDMARK:
+ case IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER:
+ continue; // ignore irrelevant marks
+ case IDocumentMarkAccess::MarkType::BOOKMARK:
+ case IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK:
+ case IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK:
+ break;
}
// Only keep the bookmarks starting or ending in this node
More information about the Libreoffice-commits
mailing list