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 "layoutnodecontext.hxx"
22 #include "datamodelcontext.hxx"
23 #include <oox/helper/attributelist.hxx>
24 #include <oox/token/namespaces.hxx>
26 using namespace ::oox::core
;
27 using namespace ::com::sun::star::uno
;
28 using namespace ::com::sun::star::xml::sax
;
30 namespace oox
{ namespace drawingml
{
32 // CT_DiagramDefinition
33 DiagramDefinitionContext::DiagramDefinitionContext( ContextHandler2Helper
& rParent
,
34 const AttributeList
& rAttributes
,
35 const DiagramLayoutPtr
&pLayout
)
36 : ContextHandler2( rParent
)
39 mpLayout
->setDefStyle( rAttributes
.getString( XML_defStyle
).get() );
40 OUString sValue
= rAttributes
.getString( XML_minVer
).get();
41 if( sValue
.isEmpty() )
43 sValue
= "http://schemas.openxmlformats.org/drawingml/2006/diagram";
45 mpLayout
->setMinVer( sValue
);
46 mpLayout
->setUniqueId( rAttributes
.getString( XML_uniqueId
).get() );
49 DiagramDefinitionContext::~DiagramDefinitionContext()
51 LayoutNodePtr node
= mpLayout
->getNode();
57 DiagramDefinitionContext::onCreateContext( ::sal_Int32 aElement
,
58 const AttributeList
& rAttribs
)
62 case DGM_TOKEN( title
):
63 mpLayout
->setTitle( rAttribs
.getString( XML_val
).get() );
65 case DGM_TOKEN( desc
):
66 mpLayout
->setDesc( rAttribs
.getString( XML_val
).get() );
68 case DGM_TOKEN( layoutNode
):
70 LayoutNodePtr
pNode( new LayoutNode() );
71 mpLayout
->getNode() = pNode
;
72 pNode
->setChildOrder( rAttribs
.getToken( XML_chOrder
, XML_b
) );
73 pNode
->setMoveWith( rAttribs
.getString( XML_moveWith
).get() );
74 pNode
->setStyleLabel( rAttribs
.getString( XML_styleLbl
).get() );
75 return new LayoutNodeContext( *this, rAttribs
, pNode
);
77 case DGM_TOKEN( clrData
):
78 // TODO, does not matter for the UI. skip.
80 case DGM_TOKEN( sampData
):
81 mpLayout
->getSampData().reset( new DiagramData
);
82 return new DataModelContext( *this, mpLayout
->getSampData() );
83 case DGM_TOKEN( styleData
):
84 mpLayout
->getStyleData().reset( new DiagramData
);
85 return new DataModelContext( *this, mpLayout
->getStyleData() );
86 case DGM_TOKEN( cat
):
87 case DGM_TOKEN( catLst
):
88 // TODO, does not matter for the UI
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */