diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-05-11 09:44:22 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-05-19 11:58:24 +0200 |
commit | 02f53bd61222d7999b847a22fd24d65195f129e5 (patch) | |
tree | 2a5db69499bcbb67ddab125cf825bf7c6cd1f878 /writerfilter | |
parent | 5648363e8f70cd95b00db62f91effb7eb1385ac9 (diff) |
tdf#148132: Revert "n#758883 dmapper: paragraph-level..."
Seems original problem is no longer reprodicible with recent builds
but ovewriting of numbering style params with inline values leads
to another problems.
Removing this mechanics do some impact on RTF filter: it tries to
modify numbering styles, so this was also corrected. It is not ideal
yet but looks better in support numbering char properties different
from paragraph ones.
This reverts commit 2123ede032ca64f696ef54af4ad3238974ca2b5d.
Change-Id: If8c79d6191de13b2f09c128b59d17efcfdb1a4ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133877
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 14 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 67 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 9 |
5 files changed, 17 insertions, 84 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index f0ca81df7706..8f3815fa9abd 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -372,13 +372,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) if (m_pImpl->GetTopContext()) { m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::Any( sStringValue )); - if (m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) && m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->isSet(PROP_NUMBERING_RULES)) - { - // Font of the paragraph mark should be used for the numbering as well. - uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); - if (xCharStyle.is()) - xCharStyle->setPropertyValue("CharFontName", uno::Any(sStringValue)); - } } break; case NS_ooxml::LN_CT_Fonts_asciiTheme: @@ -1816,9 +1809,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) if( nSprmId != NS_ooxml::LN_EG_RPrBase_bCs ) rContext->Insert(PROP_CHAR_WEIGHT_ASIAN, aBold ); - uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); - if (xCharStyle.is()) - xCharStyle->setPropertyValue(getPropertyName(PROP_CHAR_WEIGHT), aBold); if (nSprmId == NS_ooxml::LN_EG_RPrBase_b) m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "b", OUString::number(nIntValue)); else if (nSprmId == NS_ooxml::LN_EG_RPrBase_bCs) @@ -1896,10 +1886,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) //Asian get the same value as Western rContext->Insert( PROP_CHAR_HEIGHT, aVal ); rContext->Insert( PROP_CHAR_HEIGHT_ASIAN, aVal ); - - uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); - if (xCharStyle.is()) - xCharStyle->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), aVal); } m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, (nSprmId == NS_ooxml::LN_EG_RPrBase_sz ? OUString("sz") : OUString("szCs")), OUString::number(nIntValue)); } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 63cb83c2e1a0..cca5d67adf5a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2096,8 +2096,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con { aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues()); } - // TODO: this *should* work for RTF but there are test failures, maybe rtftok doesn't distinguish between formatting for the paragraph marker and for the paragraph as a whole; needs investigation - if (pPropertyMap && IsOOXMLImport()) + if (pPropertyMap) { // tdf#64222 filter out the "paragraph marker" formatting and // set it as a separate paragraph property, not a empty hint at @@ -8341,70 +8340,6 @@ uno::Reference<container::XIndexAccess> DomainMapper_Impl::GetCurrentNumberingRu return xRet; } -uno::Reference<beans::XPropertySet> DomainMapper_Impl::GetCurrentNumberingCharStyle() -{ - uno::Reference<beans::XPropertySet> xRet; - try - { - sal_Int32 nListLevel = -1; - uno::Reference<container::XIndexAccess> xLevels; - if ( GetTopContextType() == CONTEXT_PARAGRAPH ) - xLevels = GetCurrentNumberingRules(&nListLevel); - if (!xLevels.is()) - { - if (IsOOXMLImport()) - return xRet; - - PropertyMapPtr pContext = m_pTopContext; - if (IsRTFImport() && !IsOpenField()) - { - // Looking up the paragraph context explicitly (and not just taking - // the top context) is necessary for RTF, where formatting of a run - // and of the paragraph mark is not separated. - // We know that the formatting inside a field won't affect the - // paragraph marker formatting, though. - pContext = GetTopContextOfType(CONTEXT_PARAGRAPH); - if (!pContext) - return xRet; - } - - // In case numbering rules is not found via a style, try the direct formatting instead. - std::optional<PropertyMap::Property> oProp = pContext->getProperty(PROP_NUMBERING_RULES); - if (oProp) - { - xLevels.set(oProp->second, uno::UNO_QUERY); - // Found the rules, then also try to look up our numbering level. - oProp = pContext->getProperty(PROP_NUMBERING_LEVEL); - if (oProp) - oProp->second >>= nListLevel; - else - nListLevel = 0; - } - - if (!xLevels.is()) - return xRet; - } - uno::Sequence<beans::PropertyValue> aProps; - xLevels->getByIndex(nListLevel) >>= aProps; - auto pProp = std::find_if(std::cbegin(aProps), std::cend(aProps), - [](const beans::PropertyValue& rProp) { return rProp.Name == "CharStyleName"; }); - if (pProp != std::cend(aProps)) - { - OUString aCharStyle; - pProp->Value >>= aCharStyle; - uno::Reference<container::XNameAccess> xCharacterStyles; - uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier(GetTextDocument(), uno::UNO_QUERY); - uno::Reference< container::XNameAccess > xStyleFamilies = xStylesSupplier->getStyleFamilies(); - xStyleFamilies->getByName("CharacterStyles") >>= xCharacterStyles; - xRet.set(xCharacterStyles->getByName(aCharStyle), uno::UNO_QUERY_THROW); - } - } - catch( const uno::Exception& ) - { - } - return xRet; -} - SectionPropertyMap * DomainMapper_Impl::GetSectionContext() { SectionPropertyMap* pSectionContext = nullptr; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 5a48e26fe73b..27e5457c2772 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -1056,8 +1056,6 @@ public: } SectionPropertyMap * GetSectionContext(); - /// If the current paragraph has a numbering style associated, this method returns its character style (part of the numbering rules) - css::uno::Reference<css::beans::XPropertySet> GetCurrentNumberingCharStyle(); /// If the current paragraph has a numbering style associated, this method returns its numbering rules css::uno::Reference<css::container::XIndexAccess> GetCurrentNumberingRules(sal_Int32* pListLevel); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index ca092fb66a37..eb5370223aaa 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -194,7 +194,14 @@ bool RTFDocumentImpl::dispatchCharacterSprmValue(RTFKeyword nKeyword, int nParam } if (nSprm > 0) { - m_aStates.top().getCharacterSprms().set(nSprm, pIntValue); + if (m_aStates.top().getDestination() == Destination::LISTLEVEL) + { + m_aStates.top().getTableSprms().set(nSprm, pIntValue); + } + else + { + m_aStates.top().getCharacterSprms().set(nSprm, pIntValue); + } return true; } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 662f68bbda5e..ebd3922de22a 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1971,7 +1971,14 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n } if (nSprm >= 0) { - m_aStates.top().getCharacterSprms().set(nSprm, pBoolValue); + if (m_aStates.top().getDestination() == Destination::LISTLEVEL) + { + m_aStates.top().getTableSprms().set(nSprm, pBoolValue); + } + else + { + m_aStates.top().getCharacterSprms().set(nSprm, pBoolValue); + } return RTFError::OK; } |