Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <tools/debug.hxx>
21 : #include "PagePropertySetContext.hxx"
22 : #include "XMLBackgroundImageContext.hxx"
23 : #include "XMLTextColumnsContext.hxx"
24 : #include <xmloff/PageMasterStyleMap.hxx>
25 : #include "XMLFootnoteSeparatorImport.hxx"
26 :
27 :
28 : using namespace ::com::sun::star::uno;
29 : using namespace ::com::sun::star;
30 :
31 2688 : PagePropertySetContext::PagePropertySetContext(
32 : SvXMLImport& rImport, sal_uInt16 nPrfx,
33 : const OUString& rLName,
34 : const Reference< xml::sax::XAttributeList > & xAttrList,
35 : sal_uInt32 nFam,
36 : ::std::vector< XMLPropertyState > &rProps,
37 : const rtl::Reference < SvXMLImportPropertyMapper > &rMap,
38 : sal_Int32 nStartIndex, sal_Int32 nEndIndex,
39 : const PageContextType aTempType ) :
40 : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
41 2688 : rProps, rMap, nStartIndex, nEndIndex )
42 : {
43 2688 : aType = aTempType;
44 2688 : }
45 :
46 5376 : PagePropertySetContext::~PagePropertySetContext()
47 : {
48 5376 : }
49 :
50 1390 : SvXMLImportContext *PagePropertySetContext::CreateChildContext(
51 : sal_uInt16 nPrefix,
52 : const OUString& rLocalName,
53 : const Reference< xml::sax::XAttributeList > & xAttrList,
54 : ::std::vector< XMLPropertyState > &rProperties,
55 : const XMLPropertyState& rProp )
56 : {
57 1390 : sal_Int32 nPos = CTF_PM_GRAPHICPOSITION;
58 1390 : sal_Int32 nFil = CTF_PM_GRAPHICFILTER;
59 1390 : switch ( aType )
60 : {
61 : case Header:
62 : {
63 220 : nPos = CTF_PM_HEADERGRAPHICPOSITION;
64 220 : nFil = CTF_PM_HEADERGRAPHICFILTER;
65 : }
66 220 : break;
67 : case Footer:
68 : {
69 218 : nPos = CTF_PM_FOOTERGRAPHICPOSITION;
70 218 : nFil = CTF_PM_FOOTERGRAPHICFILTER;
71 : }
72 218 : break;
73 : default:
74 952 : break;
75 : }
76 1390 : SvXMLImportContext *pContext = 0;
77 :
78 2780 : switch( mxMapper->getPropertySetMapper()
79 2780 : ->GetEntryContextId( rProp.mnIndex ) )
80 : {
81 : case CTF_PM_GRAPHICURL:
82 : case CTF_PM_HEADERGRAPHICURL:
83 : case CTF_PM_FOOTERGRAPHICURL:
84 : DBG_ASSERT( rProp.mnIndex >= 2 &&
85 : nPos == mxMapper->getPropertySetMapper()
86 : ->GetEntryContextId( rProp.mnIndex-2 ) &&
87 : nFil == mxMapper->getPropertySetMapper()
88 : ->GetEntryContextId( rProp.mnIndex-1 ),
89 : "invalid property map!");
90 : (void)nPos;
91 : (void)nFil;
92 : pContext =
93 470 : new XMLBackgroundImageContext( GetImport(), nPrefix,
94 : rLocalName, xAttrList,
95 : rProp,
96 : rProp.mnIndex-2,
97 : rProp.mnIndex-1,
98 : -1,
99 470 : rProperties );
100 470 : break;
101 :
102 : case CTF_PM_TEXTCOLUMNS:
103 20 : pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
104 : rLocalName, xAttrList, rProp,
105 20 : rProperties );
106 20 : break;
107 :
108 : case CTF_PM_FTN_LINE_WEIGHT:
109 : pContext = new XMLFootnoteSeparatorImport(
110 900 : GetImport(), nPrefix, rLocalName, rProperties,
111 900 : mxMapper->getPropertySetMapper(), rProp.mnIndex);
112 900 : break;
113 : }
114 :
115 1390 : if( !pContext )
116 : pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
117 : xAttrList,
118 0 : rProperties, rProp );
119 :
120 1390 : return pContext;
121 : }
122 :
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|