/src/libreoffice/oox/source/ppt/timeanimvaluecontext.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include "timeanimvaluecontext.hxx" |
21 | | |
22 | | #include "animvariantcontext.hxx" |
23 | | |
24 | | #include <oox/helper/attributelist.hxx> |
25 | | #include <oox/token/namespaces.hxx> |
26 | | #include <oox/token/tokens.hxx> |
27 | | |
28 | | using namespace ::oox::core; |
29 | | |
30 | | namespace oox::ppt { |
31 | | |
32 | | TimeAnimValueListContext::TimeAnimValueListContext( FragmentHandler2 const & rParent, |
33 | | TimeAnimationValueList & aTavList ) |
34 | 20 | : FragmentHandler2( rParent ) |
35 | 20 | , maTavList( aTavList ) |
36 | 20 | , mbInValue( false ) |
37 | 20 | { |
38 | 20 | } |
39 | | |
40 | | TimeAnimValueListContext::~TimeAnimValueListContext( ) |
41 | 20 | { |
42 | 20 | } |
43 | | |
44 | | void TimeAnimValueListContext::onEndElement() |
45 | 60 | { |
46 | 60 | if( isCurrentElement( PPT_TOKEN( tav ) ) ) |
47 | 40 | { |
48 | 40 | mbInValue = false; |
49 | 40 | } |
50 | 60 | } |
51 | | |
52 | | ::oox::core::ContextHandlerRef TimeAnimValueListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) |
53 | 80 | { |
54 | | |
55 | 80 | switch ( aElementToken ) |
56 | 80 | { |
57 | 40 | case PPT_TOKEN( tav ): |
58 | 40 | { |
59 | 40 | mbInValue = true; |
60 | 40 | TimeAnimationValue val; |
61 | 40 | val.msFormula = rAttribs.getStringDefaulted( XML_fmla); |
62 | 40 | val.msTime = rAttribs.getStringDefaulted( XML_tm); |
63 | 40 | maTavList.push_back( val ); |
64 | 40 | return this; |
65 | 0 | } |
66 | 40 | case PPT_TOKEN( val ): |
67 | 40 | if( mbInValue ) |
68 | 40 | { |
69 | | // CT_TLAnimVariant |
70 | 40 | return new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ); |
71 | 40 | } |
72 | 0 | break; |
73 | 0 | default: |
74 | 0 | break; |
75 | 80 | } |
76 | | |
77 | 0 | return this; |
78 | 80 | } |
79 | | |
80 | | } |
81 | | |
82 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |