Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / core / anminfo.cxx
blob9979181b45fd0069485f0630bffbec410b5e5433
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 <svx/xtable.hxx>
21 #include <svx/svdopath.hxx>
22 #include <svl/urihelper.hxx>
23 #include <editeng/flditem.hxx>
24 #include <editeng/eeitem.hxx>
26 #include <anminfo.hxx>
27 #include <glob.hxx>
28 #include <sdiocmpt.hxx>
29 #include <drawdoc.hxx>
31 #include <tools/tenccvt.hxx>
33 using namespace ::com::sun::star;
35 SdAnimationInfo::SdAnimationInfo(SdrObject& rObject)
36 : SdrObjUserData(SdrInventor::StarDrawUserData, SD_ANIMATIONINFO_ID),
37 mePresObjKind (PRESOBJ_NONE),
38 meEffect (presentation::AnimationEffect_NONE),
39 meTextEffect (presentation::AnimationEffect_NONE),
40 meSpeed (presentation::AnimationSpeed_SLOW),
41 mbActive (true),
42 mbDimPrevious (false),
43 mbIsMovie (false),
44 mbDimHide (false),
45 mbSoundOn (false),
46 mbPlayFull (false),
47 meClickAction (presentation::ClickAction_NONE),
48 meSecondEffect (presentation::AnimationEffect_NONE),
49 meSecondSpeed (presentation::AnimationSpeed_SLOW),
50 mbSecondSoundOn (false),
51 mbSecondPlayFull (false),
52 mnVerb (0),
53 mrObject (rObject)
55 maBlueScreen = COL_LIGHTMAGENTA;
56 maDimColor = COL_LIGHTGRAY;
59 SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject)
60 : SdrObjUserData (rAnmInfo),
61 mePresObjKind (PRESOBJ_NONE),
62 meEffect (rAnmInfo.meEffect),
63 meTextEffect (rAnmInfo.meTextEffect),
64 meSpeed (rAnmInfo.meSpeed),
65 mbActive (rAnmInfo.mbActive),
66 mbDimPrevious (rAnmInfo.mbDimPrevious),
67 mbIsMovie (rAnmInfo.mbIsMovie),
68 mbDimHide (rAnmInfo.mbDimHide),
69 maBlueScreen (rAnmInfo.maBlueScreen),
70 maDimColor (rAnmInfo.maDimColor),
71 maSoundFile (rAnmInfo.maSoundFile),
72 mbSoundOn (rAnmInfo.mbSoundOn),
73 mbPlayFull (rAnmInfo.mbPlayFull),
74 meClickAction (rAnmInfo.meClickAction),
75 meSecondEffect (rAnmInfo.meSecondEffect),
76 meSecondSpeed (rAnmInfo.meSecondSpeed),
77 maSecondSoundFile (rAnmInfo.maSecondSoundFile),
78 mbSecondSoundOn (rAnmInfo.mbSecondSoundOn),
79 mbSecondPlayFull (rAnmInfo.mbSecondPlayFull),
80 mnVerb (rAnmInfo.mnVerb),
81 mrObject (rObject)
83 // can not be copied
84 if(meEffect == presentation::AnimationEffect_PATH)
85 meEffect = presentation::AnimationEffect_NONE;
88 SdAnimationInfo::~SdAnimationInfo()
92 std::unique_ptr<SdrObjUserData> SdAnimationInfo::Clone(SdrObject* pObject) const
94 DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
95 if( pObject == nullptr )
96 pObject = &mrObject;
98 return std::unique_ptr<SdrObjUserData>(new SdAnimationInfo(*this, *pObject ));
101 void SdAnimationInfo::SetBookmark( const OUString& rBookmark )
103 if( meClickAction == css::presentation::ClickAction_BOOKMARK )
105 OUString sURL("#");
106 sURL += rBookmark;
107 SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
108 mrObject.SetMergedItem( aURLItem );
110 else
112 SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
113 mrObject.SetMergedItem( aURLItem );
117 OUString SdAnimationInfo::GetBookmark()
119 OUString sBookmark;
121 const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) );
122 if( pFldItem )
124 SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
125 if( pURLField )
126 sBookmark = pURLField->GetURL();
129 if( (meClickAction == css::presentation::ClickAction_BOOKMARK) && sBookmark.startsWith("#") )
130 sBookmark = sBookmark.copy( 1 );
132 return sBookmark;
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */