/src/libreoffice/xmloff/source/text/XMLTextPropertySetContext.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 "XMLTextPropertySetContext.hxx" |
22 | | #include <XMLTextColumnsContext.hxx> |
23 | | #include <xmloff/XMLComplexColorContext.hxx> |
24 | | #include <XMLBackgroundImageContext.hxx> |
25 | | #include "XMLSectionFootnoteConfigImport.hxx" |
26 | | |
27 | | #include <xmloff/xmlimppr.hxx> |
28 | | #include <xmloff/txtprmap.hxx> |
29 | | #include <xmltabi.hxx> |
30 | | #include "txtdropi.hxx" |
31 | | |
32 | | using namespace ::com::sun::star::uno; |
33 | | using namespace ::com::sun::star; |
34 | | |
35 | | XMLTextPropertySetContext::XMLTextPropertySetContext( |
36 | | SvXMLImport& rImport, sal_Int32 nElement, |
37 | | const Reference< xml::sax::XFastAttributeList > & xAttrList, |
38 | | sal_uInt32 nFamily, |
39 | | ::std::vector< XMLPropertyState > &rProps, |
40 | | SvXMLImportPropertyMapper* pMap, |
41 | | OUString& rDCTextStyleName ) : |
42 | 101k | SvXMLPropertySetContext( rImport, nElement, xAttrList, nFamily, |
43 | 101k | rProps, pMap ), |
44 | 101k | rDropCapTextStyleName( rDCTextStyleName ) |
45 | 101k | { |
46 | 101k | } |
47 | | |
48 | | XMLTextPropertySetContext::~XMLTextPropertySetContext() |
49 | 101k | { |
50 | 101k | } |
51 | | |
52 | | css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetContext::createFastChildContext( |
53 | | sal_Int32 nElement, |
54 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, |
55 | | ::std::vector< XMLPropertyState > &rProperties, |
56 | | const XMLPropertyState& rProp ) |
57 | 3.19k | { |
58 | 3.19k | switch( mpMapper->getPropertySetMapper() |
59 | 3.19k | ->GetEntryContextId( rProp.mnIndex ) ) |
60 | 3.19k | { |
61 | 2.93k | case CTF_TABSTOP: |
62 | 2.93k | return new SvxXMLTabStopImportContext( GetImport(), nElement, |
63 | 2.93k | rProp, |
64 | 2.93k | rProperties ); |
65 | 0 | break; |
66 | 236 | case CTF_TEXTCOLUMNS: |
67 | 236 | return new XMLTextColumnsContext( GetImport(), nElement, |
68 | 236 | xAttrList, rProp, |
69 | 236 | rProperties ); |
70 | 0 | break; |
71 | | |
72 | 0 | case CTF_COMPLEX_COLOR: |
73 | 0 | return new XMLPropertyComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties); |
74 | 0 | break; |
75 | | |
76 | 0 | case CTF_DROPCAPFORMAT: |
77 | 0 | { |
78 | 0 | DBG_ASSERT( rProp.mnIndex >= 2 && |
79 | 0 | CTF_DROPCAPWHOLEWORD == mpMapper->getPropertySetMapper() |
80 | 0 | ->GetEntryContextId( rProp.mnIndex-2 ), |
81 | 0 | "invalid property map!"); |
82 | 0 | XMLTextDropCapImportContext *pDCContext = |
83 | 0 | new XMLTextDropCapImportContext( GetImport(), nElement, |
84 | 0 | xAttrList, |
85 | 0 | rProp, |
86 | 0 | rProp.mnIndex-2, |
87 | 0 | rProperties ); |
88 | 0 | rDropCapTextStyleName = pDCContext->GetStyleName(); |
89 | 0 | return pDCContext; |
90 | 0 | } |
91 | 0 | break; |
92 | | |
93 | 0 | case CTF_BACKGROUND_URL: |
94 | 0 | { |
95 | 0 | DBG_ASSERT( rProp.mnIndex >= 2 && |
96 | 0 | CTF_BACKGROUND_POS == mpMapper->getPropertySetMapper() |
97 | 0 | ->GetEntryContextId( rProp.mnIndex-2 ) && |
98 | 0 | CTF_BACKGROUND_FILTER == mpMapper->getPropertySetMapper() |
99 | 0 | ->GetEntryContextId( rProp.mnIndex-1 ), |
100 | 0 | "invalid property map!"); |
101 | | |
102 | | // #99657# Transparency might be there as well... but doesn't have |
103 | | // to. Thus, this is checked with an if, rather than with an assertion. |
104 | 0 | sal_Int32 nTranspIndex = -1; |
105 | 0 | if( (rProp.mnIndex >= 3) && |
106 | 0 | ( CTF_BACKGROUND_TRANSPARENCY == |
107 | 0 | mpMapper->getPropertySetMapper()->GetEntryContextId( |
108 | 0 | rProp.mnIndex-3 ) ) ) |
109 | 0 | nTranspIndex = rProp.mnIndex-3; |
110 | |
|
111 | 0 | return |
112 | 0 | new XMLBackgroundImageContext( GetImport(), nElement, |
113 | 0 | xAttrList, |
114 | 0 | rProp, |
115 | 0 | rProp.mnIndex-2, |
116 | 0 | rProp.mnIndex-1, |
117 | 0 | nTranspIndex, |
118 | 0 | -1, |
119 | 0 | rProperties ); |
120 | 0 | } |
121 | 0 | break; |
122 | 31 | case CTF_SECTION_FOOTNOTE_END: |
123 | 31 | case CTF_SECTION_ENDNOTE_END: |
124 | 31 | return new XMLSectionFootnoteConfigImport( |
125 | 31 | GetImport(), nElement, rProperties, |
126 | 31 | mpMapper->getPropertySetMapper()); |
127 | 0 | break; |
128 | 3.19k | } |
129 | | |
130 | 0 | return SvXMLPropertySetContext::createFastChildContext( nElement, |
131 | 0 | xAttrList, |
132 | 0 | rProperties, rProp ); |
133 | 3.19k | } |
134 | | |
135 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |