blob: a05dd55918ca4f02e8cbd94f2ac36f00c3c5f8f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <com/sun/star/animations/Timing.hpp>
#include <com/sun/star/animations/Event.hpp>
#include <com/sun/star/animations/EventTrigger.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/animations/XAnimationNode.hpp>
#include "pptx-animations-cond.hxx"
using namespace ::com::sun::star::animations;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::uno;
namespace
{
const char* convertEventTrigger(sal_Int16 nTrigger)
{
const char* pEvent = nullptr;
switch (nTrigger)
{
case EventTrigger::ON_NEXT:
pEvent = "onNext";
break;
case EventTrigger::ON_PREV:
pEvent = "onPrev";
break;
case EventTrigger::BEGIN_EVENT:
pEvent = "begin";
break;
case EventTrigger::END_EVENT:
pEvent = "end";
break;
case EventTrigger::ON_BEGIN:
pEvent = "onBegin";
break;
case EventTrigger::ON_END:
pEvent = "onEnd";
break;
case EventTrigger::ON_CLICK:
pEvent = "onClick";
break;
case EventTrigger::ON_DBL_CLICK:
pEvent = "onDblClick";
break;
case EventTrigger::ON_STOP_AUDIO:
pEvent = "onStopAudio";
break;
case EventTrigger::ON_MOUSE_ENTER:
pEvent = "onMouseOver"; // not exact?
break;
case EventTrigger::ON_MOUSE_LEAVE:
pEvent = "onMouseOut";
break;
}
return pEvent;
}
}
namespace oox::core
{
Cond::Cond(const Any& rAny, bool bIsMainSeqChild)
: mpEvent(nullptr)
{
bool bHasFDelay = false;
double fDelay = 0;
Timing eTiming;
Event aEvent;
if (rAny >>= eTiming)
{
if (eTiming == Timing_INDEFINITE)
msDelay = "indefinite"_ostr;
}
else if (rAny >>= aEvent)
{
if (aEvent.Trigger == EventTrigger::ON_NEXT && bIsMainSeqChild)
msDelay = "indefinite"_ostr;
else
{
mpEvent = convertEventTrigger(aEvent.Trigger);
if (!(aEvent.Source >>= mxShape))
aEvent.Source >>= mxNode;
if (aEvent.Offset >>= fDelay)
bHasFDelay = true;
}
}
else if (rAny >>= fDelay)
bHasFDelay = true;
if (bHasFDelay)
{
sal_Int32 nDelay = static_cast<sal_uInt32>(fDelay * 1000.0);
msDelay = OString::number(nDelay);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|