[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 12 03:57:26 UTC 2018


 sw/source/filter/ww8/wrtw8nds.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 0a452b5005744d96f37fcb29b37a84e23a04bf8e
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Wed Oct 10 12:01:04 2018 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Fri Oct 12 05:56:58 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>

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 32353635a075..533f787393a6 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2327,8 +2327,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 )
@@ -2391,8 +2394,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 )
                 {


More information about the Libreoffice-commits mailing list