Kaydet (Commit) 150c12fc authored tarafından Justin Luth's avatar Justin Luth

tdf#72560 writerfilter: check my style, not default style

The default style is only relevant if no style is defined
for the paragraph, so it should not be hard-coded into
any general operation.

The intention of that code was to look for an inherited value,
which can properly be found with GetPropertyFromStyleSheet().

Change-Id: Ie2805d2516b43b45e702ee860deabe89d50ec031
Reviewed-on: https://gerrit.libreoffice.org/57804
Tested-by: Jenkins
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst 7119184f
......@@ -290,6 +290,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo72560, "fdo72560.docx")
CPPUNIT_ASSERT_EQUAL( sal_Int32 (style::ParagraphAdjust_RIGHT), getProperty< sal_Int32 >( xParaRightLTR, "ParaAdjust" ));
}
DECLARE_OOXMLEXPORT_TEST(testFdo72560b, "fdo72560b.docx")
{
// The problem was libreoffice confuse when RTL was specified in non-default style
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.
......
......@@ -1183,28 +1183,10 @@ void DomainMapper::lcl_sprm(Sprm & rSprm)
static bool ExchangeLeftRight(const PropertyMapPtr& rContext, DomainMapper_Impl& rImpl)
{
bool bExchangeLeftRight = false;
boost::optional<PropertyMap::Property> aPropPara = rContext->getProperty(PROP_WRITING_MODE);
if( aPropPara )
{
sal_Int32 aAdjust ;
if( (aPropPara->second >>= aAdjust) && aAdjust == text::WritingMode2::RL_TB )
bExchangeLeftRight = true;
}
else
{
// check if there RTL <bidi> in default style for the paragraph
StyleSheetEntryPtr pTable = rImpl.GetStyleSheetTable()->FindDefaultParaStyle();
if ( pTable )
{
boost::optional<PropertyMap::Property> aPropStyle = pTable->pProperties->getProperty(PROP_WRITING_MODE);
if( aPropStyle )
{
sal_Int32 aDirect;
if( (aPropStyle->second >>= aDirect) && aDirect == text::WritingMode2::RL_TB )
bExchangeLeftRight = true;
}
}
}
sal_Int32 aAdjust;
uno::Any aPropPara = rImpl.GetAnyProperty(PROP_WRITING_MODE, rContext);
if( (aPropPara >>= aAdjust) && aAdjust == text::WritingMode2::RL_TB )
bExchangeLeftRight = true;
return bExchangeLeftRight;
}
......
......@@ -718,6 +718,16 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
return uno::Any();
}
uno::Any DomainMapper_Impl::GetAnyProperty(PropertyIds eId, const PropertyMapPtr& rContext)
{
if ( rContext )
{
boost::optional<PropertyMap::Property> aProperty = rContext->getProperty(eId);
if ( aProperty )
return aProperty->second;
}
return GetPropertyFromStyleSheet(eId);
}
ListsManager::Pointer const & DomainMapper_Impl::GetListTable()
{
......
......@@ -698,6 +698,8 @@ public:
const OUString GetDefaultParaStyleName();
css::uno::Any GetPropertyFromStyleSheet(PropertyIds eId);
// get property first from the given context, or secondly from its stylesheet
css::uno::Any GetAnyProperty(PropertyIds eId, const PropertyMapPtr& rContext);
void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;}
bool IsStyleSheetImport()const { return m_bInStyleSheetImport;}
void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
......
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