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 "diagramdefinitioncontext.hxx"
21 : #include "layoutnodecontext.hxx"
22 : #include "datamodelcontext.hxx"
23 :
24 : using namespace ::oox::core;
25 : using namespace ::com::sun::star::uno;
26 : using namespace ::com::sun::star::xml::sax;
27 :
28 : namespace oox { namespace drawingml {
29 :
30 :
31 : // CT_DiagramDefinition
32 0 : DiagramDefinitionContext::DiagramDefinitionContext( ContextHandler2Helper& rParent,
33 : const AttributeList& rAttributes,
34 : const DiagramLayoutPtr &pLayout )
35 : : ContextHandler2( rParent )
36 0 : , mpLayout( pLayout )
37 : {
38 : OSL_TRACE( "OOX: DiagramDefinitionContext::DiagramDefinitionContext()" );
39 0 : mpLayout->setDefStyle( rAttributes.getString( XML_defStyle ).get() );
40 0 : OUString sValue = rAttributes.getString( XML_minVer ).get();
41 0 : if( sValue.isEmpty() )
42 : {
43 0 : sValue = "http://schemas.openxmlformats.org/drawingml/2006/diagram";
44 : }
45 0 : mpLayout->setMinVer( sValue );
46 0 : mpLayout->setUniqueId( rAttributes.getString( XML_uniqueId ).get() );
47 0 : }
48 :
49 :
50 0 : DiagramDefinitionContext::~DiagramDefinitionContext()
51 : {
52 0 : mpLayout->getNode()->dump(0);
53 0 : }
54 :
55 : ContextHandlerRef
56 0 : DiagramDefinitionContext::onCreateContext( ::sal_Int32 aElement,
57 : const AttributeList& rAttribs )
58 : {
59 0 : switch( aElement )
60 : {
61 : case DGM_TOKEN( title ):
62 0 : mpLayout->setTitle( rAttribs.getString( XML_val ).get() );
63 0 : break;
64 : case DGM_TOKEN( desc ):
65 0 : mpLayout->setDesc( rAttribs.getString( XML_val ).get() );
66 0 : break;
67 : case DGM_TOKEN( layoutNode ):
68 : {
69 0 : LayoutNodePtr pNode( new LayoutNode() );
70 0 : mpLayout->getNode() = pNode;
71 0 : pNode->setChildOrder( rAttribs.getToken( XML_chOrder, XML_b ) );
72 0 : pNode->setMoveWith( rAttribs.getString( XML_moveWith ).get() );
73 0 : pNode->setStyleLabel( rAttribs.getString( XML_styleLbl ).get() );
74 0 : return new LayoutNodeContext( *this, rAttribs, pNode );
75 : }
76 : case DGM_TOKEN( clrData ):
77 : // TODO, does not matter for the UI. skip.
78 0 : return 0;
79 : case DGM_TOKEN( sampData ):
80 0 : mpLayout->getSampData().reset( new DiagramData );
81 0 : return new DataModelContext( *this, mpLayout->getSampData() );
82 : case DGM_TOKEN( styleData ):
83 0 : mpLayout->getStyleData().reset( new DiagramData );
84 0 : return new DataModelContext( *this, mpLayout->getStyleData() );
85 : case DGM_TOKEN( cat ):
86 : case DGM_TOKEN( catLst ):
87 : // TODO, does not matter for the UI
88 : default:
89 0 : break;
90 : }
91 :
92 0 : return this;
93 : }
94 :
95 :
96 0 : } }
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|