1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: diagramdefinitioncontext.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "diagramdefinitioncontext.hxx"
32 #include "oox/core/namespaces.hxx"
33 #include "oox/helper/helper.hxx"
34 #include "layoutnodecontext.hxx"
35 #include "oox/drawingml/diagram/datamodelcontext.hxx"
38 using namespace ::oox::core
;
39 using namespace ::com::sun::star::uno
;
40 using namespace ::com::sun::star::xml::sax
;
41 using ::rtl::OUString
;
43 namespace oox
{ namespace drawingml
{
46 // CT_DiagramDefinition
47 DiagramDefinitionContext::DiagramDefinitionContext( ContextHandler
& rParent
,
48 const Reference
< XFastAttributeList
>& xAttributes
,
49 const DiagramLayoutPtr
&pLayout
)
50 : ContextHandler( rParent
)
53 OSL_TRACE( "OOX: DiagramDefinitionContext::DiagramDefinitionContext()" );
54 mpLayout
->setDefStyle( xAttributes
->getOptionalValue( XML_defStyle
) );
55 OUString sValue
= xAttributes
->getOptionalValue( XML_minVer
);
56 if( sValue
.getLength() == 0 )
58 sValue
= CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" );
60 mpLayout
->setMinVer( sValue
);
61 mpLayout
->setUniqueId( xAttributes
->getOptionalValue( XML_uniqueId
) );
65 DiagramDefinitionContext::~DiagramDefinitionContext()
67 mpLayout
->getNode()->dump(0);
70 void SAL_CALL
DiagramDefinitionContext::endFastElement( ::sal_Int32
)
71 throw (SAXException
, RuntimeException
)
77 Reference
< XFastContextHandler
> SAL_CALL
78 DiagramDefinitionContext::createFastChildContext( ::sal_Int32 aElement
,
79 const Reference
< XFastAttributeList
>& xAttribs
)
80 throw (SAXException
, RuntimeException
)
82 Reference
< XFastContextHandler
> xRet
;
86 case NMSP_DIAGRAM
|XML_title
:
87 mpLayout
->setTitle( xAttribs
->getOptionalValue( XML_val
) );
89 case NMSP_DIAGRAM
|XML_desc
:
90 mpLayout
->setDesc( xAttribs
->getOptionalValue( XML_val
) );
92 case NMSP_DIAGRAM
|XML_layoutNode
:
93 mpLayout
->getNode().reset( new LayoutNode() );
94 xRet
.set( new LayoutNodeContext( *this, xAttribs
, mpLayout
->getNode() ) );
96 case NMSP_DIAGRAM
|XML_clrData
:
97 // TODO, does not matter for the UI. skip.
99 case NMSP_DIAGRAM
|XML_sampData
:
100 mpLayout
->getSampData().reset( new DiagramData
);
101 xRet
.set( new DataModelContext( *this, mpLayout
->getSampData() ) );
103 case NMSP_DIAGRAM
|XML_styleData
:
104 mpLayout
->getStyleData().reset( new DiagramData
);
105 xRet
.set( new DataModelContext( *this, mpLayout
->getStyleData() ) );
107 case NMSP_DIAGRAM
|XML_cat
:
108 case NMSP_DIAGRAM
|XML_catLst
:
109 // TODO, does not matter for the UI