summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/docxattributeoutput.cxx
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2017-10-31 23:39:26 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-11-03 11:38:17 +0100
commit3f2e84b4bd0bbd936e0af845ba7cbf68cb2803d6 (patch)
treec0ed895af55792f343659eebbde76dd8ab656cd8 /sw/source/filter/ww8/docxattributeoutput.cxx
parent25a26b66b398d127842369e06c3ef95fe901e305 (diff)
tdf#38778 Fix output of the font in DOC run
The font information should be output before field declaration. Added unit test. Change-Id: I147dd8956fbd8e69c3a2e86aff01dc249f4fa815 tdf#38778 DOCX output: no double output of the font info Change-Id: Ia080f742cde88b914e146fe7a95b90bf1952c96a Reviewed-on: https://gerrit.libreoffice.org/44160 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.cxx')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6cbd0a6cdc18..146b7b9e3a5f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6699,11 +6699,24 @@ void DocxAttributeOutput::CharFont( const SvxFontItem& rFont)
{
GetExport().GetId( rFont ); // ensure font info is written to fontTable.xml
const OUString& sFontName(rFont.GetFamilyName());
- OString sFontNameUtf8 = OUStringToOString(sFontName, RTL_TEXTENCODING_UTF8);
+ const OString sFontNameUtf8 = OUStringToOString(sFontName, RTL_TEXTENCODING_UTF8);
if (!sFontNameUtf8.isEmpty())
+ {
+ if (m_pFontsAttrList &&
+ ( m_pFontsAttrList->hasAttribute(FSNS( XML_w, XML_ascii )) ||
+ m_pFontsAttrList->hasAttribute(FSNS( XML_w, XML_hAnsi )) )
+ )
+ {
+ // tdf#38778: do to fields output into DOC the font could be added before and after field declaration
+ // that all sub runs of the field will have correct font inside.
+ // For DOCX we should do not add the same font information twice in the same node
+ return;
+ }
+
AddToAttrList( m_pFontsAttrList, 2,
FSNS( XML_w, XML_ascii ), sFontNameUtf8.getStr(),
FSNS( XML_w, XML_hAnsi ), sFontNameUtf8.getStr() );
+ }
}
void DocxAttributeOutput::CharFontSize( const SvxFontHeightItem& rFontSize)