1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "diagramdefinitioncontext.hxx"
21 #include "datamodel.hxx"
22 #include "datamodelcontext.hxx"
23 #include "layoutnodecontext.hxx"
24 #include <oox/helper/attributelist.hxx>
25 #include <oox/token/namespaces.hxx>
27 using namespace ::oox::core
;
28 using namespace ::com::sun::star::uno
;
29 using namespace ::com::sun::star::xml::sax
;
31 namespace oox
{ namespace drawingml
{
33 // CT_DiagramDefinition
34 DiagramDefinitionContext::DiagramDefinitionContext( ContextHandler2Helper
const & rParent
,
35 const AttributeList
& rAttributes
,
36 const DiagramLayoutPtr
&pLayout
)
37 : ContextHandler2( rParent
)
40 mpLayout
->setDefStyle( rAttributes
.getString( XML_defStyle
).get() );
41 OUString sValue
= rAttributes
.getString( XML_minVer
).get();
42 if( sValue
.isEmpty() )
44 sValue
= "http://schemas.openxmlformats.org/drawingml/2006/diagram";
46 mpLayout
->setMinVer( sValue
);
47 mpLayout
->setUniqueId( rAttributes
.getString( XML_uniqueId
).get() );
50 DiagramDefinitionContext::~DiagramDefinitionContext()
52 LayoutNodePtr node
= mpLayout
->getNode();
58 DiagramDefinitionContext::onCreateContext( ::sal_Int32 aElement
,
59 const AttributeList
& rAttribs
)
63 case DGM_TOKEN( title
):
64 mpLayout
->setTitle( rAttribs
.getString( XML_val
).get() );
66 case DGM_TOKEN( desc
):
67 mpLayout
->setDesc( rAttribs
.getString( XML_val
).get() );
69 case DGM_TOKEN( layoutNode
):
71 LayoutNodePtr
pNode( new LayoutNode(mpLayout
->getDiagram()) );
72 mpLayout
->getNode() = pNode
;
73 pNode
->setChildOrder( rAttribs
.getToken( XML_chOrder
, XML_b
) );
74 pNode
->setMoveWith( rAttribs
.getString( XML_moveWith
).get() );
75 pNode
->setStyleLabel( rAttribs
.getString( XML_styleLbl
).get() );
76 return new LayoutNodeContext( *this, rAttribs
, pNode
);
78 case DGM_TOKEN( clrData
):
79 // TODO, does not matter for the UI. skip.
81 case DGM_TOKEN( sampData
):
82 mpLayout
->getSampData().reset( new DiagramData
);
83 return new DataModelContext( *this, mpLayout
->getSampData() );
84 case DGM_TOKEN( styleData
):
85 mpLayout
->getStyleData().reset( new DiagramData
);
86 return new DataModelContext( *this, mpLayout
->getStyleData() );
87 case DGM_TOKEN( cat
):
88 case DGM_TOKEN( catLst
):
89 // TODO, does not matter for the UI
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */