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