LibreOffice Module sd (master) 1
anminfo.cxx
Go to the documentation of this file.
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 <editeng/flditem.hxx>
21#include <editeng/eeitem.hxx>
22#include <tools/debug.hxx>
23
24#include <anminfo.hxx>
25#include <glob.hxx>
26
27using namespace ::com::sun::star;
28
31 mePresObjKind (PresObjKind::NONE),
32 meEffect (presentation::AnimationEffect_NONE),
33 meTextEffect (presentation::AnimationEffect_NONE),
34 meSpeed (presentation::AnimationSpeed_SLOW),
35 mbActive (true),
36 mbDimPrevious (false),
37 mbIsMovie (false),
38 mbDimHide (false),
39 mbSoundOn (false),
40 mbPlayFull (false),
41 meClickAction (presentation::ClickAction_NONE),
42 meSecondEffect (presentation::AnimationEffect_NONE),
43 meSecondSpeed (presentation::AnimationSpeed_SLOW),
44 mbSecondSoundOn (false),
45 mbSecondPlayFull (false),
46 mnVerb (0),
47 mrObject (rObject)
48{
51}
52
54 : SdrObjUserData (rAnmInfo),
55 mePresObjKind (PresObjKind::NONE),
56 meEffect (rAnmInfo.meEffect),
57 meTextEffect (rAnmInfo.meTextEffect),
58 meSpeed (rAnmInfo.meSpeed),
59 mbActive (rAnmInfo.mbActive),
60 mbDimPrevious (rAnmInfo.mbDimPrevious),
61 mbIsMovie (rAnmInfo.mbIsMovie),
62 mbDimHide (rAnmInfo.mbDimHide),
63 maBlueScreen (rAnmInfo.maBlueScreen),
64 maDimColor (rAnmInfo.maDimColor),
65 maSoundFile (rAnmInfo.maSoundFile),
66 mbSoundOn (rAnmInfo.mbSoundOn),
67 mbPlayFull (rAnmInfo.mbPlayFull),
68 meClickAction (rAnmInfo.meClickAction),
69 meSecondEffect (rAnmInfo.meSecondEffect),
70 meSecondSpeed (rAnmInfo.meSecondSpeed),
71 maSecondSoundFile (rAnmInfo.maSecondSoundFile),
72 mbSecondSoundOn (rAnmInfo.mbSecondSoundOn),
73 mbSecondPlayFull (rAnmInfo.mbSecondPlayFull),
74 mnVerb (rAnmInfo.mnVerb),
75 mrObject (rObject)
76{
77 // can not be copied
78 if(meEffect == presentation::AnimationEffect_PATH)
79 meEffect = presentation::AnimationEffect_NONE;
80}
81
83{
84}
85
86std::unique_ptr<SdrObjUserData> SdAnimationInfo::Clone(SdrObject* pObject) const
87{
88 DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
89 if( pObject == nullptr )
91
92 return std::unique_ptr<SdrObjUserData>(new SdAnimationInfo(*this, *pObject ));
93}
94
95void SdAnimationInfo::SetBookmark( const OUString& rBookmark )
96{
97 if( meClickAction == css::presentation::ClickAction_BOOKMARK )
98 {
99 OUString sURL = "#" + rBookmark;
100 SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
101 mrObject.SetMergedItem( aURLItem );
102 }
103 else
104 {
105 SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
106 mrObject.SetMergedItem( aURLItem );
107 }
108}
109
111{
112 OUString sBookmark;
113
115 if( pFldItem )
116 {
117 SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
118 if( pURLField )
119 sBookmark = pURLField->GetURL();
120 }
121
122 if( (meClickAction == css::presentation::ClickAction_BOOKMARK) && sBookmark.startsWith("#") )
123 sBookmark = sBookmark.copy( 1 );
124
125 return sBookmark;
126}
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPRIVATE SdAnimationInfo(SdrObject &rObject)
Definition: anminfo.cxx:29
virtual SAL_DLLPRIVATE ~SdAnimationInfo() override
Definition: anminfo.cxx:82
css::presentation::AnimationEffect meEffect
Animation effect.
Definition: anminfo.hxx:36
void SetBookmark(const OUString &rBookmark)
Definition: anminfo.cxx:95
css::presentation::ClickAction meClickAction
Action at mouse click.
Definition: anminfo.hxx:48
Color maDimColor
for fading the object
Definition: anminfo.hxx:44
Color maBlueScreen
identifies "background pixels"
Definition: anminfo.hxx:43
virtual SAL_DLLPRIVATE std::unique_ptr< SdrObjUserData > Clone(SdrObject *pObject) const override
Definition: anminfo.cxx:86
OUString GetBookmark() const
Definition: anminfo.cxx:110
SdrObject & mrObject
Definition: anminfo.hxx:55
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
void SetMergedItem(const SfxPoolItem &rItem)
const SvxFieldData * GetField() const
const OUString & GetURL() const
constexpr ::Color COL_LIGHTMAGENTA(0xFF, 0x00, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
#define DBG_ASSERT(sCon, aError)
constexpr TypedWhichId< SvxFieldItem > EE_FEATURE_FIELD(EE_FEATURE_NOTCONV+1)
EmbeddedObjectRef * pObject
#define SD_ANIMATIONINFO_ID
Definition: glob.hxx:45
NONE
PresObjKind
Definition: pres.hxx:22
bool mbActive
SdrInventor