fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / oox / source / ppt / timetargetelementcontext.cxx
blobb565a1b5e9176081dc03b0c399179dbf7ce25ef8
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 "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
41 public:
42 ShapeTargetElementContext( FragmentHandler2& rParent, ShapeTargetElement & aValue )
43 : FragmentHandler2( rParent )
44 , bTargetSet(false)
45 , maShapeTarget(aValue)
48 virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) SAL_OVERRIDE
50 switch( aElementToken )
52 case PPT_TOKEN( bg ):
53 bTargetSet = true;
54 maShapeTarget.mnType = XML_bg;
55 return this;
56 case PPT_TOKEN( txEl ):
57 bTargetSet = true;
58 maShapeTarget.mnType = XML_txEl;
59 return this;
60 case PPT_TOKEN( subSp ):
61 bTargetSet = true;
62 maShapeTarget.mnType = XML_subSp;
63 maShapeTarget.msSubShapeId = rAttribs.getString( XML_spid, OUString() );
64 return this;
65 case PPT_TOKEN( graphicEl ):
66 return this; // needs a:dgm for the target
67 case A_TOKEN( dgm ):
68 bTargetSet = true;
69 maShapeTarget.mnType = XML_dgm;
70 maShapeTarget.msSubShapeId = rAttribs.getString( XML_id, OUString() );
71 return this;
72 case PPT_TOKEN( oleChartEl ):
73 bTargetSet = true;
74 // TODO
75 return this;
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() );
83 return this;
84 default:
85 break;
87 return this;
90 private:
91 bool bTargetSet;
92 ShapeTargetElement & maShapeTarget;
95 TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2& rParent, const AnimTargetElementPtr & pValue )
96 : FragmentHandler2( rParent ),
97 mpTarget( pValue )
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() );
114 if( !aId.isEmpty() )
116 mpTarget->msValue = aId;
118 return this;
120 case PPT_TOKEN( sldTgt ):
121 mpTarget->mnType = XML_sldTgt;
122 return this;
123 case PPT_TOKEN( sndTgt ):
125 mpTarget->mnType = XML_sndTgt;
126 mpTarget->msValue = drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs );
127 break;
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 );
136 default:
137 SAL_INFO(
138 "oox.ppt",
139 "unhandled tag " << getBaseToken(aElementToken)
140 << " in TL_TimeTargetElement");
141 break;
144 return this;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */