1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <osl/diagnose.h> 29 30 #include "oox/drawingml/diagram/diagramfragmenthandler.hxx" 31 #include "oox/drawingml/diagram/datamodelcontext.hxx" 32 #include "diagramdefinitioncontext.hxx" 33 34 using namespace ::oox::core; 35 using namespace ::com::sun::star::xml::sax; 36 using namespace ::com::sun::star::uno; 37 using ::rtl::OUString; 38 39 namespace oox { namespace drawingml { 40 41 DiagramDataFragmentHandler::DiagramDataFragmentHandler( XmlFilterBase& rFilter, 42 const OUString& rFragmentPath, 43 const DiagramDataPtr pDataPtr ) 44 throw( ) 45 : FragmentHandler( rFilter, rFragmentPath ) 46 , mpDataPtr( pDataPtr ) 47 { 48 } 49 50 DiagramDataFragmentHandler::~DiagramDataFragmentHandler( ) throw () 51 { 52 53 } 54 55 void SAL_CALL DiagramDataFragmentHandler::endDocument() 56 throw (SAXException, RuntimeException) 57 { 58 59 } 60 61 62 Reference< XFastContextHandler > SAL_CALL 63 DiagramDataFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 64 const Reference< XFastAttributeList >& ) 65 throw ( SAXException, RuntimeException) 66 { 67 Reference< XFastContextHandler > xRet; 68 69 switch( aElement ) 70 { 71 case DGM_TOKEN( dataModel ): 72 xRet.set( new DataModelContext( *this, mpDataPtr ) ); 73 break; 74 default: 75 break; 76 } 77 78 if( !xRet.is() ) 79 xRet = getFastContextHandler(); 80 81 return xRet; 82 } 83 84 /////////////////// 85 86 DiagramLayoutFragmentHandler::DiagramLayoutFragmentHandler( XmlFilterBase& rFilter, 87 const OUString& rFragmentPath, 88 const DiagramLayoutPtr pDataPtr ) 89 throw( ) 90 : FragmentHandler( rFilter, rFragmentPath ) 91 , mpDataPtr( pDataPtr ) 92 { 93 } 94 95 DiagramLayoutFragmentHandler::~DiagramLayoutFragmentHandler( ) throw () 96 { 97 98 } 99 100 void SAL_CALL DiagramLayoutFragmentHandler::endDocument() 101 throw (SAXException, RuntimeException) 102 { 103 104 } 105 106 107 Reference< XFastContextHandler > SAL_CALL 108 DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 109 const Reference< XFastAttributeList >& xAttribs ) 110 throw ( SAXException, RuntimeException) 111 { 112 Reference< XFastContextHandler > xRet; 113 114 switch( aElement ) 115 { 116 case DGM_TOKEN( layoutDef ): 117 xRet.set( new DiagramDefinitionContext( *this, xAttribs, mpDataPtr ) ); 118 break; 119 default: 120 break; 121 } 122 123 if( !xRet.is() ) 124 xRet = getFastContextHandler(); 125 126 return xRet; 127 } 128 129 /////////////////////// 130 131 DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFilter, 132 const OUString& rFragmentPath, 133 const DiagramQStylesPtr pDataPtr ) 134 throw( ) 135 : FragmentHandler( rFilter, rFragmentPath ) 136 , mpDataPtr( pDataPtr ) 137 { 138 } 139 140 DiagramQStylesFragmentHandler::~DiagramQStylesFragmentHandler( ) throw () 141 { 142 143 } 144 145 void SAL_CALL DiagramQStylesFragmentHandler::endDocument() 146 throw (SAXException, RuntimeException) 147 { 148 149 } 150 151 152 Reference< XFastContextHandler > SAL_CALL 153 DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 154 const Reference< XFastAttributeList >& ) 155 throw ( SAXException, RuntimeException) 156 { 157 Reference< XFastContextHandler > xRet; 158 159 switch( aElement ) 160 { 161 case DGM_TOKEN( styleDef ): 162 // TODO 163 break; 164 default: 165 break; 166 } 167 168 if( !xRet.is() ) 169 xRet = getFastContextHandler(); 170 171 return xRet; 172 } 173 174 ///////////////////// 175 176 DiagramColorsFragmentHandler::DiagramColorsFragmentHandler( XmlFilterBase& rFilter, 177 const OUString& rFragmentPath, 178 const DiagramColorsPtr pDataPtr ) 179 throw( ) 180 : FragmentHandler( rFilter, rFragmentPath ) 181 , mpDataPtr( pDataPtr ) 182 { 183 } 184 185 DiagramColorsFragmentHandler::~DiagramColorsFragmentHandler( ) throw () 186 { 187 188 } 189 190 void SAL_CALL DiagramColorsFragmentHandler::endDocument() 191 throw (SAXException, RuntimeException) 192 { 193 194 } 195 196 197 Reference< XFastContextHandler > SAL_CALL 198 DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 199 const Reference< XFastAttributeList >& ) 200 throw ( SAXException, RuntimeException) 201 { 202 Reference< XFastContextHandler > xRet; 203 204 switch( aElement ) 205 { 206 case DGM_TOKEN( colorsDef ): 207 // TODO 208 break; 209 default: 210 break; 211 } 212 213 if( !xRet.is() ) 214 xRet = getFastContextHandler(); 215 216 return xRet; 217 } 218 219 220 221 222 } } 223