diff options
author | Justin Luth <justin_luth@sil.org> | 2018-07-17 16:27:15 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-07-23 08:37:44 +0200 |
commit | 150c12fc0fba2c2f4b08b4298678ee49676ebae0 (patch) | |
tree | 94a9cf38f1150de67fc909c67c6b868f6d5e42ef /writerfilter | |
parent | 7119184f4b5441600f7b3eae7ec6771c094bbb7f (diff) |
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: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 26 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 |
3 files changed, 16 insertions, 22 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 5e6f2b0c0a1a..c1e3141ed9f5 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -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; } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8c3c59243aa0..7f0bbedfe4e0 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -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() { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 013f8aaa5799..6b6755c6fbfd 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -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;} |