[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/qa sw/source writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 11:11:51 UTC 2021


 sw/qa/extras/ooxmlexport/data/gutter-top.docx     |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx        |   11 +++++++++++
 sw/source/filter/ww8/docxexport.cxx               |    5 +++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    4 ++++
 writerfilter/source/dmapper/SettingsTable.cxx     |    6 ++++++
 writerfilter/source/dmapper/SettingsTable.hxx     |    1 +
 6 files changed, 27 insertions(+)

New commits:
commit 6fa5ce6cb9d121329bf1056c471bf522fc50d3fc
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 5 10:03:04 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Feb 10 12:11:09 2021 +0100

    tdf#91920 sw page gutter margin, from top: add DOCX filter
    
    ODF filter was already working as-is.
    
    (cherry picked from commit 506bacb79ab96656de9168d0db3e3159c6bde3b0)
    
    Conflicts:
            sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
            writerfilter/source/dmapper/DomainMapper_Impl.cxx
            writerfilter/source/dmapper/SettingsTable.cxx
            writerfilter/source/dmapper/SettingsTable.hxx
    
    Change-Id: I71089a5d0171eba0cd4c2d14bdee6ca9b64193b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110668
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/gutter-top.docx b/sw/qa/extras/ooxmlexport/data/gutter-top.docx
new file mode 100644
index 000000000000..d48cb2846287
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/gutter-top.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 52cfc5c11387..6859ac0d1c6b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -170,6 +170,17 @@ DECLARE_OOXMLEXPORT_TEST(testGutterLeft, "gutter-left.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGutterTop, "gutter-top.docx")
+{
+    xmlDocPtr pXmlSettings = parseExport("word/settings.xml");
+    CPPUNIT_ASSERT(pXmlSettings);
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1
+    // - Actual  : 0
+    // i.e. <w:gutterAtTop> was lost.
+    assertXPath(pXmlSettings, "/w:settings/w:gutterAtTop", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index a46b3eb779a2..74745f68f604 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1021,6 +1021,11 @@ void DocxExport::WriteSettings()
     if(isMirroredMargin())
         pFS->singleElementNS(XML_w, XML_mirrorMargins);
 
+    if (m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::GUTTER_AT_TOP))
+    {
+        pFS->singleElementNS(XML_w, XML_gutterAtTop);
+    }
+
     // Embed Fonts
     if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS ))
         pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f3bcc7a066c8..c180a1250945 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6815,6 +6815,10 @@ void DomainMapper_Impl::ApplySettingsTable()
             xSettings->setPropertyValue("AddParaTableSpacing", uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
             if( m_pSettingsTable->GetProtectForm() )
                 xSettings->setPropertyValue("ProtectForm", uno::makeAny( true ));
+            if (m_pSettingsTable->GetGutterAtTop())
+            {
+                xSettings->setPropertyValue("GutterAtTop", uno::makeAny(true));
+            }
         }
         catch(const uno::Exception&)
         {
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index ba619d4d4a65..16a4d48bdefc 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -266,6 +266,7 @@ struct SettingsTable_Impl
     OUString            m_sCurrentDatabaseDataSource;
 
     DocumentProtection_Impl m_DocumentProtection;
+    bool m_bGutterAtTop = false;
 
     SettingsTable_Impl() :
       m_nDefaultTabStop( 720 ) //default is 1/2 in
@@ -577,6 +578,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
     case NS_ooxml::LN_CT_Settings_displayBackgroundShape:
         m_pImpl->m_bDisplayBackgroundShape = nIntValue;
         break;
+    case NS_ooxml::LN_CT_Settings_gutterAtTop:
+        m_pImpl->m_bGutterAtTop = nIntValue != 0;
+        break;
     default:
     {
 #ifdef DBG_UTIL
@@ -812,6 +816,8 @@ bool SettingsTable::GetLongerSpaceSequence() const
     return m_pImpl->m_bLongerSpaceSequence;
 }
 
+bool SettingsTable::GetGutterAtTop() const { return m_pImpl->m_bGutterAtTop; }
+
 }//namespace dmapper
 } //namespace writerfilter
 
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 2de8a1e4a8bf..3e7d655804fc 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -95,6 +95,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
     sal_Int32 GetWordCompatibilityMode() const;
 
     const OUString & GetCurrentDatabaseDataSource() const;
+    bool GetGutterAtTop() const;
 
  private:
     // Properties


More information about the Libreoffice-commits mailing list