From 1716bff44744aacfb5ecec9b6894d16a4eee1b39 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Thu, 19 Oct 2000 04:32:52 +0000 Subject: add: names of page-master-name in master pages --- xmloff/source/style/XMLPageExport.cxx | 46 ++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/style/XMLPageExport.cxx b/xmloff/source/style/XMLPageExport.cxx index e37b376334ff..49735476d723 100644 --- a/xmloff/source/style/XMLPageExport.cxx +++ b/xmloff/source/style/XMLPageExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLPageExport.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dr $ $Date: 2000-10-18 11:32:20 $ + * last change: $Author: dr $ $Date: 2000-10-19 05:32:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,19 +112,35 @@ using namespace ::com::sun::star::style; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; -void XMLPageExport::collectPageMasterAutoStyle( - const Reference < XPropertySet > & rPropSet ) + +//______________________________________________________________________________ + +sal_Bool XMLPageExport::findPageMasterName( const OUString& rStyleName, OUString& rPMName ) const { - std::vector xPropStates = rExport.GetPageMasterPropSetMapper()->Filter( rPropSet ); - if(xPropStates.size()) + for( ::std::vector< XMLPageExportNameEntry >::const_iterator pEntry = aNameVector.begin(); + pEntry != aNameVector.end(); pEntry++ ) { - rtl::OUString sParent; - rtl::OUString sName( rExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_PAGE_MASTER, sParent, xPropStates) ); - if (!sName.getLength()) + if( pEntry->sStyleName == rStyleName ) { - sName = rExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_PAGE_MASTER, sParent, xPropStates); + rPMName = pEntry->sPageMasterName; + return sal_True; } } + return sal_False; +} + +void XMLPageExport::collectPageMasterAutoStyle( + const Reference < XPropertySet > & rPropSet, + OUString& rPageMasterName ) +{ + ::std::vector xPropStates = rExport.GetPageMasterPropSetMapper()->Filter( rPropSet ); + if(xPropStates.size()) + { + OUString sParent; + rPageMasterName = rExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_PAGE_MASTER, sParent, xPropStates ); + if (!rPageMasterName.getLength()) + rPageMasterName = rExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_PAGE_MASTER, sParent, xPropStates); + } } void XMLPageExport::exportMasterPageContent( @@ -154,7 +170,11 @@ sal_Bool XMLPageExport::exportStyle( if( bAutoStyles ) { - collectPageMasterAutoStyle( xPropSet ); + XMLPageExportNameEntry aEntry; + collectPageMasterAutoStyle( xPropSet, aEntry.sPageMasterName ); + aEntry.sStyleName = rStyle->getName(); + aNameVector.push_back( aEntry ); + exportMasterPageContent( xPropSet, sal_True ); } else @@ -162,6 +182,10 @@ sal_Bool XMLPageExport::exportStyle( OUString sName( rStyle->getName() ); GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_name, sName ); + OUString sPMName; + if( findPageMasterName( sName, sPMName ) ) + GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_page_master_name, sPMName ); + aAny = xPropSet->getPropertyValue( sFollowStyle ); OUString sNextName; aAny >>= sNextName; -- cgit