Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / drawingml / chart / chartcontextbase.cxx
blob65ad2a100953ecc66bf70e9aa8ee2bba3354e247
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <drawingml/chart/chartcontextbase.hxx>
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>
28 namespace oox {
29 namespace drawingml {
30 namespace chart {
32 using ::oox::core::ContextHandler2Helper;
33 using ::oox::core::ContextHandlerRef;
35 ShapePrWrapperContext::ShapePrWrapperContext( ContextHandler2Helper& rParent, Shape& rModel ) :
36 ContextBase< Shape >( rParent, rModel )
40 ShapePrWrapperContext::~ShapePrWrapperContext()
44 ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
46 return (isRootElement() && (nElement == C_TOKEN( spPr ))) ? new ShapePropertiesContext( *this, mrModel ) : nullptr;
49 LayoutContext::LayoutContext( ContextHandler2Helper& rParent, LayoutModel& rModel ) :
50 ContextBase< LayoutModel >( rParent, rModel )
54 LayoutContext::~LayoutContext()
58 ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
60 switch( getCurrentElement() )
62 case C_TOKEN( layout ):
63 switch( nElement )
65 case C_TOKEN( manualLayout ):
66 mrModel.mbAutoLayout = false;
67 return this;
69 break;
71 case C_TOKEN( manualLayout ):
72 switch( nElement )
74 case C_TOKEN( x ):
75 mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 );
76 return nullptr;
77 case C_TOKEN( y ):
78 mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 );
79 return nullptr;
80 case C_TOKEN( w ):
81 mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 );
82 return nullptr;
83 case C_TOKEN( h ):
84 mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 );
85 return nullptr;
86 case C_TOKEN( xMode ):
87 mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor );
88 return nullptr;
89 case C_TOKEN( yMode ):
90 mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor );
91 return nullptr;
92 case C_TOKEN( wMode ):
93 mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor );
94 return nullptr;
95 case C_TOKEN( hMode ):
96 mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor );
97 return nullptr;
98 case C_TOKEN( layoutTarget ):
99 mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer );
100 return nullptr;
102 break;
104 return nullptr;
107 } // namespace chart
108 } // namespace drawingml
109 } // namespace oox
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */