Line data Source code
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 <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>
26 :
27 : #include "anminfo.hxx"
28 : #include "glob.hxx"
29 : #include "sdiocmpt.hxx"
30 : #include "drawdoc.hxx"
31 :
32 : #include <tools/tenccvt.hxx>
33 :
34 : using namespace ::com::sun::star;
35 :
36 10696 : 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 (true),
43 : mbDimPrevious (false),
44 : mbIsMovie (false),
45 : mbDimHide (false),
46 : mbSoundOn (false),
47 : mbPlayFull (false),
48 : mpPathObj (NULL),
49 : meClickAction (presentation::ClickAction_NONE),
50 : meSecondEffect (presentation::AnimationEffect_NONE),
51 : meSecondSpeed (presentation::AnimationSpeed_SLOW),
52 : mbSecondSoundOn (false),
53 : mbSecondPlayFull (false),
54 : mnVerb (0),
55 : mnPresOrder (TREELIST_APPEND),
56 10696 : mrObject (rObject)
57 : {
58 10696 : maBlueScreen = RGB_Color(COL_LIGHTMAGENTA);
59 10696 : maDimColor = RGB_Color(COL_LIGHTGRAY);
60 10696 : }
61 :
62 4 : 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 (TREELIST_APPEND),
86 4 : mrObject (rObject)
87 : {
88 : // can not be copied
89 4 : if(meEffect == presentation::AnimationEffect_PATH)
90 0 : meEffect = presentation::AnimationEffect_NONE;
91 4 : }
92 :
93 21400 : SdAnimationInfo::~SdAnimationInfo()
94 : {
95 21400 : }
96 :
97 4 : SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const
98 : {
99 : DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
100 4 : if( pObject == 0 )
101 0 : pObject = &mrObject;
102 :
103 4 : return new SdAnimationInfo(*this, *pObject );
104 : }
105 :
106 0 : void SdAnimationInfo::SetBookmark( const OUString& rBookmark )
107 : {
108 0 : if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK )
109 : {
110 0 : OUString sURL("#");
111 0 : sURL += rBookmark;
112 0 : SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
113 0 : mrObject.SetMergedItem( aURLItem );
114 : }
115 : else
116 : {
117 0 : SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
118 0 : mrObject.SetMergedItem( aURLItem );
119 : }
120 0 : }
121 :
122 0 : OUString SdAnimationInfo::GetBookmark()
123 : {
124 0 : OUString sBookmark;
125 :
126 0 : const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) );
127 0 : if( pFldItem )
128 : {
129 0 : SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
130 0 : if( pURLField )
131 0 : sBookmark = pURLField->GetURL();
132 : }
133 :
134 0 : if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.startsWith("#") )
135 0 : sBookmark = sBookmark.copy( 1 );
136 :
137 0 : return sBookmark;
138 114 : }
139 :
140 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|