/src/libreoffice/oox/source/drawingml/chart/chartcontextbase.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 <drawingml/chart/chartcontextbase.hxx> |
21 | | |
22 | | #include <oox/drawingml/chart/modelbase.hxx> |
23 | | #include <oox/helper/attributelist.hxx> |
24 | | #include <oox/token/namespaces.hxx> |
25 | | #include <oox/token/tokens.hxx> |
26 | | #include <drawingml/shapepropertiescontext.hxx> |
27 | | |
28 | | namespace oox::drawingml::chart { |
29 | | |
30 | | using ::oox::core::ContextHandler2Helper; |
31 | | using ::oox::core::ContextHandlerRef; |
32 | | |
33 | | ShapePrWrapperContext::ShapePrWrapperContext( ContextHandler2Helper& rParent, Shape& rModel ) : |
34 | 0 | ContextBase< Shape >( rParent, rModel ) |
35 | 0 | { |
36 | 0 | } |
37 | | |
38 | | ShapePrWrapperContext::~ShapePrWrapperContext() |
39 | 0 | { |
40 | 0 | } |
41 | | |
42 | | ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, const AttributeList& ) |
43 | 0 | { |
44 | 0 | if (isRootElement() && (nElement == C_TOKEN(spPr) || nElement == CX_TOKEN(spPr))) { |
45 | 0 | return new ShapePropertiesContext( *this, mrModel ); |
46 | 0 | } else { |
47 | 0 | return nullptr; |
48 | 0 | } |
49 | 0 | } |
50 | | |
51 | | LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) : |
52 | 0 | ContextBase< LayoutModel >( rParent, rModel ) |
53 | 0 | { |
54 | 0 | } |
55 | | |
56 | | LayoutContext::~LayoutContext() |
57 | 0 | { |
58 | 0 | } |
59 | | |
60 | | ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) |
61 | 0 | { |
62 | 0 | switch( getCurrentElement() ) |
63 | 0 | { |
64 | 0 | case C_TOKEN( layout ): |
65 | 0 | case C15_TOKEN(layout): |
66 | 0 | switch( nElement ) |
67 | 0 | { |
68 | 0 | case C_TOKEN( manualLayout ): |
69 | 0 | if (getCurrentElement() == C_TOKEN(layout)) |
70 | 0 | mrModel.mbAutoLayout = false; |
71 | 0 | return this; |
72 | 0 | } |
73 | 0 | break; |
74 | | |
75 | 0 | case C_TOKEN( manualLayout ): |
76 | 0 | switch( nElement ) |
77 | 0 | { |
78 | 0 | case C_TOKEN( x ): |
79 | 0 | mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 ); |
80 | 0 | return nullptr; |
81 | 0 | case C_TOKEN( y ): |
82 | 0 | mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 ); |
83 | 0 | return nullptr; |
84 | 0 | case C_TOKEN( w ): |
85 | 0 | mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 ); |
86 | 0 | return nullptr; |
87 | 0 | case C_TOKEN( h ): |
88 | 0 | mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 ); |
89 | 0 | return nullptr; |
90 | 0 | case C_TOKEN( xMode ): |
91 | 0 | mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor ); |
92 | 0 | return nullptr; |
93 | 0 | case C_TOKEN( yMode ): |
94 | 0 | mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor ); |
95 | 0 | return nullptr; |
96 | 0 | case C_TOKEN( wMode ): |
97 | 0 | mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor ); |
98 | 0 | return nullptr; |
99 | 0 | case C_TOKEN( hMode ): |
100 | 0 | mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor ); |
101 | 0 | return nullptr; |
102 | 0 | case C_TOKEN( layoutTarget ): |
103 | 0 | mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer ); |
104 | 0 | return nullptr; |
105 | 0 | } |
106 | 0 | break; |
107 | 0 | } |
108 | 0 | return nullptr; |
109 | 0 | } |
110 | | |
111 | | } // namespace oox::drawingml::chart |
112 | | |
113 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |