merge the formfield patch from ooo-build
[ooovba.git] / xmloff / source / style / PagePropertySetContext.cxx
blob9148c005865a52c349b05a8b0d512b6c7d8c79dc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PagePropertySetContext.cxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include <tools/debug.hxx>
34 #include "PagePropertySetContext.hxx"
35 #include "XMLBackgroundImageContext.hxx"
36 #include "XMLTextColumnsContext.hxx"
37 #ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX
38 #include <xmloff/PageMasterStyleMap.hxx>
39 #endif
40 #include "XMLFootnoteSeparatorImport.hxx"
42 using ::rtl::OUString;
44 using namespace ::com::sun::star::uno;
45 using namespace ::com::sun::star;
47 PagePropertySetContext::PagePropertySetContext(
48 SvXMLImport& rImport, sal_uInt16 nPrfx,
49 const OUString& rLName,
50 const Reference< xml::sax::XAttributeList > & xAttrList,
51 sal_uInt32 nFam,
52 ::std::vector< XMLPropertyState > &rProps,
53 const UniReference < SvXMLImportPropertyMapper > &rMap,
54 sal_Int32 nStartIndex, sal_Int32 nEndIndex,
55 const PageContextType aTempType ) :
56 SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
57 rProps, rMap, nStartIndex, nEndIndex )
59 aType = aTempType;
62 PagePropertySetContext::~PagePropertySetContext()
66 SvXMLImportContext *PagePropertySetContext::CreateChildContext(
67 sal_uInt16 nPrefix,
68 const OUString& rLocalName,
69 const Reference< xml::sax::XAttributeList > & xAttrList,
70 ::std::vector< XMLPropertyState > &rProperties,
71 const XMLPropertyState& rProp )
73 sal_Int32 nPos = CTF_PM_GRAPHICPOSITION;
74 sal_Int32 nFil = CTF_PM_GRAPHICFILTER;
75 switch ( aType )
77 case Header:
79 nPos = CTF_PM_HEADERGRAPHICPOSITION;
80 nFil = CTF_PM_HEADERGRAPHICFILTER;
82 break;
83 case Footer:
85 nPos = CTF_PM_FOOTERGRAPHICPOSITION;
86 nFil = CTF_PM_FOOTERGRAPHICFILTER;
88 break;
89 default:
90 break;
92 SvXMLImportContext *pContext = 0;
94 switch( mxMapper->getPropertySetMapper()
95 ->GetEntryContextId( rProp.mnIndex ) )
97 case CTF_PM_GRAPHICURL:
98 case CTF_PM_HEADERGRAPHICURL:
99 case CTF_PM_FOOTERGRAPHICURL:
100 DBG_ASSERT( rProp.mnIndex >= 2 &&
101 nPos == mxMapper->getPropertySetMapper()
102 ->GetEntryContextId( rProp.mnIndex-2 ) &&
103 nFil == mxMapper->getPropertySetMapper()
104 ->GetEntryContextId( rProp.mnIndex-1 ),
105 "invalid property map!");
106 pContext =
107 new XMLBackgroundImageContext( GetImport(), nPrefix,
108 rLocalName, xAttrList,
109 rProp,
110 rProp.mnIndex-2,
111 rProp.mnIndex-1,
113 rProperties );
114 break;
116 case CTF_PM_TEXTCOLUMNS:
117 #ifndef SVX_LIGHT
118 pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
119 rLocalName, xAttrList, rProp,
120 rProperties );
121 #else
122 // create default context to skip content
123 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
124 #endif // #ifndef SVX_LIGHT
125 break;
127 case CTF_PM_FTN_LINE_WEIGTH:
128 #ifndef SVX_LIGHT
129 pContext = new XMLFootnoteSeparatorImport(
130 GetImport(), nPrefix, rLocalName, rProperties,
131 mxMapper->getPropertySetMapper(), rProp.mnIndex);
132 #else
133 // create default context to skip content
134 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName);
135 #endif // #ifndef SVX_LIGHT
136 break;
139 if( !pContext )
140 pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
141 xAttrList,
142 rProperties, rProp );
144 return pContext;