diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-02-28 12:57:42 +0100 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-02-28 20:24:37 +0100 |
commit | acd5d5fc92f53ca1cfb48357c6b73260b73d56b3 (patch) | |
tree | e93090c2d1617b5610408241a825009c48147e1e /writerfilter | |
parent | writerfilter: extend tokens and model.xml for w:compatSettings (diff) | |
download | core-acd5d5fc92f53ca1cfb48357c6b73260b73d56b3.tar.gz core-acd5d5fc92f53ca1cfb48357c6b73260b73d56b3.zip |
writerfilter: put w:compatSettings into a document level GrabBag
Change-Id: Iefb8ef14c61e7966098754b8f3395f994bb9bda7
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.cxx | 39 | ||||
-rw-r--r-- | writerfilter/source/dmapper/SettingsTable.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/filter/ImportFilter.cxx | 6 |
5 files changed, 50 insertions, 3 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index 0a9ecbe9697d..a2d600686586 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx @@ -128,6 +128,7 @@ public: beans::PropertyValue getInteropGrabBag(); uno::Sequence<beans::PropertyValue> GetThemeFontLangProperties() const; + css::uno::Sequence<css::beans::PropertyValue> GetCompatSettings() const; void HandleRedline( Sprm& rSprm ); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 00b23addc969..aa81f65f4693 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3177,6 +3177,11 @@ uno::Sequence<beans::PropertyValue> DomainMapper::GetThemeFontLangProperties() c return m_pImpl->GetSettingsTable()->GetThemeFontLangProperties(); } +uno::Sequence<beans::PropertyValue> DomainMapper::GetCompatSettings() const +{ + return m_pImpl->GetSettingsTable()->GetCompatSettings(); +} + void DomainMapper::HandleRedline( Sprm& rSprm ) { sal_uInt32 nSprmId = rSprm.getId(); diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index f2c9023faee6..27ff52d8c49e 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -76,6 +76,9 @@ struct SettingsTable_Impl bool m_bMirrorMargin; uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps; + uno::Sequence<beans::PropertyValue> m_pCompatSettings; + uno::Sequence<beans::PropertyValue> m_pCurrentCompatSetting; + SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : m_rDMapper( rDMapper ) , m_xTextFactory( xTextFactory ) @@ -102,6 +105,8 @@ struct SettingsTable_Impl , m_bSplitPgBreakAndParaMark(false) , m_bMirrorMargin(false) , m_pThemeFontLangProps(3) + , m_pCompatSettings(0) + , m_pCurrentCompatSetting(3) {} }; @@ -144,6 +149,18 @@ void SettingsTable::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_View_val: m_pImpl->m_nView = nIntValue; break; + case NS_ooxml::LN_CT_CompatSetting_name: + m_pImpl->m_pCurrentCompatSetting[0].Name = "name"; + m_pImpl->m_pCurrentCompatSetting[0].Value <<= sStringValue; + break; + case NS_ooxml::LN_CT_CompatSetting_uri: + m_pImpl->m_pCurrentCompatSetting[1].Name = "uri"; + m_pImpl->m_pCurrentCompatSetting[1].Value <<= sStringValue; + break; + case NS_ooxml::LN_CT_CompatSetting_val: + m_pImpl->m_pCurrentCompatSetting[2].Name = "val"; + m_pImpl->m_pCurrentCompatSetting[2].Value <<= sStringValue; + break; default: { #ifdef DEBUG_DMAPPER_SETTINGS_TABLE @@ -174,12 +191,11 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_themeFontLang: // 92552; case NS_ooxml::LN_CT_Settings_shapeDefaults: // 92560; case NS_ooxml::LN_CT_Settings_view: - //PropertySetValues - need to be resolved { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) - pProperties->resolve(*this); + pProperties->resolve(*this); } break; case NS_ooxml::LN_CT_Settings_stylePaneFormatFilter: // 92493; @@ -244,6 +260,20 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) case NS_ooxml::LN_CT_Settings_mirrorMargins: m_pImpl->m_bMirrorMargin = nIntValue; break; + case NS_ooxml::LN_CT_Compat_compatSetting: + { + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); + if( pProperties.get()) + { + pProperties->resolve(*this); + + sal_Int32 aLength = m_pImpl->m_pCompatSettings.getLength(); + m_pImpl->m_pCompatSettings.realloc(aLength + 1); + m_pImpl->m_pCompatSettings[aLength].Name = "compatSetting"; + m_pImpl->m_pCompatSettings[aLength].Value = uno::makeAny(m_pImpl->m_pCurrentCompatSetting); + } + } + break; default: { #ifdef DEBUG_DMAPPER_SETTINGS_TABLE @@ -321,6 +351,11 @@ uno::Sequence<beans::PropertyValue> SettingsTable::GetThemeFontLangProperties() return m_pImpl->m_pThemeFontLangProps; } +uno::Sequence<beans::PropertyValue> SettingsTable::GetCompatSettings() const +{ + return m_pImpl->m_pCompatSettings; +} + void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc ) { uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY ); diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx index b19146af609f..54cd0a0b3eb5 100644 --- a/writerfilter/source/dmapper/SettingsTable.hxx +++ b/writerfilter/source/dmapper/SettingsTable.hxx @@ -77,6 +77,8 @@ class SettingsTable : public LoggedProperties, public LoggedTable uno::Sequence<beans::PropertyValue> GetThemeFontLangProperties() const; + uno::Sequence<beans::PropertyValue> GetCompatSettings() const; + void ApplyProperties( uno::Reference< text::XTextDocument > xDoc ); private: diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index ab3a5fa91c1a..b6615a92ffb4 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -119,7 +119,7 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes pDocument->resolve(*pStream); // Adding some properties to the document's grab bag for interoperability purposes: - uno::Sequence<beans::PropertyValue> aGrabBagProperties(9); + uno::Sequence<beans::PropertyValue> aGrabBagProperties(10); // Adding the saved Theme DOM aGrabBagProperties[0].Name = "OOXTheme"; @@ -151,6 +151,10 @@ sal_Bool WriterFilter::filter( const uno::Sequence< beans::PropertyValue >& aDes aGrabBagProperties[8].Name = "OOXEmbeddings"; aGrabBagProperties[8].Value = uno::makeAny( pDocument->getEmbeddingsList() ); + // Adding the saved compat settings + aGrabBagProperties[9].Name = "CompatSettings"; + aGrabBagProperties[9].Value = uno::makeAny( aDomainMapper->GetCompatSettings() ); + putPropertiesToDocumentGrabBag( aGrabBagProperties ); writerfilter::ooxml::OOXMLStream::Pointer_t pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream( pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT )); |