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