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 : using ::rtl::OUString;
28 :
29 : using namespace ::com::sun::star::uno;
30 : using namespace ::com::sun::star;
31 :
32 170 : PagePropertySetContext::PagePropertySetContext(
33 : SvXMLImport& rImport, sal_uInt16 nPrfx,
34 : const OUString& rLName,
35 : const Reference< xml::sax::XAttributeList > & xAttrList,
36 : sal_uInt32 nFam,
37 : ::std::vector< XMLPropertyState > &rProps,
38 : const UniReference < SvXMLImportPropertyMapper > &rMap,
39 : sal_Int32 nStartIndex, sal_Int32 nEndIndex,
40 : const PageContextType aTempType ) :
41 : SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
42 170 : rProps, rMap, nStartIndex, nEndIndex )
43 : {
44 170 : aType = aTempType;
45 170 : }
46 :
47 340 : PagePropertySetContext::~PagePropertySetContext()
48 : {
49 340 : }
50 :
51 71 : SvXMLImportContext *PagePropertySetContext::CreateChildContext(
52 : sal_uInt16 nPrefix,
53 : const OUString& rLocalName,
54 : const Reference< xml::sax::XAttributeList > & xAttrList,
55 : ::std::vector< XMLPropertyState > &rProperties,
56 : const XMLPropertyState& rProp )
57 : {
58 71 : sal_Int32 nPos = CTF_PM_GRAPHICPOSITION;
59 71 : sal_Int32 nFil = CTF_PM_GRAPHICFILTER;
60 71 : switch ( aType )
61 : {
62 : case Header:
63 : {
64 22 : nPos = CTF_PM_HEADERGRAPHICPOSITION;
65 22 : nFil = CTF_PM_HEADERGRAPHICFILTER;
66 : }
67 22 : break;
68 : case Footer:
69 : {
70 22 : nPos = CTF_PM_FOOTERGRAPHICPOSITION;
71 22 : nFil = CTF_PM_FOOTERGRAPHICFILTER;
72 : }
73 22 : break;
74 : default:
75 27 : break;
76 : }
77 71 : SvXMLImportContext *pContext = 0;
78 :
79 142 : switch( mxMapper->getPropertySetMapper()
80 142 : ->GetEntryContextId( rProp.mnIndex ) )
81 : {
82 : case CTF_PM_GRAPHICURL:
83 : case CTF_PM_HEADERGRAPHICURL:
84 : case CTF_PM_FOOTERGRAPHICURL:
85 : DBG_ASSERT( rProp.mnIndex >= 2 &&
86 : nPos == mxMapper->getPropertySetMapper()
87 : ->GetEntryContextId( rProp.mnIndex-2 ) &&
88 : nFil == mxMapper->getPropertySetMapper()
89 : ->GetEntryContextId( rProp.mnIndex-1 ),
90 : "invalid property map!");
91 : (void)nPos;
92 : (void)nFil;
93 : pContext =
94 45 : new XMLBackgroundImageContext( GetImport(), nPrefix,
95 : rLocalName, xAttrList,
96 : rProp,
97 : rProp.mnIndex-2,
98 : rProp.mnIndex-1,
99 : -1,
100 45 : rProperties );
101 45 : break;
102 :
103 : case CTF_PM_TEXTCOLUMNS:
104 2 : pContext = new XMLTextColumnsContext( GetImport(), nPrefix,
105 : rLocalName, xAttrList, rProp,
106 2 : rProperties );
107 2 : break;
108 :
109 : case CTF_PM_FTN_LINE_WEIGTH:
110 : pContext = new XMLFootnoteSeparatorImport(
111 24 : GetImport(), nPrefix, rLocalName, rProperties,
112 24 : mxMapper->getPropertySetMapper(), rProp.mnIndex);
113 24 : break;
114 : }
115 :
116 71 : if( !pContext )
117 : pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
118 : xAttrList,
119 0 : rProperties, rProp );
120 :
121 71 : return pContext;
122 : }
123 :
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|