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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 24 04:09:41 UTC 2018


 sw/qa/extras/ooxmlexport/data/fdo72560c.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx        |    8 ++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 ++++++++++
 writerfilter/source/dmapper/StyleSheetTable.cxx   |    5 +++++
 writerfilter/source/dmapper/StyleSheetTable.hxx   |    1 +
 5 files changed, 24 insertions(+)

New commits:
commit 0fbf627a4beca383c25cc50cfa9d555f18fade53
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Tue Jul 17 09:24:58 2018 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Tue Jul 24 06:09:20 2018 +0200

    tdf#72560 writerfilter: StyleProperty - also check DocDefaults
    
    Styles without parents still have inheritance - from the DocDefaults.
    So, make sure to check those properties too in
    GetPropertyFromStyleSheet() (and therefore also in GetAnyProperty).
    
    Currently, this should only impact when InStyleSheetImport(),
    but if the docDefaults ever find a way to naturally migrate
    into LO as doc defaults and not into the style itself, then
    this will also be useful to check for paragraph properties etc.
    
    Change-Id: Ic02cd10c104c0330684308f1380a77009206a664
    Reviewed-on: https://gerrit.libreoffice.org/57805
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo72560c.docx b/sw/qa/extras/ooxmlexport/data/fdo72560c.docx
new file mode 100644
index 000000000000..ed0b88822066
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo72560c.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 381262a85d33..bd90c27c4a7f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -298,6 +298,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo72560b, "fdo72560b.docx")
     CPPUNIT_ASSERT_EQUAL( sal_Int32(style::ParagraphAdjust_LEFT), getProperty< sal_Int32 >( xParaEndRTL, "ParaAdjust" ));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo72560c, "fdo72560c.docx")
+{
+    // The problem was libreoffice confuse when RTL was specified in DocDefaults
+    uno::Reference<uno::XInterface> xParaEndRTL(getParagraph( 2, "RTL END"));
+    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::RL_TB, getProperty<sal_Int16>( xParaEndRTL, "WritingMode" ));
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(style::ParagraphAdjust_LEFT), getProperty< sal_Int32 >( xParaEndRTL, "ParaAdjust" ));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testRPrChangeClosed, "rprchange_closed.docx")
 {
     // Redline defined by rPrChanged wasn't removed.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7f0bbedfe4e0..6bfb6d7b65b6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -715,6 +715,16 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
 
         pEntry = pNewEntry;
     }
+    // not found in style, try the document's DocDefault properties
+    {
+        const PropertyMapPtr& pDefaultParaProps = GetStyleSheetTable()->GetDefaultParaProps();
+        if ( pDefaultParaProps )
+        {
+            boost::optional<PropertyMap::Property> aProperty = pDefaultParaProps->getProperty(eId);
+            if ( aProperty )
+                return aProperty->second;
+        }
+    }
     return uno::Any();
 }
 
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 2c7307a68d5c..8e71f5f28f2d 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -394,6 +394,11 @@ StyleSheetTable::~StyleSheetTable()
 {
 }
 
+PropertyMapPtr const & StyleSheetTable::GetDefaultParaProps()
+{
+    return m_pImpl->m_pDefaultParaProps;
+}
+
 PropertyMapPtr const & StyleSheetTable::GetDefaultCharProps()
 {
     return m_pImpl->m_pDefaultCharProps;
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index 1d461401055e..a5e1df2685d6 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -97,6 +97,7 @@ public:
 
     OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
 
+    PropertyMapPtr const & GetDefaultParaProps();
     /// Returns the default character properties.
     PropertyMapPtr const & GetDefaultCharProps();
 


More information about the Libreoffice-commits mailing list