summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx5
-rw-r--r--sw/source/filter/ww8/docxexport.cxx13
2 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 923a82ffc969..d2a4c7f61fa9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -462,6 +462,11 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78599,"fdo78599.docx")
return;
//docx file after RT is getting corrupted.
assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar", "fldCharType", "end" );
+
+ // Check for automatic hyphenation
+ if (xmlDocPtr pSettingsXml = parseExport("word/settings.xml"))
+ // This failed as w:settings had no w:autoHyphenation child.
+ assertXPath(pSettingsXml, "/w:settings/w:autoHyphenation");
}
DECLARE_OOXMLEXPORT_TEST(testfdo78886, "fdo78886.docx")
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 6cb7d80adebd..48ebe66b5ecc 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -43,6 +43,7 @@
#include <IMark.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentStylePoolAccess.hxx>
#include <docsh.hxx>
#include <ndtxt.hxx>
#include <wrtww8.hxx>
@@ -58,6 +59,7 @@
#include <editeng/editobj.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/brushitem.hxx>
+#include <editeng/hyphenzoneitem.hxx>
#include <docary.hxx>
#include <numrule.hxx>
@@ -849,6 +851,17 @@ void DocxExport::WriteSettings()
pFS->singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val ),
OString::number( m_aSettings.defaultTabStop).getStr(), FSEND );
+ // Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer.
+ // Use the setting from the default style.
+ SwTxtFmtColl* pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false);
+ const SfxPoolItem* pItem;
+ if (pColl && SfxItemState::SET == pColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem))
+ {
+ pFS->singleElementNS(XML_w, XML_autoHyphenation,
+ FSNS(XML_w, XML_val), OString::boolean(static_cast<const SvxHyphenZoneItem*>(pItem)->IsHyphen()),
+ FSEND);
+ }
+
// Even and Odd Headers
if( m_aSettings.evenAndOddHeaders )
pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );