xref: /trunk/main/xmloff/source/style/PageHeaderFooterContext.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_xmloff.hxx"
30 
31 
32 
33 
34 // INCLUDE ---------------------------------------------------------------
35 
36 #ifndef _XMLOFF_PAGEPHEADERFOOTERCONTEXT_HXX
37 #include "PageHeaderFooterContext.hxx"
38 #endif
39 #include "xmloff/xmlnmspe.hxx"
40 #include <xmloff/xmltoken.hxx>
41 #include "PagePropertySetContext.hxx"
42 
43 using namespace com::sun::star;
44 using ::xmloff::token::IsXMLToken;
45 using ::xmloff::token::XML_HEADER_FOOTER_PROPERTIES;
46 
47 //------------------------------------------------------------------
48 
49 PageHeaderFooterContext::PageHeaderFooterContext( SvXMLImport& rImport,
50                                       sal_uInt16 nPrfx,
51                                       const rtl::OUString& rLName,
52                                       const ::com::sun::star::uno::Reference<
53                                       ::com::sun::star::xml::sax::XAttributeList>&,
54                                       ::std::vector< XMLPropertyState > & rTempProperties,
55                                       const UniReference < SvXMLImportPropertyMapper > &rTempMap,
56                                       sal_Int32 nStart, sal_Int32 nEnd,
57                                       const sal_Bool bTempHeader ) :
58     SvXMLImportContext( rImport, nPrfx, rLName ),
59     rProperties(rTempProperties),
60     nStartIndex(nStart),
61     nEndIndex(nEnd),
62     rMap(rTempMap)
63 {
64     bHeader = bTempHeader;
65 }
66 
67 PageHeaderFooterContext::~PageHeaderFooterContext()
68 {
69 }
70 
71 SvXMLImportContext *PageHeaderFooterContext::CreateChildContext( sal_uInt16 nPrefix,
72                                             const rtl::OUString& rLName,
73                                             const ::com::sun::star::uno::Reference<
74                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
75 {
76     SvXMLImportContext *pContext = 0;
77 
78     if( XML_NAMESPACE_STYLE == nPrefix && IsXMLToken( rLName, XML_HEADER_FOOTER_PROPERTIES ) )
79     {
80         PageContextType aType = Header;
81         if (!bHeader)
82             aType = Footer;
83         pContext = new PagePropertySetContext( GetImport(), nPrefix,
84                                                 rLName, xAttrList,
85                                                 XML_TYPE_PROP_HEADER_FOOTER,
86                                                 rProperties,
87                                                 rMap,  nStartIndex, nEndIndex, aType);
88     }
89 
90 
91     if( !pContext )
92         pContext = new SvXMLImportContext( GetImport(), nPrefix, rLName );
93 
94     return pContext;
95 }
96 
97 void PageHeaderFooterContext::EndElement()
98 {
99 }
100 
101