1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #include <osl/diagnose.h> 25 26 #include "oox/drawingml/diagram/diagramfragmenthandler.hxx" 27 #include "oox/drawingml/diagram/datamodelcontext.hxx" 28 #include "diagramdefinitioncontext.hxx" 29 30 using namespace ::oox::core; 31 using namespace ::com::sun::star::xml::sax; 32 using namespace ::com::sun::star::uno; 33 using ::rtl::OUString; 34 35 namespace oox { namespace drawingml { 36 37 DiagramDataFragmentHandler::DiagramDataFragmentHandler( XmlFilterBase& rFilter, 38 const OUString& rFragmentPath, 39 const DiagramDataPtr pDataPtr ) 40 throw( ) 41 : FragmentHandler( rFilter, rFragmentPath ) 42 , mpDataPtr( pDataPtr ) 43 { 44 } 45 46 DiagramDataFragmentHandler::~DiagramDataFragmentHandler( ) throw () 47 { 48 49 } 50 51 void SAL_CALL DiagramDataFragmentHandler::endDocument() 52 throw (SAXException, RuntimeException) 53 { 54 55 } 56 57 58 Reference< XFastContextHandler > SAL_CALL 59 DiagramDataFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 60 const Reference< XFastAttributeList >& ) 61 throw ( SAXException, RuntimeException) 62 { 63 Reference< XFastContextHandler > xRet; 64 65 switch( aElement ) 66 { 67 case DGM_TOKEN( dataModel ): 68 xRet.set( new DataModelContext( *this, mpDataPtr ) ); 69 break; 70 default: 71 break; 72 } 73 74 if( !xRet.is() ) 75 xRet = getFastContextHandler(); 76 77 return xRet; 78 } 79 80 /////////////////// 81 82 DiagramLayoutFragmentHandler::DiagramLayoutFragmentHandler( XmlFilterBase& rFilter, 83 const OUString& rFragmentPath, 84 const DiagramLayoutPtr pDataPtr ) 85 throw( ) 86 : FragmentHandler( rFilter, rFragmentPath ) 87 , mpDataPtr( pDataPtr ) 88 { 89 } 90 91 DiagramLayoutFragmentHandler::~DiagramLayoutFragmentHandler( ) throw () 92 { 93 94 } 95 96 void SAL_CALL DiagramLayoutFragmentHandler::endDocument() 97 throw (SAXException, RuntimeException) 98 { 99 100 } 101 102 103 Reference< XFastContextHandler > SAL_CALL 104 DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 105 const Reference< XFastAttributeList >& xAttribs ) 106 throw ( SAXException, RuntimeException) 107 { 108 Reference< XFastContextHandler > xRet; 109 110 switch( aElement ) 111 { 112 case DGM_TOKEN( layoutDef ): 113 xRet.set( new DiagramDefinitionContext( *this, xAttribs, mpDataPtr ) ); 114 break; 115 default: 116 break; 117 } 118 119 if( !xRet.is() ) 120 xRet = getFastContextHandler(); 121 122 return xRet; 123 } 124 125 /////////////////////// 126 127 DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFilter, 128 const OUString& rFragmentPath, 129 const DiagramQStylesPtr pDataPtr ) 130 throw( ) 131 : FragmentHandler( rFilter, rFragmentPath ) 132 , mpDataPtr( pDataPtr ) 133 { 134 } 135 136 DiagramQStylesFragmentHandler::~DiagramQStylesFragmentHandler( ) throw () 137 { 138 139 } 140 141 void SAL_CALL DiagramQStylesFragmentHandler::endDocument() 142 throw (SAXException, RuntimeException) 143 { 144 145 } 146 147 148 Reference< XFastContextHandler > SAL_CALL 149 DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 150 const Reference< XFastAttributeList >& ) 151 throw ( SAXException, RuntimeException) 152 { 153 Reference< XFastContextHandler > xRet; 154 155 switch( aElement ) 156 { 157 case DGM_TOKEN( styleDef ): 158 // TODO 159 break; 160 default: 161 break; 162 } 163 164 if( !xRet.is() ) 165 xRet = getFastContextHandler(); 166 167 return xRet; 168 } 169 170 ///////////////////// 171 172 DiagramColorsFragmentHandler::DiagramColorsFragmentHandler( XmlFilterBase& rFilter, 173 const OUString& rFragmentPath, 174 const DiagramColorsPtr pDataPtr ) 175 throw( ) 176 : FragmentHandler( rFilter, rFragmentPath ) 177 , mpDataPtr( pDataPtr ) 178 { 179 } 180 181 DiagramColorsFragmentHandler::~DiagramColorsFragmentHandler( ) throw () 182 { 183 184 } 185 186 void SAL_CALL DiagramColorsFragmentHandler::endDocument() 187 throw (SAXException, RuntimeException) 188 { 189 190 } 191 192 193 Reference< XFastContextHandler > SAL_CALL 194 DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement, 195 const Reference< XFastAttributeList >& ) 196 throw ( SAXException, RuntimeException) 197 { 198 Reference< XFastContextHandler > xRet; 199 200 switch( aElement ) 201 { 202 case DGM_TOKEN( colorsDef ): 203 // TODO 204 break; 205 default: 206 break; 207 } 208 209 if( !xRet.is() ) 210 xRet = getFastContextHandler(); 211 212 return xRet; 213 } 214 215 216 217 218 } } 219