diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-06-19 09:28:28 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-06-19 09:30:11 +0200 |
commit | 2123ede032ca64f696ef54af4ad3238974ca2b5d (patch) | |
tree | db2963c8fd72a340346f261a548c4028c00e2528 | |
parent | 14d6cf1f8f86027d58fe56feae3139c314fbb058 (diff) |
n#758883 dmapper: paragraph-level run props should affect numberings as well
Change-Id: I707105f6da53a6cb790d743738875acde561e20f
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 42 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 |
3 files changed, 53 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index c3b8a10555e5..d4b01d640c5c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1437,6 +1437,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType Value::Pointer_t pValue = rSprm.getValue(); sal_Int32 nIntValue = pValue->getInt(); rtl::OUString sStringValue = pValue->getString(); + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); switch(nSprmId) { @@ -1983,6 +1984,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType rContext->Insert(ePropertyId, true, aBold ); if( nSprmId != NS_sprm::LN_CFBoldBi ) // sprmCFBoldBi rContext->Insert(PROP_CHAR_WEIGHT_ASIAN, true, aBold ); + + uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); + if (xCharStyle.is()) + xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_WEIGHT), aBold); } break; case 61: /*sprmCFItalic*/ @@ -2060,6 +2065,10 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType //Asian get the same value as Western rContext->Insert( PROP_CHAR_HEIGHT, true, aVal ); rContext->Insert( PROP_CHAR_HEIGHT_ASIAN, true, aVal ); + + uno::Reference<beans::XPropertySet> xCharStyle(m_pImpl->GetCurrentNumberingCharStyle()); + if (xCharStyle.is()) + xCharStyle->setPropertyValue(rPropNameSupplier.GetName(PROP_CHAR_HEIGHT), aVal); } } break; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 1dcb7f562e2e..1ca32f62e44d 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3561,6 +3561,48 @@ void DomainMapper_Impl::ApplySettingsTable() } } +uno::Reference<beans::XPropertySet> DomainMapper_Impl::GetCurrentNumberingCharStyle() +{ + uno::Reference<beans::XPropertySet> xRet; + OUString aStyle = GetCurrentParaStyleId(); + if (aStyle.isEmpty() || GetTopContextType() != CONTEXT_PARAGRAPH) + return xRet; + const StyleSheetEntryPtr pEntry = GetStyleSheetTable()->FindStyleSheetByISTD(aStyle); + if (!pEntry) + return xRet; + const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0); + sal_Int32 nListId = pStyleSheetProperties->GetListId(); + sal_Int32 nListLevel = pStyleSheetProperties->GetListLevel(); + if (nListId < 0 || nListLevel < 0) + return xRet; + + // So we are in a paragraph style and it has numbering. Look up the relevant character style. + OUString aListName = ListDef::GetStyleName(nListId); + uno::Reference< style::XStyleFamiliesSupplier > xStylesSupplier(GetTextDocument(), uno::UNO_QUERY); + uno::Reference< container::XNameAccess > xStyleFamilies = xStylesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xNumberingStyles; + xStyleFamilies->getByName("NumberingStyles") >>= xNumberingStyles; + uno::Reference<beans::XPropertySet> xStyle(xNumberingStyles->getByName(aListName), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels(xStyle->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProps; + xLevels->getByIndex(nListLevel) >>= aProps; + for (int i = 0; i < aProps.getLength(); ++i) + { + const beans::PropertyValue& rProp = aProps[i]; + + if (rProp.Name == "CharStyleName") + { + OUString aCharStyle; + rProp.Value >>= aCharStyle; + uno::Reference<container::XNameAccess> xCharacterStyles; + xStyleFamilies->getByName("CharacterStyles") >>= xCharacterStyles; + xRet.set(xCharacterStyles->getByName(aCharStyle), uno::UNO_QUERY); + break; + } + } + return xRet; +} + SectionPropertyMap * DomainMapper_Impl::GetSectionContext() { SectionPropertyMap* pSectionContext = 0; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 07f69343fb4d..77a2b62adc6c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -613,6 +613,8 @@ public: void ApplySettingsTable(); SectionPropertyMap * GetSectionContext(); + /// If the current paragraph has a numbering style associated, this method returns its character style + com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> GetCurrentNumberingCharStyle(); }; } //namespace dmapper } //namespace writerfilter |