/src/libreoffice/xmloff/source/style/PagePropertySetContext.cxx
Line | Count | Source |
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 <PageMasterStyleMap.hxx> |
25 | | #include "XMLFootnoteSeparatorImport.hxx" |
26 | | #include <xmloff/xmlimppr.hxx> |
27 | | #include <xmloff/xmlprmap.hxx> |
28 | | |
29 | | |
30 | | using namespace ::com::sun::star::uno; |
31 | | using namespace ::com::sun::star; |
32 | | |
33 | | PagePropertySetContext::PagePropertySetContext( |
34 | | SvXMLImport& rImport, sal_Int32 nElement, |
35 | | const Reference< xml::sax::XFastAttributeList > & xAttrList, |
36 | | sal_uInt32 nFam, |
37 | | ::std::vector< XMLPropertyState > &rProps, |
38 | | SvXMLImportPropertyMapper* pMap, |
39 | | sal_Int32 nStartIndex, sal_Int32 nEndIndex, |
40 | | const PageContextType aTempType ) : |
41 | 27.1k | SvXMLPropertySetContext( rImport, nElement, xAttrList, nFam, |
42 | 27.1k | rProps, pMap, nStartIndex, nEndIndex ) |
43 | 27.1k | { |
44 | 27.1k | aType = aTempType; |
45 | 27.1k | } |
46 | | |
47 | | PagePropertySetContext::~PagePropertySetContext() |
48 | 25.4k | { |
49 | 25.4k | } |
50 | | |
51 | | css::uno::Reference< css::xml::sax::XFastContextHandler > PagePropertySetContext::createFastChildContext( |
52 | | sal_Int32 nElement, |
53 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, |
54 | | ::std::vector< XMLPropertyState > &rProperties, |
55 | | const XMLPropertyState& rProp ) |
56 | 4.53k | { |
57 | 4.53k | sal_Int32 nPos = CTF_PM_GRAPHICPOSITION; |
58 | 4.53k | sal_Int32 nFil = CTF_PM_GRAPHICFILTER; |
59 | 4.53k | switch ( aType ) |
60 | 4.53k | { |
61 | 904 | case Header: |
62 | 904 | { |
63 | 904 | nPos = CTF_PM_HEADERGRAPHICPOSITION; |
64 | 904 | nFil = CTF_PM_HEADERGRAPHICFILTER; |
65 | 904 | } |
66 | 904 | break; |
67 | 1.19k | case Footer: |
68 | 1.19k | { |
69 | 1.19k | nPos = CTF_PM_FOOTERGRAPHICPOSITION; |
70 | 1.19k | nFil = CTF_PM_FOOTERGRAPHICFILTER; |
71 | 1.19k | } |
72 | 1.19k | break; |
73 | 2.44k | default: |
74 | 2.44k | break; |
75 | 4.53k | } |
76 | | |
77 | 4.53k | switch( mpMapper->getPropertySetMapper() |
78 | 4.53k | ->GetEntryContextId( rProp.mnIndex ) ) |
79 | 4.53k | { |
80 | 4 | case CTF_PM_GRAPHICURL: |
81 | 908 | case CTF_PM_HEADERGRAPHICURL: |
82 | 2.10k | case CTF_PM_FOOTERGRAPHICURL: |
83 | 2.10k | DBG_ASSERT( rProp.mnIndex >= 2 && |
84 | 2.10k | nPos == mpMapper->getPropertySetMapper() |
85 | 2.10k | ->GetEntryContextId( rProp.mnIndex-2 ) && |
86 | 2.10k | nFil == mpMapper->getPropertySetMapper() |
87 | 2.10k | ->GetEntryContextId( rProp.mnIndex-1 ), |
88 | 2.10k | "invalid property map!"); |
89 | 2.10k | return |
90 | 2.10k | new XMLBackgroundImageContext( GetImport(), nElement, |
91 | 2.10k | xAttrList, |
92 | 2.10k | rProp, |
93 | 2.10k | rProp.mnIndex-2, |
94 | 2.10k | rProp.mnIndex-1, |
95 | 2.10k | -1, |
96 | 2.10k | mpMapper->getPropertySetMapper()->FindEntryIndex(CTF_PM_FILLBITMAPMODE), |
97 | 2.10k | rProperties ); |
98 | 0 | break; |
99 | | |
100 | 15 | case CTF_PM_TEXTCOLUMNS: |
101 | 15 | return new XMLTextColumnsContext(GetImport(), nElement, xAttrList, rProp, rProperties); |
102 | 0 | break; |
103 | | |
104 | 2.42k | case CTF_PM_FTN_LINE_WEIGHT: |
105 | 2.42k | return new XMLFootnoteSeparatorImport( |
106 | 2.42k | GetImport(), nElement, rProperties, |
107 | 2.42k | mpMapper->getPropertySetMapper(), rProp.mnIndex); |
108 | 0 | break; |
109 | 4.53k | } |
110 | | |
111 | 0 | return SvXMLPropertySetContext::createFastChildContext( nElement, |
112 | 0 | xAttrList, |
113 | 0 | rProperties, rProp ); |
114 | 4.53k | } |
115 | | |
116 | | |
117 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |