GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / oox / source / ppt / timetargetelementcontext.cxx
blobe8c59a8913df278cdc07c42070266ef75101e790
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "oox/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 {
39 // CT_TLShapeTargetElement
40 class ShapeTargetElementContext
41 : public FragmentHandler2
43 public:
44 ShapeTargetElementContext( FragmentHandler2& rParent, ShapeTargetElement & aValue )
45 : FragmentHandler2( rParent )
46 , bTargetSet(false)
47 , maShapeTarget(aValue)
50 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
52 switch( aElementToken )
54 case PPT_TOKEN( bg ):
55 bTargetSet = true;
56 maShapeTarget.mnType = XML_bg;
57 return this;
58 case PPT_TOKEN( txEl ):
59 bTargetSet = true;
60 maShapeTarget.mnType = XML_txEl;
61 return this;
62 case PPT_TOKEN( subSp ):
63 bTargetSet = true;
64 maShapeTarget.mnType = XML_subSp;
65 maShapeTarget.msSubShapeId = rAttribs.getString( XML_spid, OUString() );
66 return this;
67 case PPT_TOKEN( graphicEl ):
68 return this; // needs a:dgm for the target
69 case A_TOKEN( dgm ):
70 bTargetSet = true;
71 maShapeTarget.mnType = XML_dgm;
72 maShapeTarget.msSubShapeId = rAttribs.getString( XML_id, OUString() );
73 return this;
74 case PPT_TOKEN( oleChartEl ):
75 bTargetSet = true;
76 // TODO
77 return this;
78 case PPT_TOKEN( charRg ):
79 case PPT_TOKEN( pRg ):
80 if( bTargetSet && maShapeTarget.mnType == XML_txEl )
82 maShapeTarget.mnRangeType = getBaseToken( aElementToken );
83 maShapeTarget.maRange = drawingml::GetIndexRange( rAttribs.getFastAttributeList() );
85 return this;
86 default:
87 break;
89 return this;
92 private:
93 bool bTargetSet;
94 ShapeTargetElement & maShapeTarget;
99 TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2& rParent, const AnimTargetElementPtr & pValue )
100 : FragmentHandler2( rParent ),
101 mpTarget( pValue )
103 OSL_ENSURE( mpTarget, "no valid target passed" );
107 TimeTargetElementContext::~TimeTargetElementContext( ) throw( )
111 ::oox::core::ContextHandlerRef TimeTargetElementContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
113 switch( aElementToken )
115 case PPT_TOKEN( inkTgt ):
117 mpTarget->mnType = XML_inkTgt;
118 OUString aId = rAttribs.getString( XML_spid, OUString() );
119 if( !aId.isEmpty() )
121 mpTarget->msValue = aId;
123 return this;
125 case PPT_TOKEN( sldTgt ):
126 mpTarget->mnType = XML_sldTgt;
127 return this;
128 case PPT_TOKEN( sndTgt ):
130 mpTarget->mnType = XML_sndTgt;
131 drawingml::EmbeddedWAVAudioFile aAudio;
132 drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio);
134 OUString sSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed );
135 mpTarget->msValue = sSndName;
136 break;
138 case PPT_TOKEN( spTgt ):
140 mpTarget->mnType = XML_spTgt;
141 OUString aId = rAttribs.getString( XML_spid, OUString() );
142 mpTarget->msValue = aId;
143 return new ShapeTargetElementContext( *this, mpTarget->maShapeTarget );
145 default:
146 OSL_TRACE( "OOX: unhandled tag %ld in TL_TimeTargetElement.", getBaseToken( aElementToken ) );
147 break;
150 return this;
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */