1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: customshowlistcontext.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "customshowlistcontext.hxx"
32 #include "oox/core/namespaces.hxx"
36 using namespace ::oox::core
;
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::xml::sax
;
40 namespace oox
{ namespace ppt
{
42 class CustomShowContext
: public ::oox::core::ContextHandler
44 CustomShow mrCustomShow
;
47 CustomShowContext( ::oox::core::ContextHandler
& rParent
,
48 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XFastAttributeList
>& xAttribs
,
49 CustomShow
& rCustomShow
);
50 ~CustomShowContext( );
51 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XFastContextHandler
> SAL_CALL
52 createFastChildContext( ::sal_Int32 aElementToken
, const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XFastAttributeList
>& /*xAttribs*/ )
53 throw ( ::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
56 CustomShowContext::CustomShowContext( ContextHandler
& rParent
,
57 const Reference
< XFastAttributeList
>& rxAttribs
,
58 CustomShow
& rCustomShow
)
59 : ContextHandler( rParent
)
60 , mrCustomShow( rCustomShow
)
62 mrCustomShow
.maName
= rxAttribs
->getOptionalValue( XML_name
);
63 mrCustomShow
.mnId
= rxAttribs
->getOptionalValue( XML_id
);
66 CustomShowContext::~CustomShowContext( )
70 Reference
< XFastContextHandler
> SAL_CALL
CustomShowContext::createFastChildContext( sal_Int32 aElementToken
,
71 const Reference
< XFastAttributeList
>& xAttribs
)
72 throw ( SAXException
, RuntimeException
)
74 Reference
< XFastContextHandler
> xRet
;
75 switch( aElementToken
)
77 case NMSP_PPT
|XML_sld
:
78 mrCustomShow
.maSldLst
.push_back( xAttribs
->getOptionalValue( NMSP_RELATIONSHIPS
| XML_id
) );
88 //---------------------------------------------------------------------------
90 CustomShowListContext::CustomShowListContext( ContextHandler
& rParent
,
91 std::vector
< CustomShow
>& rCustomShowList
)
92 : ContextHandler( rParent
)
93 , mrCustomShowList( rCustomShowList
)
97 CustomShowListContext::~CustomShowListContext( )
101 Reference
< XFastContextHandler
> SAL_CALL
CustomShowListContext::createFastChildContext( sal_Int32 aElementToken
,
102 const Reference
< XFastAttributeList
>& xAttribs
)
103 throw ( SAXException
, RuntimeException
)
105 Reference
< XFastContextHandler
> xRet
;
106 switch( aElementToken
)
108 case NMSP_PPT
|XML_custShow
:
110 CustomShow aCustomShow
;
111 mrCustomShowList
.push_back( aCustomShow
);
112 xRet
= new CustomShowContext( *this, xAttribs
, mrCustomShowList
.back() );