[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - sw/source writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Oct 15 20:48:37 UTC 2018
sw/source/filter/ww8/wrtw8nds.cxx | 12 +++++++++---
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 15 +++++++++++++++
2 files changed, 24 insertions(+), 3 deletions(-)
New commits:
commit ff2067b3d5149c35de17bf1939a34849ae6608aa
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Wed Oct 10 12:01:04 2018 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Oct 13 20:44:09 2018 +0200
tdf120224 docx export: don't double up field bookmarks
fields are internal bookmarks. When the exporter runs
through the bookmarks, it will already write out a bookmark
entry, so don't output a separate one for the fieldmark.
Change-Id: I84af2989035507ac745d028f1585d60d8823ff8b
Reviewed-on: https://gerrit.libreoffice.org/61616
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit 0a452b5005744d96f37fcb29b37a84e23a04bf8e)
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 20a43e27cd30..9361943a7636 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2406,8 +2406,11 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
::sw::mark::IFieldmark const * const pFieldmark = pMarkAccess->getFieldmarkFor( aPosition );
OSL_ENSURE( pFieldmark, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??" );
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
- AppendBookmark( pFieldmark->GetName() );
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT
+ && GetExportFormat() != MSWordExportBase::ExportFormat::DOCX )
+ {
+ AppendBookmark( pFieldmark->GetName() );
+ }
ww::eField eFieldId = lcl_getFieldId( pFieldmark );
OUString sCode = lcl_getFieldCode( pFieldmark );
if ( pFieldmark && pFieldmark->GetFieldname() == ODF_UNHANDLED )
@@ -2470,8 +2473,11 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode )
OutputField( nullptr, eFieldId, OUString(), FieldFlags::Close );
- if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT )
+ if ( pFieldmark && pFieldmark->GetFieldname() == ODF_FORMTEXT
+ && GetExportFormat() != MSWordExportBase::ExportFormat::DOCX )
+ {
AppendBookmark( pFieldmark->GetName() );
+ }
}
else if ( ch == CH_TXT_ATR_FORMELEMENT )
{
commit 55728c04006b791a5380e9a4145c593287ec33ca
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Oct 9 14:03:37 2018 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Oct 13 20:43:47 2018 +0200
tdf120224 writerfilter: consume excess bookmark from fields
Although this follows a very different code path, copy the ww8
import idea of "consuming" the bookmark of a BOOK_FIELD.
This is particularly important for textcontrols, especially
since LO keeps duplicating bookmarks as it adds another
bookmark for the field name at each save.
Existing unit tests that this matches are fdo53985.docx and
tdf111964.docx. I expected more, but apparently most fields
don't contain or represent any bookmarks.
This patch is for import only. A followup patch stops
the creation of duplicate bookmarks during export.
Reviewed-on: https://gerrit.libreoffice.org/61615
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit 579c0749bef8c980507229439715e72060c1b077)
Change-Id: I1e11980e52dc523393fd6d621191228d676e9a17
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f65d2166cc01..1ea53b810609 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4827,7 +4827,22 @@ void DomainMapper_Impl::SetBookmarkName( const OUString& rBookmarkName )
{
BookmarkMap_t::iterator aBookmarkIter = m_aBookmarkMap.find( m_sCurrentBkmkId );
if( aBookmarkIter != m_aBookmarkMap.end() )
+ {
+ // fields are internal bookmarks: consume redundant "normal" bookmark
+ if ( IsOpenField() )
+ {
+ FFDataHandler::Pointer_t pFFDataHandler(GetTopFieldContext()->getFFDataHandler());
+ if ( IsOpenFieldCommand() || (pFFDataHandler && pFFDataHandler->getName() == rBookmarkName) )
+ {
+ // HACK: At the END marker, StartOrEndBookmark will START
+ // a bookmark which will eventually be abandoned, not created.
+ m_aBookmarkMap.erase(aBookmarkIter);
+ return;
+ }
+ }
+
aBookmarkIter->second.m_sBookmarkName = rBookmarkName;
+ }
else
m_sCurrentBkmkName = rBookmarkName;
}
More information about the Libreoffice-commits
mailing list