summaryrefslogtreecommitdiff
path: root/xmloff/source/style/xmlaustp.cxx
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2000-10-18 10:34:12 +0000
committerDaniel Rentz <dr@openoffice.org>2000-10-18 10:34:12 +0000
commit1d440379f0191a0d1d4bf225a20960bb056e14ab (patch)
tree731fe313b9590b22ba07869e412bbf06444c3430 /xmloff/source/style/xmlaustp.cxx
parent6203d35b20ecc1cae58be701da69aed783c9010f (diff)
add: im/export of page-master styles
Diffstat (limited to 'xmloff/source/style/xmlaustp.cxx')
-rw-r--r--xmloff/source/style/xmlaustp.cxx103
1 files changed, 97 insertions, 6 deletions
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
index 1e7c3bde8f..252bcfa34f 100644
--- a/xmloff/source/style/xmlaustp.cxx
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlaustp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: sab $ $Date: 2000-09-22 13:41:50 $
+ * last change: $Author: dr $ $Date: 2000-10-18 11:34:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,6 +69,29 @@
#ifndef _XMLOFF_XMLASTPLP_HXX
#include "xmlaustp.hxx"
#endif
+#ifndef _XMLOFF_FAMILIES_HXX_
+#include "families.hxx"
+#endif
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include "attrlist.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX
+#include "PageMasterStyleMap.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
using namespace ::std;
using namespace ::rtl;
@@ -88,9 +111,75 @@ void SvXMLAutoStylePoolP::exportStyleContent(
const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
sal_Int32 nFamily,
const vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp,
const SvXMLUnitConverter& rUnitConverter,
const SvXMLNamespaceMap& rNamespaceMap ) const
{
+ if( nFamily == XML_STYLE_FAMILY_PAGE_MASTER )
+ {
+ SvXMLAttributeList* pHeaderAttr = new SvXMLAttributeList;
+ uno::Reference< xml::sax::XAttributeList > xHeaderAttrList( pHeaderAttr );
+ SvXMLAttributeList* pFooterAttr = new SvXMLAttributeList;
+ uno::Reference< xml::sax::XAttributeList > xFooterAttrList( pFooterAttr );
+
+ OUString sType( RTL_CONSTASCII_USTRINGPARAM( sXML_CDATA ) );
+ OUString sWS( RTL_CONSTASCII_USTRINGPARAM( sXML_WS ) );
+
+ for( ::std::vector< XMLPropertyState >::const_iterator pProp = rProperties.begin(); pProp != rProperties.end(); pProp++ )
+ {
+ UniReference< XMLPropertySetMapper > aPropMapper = rPropExp.getPropertySetMapper();
+ sal_Int32 nIndex = pProp->mnIndex;
+ sal_Int32 nId = aPropMapper->GetEntryContextId( nIndex );
+
+ if( nId & (CTF_PM_HEADERFLAG | CTF_PM_FOOTERFLAG) )
+ {
+ OUString sName( rNamespaceMap.GetQNameByKey(
+ aPropMapper->GetEntryNameSpace( nIndex ), aPropMapper->GetEntryXMLName( nIndex ) ) );
+ OUString sValue;
+ const XMLPropertyHandler* pPropHdl = aPropMapper->GetPropertyHandler( nIndex );
+ if( pPropHdl )
+ {
+ if( pPropHdl->exportXML( sValue, pProp->maValue, rUnitConverter ) )
+ {
+ if( nId & CTF_PM_HEADERFLAG )
+ pHeaderAttr->AddAttribute( sName, sType, sValue );
+ else if( nId & CTF_PM_FOOTERFLAG )
+ pFooterAttr->AddAttribute( sName, sType, sValue );
+ }
+ }
+ }
+ }
+
+ uno::Reference< xml::sax::XAttributeList > xEmptyList;
+ if( pHeaderAttr->getLength() )
+ {
+ OUString sNameHeader( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii( sXML_header_style ) ) );
+ OUString sNameProp( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii( sXML_properties ) ) );
+
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->startElement( sNameHeader, xEmptyList );
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->startElement( sNameProp, xHeaderAttrList );
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->endElement( sNameProp );
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->endElement( sNameHeader );
+ }
+ if( pFooterAttr->getLength() )
+ {
+ OUString sNameFooter( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii( sXML_footer_style ) ) );
+ OUString sNameProp( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii( sXML_properties ) ) );
+
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->startElement( sNameFooter, xEmptyList );
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->startElement( sNameProp, xFooterAttrList );
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->endElement( sNameProp );
+ rHandler->ignorableWhitespace( sWS );
+ rHandler->endElement( sNameFooter );
+ }
+ }
}
SvXMLAutoStylePoolP::SvXMLAutoStylePoolP()
@@ -108,19 +197,21 @@ void SvXMLAutoStylePoolP::AddFamily(
sal_Int32 nFamily,
const OUString& rStrName,
XMLPropertySetMapper* pMapper,
- OUString aStrPrefix )
+ OUString aStrPrefix,
+ sal_Bool bAsFamily )
{
UniReference <XMLPropertySetMapper> xTmp = pMapper;
- AddFamily( nFamily, rStrName, xTmp, aStrPrefix );
+ AddFamily( nFamily, rStrName, xTmp, aStrPrefix, bAsFamily );
}
void SvXMLAutoStylePoolP::AddFamily(
sal_Int32 nFamily,
const OUString& rStrName,
const UniReference < XMLPropertySetMapper > & rMapper,
- const OUString& rStrPrefix )
+ const OUString& rStrPrefix,
+ sal_Bool bAsFamily )
{
- pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix );
+ pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily );
}
void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily,