1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "timetargetelementcontext.hxx"
22 #include <cppuhelper/exc_hlp.hxx>
23 #include <osl/diagnose.h>
25 #include <oox/helper/attributelist.hxx>
26 #include <drawingml/embeddedwavaudiofile.hxx>
27 #include <oox/token/namespaces.hxx>
28 #include <oox/token/tokens.hxx>
30 using namespace ::com::sun::star::uno
;
31 using namespace ::com::sun::star::xml::sax
;
32 using namespace ::oox::core
;
34 namespace oox
{ namespace ppt
{
36 // CT_TLShapeTargetElement
37 class ShapeTargetElementContext
38 : public FragmentHandler2
41 ShapeTargetElementContext( FragmentHandler2
const & rParent
, ShapeTargetElement
& aValue
)
42 : FragmentHandler2( rParent
)
44 , maShapeTarget(aValue
)
47 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
) override
49 switch( aElementToken
)
53 maShapeTarget
.mnType
= XML_bg
;
55 case PPT_TOKEN( txEl
):
57 maShapeTarget
.mnType
= XML_txEl
;
59 case PPT_TOKEN( subSp
):
61 maShapeTarget
.mnType
= XML_subSp
;
62 maShapeTarget
.msSubShapeId
= rAttribs
.getString( XML_spid
, OUString() );
64 case PPT_TOKEN( graphicEl
):
65 return this; // needs a:dgm for the target
68 maShapeTarget
.mnType
= XML_dgm
;
69 maShapeTarget
.msSubShapeId
= rAttribs
.getString( XML_id
, OUString() );
71 case PPT_TOKEN( oleChartEl
):
75 case PPT_TOKEN( charRg
):
76 case PPT_TOKEN( pRg
):
77 if( bTargetSet
&& maShapeTarget
.mnType
== XML_txEl
)
79 maShapeTarget
.mnRangeType
= getBaseToken( aElementToken
);
80 maShapeTarget
.maRange
= drawingml::GetIndexRange( rAttribs
.getFastAttributeList() );
91 ShapeTargetElement
& maShapeTarget
;
94 TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2
const & rParent
, const AnimTargetElementPtr
& pValue
)
95 : FragmentHandler2( rParent
),
98 OSL_ENSURE( mpTarget
, "no valid target passed" );
101 TimeTargetElementContext::~TimeTargetElementContext( ) throw( )
105 ::oox::core::ContextHandlerRef
TimeTargetElementContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
107 switch( aElementToken
)
109 case PPT_TOKEN( inkTgt
):
111 mpTarget
->mnType
= XML_inkTgt
;
112 OUString aId
= rAttribs
.getString( XML_spid
, OUString() );
115 mpTarget
->msValue
= aId
;
119 case PPT_TOKEN( sldTgt
):
120 mpTarget
->mnType
= XML_sldTgt
;
122 case PPT_TOKEN( sndTgt
):
124 mpTarget
->mnType
= XML_sndTgt
;
125 mpTarget
->msValue
= drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs
);
128 case PPT_TOKEN( spTgt
):
130 mpTarget
->mnType
= XML_spTgt
;
131 OUString aId
= rAttribs
.getString( XML_spid
, OUString() );
132 mpTarget
->msValue
= aId
;
133 return new ShapeTargetElementContext( *this, mpTarget
->maShapeTarget
);
138 "unhandled tag " << getBaseToken(aElementToken
)
139 << " in TL_TimeTargetElement");
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */