summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2018-07-17 09:24:58 +0300
committerJustin Luth <justin_luth@sil.org>2018-07-24 06:09:20 +0200
commit0fbf627a4beca383c25cc50cfa9d555f18fade53 (patch)
tree29c17cea5a2f2d2734dda9d8dec59e509b854ead
parentea96a4815e456295ca7454475e54cd8b0ba5c388 (diff)
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@sil.org> Tested-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo72560c.docxbin0 -> 9969 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport10.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx10
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.cxx5
-rw-r--r--writerfilter/source/dmapper/StyleSheetTable.hxx1
5 files changed, 24 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo72560c.docx
Binary files 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();