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/table/tablestylecontext.hxx" 27 #include "oox/drawingml/table/tablebackgroundstylecontext.hxx" 28 #include "oox/drawingml/table/tablepartstylecontext.hxx" 29 30 using namespace ::oox::core; 31 using namespace ::com::sun::star; 32 using namespace ::com::sun::star::uno; 33 using namespace ::com::sun::star::xml::sax; 34 using ::rtl::OUString; 35 36 namespace oox { namespace drawingml { namespace table { 37 38 TableStyleContext::TableStyleContext( ContextHandler& rParent, 39 const Reference< XFastAttributeList >& xAttribs, TableStyle& rTableStyle ) 40 : ContextHandler( rParent ) 41 , mrTableStyle( rTableStyle ) 42 { 43 mrTableStyle.getStyleId() = xAttribs->getOptionalValue( XML_styleId ); 44 mrTableStyle.getStyleName() = xAttribs->getOptionalValue( XML_styleName ); 45 } 46 47 TableStyleContext::~TableStyleContext() 48 { 49 } 50 51 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL 52 TableStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& /* xAttribs */ ) 53 throw ( xml::sax::SAXException, uno::RuntimeException) 54 { 55 uno::Reference< xml::sax::XFastContextHandler > xRet; 56 57 switch( aElementToken ) 58 { 59 case A_TOKEN( tblBg ): // CT_TableBackgroundStyle 60 xRet = new TableBackgroundStyleContext( *this, mrTableStyle ); 61 break; 62 case A_TOKEN( wholeTbl ): // CT_TablePartStyle 63 xRet = new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() ); 64 break; 65 case A_TOKEN( band1H ): // CT_TablePartStyle 66 xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1H() ); 67 break; 68 case A_TOKEN( band2H ): // CT_TablePartStyle 69 xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2H() ); 70 break; 71 case A_TOKEN( band1V ): // CT_TablePartStyle 72 xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1V() ); 73 break; 74 case A_TOKEN( band2V ): // CT_TablePartStyle 75 xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2V() ); 76 break; 77 case A_TOKEN( lastCol ): // CT_TablePartStyle 78 xRet = new TablePartStyleContext( *this, mrTableStyle.getLastCol() ); 79 break; 80 case A_TOKEN( firstCol ): // CT_TablePartStyle 81 xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstCol() ); 82 break; 83 case A_TOKEN( lastRow ): // CT_TablePartStyle 84 xRet = new TablePartStyleContext( *this, mrTableStyle.getLastRow() ); 85 break; 86 case A_TOKEN( seCell ): // CT_TablePartStyle 87 xRet = new TablePartStyleContext( *this, mrTableStyle.getSeCell() ); 88 break; 89 case A_TOKEN( swCell ): // CT_TablePartStyle 90 xRet = new TablePartStyleContext( *this, mrTableStyle.getSwCell() ); 91 break; 92 case A_TOKEN( firstRow ): // CT_TablePartStyle 93 xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstRow() ); 94 break; 95 case A_TOKEN( neCell ): // CT_TablePartStyle 96 xRet = new TablePartStyleContext( *this, mrTableStyle.getNeCell() ); 97 break; 98 case A_TOKEN( nwCell ): // CT_TablePartStyle 99 xRet = new TablePartStyleContext( *this, mrTableStyle.getNwCell() ); 100 break; 101 case A_TOKEN( extLst ): // CT_OfficeArtExtensionList 102 break; 103 } 104 if( !xRet.is() ) 105 { 106 uno::Reference<XFastContextHandler> xTmp(this); 107 xRet.set( xTmp ); 108 } 109 return xRet; 110 } 111 112 } } } 113