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