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( ContextHandler& rParent,
33 : const Reference< XFastAttributeList >& xAttributes,
34 : const DiagramLayoutPtr &pLayout )
35 : : ContextHandler( rParent )
36 0 : , mpLayout( pLayout )
37 : {
38 : OSL_TRACE( "OOX: DiagramDefinitionContext::DiagramDefinitionContext()" );
39 0 : mpLayout->setDefStyle( xAttributes->getOptionalValue( XML_defStyle ) );
40 0 : OUString sValue = xAttributes->getOptionalValue( XML_minVer );
41 0 : if( sValue.isEmpty() )
42 : {
43 0 : sValue = CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" );
44 : }
45 0 : mpLayout->setMinVer( sValue );
46 0 : mpLayout->setUniqueId( xAttributes->getOptionalValue( XML_uniqueId ) );
47 0 : }
48 :
49 :
50 0 : DiagramDefinitionContext::~DiagramDefinitionContext()
51 : {
52 0 : mpLayout->getNode()->dump(0);
53 0 : }
54 :
55 0 : void SAL_CALL DiagramDefinitionContext::endFastElement( ::sal_Int32 )
56 : throw (SAXException, RuntimeException)
57 : {
58 :
59 0 : }
60 :
61 :
62 : Reference< XFastContextHandler > SAL_CALL
63 0 : DiagramDefinitionContext::createFastChildContext( ::sal_Int32 aElement,
64 : const Reference< XFastAttributeList >& xAttribs )
65 : throw (SAXException, RuntimeException)
66 : {
67 0 : Reference< XFastContextHandler > xRet;
68 :
69 0 : switch( aElement )
70 : {
71 : case DGM_TOKEN( title ):
72 0 : mpLayout->setTitle( xAttribs->getOptionalValue( XML_val ) );
73 0 : break;
74 : case DGM_TOKEN( desc ):
75 0 : mpLayout->setDesc( xAttribs->getOptionalValue( XML_val ) );
76 0 : break;
77 : case DGM_TOKEN( layoutNode ):
78 : {
79 0 : LayoutNodePtr pNode( new LayoutNode() );
80 0 : mpLayout->getNode() = pNode;
81 0 : pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
82 0 : pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
83 0 : pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
84 0 : xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
85 0 : break;
86 : }
87 : case DGM_TOKEN( clrData ):
88 : // TODO, does not matter for the UI. skip.
89 0 : return xRet;
90 : case DGM_TOKEN( sampData ):
91 0 : mpLayout->getSampData().reset( new DiagramData );
92 0 : xRet.set( new DataModelContext( *this, mpLayout->getSampData() ) );
93 0 : break;
94 : case DGM_TOKEN( styleData ):
95 0 : mpLayout->getStyleData().reset( new DiagramData );
96 0 : xRet.set( new DataModelContext( *this, mpLayout->getStyleData() ) );
97 0 : break;
98 : case DGM_TOKEN( cat ):
99 : case DGM_TOKEN( catLst ):
100 : // TODO, does not matter for the UI
101 : default:
102 0 : break;
103 : }
104 0 : if( !xRet.is() )
105 0 : xRet.set(this);
106 :
107 0 : return xRet;
108 : }
109 :
110 :
111 51 : } }
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|