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 0 : 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 (TREELIST_APPEND),
56 0 : mrObject (rObject)
57 : {
58 0 : maBlueScreen = RGB_Color(COL_LIGHTMAGENTA);
59 0 : maDimColor = RGB_Color(COL_LIGHTGRAY);
60 0 : }
61 :
62 0 : 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 0 : mrObject (rObject)
87 : {
88 : // can not be copied
89 0 : if(meEffect == presentation::AnimationEffect_PATH)
90 0 : meEffect = presentation::AnimationEffect_NONE;
91 0 : }
92 :
93 :
94 0 : SdAnimationInfo::~SdAnimationInfo()
95 : {
96 0 : }
97 :
98 0 : SdrObjUserData* SdAnimationInfo::Clone(SdrObject* pObject) const
99 : {
100 : DBG_ASSERT( pObject, "SdAnimationInfo::Clone(), pObject must not be null!" );
101 0 : if( pObject == 0 )
102 0 : pObject = &mrObject;
103 :
104 0 : return new SdAnimationInfo(*this, *pObject );
105 : }
106 :
107 0 : void SdAnimationInfo::SetBookmark( const OUString& rBookmark )
108 : {
109 0 : if( meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK )
110 : {
111 0 : OUString sURL("#");
112 0 : sURL += rBookmark;
113 0 : SvxFieldItem aURLItem( SvxURLField( sURL, sURL ), EE_FEATURE_FIELD );
114 0 : mrObject.SetMergedItem( aURLItem );
115 : }
116 : else
117 : {
118 0 : SvxFieldItem aURLItem( SvxURLField( rBookmark, rBookmark ), EE_FEATURE_FIELD );
119 0 : mrObject.SetMergedItem( aURLItem );
120 : }
121 0 : }
122 :
123 0 : OUString SdAnimationInfo::GetBookmark()
124 : {
125 0 : OUString sBookmark;
126 :
127 0 : const SvxFieldItem* pFldItem = dynamic_cast< const SvxFieldItem* >( &mrObject.GetMergedItem( EE_FEATURE_FIELD ) );
128 0 : if( pFldItem )
129 : {
130 0 : SvxURLField* pURLField = const_cast< SvxURLField* >( dynamic_cast<const SvxURLField*>( pFldItem->GetField() ) );
131 0 : if( pURLField )
132 0 : sBookmark = pURLField->GetURL();
133 : }
134 :
135 0 : if( (meClickAction == ::com::sun::star::presentation::ClickAction_BOOKMARK) && sBookmark.startsWith("#") )
136 0 : sBookmark = sBookmark.copy( 1 );
137 :
138 0 : return sBookmark;
139 : }
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|