[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - sw/qa sw/source writerfilter/source

nikki nikkic at epoq.co.uk
Mon Jul 10 14:07:59 UTC 2017


 sw/qa/extras/ooxmlexport/data/fdo106029.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx         |    8 ++++++++
 sw/source/filter/ww8/docxexport.cxx               |   10 +++++++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    7 +++++++
 writerfilter/source/dmapper/SettingsTable.cxx     |   10 ++++++++++
 writerfilter/source/dmapper/SettingsTable.hxx     |    1 +
 6 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit a59cf3ecab2f327801c2b580d20df9e8b643cc6c
Author: nikki <nikkic at epoq.co.uk>
Date:   Wed Apr 12 16:52:49 2017 +0100

    Fix tdf#106029 - Add setting XML_doNotExpandShiftReturn when exporting to docx
    
    Change-Id: Ie8ffb0f2d5444c6ead13bdc894715c5a2e6d0baa
    Reviewed-on: https://gerrit.libreoffice.org/36485
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 9ad9c5183f348384b62ec88459a3a5922e423d83)
    Reviewed-on: https://gerrit.libreoffice.org/39749

diff --git a/sw/qa/extras/ooxmlexport/data/fdo106029.docx b/sw/qa/extras/ooxmlexport/data/fdo106029.docx
new file mode 100644
index 000000000000..b19d63d4c218
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo106029.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index d777cd528ece..aac74c777bb5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -337,6 +337,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo73541,"fdo73541.docx")
     assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo106029,"fdo106029.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/settings.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotExpandShiftReturn");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO74106, "FDO74106.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index c36139ca31ac..6470999120bf 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -865,7 +865,13 @@ void DocxExport::WriteSettings()
     {
         pFS->singleElementNS( XML_w, XML_documentProtection, FSNS(XML_w, XML_edit), "forms", FSNS(XML_w, XML_enforcement), "1",  FSEND );
     }
-
+    // Do not justify lines with manual break
+    if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK ))
+    {
+        pFS->startElementNS( XML_w, XML_compat, FSEND );
+        pFS->singleElementNS( XML_w, XML_doNotExpandShiftReturn, FSEND );
+        pFS->endElementNS( XML_w, XML_compat );
+    }
     // Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer.
     // Use the setting from the default style.
     SwTextFormatColl* pColl = m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false);
@@ -949,7 +955,6 @@ void DocxExport::WriteSettings()
                         FSNS( XML_w, XML_val ),  OUStringToOString(aValue, RTL_TEXTENCODING_UTF8).getStr(),
                         FSEND);
                 }
-
                 pFS->endElementNS( XML_w, XML_compat );
             }
         }
@@ -963,7 +968,6 @@ void DocxExport::WriteSettings()
                               FSNS( XML_w, XML_edit ), "forms",
                               FSEND );
     }
-
     pFS->endElementNS( XML_w, XML_settings );
 }
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d5348c8b0e6b..f2a2f2abc277 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -86,6 +86,10 @@
 #include <comphelper/propertyvalue.hxx>
 #include <unotools/mediadescriptor.hxx>
 
+
+
+
+
 using namespace ::com::sun::star;
 using namespace oox;
 namespace writerfilter {
@@ -5115,6 +5119,9 @@ void DomainMapper_Impl::ApplySettingsTable()
             }
 
             uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
+
+            if (m_pSettingsTable->GetDoNotExpandShiftReturn())
+                xSettings->setPropertyValue( "DoNotJustifyLinesWithManualBreak", uno::makeAny(true) );
             if (m_pSettingsTable->GetUsePrinterMetrics())
                 xSettings->setPropertyValue("PrinterIndependentLayout", uno::makeAny(document::PrinterIndependentLayout::DISABLED));
             if( m_pSettingsTable->GetEmbedTrueTypeFonts())
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 9a52c416f029..038723e6c1b4 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -65,6 +65,7 @@ struct SettingsTable_Impl
     bool                m_bWidowControl;
     bool                m_bSplitPgBreakAndParaMark;
     bool                m_bMirrorMargin;
+    bool                m_bDoNotExpandShiftReturn;
     bool                m_bProtectForm;
     bool                m_bDisplayBackgroundShape;
 
@@ -92,6 +93,7 @@ struct SettingsTable_Impl
     , m_bWidowControl(false)
     , m_bSplitPgBreakAndParaMark(false)
     , m_bMirrorMargin(false)
+    , m_bDoNotExpandShiftReturn(false)
     , m_bProtectForm(false)
     , m_bDisplayBackgroundShape(false)
     , m_pThemeFontLangProps(3)
@@ -279,6 +281,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
     case NS_ooxml::LN_CT_Settings_widowControl:
         m_pImpl->m_bWidowControl = nIntValue;
         break;
+    case NS_ooxml::LN_CT_Compat_doNotExpandShiftReturn:
+        m_pImpl->m_bDoNotExpandShiftReturn = true;
+        break;
     case NS_ooxml::LN_CT_Settings_displayBackgroundShape:
         m_pImpl->m_bDisplayBackgroundShape = nIntValue;
         break;
@@ -362,6 +367,11 @@ bool SettingsTable::GetDisplayBackgroundShape() const
     return m_pImpl->m_bDisplayBackgroundShape;
 }
 
+bool SettingsTable::GetDoNotExpandShiftReturn() const
+{
+    return m_pImpl->m_bDoNotExpandShiftReturn;
+}
+
 bool SettingsTable::GetProtectForm() const
 {
     return m_pImpl->m_bProtectForm;
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 75c0d76e490e..28db5c26fb73 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -71,6 +71,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
     bool GetSplitPgBreakAndParaMark() const;
     bool GetMirrorMarginSettings() const;
     bool GetDisplayBackgroundShape() const;
+    bool GetDoNotExpandShiftReturn() const;
     bool GetNoColumnBalance() const;
     bool GetProtectForm() const;
 


More information about the Libreoffice-commits mailing list