summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-11 19:18:06 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-11 19:18:07 +0100
commit5a410df4ff5edd9ea2fbe5469084bb0e8b57bd1c (patch)
tree22e31da1375492579379467ae5bf39296f7214cc /sw
parentd93d09c5065cf4342402b6f4e1216406d3cf9b24 (diff)
DOCX export: handle <w:autoHyphenation/>
Change-Id: Ie4bb2b3bf7d2df58c30a54ded68f7b932c2111ed
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 );