Kaydet (Commit) 0fbf627a authored tarafından Justin Luth's avatar Justin Luth

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/57805Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
üst ea96a481
......@@ -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.
......
......@@ -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();
}
......
......@@ -394,6 +394,11 @@ StyleSheetTable::~StyleSheetTable()
{
}
PropertyMapPtr const & StyleSheetTable::GetDefaultParaProps()
{
return m_pImpl->m_pDefaultParaProps;
}
PropertyMapPtr const & StyleSheetTable::GetDefaultCharProps()
{
return m_pImpl->m_pDefaultCharProps;
......
......@@ -97,6 +97,7 @@ public:
OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
PropertyMapPtr const & GetDefaultParaProps();
/// Returns the default character properties.
PropertyMapPtr const & GetDefaultCharProps();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment