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: diagramfragmenthandler.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 <osl/diagnose.h>
33 #include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
34 #include "oox/drawingml/diagram/datamodelcontext.hxx"
35 #include "oox/core/namespaces.hxx"
36 #include "diagramdefinitioncontext.hxx"
39 using namespace ::oox::core
;
40 using namespace ::com::sun::star::xml::sax
;
41 using namespace ::com::sun::star::uno
;
42 using ::rtl::OUString
;
44 namespace oox
{ namespace drawingml
{
46 DiagramDataFragmentHandler::DiagramDataFragmentHandler( XmlFilterBase
& rFilter
,
47 const OUString
& rFragmentPath
,
48 const DiagramDataPtr pDataPtr
)
50 : FragmentHandler( rFilter
, rFragmentPath
)
51 , mpDataPtr( pDataPtr
)
55 DiagramDataFragmentHandler::~DiagramDataFragmentHandler( ) throw ()
60 void SAL_CALL
DiagramDataFragmentHandler::endDocument()
61 throw (SAXException
, RuntimeException
)
67 Reference
< XFastContextHandler
> SAL_CALL
68 DiagramDataFragmentHandler::createFastChildContext( ::sal_Int32 aElement
,
69 const Reference
< XFastAttributeList
>& )
70 throw ( SAXException
, RuntimeException
)
72 Reference
< XFastContextHandler
> xRet
;
76 case NMSP_DIAGRAM
|XML_dataModel
:
77 xRet
.set( new DataModelContext( *this, mpDataPtr
) );
84 xRet
= getFastContextHandler();
91 DiagramLayoutFragmentHandler::DiagramLayoutFragmentHandler( XmlFilterBase
& rFilter
,
92 const OUString
& rFragmentPath
,
93 const DiagramLayoutPtr pDataPtr
)
95 : FragmentHandler( rFilter
, rFragmentPath
)
96 , mpDataPtr( pDataPtr
)
100 DiagramLayoutFragmentHandler::~DiagramLayoutFragmentHandler( ) throw ()
105 void SAL_CALL
DiagramLayoutFragmentHandler::endDocument()
106 throw (SAXException
, RuntimeException
)
112 Reference
< XFastContextHandler
> SAL_CALL
113 DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement
,
114 const Reference
< XFastAttributeList
>& xAttribs
)
115 throw ( SAXException
, RuntimeException
)
117 Reference
< XFastContextHandler
> xRet
;
121 case NMSP_DIAGRAM
|XML_layoutDef
:
122 xRet
.set( new DiagramDefinitionContext( *this, xAttribs
, mpDataPtr
) );
129 xRet
= getFastContextHandler();
134 ///////////////////////
136 DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase
& rFilter
,
137 const OUString
& rFragmentPath
,
138 const DiagramQStylesPtr pDataPtr
)
140 : FragmentHandler( rFilter
, rFragmentPath
)
141 , mpDataPtr( pDataPtr
)
145 DiagramQStylesFragmentHandler::~DiagramQStylesFragmentHandler( ) throw ()
150 void SAL_CALL
DiagramQStylesFragmentHandler::endDocument()
151 throw (SAXException
, RuntimeException
)
157 Reference
< XFastContextHandler
> SAL_CALL
158 DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement
,
159 const Reference
< XFastAttributeList
>& )
160 throw ( SAXException
, RuntimeException
)
162 Reference
< XFastContextHandler
> xRet
;
166 case NMSP_DIAGRAM
|XML_styleDef
:
174 xRet
= getFastContextHandler();
179 /////////////////////
181 DiagramColorsFragmentHandler::DiagramColorsFragmentHandler( XmlFilterBase
& rFilter
,
182 const OUString
& rFragmentPath
,
183 const DiagramColorsPtr pDataPtr
)
185 : FragmentHandler( rFilter
, rFragmentPath
)
186 , mpDataPtr( pDataPtr
)
190 DiagramColorsFragmentHandler::~DiagramColorsFragmentHandler( ) throw ()
195 void SAL_CALL
DiagramColorsFragmentHandler::endDocument()
196 throw (SAXException
, RuntimeException
)
202 Reference
< XFastContextHandler
> SAL_CALL
203 DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement
,
204 const Reference
< XFastAttributeList
>& )
205 throw ( SAXException
, RuntimeException
)
207 Reference
< XFastContextHandler
> xRet
;
211 case NMSP_DIAGRAM
|XML_colorsDef
:
219 xRet
= getFastContextHandler();