fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / core / anminfo.cxx
blob114c191d06b91525e92ba14f3409c9cb35afca46
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 <svl/smplhint.hxx>
21 #include "svx/xtable.hxx"
22 #include <svx/svdopath.hxx>
23 #include <svl/urihelper.hxx>
24 #include <editeng/flditem.hxx>
25 #include <editeng/eeitem.hxx>
27 #include "anminfo.hxx"
28 #include "glob.hxx"
29 #include "sdiocmpt.hxx"
30 #include "drawdoc.hxx"
32 #include <tools/tenccvt.hxx>
34 using namespace ::com::sun::star;
36 SdAnimationInfo::SdAnimationInfo(SdrObject& rObject)
37 : SdrObjUserData(SdUDInventor, SD_ANIMATIONINFO_ID, 0),
38 mePresObjKind (PRESOBJ_NONE),
39 meEffect (presentation::AnimationEffect_NONE),
40 meTextEffect (presentation::AnimationEffect_NONE),
41 meSpeed (presentation::AnimationSpeed_SLOW),
42 mbActive (sal_True),
43 mbDimPrevious (sal_False),
44 mbIsMovie (sal_False),
45 mbDimHide (sal_False),
46 mbSoundOn (sal_False),
47 mbPlayFull (sal_False),
48 mpPathObj (NULL),
49 meClickAction (presentation::ClickAction_NONE),
50 meSecondEffect (presentation::AnimationEffect_NONE),
51 meSecondSpeed (presentation::AnimationSpeed_SLOW),
52 mbSecondSoundOn (sal_False),
53 mbSecondPlayFull (sal_False),
54 mnVerb (0),
55 mnPresOrder (LIST_APPEND),
56 mrObject (rObject)
58 maBlueScreen = RGB_Color(COL_LIGHTMAGENTA);
59 maDimColor = RGB_Color(COL_LIGHTGRAY);
62 SdAnimationInfo::SdAnimationInfo(const SdAnimationInfo& rAnmInfo, SdrObject& rObject)
63 : SdrObjUserData (rAnmInfo),
64 mePresObjKind (PRESOBJ_NONE),
65 meEffect (rAnmInfo.meEffect),
66 meTextEffect (rAnmInfo.meTextEffect),
67 meSpeed (rAnmInfo.meSpeed),
68 mbActive (rAnmInfo.mbActive),
69 mbDimPrevious (rAnmInfo.mbDimPrevious),
70 mbIsMovie (rAnmInfo.mbIsMovie),
71 mbDimHide (rAnmInfo.mbDimHide),
72 maBlueScreen (rAnmInfo.maBlueScreen),
73 maDimColor (rAnmInfo.maDimColor),
74 maSoundFile (rAnmInfo.maSoundFile),
75 mbSoundOn (rAnmInfo.mbSoundOn),
76 mbPlayFull (rAnmInfo.mbPlayFull),
77 mpPathObj (NULL),
78 meClickAction (rAnmInfo.meClickAction),
79 meSecondEffect (rAnmInfo.meSecondEffect),
80 meSecondSpeed (rAnmInfo.meSecondSpeed),
81 maSecondSoundFile (rAnmInfo.maSecondSoundFile),
82 mbSecondSoundOn (rAnmInfo.mbSecondSoundOn),
83 mbSecondPlayFull (rAnmInfo.mbSecondPlayFull),
84 mnVerb (rAnmInfo.mnVerb),
85 mnPresOrder (LIST_APPEND),
86 mrObject (rObject)
88 // can not be copied
89 if(meEffect == presentation::AnimationEffect_PATH)
90 meEffect = presentation::AnimationEffect_NONE;
94 SdAnimationInfo::~SdAnimationInfo()
98 SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const
100 DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
101 if( pObject == 0 )
102 pObject = &mrObject;
104 return new SdAnimationInfo(*this, *pObject );
107 void SdAnimationInfo::SetBookmark( const String& rBookmark )
109 if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK )
111 String sURL = OUString('#');
112 sURL += rBookmark;
113 SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
114 mrObject.SetMergedItem( aURLItem );
116 else
118 SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
119 mrObject.SetMergedItem( aURLItem );
123 String SdAnimationInfo::GetBookmark()
125 String sBookmark;
127 const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) );
128 if( pFldItem )
130 SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
131 if( pURLField )
132 sBookmark = pURLField->GetURL();
135 if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.Len() && (sBookmark.GetChar(0) == '#') )
136 sBookmark = sBookmark.Copy( 1 );
138 return sBookmark;
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */