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 0 : 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 UniReference < SvXMLImportPropertyMapper > &rMap,
38 : sal_Int32 nStartIndex, sal_Int32 nEndIndex,
39 : const PageContextType aTempType ) :
40 : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
41 0 : rProps, rMap, nStartIndex, nEndIndex )
42 : {
43 0 : aType = aTempType;
44 0 : }
45 :
46 0 : PagePropertySetContext::~PagePropertySetContext()
47 : {
48 0 : }
49 :
50 0 : 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 0 : sal_Int32 nPos = CTF_PM_GRAPHICPOSITION;
58 0 : sal_Int32 nFil = CTF_PM_GRAPHICFILTER;
59 0 : switch ( aType )
60 : {
61 : case Header:
62 : {
63 0 : nPos = CTF_PM_HEADERGRAPHICPOSITION;
64 0 : nFil = CTF_PM_HEADERGRAPHICFILTER;
65 : }
66 0 : break;
67 : case Footer:
68 : {
69 0 : nPos = CTF_PM_FOOTERGRAPHICPOSITION;
70 0 : nFil = CTF_PM_FOOTERGRAPHICFILTER;
71 : }
72 0 : break;
73 : default:
74 0 : break;
75 : }
76 0 : SvXMLImportContext *pContext = 0;
77 :
78 0 : switch( mxMapper->getPropertySetMapper()
79 0 : ->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 0 : new XMLBackgroundImageContext( GetImport(), nPrefix,
94 : rLocalName, xAttrList,
95 : rProp,
96 : rProp.mnIndex-2,
97 : rProp.mnIndex-1,
98 : -1,
99 0 : rProperties );
100 0 : break;
101 :
102 : case CTF_PM_TEXTCOLUMNS:
103 0 : pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
104 : rLocalName, xAttrList, rProp,
105 0 : rProperties );
106 0 : break;
107 :
108 : case CTF_PM_FTN_LINE_WEIGHT:
109 : pContext = new XMLFootnoteSeparatorImport(
110 0 : GetImport(), nPrefix, rLocalName, rProperties,
111 0 : mxMapper->getPropertySetMapper(), rProp.mnIndex);
112 0 : break;
113 : }
114 :
115 0 : if( !pContext )
116 : pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
117 : xAttrList,
118 0 : rProperties, rProp );
119 :
120 0 : return pContext;
121 : }
122 :
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|