LibreOffice Module oox (master)  1
chartcontextbase.cxx
Go to the documentation of this file.
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 
21 
24 #include <oox/token/namespaces.hxx>
25 #include <oox/token/tokens.hxx>
27 
28 namespace oox::drawingml::chart {
29 
30 using ::oox::core::ContextHandler2Helper;
32 
34  ContextBase< Shape >( rParent, rModel )
35 {
36 }
37 
39 {
40 }
41 
43 {
44  return (isRootElement() && (nElement == C_TOKEN( spPr ))) ? new ShapePropertiesContext( *this, mrModel ) : nullptr;
45 }
46 
48  ContextBase< LayoutModel >( rParent, rModel )
49 {
50 }
51 
53 {
54 }
55 
56 ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
57 {
58  switch( getCurrentElement() )
59  {
60  case C_TOKEN( layout ):
61  switch( nElement )
62  {
63  case C_TOKEN( manualLayout ):
64  mrModel.mbAutoLayout = false;
65  return this;
66  }
67  break;
68 
69  case C_TOKEN( manualLayout ):
70  switch( nElement )
71  {
72  case C_TOKEN( x ):
73  mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 );
74  return nullptr;
75  case C_TOKEN( y ):
76  mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 );
77  return nullptr;
78  case C_TOKEN( w ):
79  mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 );
80  return nullptr;
81  case C_TOKEN( h ):
82  mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 );
83  return nullptr;
84  case C_TOKEN( xMode ):
85  mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor );
86  return nullptr;
87  case C_TOKEN( yMode ):
88  mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor );
89  return nullptr;
90  case C_TOKEN( wMode ):
91  mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor );
92  return nullptr;
93  case C_TOKEN( hMode ):
94  mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor );
95  return nullptr;
96  case C_TOKEN( layoutTarget ):
97  mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer );
98  return nullptr;
99  }
100  break;
101  }
102  return nullptr;
103 }
104 
105 } // namespace oox::drawingml::chart
106 
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 mnHMode
Mode for width.
Definition: modelbase.hxx:114
OptValue< double > getDouble(sal_Int32 nAttrToken) const
Returns the double value of the specified attribute.
double mfW
Top position of this object.
Definition: modelbase.hxx:109
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
float x
double mfH
Width of this object.
Definition: modelbase.hxx:110
sal_Int32 mnWMode
Mode for top position.
Definition: modelbase.hxx:113
ShapePrWrapperContext(::oox::core::ContextHandler2Helper &rParent, Shape &rModel)
float y
double mfY
Left position of this object.
Definition: modelbase.hxx:108
sal_Int32 getCurrentElement() const
Returns the identifier of the currently processed element.
sal_Int32 w
sal_Int32 mnTarget
Mode for height.
Definition: modelbase.hxx:115
Provides access to attribute values of an element.
bool isRootElement() const
Returns true, if the element currently processed is the root element of the context or fragment handl...
sal_Int32 mnYMode
Mode for left position.
Definition: modelbase.hxx:112
::rtl::Reference< ContextHandler > ContextHandlerRef
sal_Int32 mnXMode
Height of this object.
Definition: modelbase.hxx:111
bool mbAutoLayout
Layout target for plot area.
Definition: modelbase.hxx:116
Helper class that provides a context stack.
sal_Int32 h
LayoutContext(::oox::core::ContextHandler2Helper &rParent, LayoutModel &rModel)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.