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 "comphelper/anytostring.hxx"
23 #include "cppuhelper/exc_hlp.hxx"
24 #include <osl/diagnose.h>
26 #include <com/sun/star/uno/Any.hxx>
28 #include "oox/helper/attributelist.hxx"
29 #include "drawingml/embeddedwavaudiofile.hxx"
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::xml::sax
;
33 using namespace ::oox::core
;
35 namespace oox
{ namespace ppt
{
37 // CT_TLShapeTargetElement
38 class ShapeTargetElementContext
39 : public FragmentHandler2
42 ShapeTargetElementContext( FragmentHandler2
& rParent
, ShapeTargetElement
& aValue
)
43 : FragmentHandler2( rParent
)
45 , maShapeTarget(aValue
)
48 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
) SAL_OVERRIDE
50 switch( aElementToken
)
54 maShapeTarget
.mnType
= XML_bg
;
56 case PPT_TOKEN( txEl
):
58 maShapeTarget
.mnType
= XML_txEl
;
60 case PPT_TOKEN( subSp
):
62 maShapeTarget
.mnType
= XML_subSp
;
63 maShapeTarget
.msSubShapeId
= rAttribs
.getString( XML_spid
, OUString() );
65 case PPT_TOKEN( graphicEl
):
66 return this; // needs a:dgm for the target
69 maShapeTarget
.mnType
= XML_dgm
;
70 maShapeTarget
.msSubShapeId
= rAttribs
.getString( XML_id
, OUString() );
72 case PPT_TOKEN( oleChartEl
):
76 case PPT_TOKEN( charRg
):
77 case PPT_TOKEN( pRg
):
78 if( bTargetSet
&& maShapeTarget
.mnType
== XML_txEl
)
80 maShapeTarget
.mnRangeType
= getBaseToken( aElementToken
);
81 maShapeTarget
.maRange
= drawingml::GetIndexRange( rAttribs
.getFastAttributeList() );
92 ShapeTargetElement
& maShapeTarget
;
95 TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2
& rParent
, const AnimTargetElementPtr
& pValue
)
96 : FragmentHandler2( rParent
),
99 OSL_ENSURE( mpTarget
, "no valid target passed" );
102 TimeTargetElementContext::~TimeTargetElementContext( ) throw( )
106 ::oox::core::ContextHandlerRef
TimeTargetElementContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
108 switch( aElementToken
)
110 case PPT_TOKEN( inkTgt
):
112 mpTarget
->mnType
= XML_inkTgt
;
113 OUString aId
= rAttribs
.getString( XML_spid
, OUString() );
116 mpTarget
->msValue
= aId
;
120 case PPT_TOKEN( sldTgt
):
121 mpTarget
->mnType
= XML_sldTgt
;
123 case PPT_TOKEN( sndTgt
):
125 mpTarget
->mnType
= XML_sndTgt
;
126 mpTarget
->msValue
= drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs
);
129 case PPT_TOKEN( spTgt
):
131 mpTarget
->mnType
= XML_spTgt
;
132 OUString aId
= rAttribs
.getString( XML_spid
, OUString() );
133 mpTarget
->msValue
= aId
;
134 return new ShapeTargetElementContext( *this, mpTarget
->maShapeTarget
);
139 "unhandled tag " << getBaseToken(aElementToken
)
140 << " in TL_TimeTargetElement");
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */