diff options
author | László Németh <nemeth@numbertext.org> | 2020-08-19 13:00:58 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-08-20 10:34:18 +0200 |
commit | bf3124cdf61b40c94ba117a76f1b63dabdfd528e (patch) | |
tree | d215ab62a6be1efb9872f4ef4835db6840ca018b /writerfilter/source/dmapper | |
parent | b39364492c7cbe34923e0d0755db8737b7d6225a (diff) |
tdf#135187 DOCX import: fix table style at character formatting
applied also on paragraph level during import.
Regression from commit 4d5c0eaf3e0d3d3bcd9e691fffee19b75f3d6631
(tdf#118812 DOCX import: fix table style preference – part 2)
See also commit 5ac6f02fdc6015a5d78071570dee310febf95fc6
(tdf#105215 DOCX import: fix paragraph-length direct formatting).
Change-Id: I14072c81fc4c54e376a004fa36ba76b56d2beb01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100996
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index b44325fa06d3..02baba345d58 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1094,7 +1094,8 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag { // apply paragraph and character properties of the table style on table paragraphs // if there is no direct paragraph formatting - if ( !rParaProp.m_pPropertyMap->isSet(eId) ) + bool bIsParaLevel = rParaProp.m_pPropertyMap->isSet(eId); + if ( !bIsParaLevel || isCharacterProperty(eId) ) { if ( (eId == PROP_PARA_LEFT_MARGIN || eId == PROP_PARA_FIRST_LINE_INDENT) && rParaProp.m_pPropertyMap->isSet(PROP_NUMBERING_RULES) ) @@ -1104,6 +1105,15 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag } OUString sPropertyName = getPropertyName(eId); + + if ( bIsParaLevel && ( rParaProp.m_aParaOverrideApplied.find(sPropertyName) != rParaProp.m_aParaOverrideApplied.end() || + sPropertyName.startsWith("CharFontName") ) ) + { + // don't apply table style, if this character property was applied on paragraph level + // (or in the case of paragraph level font name settings to avoid regressions) + continue; + } + auto pCellProp = std::find_if(rCellProperties.begin(), rCellProperties.end(), [&](const beans::PropertyValue& rProp) { return rProp.Name == sPropertyName; }); // this cell applies the table style property diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 333f1170ea09..d720e53a2a53 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1877,7 +1877,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con xParaCursor->gotoStartOfParagraph(false); if (m_nTableDepth > 0) { - TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps}; + TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps, std::set<OUString>()}; getTableManager().getCurrentParagraphs()->push_back(aPending); } @@ -1995,6 +1995,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con { uno::Reference<beans::XPropertySet> xRunPropertySet(xCur, uno::UNO_QUERY); xParaProps->setPropertyValue( rParaProp.Name, xRunPropertySet->getPropertyValue(rParaProp.Name) ); + // remember this for table style handling + getTableManager().getCurrentParagraphs()->back().m_aParaOverrideApplied.insert(rParaProp.Name); } } diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 0ac658f7674d..c48d52803ee1 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -33,6 +33,7 @@ #include <optional> #include <map> #include <vector> +#include <set> namespace com::sun::star { namespace beans { @@ -594,6 +595,7 @@ struct TableParagraph css::uno::Reference<css::text::XTextRange> m_rEndParagraph; PropertyMapPtr m_pPropertyMap; css::uno::Reference<css::beans::XPropertySet> m_rPropertySet; + std::set<OUString> m_aParaOverrideApplied; }; typedef std::shared_ptr< std::vector<TableParagraph> > TableParagraphVectorPtr; |