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

Miklos Vajna vmiklos at collabora.co.uk
Fri Apr 17 08:55:16 PDT 2015


 sw/qa/extras/rtfexport/data/hyphauto.rtf       |    6 ++++++
 sw/qa/extras/rtfexport/rtfexport.cxx           |    5 +++++
 sw/source/filter/ww8/rtfexport.cxx             |   13 +++++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    3 +++
 4 files changed, 27 insertions(+)

New commits:
commit 7b3c07a78b8db73a966a0999153c6a914cbedae5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Apr 17 17:13:51 2015 +0200

    RTF filter: export \hyphauto
    
    Change-Id: Ide8cb5f45d3eb60c45d86d58a9ab12bbc9f4cf47

diff --git a/sw/qa/extras/rtfexport/data/hyphauto.rtf b/sw/qa/extras/rtfexport/data/hyphauto.rtf
new file mode 100644
index 0000000..dd4767f
--- /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 3ef2f13..dc1107a 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 60ca1f0..ab5e763 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)
commit 830abf307aab9f9611db60b5c734fbafd3b3d8a3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Apr 17 16:52:46 2015 +0200

    RTF filter: import \hyphauto
    
    "Automatically Hyphenate Document Contents When Displayed"
    
    Change-Id: I832eed60511b332a3f936b8239fd0a56a84879f1

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4965e13..dd873fe 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4887,6 +4887,9 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
     case RTF_FACINGP:
         m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, pBoolValue);
         break;
+    case RTF_HYPHAUTO:
+        m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_autoHyphenation, pBoolValue);
+        break;
     default:
     {
         SAL_INFO("writerfilter", "TODO handle toggle '" << lcl_RtfToString(nKeyword) << "'");


More information about the Libreoffice-commits mailing list