diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-06-25 13:15:47 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-06-25 13:15:47 +0000 |
commit | d130081857c58b913cd451577219ffee31e720ba (patch) | |
tree | a866d41df31292b571c879c28f15b6c4d6544715 /xmloff/source/core | |
parent | 5427e2a77c5f94ee196d2ae1676f6bd99613650b (diff) |
INTEGRATION: CWS xformsdocmodify (1.28.24); FILE MERGED
2008/06/04 12:07:49 fs 1.28.24.2: #i90243# call SetDocumentSpecificSettings
2008/06/03 20:50:24 fs 1.28.24.1: #i90243# allow exporting document-specifc settings, which are neither view nor configuration settings
Diffstat (limited to 'xmloff/source/core')
-rw-r--r-- | xmloff/source/core/DocumentSettingsContext.cxx | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index c9e0639fe685..5845a80bc1a0 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: DocumentSettingsContext.cxx,v $ - * $Revision: 1.28 $ + * $Revision: 1.29 $ * * This file is part of OpenOffice.org. * @@ -325,10 +325,40 @@ SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, USHORT p_nPrefix } //============================================================================= +namespace +{ + struct SettingsGroup + { + ::rtl::OUString sGroupName; + uno::Any aSettings; + + SettingsGroup() + :sGroupName() + ,aSettings() + { + } + + SettingsGroup( const ::rtl::OUString& _rGroupName, const uno::Any& _rSettings ) + :sGroupName( _rGroupName ) + ,aSettings( _rSettings ) + { + } + }; +} + +struct XMLDocumentSettingsContext_Data +{ + com::sun::star::uno::Any aViewProps; + com::sun::star::uno::Any aConfigProps; + ::std::list< SettingsGroup > aDocSpecificSettings; +}; + +//============================================================================= XMLDocumentSettingsContext::XMLDocumentSettingsContext(SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLName, const uno::Reference<xml::sax::XAttributeList>& ) : SvXMLImportContext( rImport, nPrfx, rLName ) + , m_pData( new XMLDocumentSettingsContext_Data ) { // here are no attributes } @@ -375,12 +405,23 @@ SvXMLImportContext *XMLDocumentSettingsContext::CreateChildContext( USHORT p_nPr if (IsXMLToken(aLocalConfigName, XML_VIEW_SETTINGS)) pContext = new XMLConfigItemSetContext(GetImport(), p_nPrefix, rLocalName, xAttrList, - aViewProps, NULL); + m_pData->aViewProps, NULL); else if (IsXMLToken(aLocalConfigName, XML_CONFIGURATION_SETTINGS)) pContext = new XMLConfigItemSetContext(GetImport(), p_nPrefix, rLocalName, xAttrList, - aConfigProps, NULL); + m_pData->aConfigProps, NULL); + else + { + m_pData->aDocSpecificSettings.push_back( SettingsGroup( aLocalConfigName, uno::Any() ) ); + + ::std::list< SettingsGroup >::reverse_iterator settingsPos = + m_pData->aDocSpecificSettings.rbegin(); + + pContext = new XMLConfigItemSetContext(GetImport(), + p_nPrefix, rLocalName, xAttrList, + settingsPos->aSettings, NULL); + } } } } @@ -394,7 +435,7 @@ SvXMLImportContext *XMLDocumentSettingsContext::CreateChildContext( USHORT p_nPr void XMLDocumentSettingsContext::EndElement() { uno::Sequence<beans::PropertyValue> aSeqViewProps; - if (aViewProps >>= aSeqViewProps) + if (m_pData->aViewProps >>= aSeqViewProps) { GetImport().SetViewSettings(aSeqViewProps); sal_Int32 i(aSeqViewProps.getLength() - 1); @@ -423,7 +464,7 @@ void XMLDocumentSettingsContext::EndElement() C2U("org.openoffice.Office.Common/"), C2U("Save/Document"), C2U("LoadPrinter"), ::comphelper::ConfigurationHelper::E_READONLY ) >>= bLoadDocPrinter; uno::Sequence<beans::PropertyValue> aSeqConfigProps; - if ( aConfigProps >>= aSeqConfigProps ) + if ( m_pData->aConfigProps >>= aSeqConfigProps ) { if ( !bLoadDocPrinter ) { @@ -453,6 +494,16 @@ void XMLDocumentSettingsContext::EndElement() GetImport().SetConfigurationSettings( aSeqConfigProps ); } + + for ( ::std::list< SettingsGroup >::const_iterator settings = m_pData->aDocSpecificSettings.begin(); + settings != m_pData->aDocSpecificSettings.end(); + ++settings + ) + { + uno::Sequence< beans::PropertyValue > aDocSettings; + OSL_VERIFY( settings->aSettings >>= aDocSettings ); + GetImport().SetDocumentSpecificSettings( settings->sGroupName, aDocSettings ); + } } //============================================================================= |