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 "oox/drawingml/themefragmenthandler.hxx" 25 #include "oox/drawingml/objectdefaultcontext.hxx" 26 #include "oox/drawingml/theme.hxx" 27 #include "oox/drawingml/themeelementscontext.hxx" 28 29 using ::rtl::OUString; 30 using namespace ::oox::core; 31 32 namespace oox { 33 namespace drawingml { 34 35 // ============================================================================ 36 ThemeFragmentHandler(XmlFilterBase & rFilter,const OUString & rFragmentPath,Theme & rTheme)37 ThemeFragmentHandler::ThemeFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rTheme ) : 38 FragmentHandler2( rFilter, rFragmentPath ), 39 mrTheme( rTheme ) 40 { 41 } 42 ~ThemeFragmentHandler()43 ThemeFragmentHandler::~ThemeFragmentHandler() 44 { 45 } 46 onCreateContext(sal_Int32 nElement,const AttributeList &)47 ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& ) 48 { 49 // CT_OfficeStyleSheet 50 switch( getCurrentElement() ) 51 { 52 case XML_ROOT_CONTEXT: 53 switch( nElement ) 54 { 55 case A_TOKEN( theme ): 56 return this; 57 } 58 break; 59 60 case A_TOKEN( theme ): 61 switch( nElement ) 62 { 63 case A_TOKEN( themeElements ): // CT_BaseStyles 64 return new ThemeElementsContext( *this, mrTheme ); 65 case A_TOKEN( objectDefaults ): // CT_ObjectStyleDefaults 66 return new objectDefaultContext( *this, mrTheme ); 67 case A_TOKEN( extraClrSchemeLst ): // CT_ColorSchemeList 68 return 0; 69 case A_TOKEN( custClrLst ): // CustomColorList 70 return 0; 71 case A_TOKEN( ext ): // CT_OfficeArtExtension 72 return 0; 73 } 74 break; 75 } 76 return 0; 77 } 78 79 // ============================================================================ 80 81 } // namespace drawingml 82 } // namespace oox 83 84