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 "customshowlistcontext.hxx" 25 26 using namespace ::oox::core; 27 using namespace ::com::sun::star::uno; 28 using namespace ::com::sun::star::xml::sax; 29 30 namespace oox { namespace ppt { 31 32 class CustomShowContext : public ::oox::core::ContextHandler 33 { 34 CustomShow mrCustomShow; 35 36 public: 37 CustomShowContext( ::oox::core::ContextHandler& rParent, 38 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, 39 CustomShow& rCustomShow ); 40 ~CustomShowContext( ); 41 virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL 42 createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ); 43 }; 44 45 CustomShowContext::CustomShowContext( ContextHandler& rParent, 46 const Reference< XFastAttributeList >& rxAttribs, 47 CustomShow& rCustomShow ) 48 : ContextHandler( rParent ) 49 , mrCustomShow( rCustomShow ) 50 { 51 mrCustomShow.maName = rxAttribs->getOptionalValue( XML_name ); 52 mrCustomShow.mnId = rxAttribs->getOptionalValue( XML_id ); 53 } 54 55 CustomShowContext::~CustomShowContext( ) 56 { 57 } 58 59 Reference< XFastContextHandler > SAL_CALL CustomShowContext::createFastChildContext( sal_Int32 aElementToken, 60 const Reference< XFastAttributeList >& xAttribs ) 61 { 62 Reference< XFastContextHandler > xRet; 63 switch( aElementToken ) 64 { 65 case PPT_TOKEN( sld ) : 66 mrCustomShow.maSldLst.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); 67 default: 68 break; 69 } 70 if( !xRet.is() ) 71 xRet.set( this ); 72 73 return xRet; 74 } 75 76 //--------------------------------------------------------------------------- 77 78 CustomShowListContext::CustomShowListContext( ContextHandler& rParent, 79 std::vector< CustomShow >& rCustomShowList ) 80 : ContextHandler( rParent ) 81 , mrCustomShowList( rCustomShowList ) 82 { 83 } 84 85 CustomShowListContext::~CustomShowListContext( ) 86 { 87 } 88 89 Reference< XFastContextHandler > SAL_CALL CustomShowListContext::createFastChildContext( sal_Int32 aElementToken, 90 const Reference< XFastAttributeList >& xAttribs ) 91 { 92 Reference< XFastContextHandler > xRet; 93 switch( aElementToken ) 94 { 95 case PPT_TOKEN( custShow ) : 96 { 97 CustomShow aCustomShow; 98 mrCustomShowList.push_back( aCustomShow ); 99 xRet = new CustomShowContext( *this, xAttribs, mrCustomShowList.back() ); 100 } 101 default: 102 break; 103 } 104 if( !xRet.is() ) 105 xRet.set( this ); 106 107 return xRet; 108 } 109 110 111 } } 112