diff options
-rw-r--r-- | xmloff/source/style/PageHeaderFooterContext.cxx | 135 | ||||
-rw-r--r-- | xmloff/source/style/PageHeaderFooterContext.hxx | 96 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterImportContext.cxx | 185 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterImportPropMapper.cxx | 266 | ||||
-rw-r--r-- | xmloff/source/style/PageMasterImportPropMapper.hxx | 100 | ||||
-rw-r--r-- | xmloff/source/style/PagePropertySetContext.cxx | 152 | ||||
-rw-r--r-- | xmloff/source/style/PagePropertySetContext.hxx | 99 |
7 files changed, 1033 insertions, 0 deletions
diff --git a/xmloff/source/style/PageHeaderFooterContext.cxx b/xmloff/source/style/PageHeaderFooterContext.cxx new file mode 100644 index 000000000000..8123e603db20 --- /dev/null +++ b/xmloff/source/style/PageHeaderFooterContext.cxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * $RCSfile: PageHeaderFooterContext.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:47 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifdef PCH +#include "filt_pch.hxx" +#endif + +#pragma hdrstop + +// INCLUDE --------------------------------------------------------------- + +#ifndef _XMLOFF_PAGEPHEADERFOOTERCONTEXT_HXX +#include "PageHeaderFooterContext.hxx" +#endif +#ifndef _XMLOFF_XMLNMSPE_HXX +#include "xmlnmspe.hxx" +#endif +#ifndef _XMLOFF_XMLKYWD_HXX +#include "xmlkywd.hxx" +#endif +#ifndef _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX +#include "PagePropertySetContext.hxx" +#endif + +using namespace com::sun::star; + +//------------------------------------------------------------------ + +PageHeaderFooterContext::PageHeaderFooterContext( SvXMLImport& rImport, + USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ::std::vector< XMLPropertyState > & rTempProperties, + const UniReference < SvXMLImportPropertyMapper > &rTempMap, + const sal_Bool bTempHeader ) : + SvXMLImportContext( rImport, nPrfx, rLName ), + rProperties(rTempProperties), + rMap(rTempMap) +{ + bHeader = bTempHeader; +} + +PageHeaderFooterContext::~PageHeaderFooterContext() +{ +} + +SvXMLImportContext *PageHeaderFooterContext::CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) +{ + SvXMLImportContext *pContext = 0; + + if( XML_NAMESPACE_STYLE == nPrefix && + rLName.compareToAscii( sXML_properties ) == 0 ) + { + PageContextType aType = Header; + if (!bHeader) + aType = Footer; + pContext = new PagePropertySetContext( GetImport(), nPrefix, + rLName, xAttrList, + rProperties, + rMap, aType); + } + + + if( !pContext ) + pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName ); + + return pContext; +} + +void PageHeaderFooterContext::EndElement() +{ +} + diff --git a/xmloff/source/style/PageHeaderFooterContext.hxx b/xmloff/source/style/PageHeaderFooterContext.hxx new file mode 100644 index 000000000000..93ec3f9e2c8b --- /dev/null +++ b/xmloff/source/style/PageHeaderFooterContext.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: PageHeaderFooterContext.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:48 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _XMLOFF_PAGEHEADERFOOTERCONTEXT_HXX +#define _XMLOFF_PAGEHEADERFOOTERCONTEXT_HXX + +#ifndef _XMLOFF_XMLIMP_HXX +#include <xmloff/xmlimp.hxx> +#endif + +class PageHeaderFooterContext : public SvXMLImportContext +{ + ::std::vector< XMLPropertyState > & rProperties; + sal_Bool bHeader; + const UniReference < SvXMLImportPropertyMapper > &rMap; + +public: + + PageHeaderFooterContext( SvXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ::std::vector< XMLPropertyState > & rProperties, + const UniReference < SvXMLImportPropertyMapper > &rMap, + const sal_Bool bHeader); + + virtual ~PageHeaderFooterContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); +}; + +#endif + + diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx new file mode 100644 index 000000000000..030bd373a73b --- /dev/null +++ b/xmloff/source/style/PageMasterImportContext.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * $RCSfile: PageMasterImportContext.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:48 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#pragma hdrstop + +#ifndef _XMLOFF_PAGEMASTERIMPORTCONTEXT_HXX +#include "PageMasterImportContext.hxx" +#endif + +#ifndef _XMLOFF_XMLNMSPE_HXX +#include "xmlnmspe.hxx" +#endif +#ifndef _XMLOFF_XMLKYWD_HXX +#include "xmlkywd.hxx" +#endif +#ifndef _XMLOFF_PAGEMASTERPROPHDL_HXX_ +#include "PageMasterPropHdl.hxx" +#endif +#ifndef _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX +#include "PagePropertySetContext.hxx" +#endif +#ifndef _XMLOFF_PAGEPHEADERFOOTERCONTEXT_HXX +#include "PageHeaderFooterContext.hxx" +#endif + +using namespace ::com::sun::star; + +void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey, + const rtl::OUString& rLocalName, + const rtl::OUString& rValue ) +{ + // TODO: use a map here + if( XML_NAMESPACE_STYLE == nPrefixKey && rLocalName.compareToAscii( sXML_page_usage ) == 0 ) + { + sPageUsage = rValue; + } + else + { + XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue ); + } +} + +TYPEINIT1( PageStyleContext, XMLPropStyleContext ); + +PageStyleContext::PageStyleContext( SvXMLImport& rImport, + sal_uInt16 nPrfx, const rtl::OUString& rLName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList, + SvXMLStylesContext& rStyles) : + XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles ), + sPageUsage() +{ + SetFamily(XML_STYLE_FAMILY_PAGE_MASTER); +} + +PageStyleContext::~PageStyleContext() +{ +} + +SvXMLImportContext *PageStyleContext::CreateChildContext( + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList > & xAttrList ) +{ + SvXMLImportContext *pContext = NULL; + + if( XML_NAMESPACE_STYLE == nPrefix && + ((rLocalName.compareToAscii( sXML_header_style ) == 0) || + (rLocalName.compareToAscii( sXML_footer_style ) == 0) ) ) + { + UniReference < SvXMLImportPropertyMapper > xImpPrMap = + GetStyles()->GetImportPropertyMapper( GetFamily() ); + if( xImpPrMap.is() ) + { + sal_Bool bHeader = (rLocalName.compareToAscii( sXML_header_style ) == 0); + pContext = new PageHeaderFooterContext(GetImport(), nPrefix, rLocalName, + xAttrList, GetProperties(), xImpPrMap, bHeader); + } + } + if( XML_NAMESPACE_STYLE == nPrefix && + rLocalName.compareToAscii( sXML_properties ) == 0 ) + { + UniReference < SvXMLImportPropertyMapper > xImpPrMap = + GetStyles()->GetImportPropertyMapper( GetFamily() ); + if( xImpPrMap.is() ) + { + PageContextType aType = Page; + pContext = new PagePropertySetContext( GetImport(), nPrefix, + rLocalName, xAttrList, + GetProperties(), + xImpPrMap, aType); + } + } + + if (!pContext) + pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName, + xAttrList ); + return pContext; +} + +void PageStyleContext::FillPropertySet( + const uno::Reference< beans::XPropertySet > & rPropSet ) +{ + XMLPropStyleContext::FillPropertySet(rPropSet); + if (sPageUsage.len()) + { + uno::Any aPageUsage; + XMLPMPropHdl_PageStyleLayout aPageUsageHdl; + if (aPageUsageHdl.importXML(sPageUsage, aPageUsage, GetImport().GetMM100UnitConverter())) + rPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyleLayout")), aPageUsage); + } +} + +void PageStyleContext::CreateAndInsert( sal_Bool bOverwrite ) +{ + XMLPropStyleContext::CreateAndInsert( bOverwrite ); +} + +void PageStyleContext::CreateAndInsertLate( sal_Bool bOverwrite ) +{ + XMLPropStyleContext::CreateAndInsertLate( bOverwrite ); +} + +void PageStyleContext::Finish( sal_Bool bOverwrite ) +{ + XMLPropStyleContext::Finish( bOverwrite ); +} + diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx new file mode 100644 index 000000000000..fc1261e8aa9c --- /dev/null +++ b/xmloff/source/style/PageMasterImportPropMapper.cxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * $RCSfile: PageMasterImportPropMapper.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:48 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#pragma hdrstop + +#ifndef _XMLOFF_PAGEMASTERIMPORTPROPMAPPER_HXX +#include "PageMasterImportPropMapper.hxx" +#endif +#ifndef _XMLOFF_PAGEMASTERPROPMAPPER_HXX +#include "PageMasterPropMapper.hxx" +#endif +#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX +#include "PageMasterStyleMap.hxx" +#endif + +#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX +#include <xmloff/maptype.hxx> +#endif + +using namespace ::com::sun::star; + +PageMasterImportPropertyMapper::PageMasterImportPropertyMapper( + const UniReference< XMLPropertySetMapper >& rMapper ) : + SvXMLImportPropertyMapper( rMapper ) +{ +} + +PageMasterImportPropertyMapper::~PageMasterImportPropertyMapper() +{ +} + +/*sal_Bool PageMasterImportPropertyMapper::handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const ::rtl::OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const +{ + return sal_True; +}*/ + +/*sal_Bool PageMasterImportPropertyMapper::handleNoItem( + sal_Int32 nIndex, + ::std::vector< XMLPropertyState >& rProperties, + const ::rtl::OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const +{ + return sal_True; +}*/ + +void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >& rProperties ) const +{ + SvXMLImportPropertyMapper::finished(rProperties); + XMLPropertyState* pAllPaddingProperty = NULL; + XMLPropertyState* pAllBorderProperty = NULL; + XMLPropertyState* pAllBorderWidthProperty = NULL; + XMLPropertyState* pAllHeaderPaddingProperty = NULL; + XMLPropertyState* pAllHeaderBorderProperty = NULL; + XMLPropertyState* pAllHeaderBorderWidthProperty = NULL; + XMLPropertyState* pAllFooterPaddingProperty = NULL; + XMLPropertyState* pAllFooterBorderProperty = NULL; + XMLPropertyState* pAllFooterBorderWidthProperty = NULL; + ::std::vector< XMLPropertyState >::iterator i = rProperties.begin(); + for (i; i != rProperties.end(); i++) + { + sal_Int16 nContextID = getPropertySetMapper()->GetEntryContextId(i->mnIndex); + switch (nContextID) + { + case CTF_PM_PADDINGALL : + { + pAllPaddingProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_BORDERALL : + { + pAllBorderProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_BORDERWIDTHALL : + { + pAllBorderWidthProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_HEADERPADDINGALL : + { + pAllHeaderPaddingProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_HEADERBORDERALL : + { + pAllHeaderBorderProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_HEADERBORDERWIDTHALL : + { + pAllHeaderBorderWidthProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_FOOTERPADDINGALL : + { + pAllFooterPaddingProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_FOOTERBORDERALL : + { + pAllFooterBorderProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + case CTF_PM_FOOTERBORDERWIDTHALL : + { + pAllFooterBorderWidthProperty = new XMLPropertyState(i->mnIndex, i->maValue); + } + break; + } + } + if (pAllPaddingProperty) + { + sal_Int32 nIndex = pAllPaddingProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllPaddingProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllBorderProperty) + { + sal_Int32 nIndex = pAllBorderProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllBorderProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllBorderWidthProperty) + { + sal_Int32 nIndex = pAllBorderWidthProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllBorderWidthProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllHeaderPaddingProperty) + { + sal_Int32 nIndex = pAllHeaderPaddingProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllHeaderPaddingProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllHeaderBorderProperty) + { + sal_Int32 nIndex = pAllHeaderBorderProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllHeaderBorderProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllHeaderBorderWidthProperty) + { + sal_Int32 nIndex = pAllHeaderBorderWidthProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllHeaderBorderWidthProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllFooterPaddingProperty) + { + sal_Int32 nIndex = pAllFooterPaddingProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllFooterPaddingProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllFooterBorderProperty) + { + sal_Int32 nIndex = pAllFooterBorderProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllFooterBorderProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } + if (pAllFooterBorderWidthProperty) + { + sal_Int32 nIndex = pAllFooterBorderWidthProperty->mnIndex + 2; + XMLPropertyState aNewProperty (nIndex, pAllFooterBorderWidthProperty->maValue); + for (sal_Int16 j = 0; j < 3; j++) + { + aNewProperty.mnIndex = nIndex++; + rProperties.push_back(aNewProperty); + } + } +} + diff --git a/xmloff/source/style/PageMasterImportPropMapper.hxx b/xmloff/source/style/PageMasterImportPropMapper.hxx new file mode 100644 index 000000000000..80d6b3b72bca --- /dev/null +++ b/xmloff/source/style/PageMasterImportPropMapper.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * $RCSfile: PageMasterImportPropMapper.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:48 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _XMLOFF_PAGEMASTERIMPORTPROPMAPPER_HXX +#define _XMLOFF_PAGEMASTERIMPORTPROPMAPPER_HXX + +#ifndef _XMLOFF_XMLIMPPR_HXX +#include <xmloff/xmlimppr.hxx> +#endif + +class PageMasterImportPropertyMapper : public SvXMLImportPropertyMapper +{ +protected: + +public: + + PageMasterImportPropertyMapper( + const UniReference< XMLPropertySetMapper >& rMapper ); + virtual ~PageMasterImportPropertyMapper(); + + /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */ +/* virtual sal_Bool handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const ::rtl::OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const;*/ + + /** this method is called for every item that has the MID_FLAG_NO_ITEM_IMPORT flag set */ +/* virtual sal_Bool handleNoItem( + sal_Int32 nIndex, + ::std::vector< XMLPropertyState >& rProperties, + const ::rtl::OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const;*/ + + /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */ + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties ) const; +}; + +#endif diff --git a/xmloff/source/style/PagePropertySetContext.cxx b/xmloff/source/style/PagePropertySetContext.cxx new file mode 100644 index 000000000000..a78bdbdb5dc0 --- /dev/null +++ b/xmloff/source/style/PagePropertySetContext.cxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * $RCSfile: PagePropertySetContext.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:48 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + +#ifndef _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX +#include "PagePropertySetContext.hxx" +#endif +#ifndef _XMLBACKGROUNDIMAGECONTEXT_HXX +#include "XMLBackgroundImageContext.hxx" +#endif +#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX +#include "PageMasterStyleMap.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; + +PagePropertySetContext::PagePropertySetContext( + SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const Reference< xml::sax::XAttributeList > & xAttrList, + ::std::vector< XMLPropertyState > &rProps, + const UniReference < SvXMLImportPropertyMapper > &rMap, + const PageContextType aTempType ) : + SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, rProps, rMap ) +{ + aType = aTempType; +} + +PagePropertySetContext::~PagePropertySetContext() +{ +} + +SvXMLImportContext *PagePropertySetContext::CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const Reference< xml::sax::XAttributeList > & xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp ) +{ + sal_Int32 nPos = CTF_PM_GRAPHICPOSITION; + sal_Int32 nFil = CTF_PM_GRAPHICFILTER; + switch ( aType ) + { + case Header: + { + nPos = CTF_PM_HEADERGRAPHICPOSITION; + nFil = CTF_PM_HEADERGRAPHICFILTER; + } + break; + case Footer: + { + nPos = CTF_PM_FOOTERGRAPHICPOSITION; + nFil = CTF_PM_FOOTERGRAPHICFILTER; + } + break; + } + SvXMLImportContext *pContext = 0; + + switch( xMapper->getPropertySetMapper() + ->GetEntryContextId( rProp.mnIndex ) ) + { + case CTF_PM_GRAPHICURL: + case CTF_PM_HEADERGRAPHICURL: + case CTF_PM_FOOTERGRAPHICURL: + DBG_ASSERT( rProp.mnIndex >= 2 && + nPos == xMapper->getPropertySetMapper() + ->GetEntryContextId( rProp.mnIndex-2 ) && + nFil == xMapper->getPropertySetMapper() + ->GetEntryContextId( rProp.mnIndex-1 ), + "invalid property map!"); + pContext = + new XMLBackgroundImageContext( GetImport(), nPrefix, + rLocalName, xAttrList, + rProp, + rProp.mnIndex-2, + rProp.mnIndex-1, + rProperties ); + break; + } + + if( !pContext ) + pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, + xAttrList, + rProperties, rProp ); + + return pContext; +} + + diff --git a/xmloff/source/style/PagePropertySetContext.hxx b/xmloff/source/style/PagePropertySetContext.hxx new file mode 100644 index 000000000000..c85482acabda --- /dev/null +++ b/xmloff/source/style/PagePropertySetContext.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: PagePropertySetContext.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: sab $ $Date: 2000-10-23 10:17:48 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX +#define _XMLOFF_PAGEPROPERTYSETCONTEXT_HXX + +#ifndef _XMLOFF_XMLPROPERTYSETCONTEXT_HXX +#include "xmlprcon.hxx" +#endif + +enum PageContextType +{ + Page, + Header, + Footer +}; + +class PagePropertySetContext : public SvXMLPropertySetContext +{ + PageContextType aType; + +public: + PagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProps, + const UniReference < SvXMLImportPropertyMapper > &rMap, + const PageContextType aType ); + + virtual ~PagePropertySetContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp); +}; + + +#endif // _XMLOFF_XMLTEXTPROPERTYSETCONTEXT_HXX |