summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-04-17 17:13:51 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-04-17 17:52:14 +0200
commit7b3c07a78b8db73a966a0999153c6a914cbedae5 (patch)
tree565f78901602595ae68c60c945089cc461451c2f /sw
parent830abf307aab9f9611db60b5c734fbafd3b3d8a3 (diff)
RTF filter: export \hyphauto
Change-Id: Ide8cb5f45d3eb60c45d86d58a9ab12bbc9f4cf47
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/hyphauto.rtf6
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx5
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx13
3 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/hyphauto.rtf b/sw/qa/extras/rtfexport/data/hyphauto.rtf
new file mode 100644
index 000000000000..dd4767f196cb
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/hyphauto.rtf
@@ -0,0 +1,6 @@
+{\rtf1
+\hyphauto1
+\pard\plain
+Hello.
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 3ef2f13bfc07..dc1107a6b9dd 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -867,6 +867,11 @@ DECLARE_RTFEXPORT_TEST(testSautoupd, "sautoupd.rtf")
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xHeading2, "IsAutoUpdate"));
}
+DECLARE_RTFEXPORT_TEST(testHyphauto, "hyphauto.rtf")
+{
+ CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getParagraph(1), "ParaIsHyphenation"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 60ca1f09e0c1..ab5e763e3a6c 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -36,6 +36,7 @@
#include <lineinfo.hxx>
#include <swmodule.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentStylePoolAccess.hxx>
#include "ww8par.hxx"
#include <comphelper/string.hxx>
#include <svtools/rtfkeywd.hxx>
@@ -45,6 +46,7 @@
#include <iostream>
#endif
#include <svx/xflclit.hxx>
+#include <editeng/hyphenzoneitem.hxx>
using namespace ::com::sun::star;
@@ -502,6 +504,17 @@ void RtfExport::ExportDocument_Impl()
WriteInfo();
// Default TabSize
Strm().WriteCharPtr(m_pAttrOutput->m_aTabStop.makeStringAndClear().getStr()).WriteCharPtr(SAL_NEWLINE_STRING);
+
+ // Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer.
+ // Use the setting from the default style.
+ SwTxtFmtColl* pTxtFmtColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false);
+ const SfxPoolItem* pItem;
+ if (pTxtFmtColl && pTxtFmtColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem) == SfxItemState::SET)
+ {
+ Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_HYPHAUTO);
+ OutULong(static_cast<const SvxHyphenZoneItem*>(pItem)->IsHyphen());
+ }
+
// Zoom
SwViewShell* pViewShell(pDoc->getIDocumentLayoutAccess().GetCurrentViewShell());
if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SvxZoomType::PERCENT)