15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp>
28cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
30cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
31cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp>
33cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
34cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
35cdf0e10cSrcweir #include <vos/mutex.hxx>
36cdf0e10cSrcweir #include <svl/itemprop.hxx>
37cdf0e10cSrcweir #include <svl/style.hxx>
38cdf0e10cSrcweir #include <svx/svdpool.hxx>
39cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
40cdf0e10cSrcweir #include <sfx2/app.hxx>
41cdf0e10cSrcweir #include <svtools/unoimap.hxx>
42cdf0e10cSrcweir #include <svtools/unoevent.hxx>
43cdf0e10cSrcweir #include <sfx2/bindings.hxx>
44cdf0e10cSrcweir #include <sfx2/sfxsids.hrc>
45cdf0e10cSrcweir #include <comphelper/extract.hxx>
46cdf0e10cSrcweir #include <svx/unoprov.hxx>
47cdf0e10cSrcweir #include <svx/unoshape.hxx>
48cdf0e10cSrcweir #include <svx/svditer.hxx>
49cdf0e10cSrcweir #include <svx/svdotext.hxx>
50cdf0e10cSrcweir #include <svx/unoapi.hxx>
51cdf0e10cSrcweir #include <svx/svdopath.hxx>
52cdf0e10cSrcweir #include <svx/svdoole2.hxx>
53cdf0e10cSrcweir #include <svx/svdograf.hxx>
54cdf0e10cSrcweir #include <editeng/outlobj.hxx>
55cdf0e10cSrcweir #include "CustomAnimationPreset.hxx"
56cdf0e10cSrcweir #include "Outliner.hxx"
57cdf0e10cSrcweir #include "sdresid.hxx"
58cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx>
59*dc72cefdSArmin Le Grand #include <svx/svdogrp.hxx>
60cdf0e10cSrcweir
61cdf0e10cSrcweir #include "anminfo.hxx"
62cdf0e10cSrcweir #include "unohelp.hxx"
63cdf0e10cSrcweir #include "unoobj.hxx"
64cdf0e10cSrcweir #include "unoprnms.hxx"
65cdf0e10cSrcweir #include "unomodel.hxx"
66cdf0e10cSrcweir #include "drawdoc.hxx"
67cdf0e10cSrcweir #include "sdpage.hxx"
68cdf0e10cSrcweir #include "ViewShell.hxx"
69cdf0e10cSrcweir #include "unokywds.hxx"
70cdf0e10cSrcweir #include "unopage.hxx"
71cdf0e10cSrcweir #ifndef SVX_LIGHT
72cdf0e10cSrcweir #ifndef SD_DRAW_DOC_SHELL_HXX
73cdf0e10cSrcweir #include "DrawDocShell.hxx"
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir #endif
76cdf0e10cSrcweir #include "helpids.h"
77cdf0e10cSrcweir #include "glob.hxx"
78cdf0e10cSrcweir #include "glob.hrc"
79cdf0e10cSrcweir #include "unolayer.hxx"
80cdf0e10cSrcweir #include "imapinfo.hxx"
81cdf0e10cSrcweir #include "EffectMigration.hxx"
82cdf0e10cSrcweir
83cdf0e10cSrcweir #ifndef SEQTYPE
84cdf0e10cSrcweir #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
85cdf0e10cSrcweir #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
86cdf0e10cSrcweir #else
87cdf0e10cSrcweir #define SEQTYPE(x) &(x)
88cdf0e10cSrcweir #endif
89cdf0e10cSrcweir #endif
90cdf0e10cSrcweir
91cdf0e10cSrcweir using ::rtl::OUString;
92cdf0e10cSrcweir using ::rtl::OUStringBuffer;
93cdf0e10cSrcweir using namespace ::vos;
94cdf0e10cSrcweir using namespace ::sd;
95cdf0e10cSrcweir using namespace ::com::sun::star;
96cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
97cdf0e10cSrcweir using namespace ::com::sun::star::animations;
98cdf0e10cSrcweir
99cdf0e10cSrcweir using ::com::sun::star::uno::makeAny;
100cdf0e10cSrcweir using ::com::sun::star::uno::Any;
101cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
102cdf0e10cSrcweir using ::com::sun::star::drawing::XShape;
103cdf0e10cSrcweir
104cdf0e10cSrcweir extern OUString getPageApiNameFromUiName( const String& rUIName );
105cdf0e10cSrcweir extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName );
106cdf0e10cSrcweir
107cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
108cdf0e10cSrcweir
109cdf0e10cSrcweir DECLARE_STL_STDKEY_MAP(sal_uIntPtr, SfxExtItemPropertySetInfo*, SdExtPropertySetInfoCache);
110cdf0e10cSrcweir static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
111cdf0e10cSrcweir static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
112cdf0e10cSrcweir
113cdf0e10cSrcweir DECLARE_STL_STDKEY_MAP(sal_uInt32, uno::Sequence< uno::Type >*, SdTypesCache);
114cdf0e10cSrcweir static SdTypesCache gImplTypesCache;
115cdf0e10cSrcweir
116cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
117cdf0e10cSrcweir
118cdf0e10cSrcweir
119cdf0e10cSrcweir #define WID_EFFECT 1
120cdf0e10cSrcweir #define WID_SPEED 2
121cdf0e10cSrcweir #define WID_TEXTEFFECT 3
122cdf0e10cSrcweir #define WID_BOOKMARK 4
123cdf0e10cSrcweir #define WID_CLICKACTION 5
124cdf0e10cSrcweir #define WID_PLAYFULL 6
125cdf0e10cSrcweir #define WID_SOUNDFILE 7
126cdf0e10cSrcweir #define WID_SOUNDON 8
127cdf0e10cSrcweir #define WID_BLUESCREEN 9
128cdf0e10cSrcweir #define WID_VERB 10
129cdf0e10cSrcweir #define WID_DIMCOLOR 11
130cdf0e10cSrcweir #define WID_DIMHIDE 12
131cdf0e10cSrcweir #define WID_DIMPREV 13
132cdf0e10cSrcweir #define WID_PRESORDER 14
133cdf0e10cSrcweir #define WID_STYLE 15
134cdf0e10cSrcweir #define WID_ANIMPATH 16
135cdf0e10cSrcweir #define WID_IMAGEMAP 17
136cdf0e10cSrcweir #define WID_ISANIMATION 18
137cdf0e10cSrcweir
138cdf0e10cSrcweir #define WID_ISEMPTYPRESOBJ 20
139cdf0e10cSrcweir #define WID_ISPRESOBJ 21
140cdf0e10cSrcweir #define WID_MASTERDEPEND 22
141cdf0e10cSrcweir
142cdf0e10cSrcweir #define WID_NAVORDER 23
143cdf0e10cSrcweir
144cdf0e10cSrcweir #define WID_THAT_NEED_ANIMINFO 19
145cdf0e10cSrcweir
146cdf0e10cSrcweir
147cdf0e10cSrcweir
148cdf0e10cSrcweir #define IMPRESS_MAP_ENTRIES \
149cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_ANIMATIONPATH), WID_ANIMPATH, &ITYPE(drawing::XShape), 0, 0},\
150cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\
151cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMCOLOR), WID_DIMCOLOR, &::getCppuType((const sal_Int32*)0), 0, 0},\
152cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMHIDE), WID_DIMHIDE, &::getBooleanCppuType(), 0, 0},\
153cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_DIMPREV), WID_DIMPREV, &::getBooleanCppuType(), 0, 0},\
154cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_EFFECT), WID_EFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0},\
155cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_ISEMPTYPRESOBJ),WID_ISEMPTYPRESOBJ, &::getBooleanCppuType(), 0, 0},\
156cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_ISPRESOBJ), WID_ISPRESOBJ, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
157cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_MASTERDEPENDENT),WID_MASTERDEPEND, &::getBooleanCppuType(), 0, 0},\
158cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0), 0, 0},\
159cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_PLAYFULL), WID_PLAYFULL, &::getBooleanCppuType(), 0, 0},\
160cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_PRESORDER), WID_PRESORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
161cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE( style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
162cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE), WID_SOUNDFILE, &::getCppuType((const OUString*)0), 0, 0},\
163cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDON), WID_SOUNDON, &::getBooleanCppuType(), 0, 0},\
164cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_SPEED), WID_SPEED, &::getCppuType((const presentation::AnimationSpeed*)0), 0, 0},\
165cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_TEXTEFFECT), WID_TEXTEFFECT, &::getCppuType((const presentation::AnimationEffect*)0), 0, 0},\
166cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_BLUESCREEN), WID_BLUESCREEN, &::getCppuType((const sal_Int32*)0), 0, 0},\
167cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_VERB), WID_VERB, &::getCppuType((const sal_Int32*)0), 0, 0},\
168cdf0e10cSrcweir { MAP_CHAR_LEN("IsAnimation"), WID_ISANIMATION, &::getBooleanCppuType(), 0, 0},\
169cdf0e10cSrcweir { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
170cdf0e10cSrcweir { 0,0,0,0,0,0}
171cdf0e10cSrcweir
172cdf0e10cSrcweir
lcl_GetImpress_SdXShapePropertyGraphicMap_Impl()173cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertyGraphicMap_Impl()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir
176cdf0e10cSrcweir static const SfxItemPropertyMapEntry aImpress_SdXShapePropertyGraphicMap_Impl[] =
177cdf0e10cSrcweir {
178cdf0e10cSrcweir { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 },
179cdf0e10cSrcweir IMPRESS_MAP_ENTRIES
180cdf0e10cSrcweir };
181cdf0e10cSrcweir return aImpress_SdXShapePropertyGraphicMap_Impl;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir
lcl_GetImpress_SdXShapePropertySimpleMap_Impl()184cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetImpress_SdXShapePropertySimpleMap_Impl()
185cdf0e10cSrcweir {
186cdf0e10cSrcweir
187cdf0e10cSrcweir static const SfxItemPropertyMapEntry aImpress_SdXShapePropertySimpleMap_Impl[] =
188cdf0e10cSrcweir {
189cdf0e10cSrcweir IMPRESS_MAP_ENTRIES
190cdf0e10cSrcweir };
191cdf0e10cSrcweir return aImpress_SdXShapePropertySimpleMap_Impl;
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
194cdf0e10cSrcweir #define DRAW_MAP_ENTRIES\
195cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_BOOKMARK), WID_BOOKMARK, &::getCppuType((const OUString*)0), 0, 0},\
196cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_CLICKACTION), WID_CLICKACTION, &::getCppuType((const presentation::ClickAction*)0),0, 0},\
197cdf0e10cSrcweir { MAP_CHAR_LEN(UNO_NAME_OBJ_STYLE), WID_STYLE, &ITYPE(style::XStyle), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},\
198cdf0e10cSrcweir { MAP_CHAR_LEN("NavigationOrder"), WID_NAVORDER, &::getCppuType((const sal_Int32*)0), 0, 0},\
199cdf0e10cSrcweir { 0,0,0,0,0,0}
200cdf0e10cSrcweir
lcl_GetDraw_SdXShapePropertySimpleMap_Impl()201cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertySimpleMap_Impl()
202cdf0e10cSrcweir {
203cdf0e10cSrcweir static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyMap_Impl[] =
204cdf0e10cSrcweir {
205cdf0e10cSrcweir DRAW_MAP_ENTRIES
206cdf0e10cSrcweir };
207cdf0e10cSrcweir return aDraw_SdXShapePropertyMap_Impl;
208cdf0e10cSrcweir }
lcl_GetDraw_SdXShapePropertyGraphicMap_Impl()209cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetDraw_SdXShapePropertyGraphicMap_Impl()
210cdf0e10cSrcweir {
211cdf0e10cSrcweir static const SfxItemPropertyMapEntry aDraw_SdXShapePropertyGraphicMap_Impl[] =
212cdf0e10cSrcweir {
213cdf0e10cSrcweir { MAP_CHAR_LEN("ImageMap"), WID_IMAGEMAP, &::getCppuType((const uno::Reference< container::XIndexContainer >*)0), 0, 0 },
214cdf0e10cSrcweir DRAW_MAP_ENTRIES
215cdf0e10cSrcweir };
216cdf0e10cSrcweir return aDraw_SdXShapePropertyGraphicMap_Impl;
217cdf0e10cSrcweir }
lcl_ImplGetShapePropertyMap(sal_Bool bImpress,sal_Bool bGraphicObj)218cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_ImplGetShapePropertyMap( sal_Bool bImpress, sal_Bool bGraphicObj )
219cdf0e10cSrcweir {
220cdf0e10cSrcweir const SfxItemPropertyMapEntry* pRet = 0;
221cdf0e10cSrcweir if( bImpress )
222cdf0e10cSrcweir {
223cdf0e10cSrcweir if( bGraphicObj )
224cdf0e10cSrcweir pRet = lcl_GetImpress_SdXShapePropertyGraphicMap_Impl();
225cdf0e10cSrcweir else
226cdf0e10cSrcweir pRet = lcl_GetImpress_SdXShapePropertySimpleMap_Impl();
227cdf0e10cSrcweir }
228cdf0e10cSrcweir else
229cdf0e10cSrcweir {
230cdf0e10cSrcweir if( bGraphicObj )
231cdf0e10cSrcweir pRet = lcl_GetDraw_SdXShapePropertyGraphicMap_Impl();
232cdf0e10cSrcweir else
233cdf0e10cSrcweir pRet = lcl_GetDraw_SdXShapePropertySimpleMap_Impl();
234cdf0e10cSrcweir }
235cdf0e10cSrcweir return pRet;
236cdf0e10cSrcweir
237cdf0e10cSrcweir }
lcl_ImplGetShapePropertySet(sal_Bool bImpress,sal_Bool bGraphicObj)238cdf0e10cSrcweir const SvxItemPropertySet* lcl_ImplGetShapePropertySet( sal_Bool bImpress, sal_Bool bGraphicObj )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir const SvxItemPropertySet* pRet = 0;
241cdf0e10cSrcweir if( bImpress )
242cdf0e10cSrcweir {
243cdf0e10cSrcweir if( bGraphicObj )
244cdf0e10cSrcweir {
245cdf0e10cSrcweir static SvxItemPropertySet aImpress_SdXShapePropertyGraphicSet_Impl( lcl_GetImpress_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
246cdf0e10cSrcweir pRet = &aImpress_SdXShapePropertyGraphicSet_Impl;
247cdf0e10cSrcweir }
248cdf0e10cSrcweir else
249cdf0e10cSrcweir {
250cdf0e10cSrcweir static SvxItemPropertySet aImpress_SdXShapePropertySet_Impl(lcl_GetImpress_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
251cdf0e10cSrcweir pRet = &aImpress_SdXShapePropertySet_Impl;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir }
254cdf0e10cSrcweir else
255cdf0e10cSrcweir {
256cdf0e10cSrcweir if( bGraphicObj )
257cdf0e10cSrcweir {
258cdf0e10cSrcweir static SvxItemPropertySet aDraw_SdXShapePropertyGraphicSet_Impl(lcl_GetDraw_SdXShapePropertyGraphicMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
259cdf0e10cSrcweir pRet = &aDraw_SdXShapePropertyGraphicSet_Impl;
260cdf0e10cSrcweir }
261cdf0e10cSrcweir else
262cdf0e10cSrcweir {
263cdf0e10cSrcweir static SvxItemPropertySet aDraw_SdXShapePropertySet_Impl( lcl_GetDraw_SdXShapePropertySimpleMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool());
264cdf0e10cSrcweir pRet = &aDraw_SdXShapePropertySet_Impl;
265cdf0e10cSrcweir }
266cdf0e10cSrcweir }
267cdf0e10cSrcweir return pRet;
268cdf0e10cSrcweir }
lcl_GetEmpty_SdXShapePropertyMap_Impl()269cdf0e10cSrcweir const SfxItemPropertyMapEntry* lcl_GetEmpty_SdXShapePropertyMap_Impl()
270cdf0e10cSrcweir {
271cdf0e10cSrcweir static SfxItemPropertyMapEntry aEmpty_SdXShapePropertyMap_Impl[] =
272cdf0e10cSrcweir {
273cdf0e10cSrcweir { 0,0,0,0,0,0}
274cdf0e10cSrcweir };
275cdf0e10cSrcweir return aEmpty_SdXShapePropertyMap_Impl;
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
lcl_GetEmpty_SdXShapePropertySet_Impl()278cdf0e10cSrcweir static const SvxItemPropertySet* lcl_GetEmpty_SdXShapePropertySet_Impl()
279cdf0e10cSrcweir {
280cdf0e10cSrcweir static SvxItemPropertySet aEmptyPropSet( lcl_GetEmpty_SdXShapePropertyMap_Impl(), SdrObject::GetGlobalDrawObjectItemPool() );
281cdf0e10cSrcweir return &aEmptyPropSet;
282cdf0e10cSrcweir }
ImplGetSupportedMacroItems()283cdf0e10cSrcweir const SvEventDescription* ImplGetSupportedMacroItems()
284cdf0e10cSrcweir {
285cdf0e10cSrcweir static const SvEventDescription aMacroDescriptionsImpl[] =
286cdf0e10cSrcweir {
287cdf0e10cSrcweir { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
288cdf0e10cSrcweir { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
289cdf0e10cSrcweir { 0, NULL }
290cdf0e10cSrcweir };
291cdf0e10cSrcweir
292cdf0e10cSrcweir return aMacroDescriptionsImpl;
293cdf0e10cSrcweir }
294cdf0e10cSrcweir
295cdf0e10cSrcweir /*************************************************************************
296cdf0e10cSrcweir |*
297cdf0e10cSrcweir |* Vergleichsfkt. fuer QSort
298cdf0e10cSrcweir |*
299cdf0e10cSrcweir \************************************************************************/
300cdf0e10cSrcweir struct SortStruct
301cdf0e10cSrcweir {
302cdf0e10cSrcweir SdrObject* pObj;
303cdf0e10cSrcweir sal_uInt32 nOrder;
304cdf0e10cSrcweir };
305cdf0e10cSrcweir
306cdf0e10cSrcweir typedef SortStruct SORT;
307cdf0e10cSrcweir typedef SORT* PSORT;
308cdf0e10cSrcweir
309cdf0e10cSrcweir extern "C" int __LOADONCALLAPI SortFunc( const void* p1, const void* p2 );
310cdf0e10cSrcweir
SdXShape(SvxShape * pShape,SdXImpressDocument * pModel)311cdf0e10cSrcweir SdXShape::SdXShape( SvxShape* pShape, SdXImpressDocument* pModel) throw()
312cdf0e10cSrcweir : mpShape( pShape ),
313cdf0e10cSrcweir mpPropSet( pModel?
314cdf0e10cSrcweir lcl_ImplGetShapePropertySet(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
315cdf0e10cSrcweir : lcl_GetEmpty_SdXShapePropertySet_Impl() ),
316cdf0e10cSrcweir mpMap( pModel?
317cdf0e10cSrcweir lcl_ImplGetShapePropertyMap(pModel->IsImpressDocument(), pShape->getShapeKind() == OBJ_GRAF )
318cdf0e10cSrcweir : lcl_GetEmpty_SdXShapePropertyMap_Impl() ),
319cdf0e10cSrcweir mpModel(pModel),
320cdf0e10cSrcweir mpImplementationId( NULL )
321cdf0e10cSrcweir
322cdf0e10cSrcweir {
323cdf0e10cSrcweir
324cdf0e10cSrcweir pShape->setMaster( this );
325cdf0e10cSrcweir }
326cdf0e10cSrcweir
~SdXShape()327cdf0e10cSrcweir SdXShape::~SdXShape() throw()
328cdf0e10cSrcweir {
329cdf0e10cSrcweir }
330cdf0e10cSrcweir
dispose()331cdf0e10cSrcweir void SdXShape::dispose()
332cdf0e10cSrcweir {
333cdf0e10cSrcweir mpShape->setMaster( NULL );
334cdf0e10cSrcweir delete this;
335cdf0e10cSrcweir }
336cdf0e10cSrcweir
337cdf0e10cSrcweir // XInterface
queryAggregation(const uno::Type & rType)338cdf0e10cSrcweir uno::Any SAL_CALL SdXShape::queryAggregation( const uno::Type & rType )
339cdf0e10cSrcweir throw(uno::RuntimeException)
340cdf0e10cSrcweir {
341cdf0e10cSrcweir return mpShape->queryAggregation( rType );
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
queryInterface(const uno::Type & rType)344cdf0e10cSrcweir uno::Any SAL_CALL SdXShape::queryInterface( const uno::Type & rType )
345cdf0e10cSrcweir throw(uno::RuntimeException)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir return mpShape->queryInterface( rType );
348cdf0e10cSrcweir }
349cdf0e10cSrcweir
acquire()350cdf0e10cSrcweir void SAL_CALL SdXShape::acquire() throw()
351cdf0e10cSrcweir {
352cdf0e10cSrcweir mpShape->acquire();
353cdf0e10cSrcweir }
354cdf0e10cSrcweir
release()355cdf0e10cSrcweir void SAL_CALL SdXShape::release() throw()
356cdf0e10cSrcweir {
357cdf0e10cSrcweir mpShape->release();
358cdf0e10cSrcweir }
359cdf0e10cSrcweir
queryAggregation(const com::sun::star::uno::Type & rType,com::sun::star::uno::Any & aAny)360cdf0e10cSrcweir sal_Bool SdXShape::queryAggregation( const com::sun::star::uno::Type & rType, com::sun::star::uno::Any& aAny )
361cdf0e10cSrcweir {
362cdf0e10cSrcweir if( mpModel && mpModel ->IsImpressDocument() )
363cdf0e10cSrcweir {
364cdf0e10cSrcweir if( rType == ::getCppuType(( const uno::Reference< document::XEventsSupplier >*)0) )
365cdf0e10cSrcweir {
366cdf0e10cSrcweir aAny <<= uno::Reference< document::XEventsSupplier >(this);
367cdf0e10cSrcweir return sal_True;
368cdf0e10cSrcweir }
369cdf0e10cSrcweir }
370cdf0e10cSrcweir
371cdf0e10cSrcweir return sal_False;
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
getTypes()374cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
375cdf0e10cSrcweir throw (uno::RuntimeException)
376cdf0e10cSrcweir {
377cdf0e10cSrcweir if( mpModel && !mpModel->IsImpressDocument() )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir return mpShape->_getTypes();
380cdf0e10cSrcweir }
381cdf0e10cSrcweir else
382cdf0e10cSrcweir {
383cdf0e10cSrcweir const sal_uInt32 nObjId = mpShape->getShapeKind();
384cdf0e10cSrcweir uno::Sequence< uno::Type >* pTypes;
385cdf0e10cSrcweir SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
386cdf0e10cSrcweir if( aIter == gImplTypesCache.end() )
387cdf0e10cSrcweir {
388cdf0e10cSrcweir pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() );
389cdf0e10cSrcweir sal_uInt32 nCount = pTypes->getLength();
390cdf0e10cSrcweir pTypes->realloc( nCount+1 );
391cdf0e10cSrcweir (*pTypes)[nCount] = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0);
392cdf0e10cSrcweir
393cdf0e10cSrcweir gImplTypesCache[ nObjId ] = pTypes;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir else
396cdf0e10cSrcweir {
397cdf0e10cSrcweir // use the already computed implementation id
398cdf0e10cSrcweir pTypes = (*aIter).second;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir return *pTypes;
401cdf0e10cSrcweir }
402cdf0e10cSrcweir }
403cdf0e10cSrcweir
404cdf0e10cSrcweir // XPropertyState
getPropertyState(const OUString & PropertyName)405cdf0e10cSrcweir beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
406cdf0e10cSrcweir {
407cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
408cdf0e10cSrcweir
409cdf0e10cSrcweir if( mpPropSet->getPropertyMapEntry(PropertyName) )
410cdf0e10cSrcweir {
411cdf0e10cSrcweir return beans::PropertyState_DIRECT_VALUE;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir else
414cdf0e10cSrcweir {
415cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
416cdf0e10cSrcweir if( pObj == NULL || ( pObj->GetPage()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
417cdf0e10cSrcweir return beans::PropertyState_DEFAULT_VALUE;
418cdf0e10cSrcweir
419cdf0e10cSrcweir return mpShape->_getPropertyState( PropertyName );
420cdf0e10cSrcweir }
421cdf0e10cSrcweir }
422cdf0e10cSrcweir
setPropertyToDefault(const OUString & PropertyName)423cdf0e10cSrcweir void SAL_CALL SdXShape::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException)
424cdf0e10cSrcweir {
425cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
426cdf0e10cSrcweir
427cdf0e10cSrcweir if( mpPropSet->getPropertyMapEntry(PropertyName) )
428cdf0e10cSrcweir {
429cdf0e10cSrcweir return;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir else
432cdf0e10cSrcweir {
433cdf0e10cSrcweir mpShape->_setPropertyToDefault(PropertyName);
434cdf0e10cSrcweir }
435cdf0e10cSrcweir }
436cdf0e10cSrcweir
getPropertyDefault(const OUString & aPropertyName)437cdf0e10cSrcweir uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
438cdf0e10cSrcweir {
439cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
440cdf0e10cSrcweir
441cdf0e10cSrcweir if( mpPropSet->getPropertyMapEntry(aPropertyName) )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir return getPropertyValue( aPropertyName );
444cdf0e10cSrcweir }
445cdf0e10cSrcweir else
446cdf0e10cSrcweir {
447cdf0e10cSrcweir uno::Any aRet( mpShape->_getPropertyDefault(aPropertyName) );
448cdf0e10cSrcweir
449cdf0e10cSrcweir if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir OUString aName;
452cdf0e10cSrcweir if( aRet >>= aName )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir aName = SdLayer::convertToExternalName( aName );
455cdf0e10cSrcweir aRet <<= aName;
456cdf0e10cSrcweir }
457cdf0e10cSrcweir }
458cdf0e10cSrcweir return aRet;
459cdf0e10cSrcweir }
460cdf0e10cSrcweir }
461cdf0e10cSrcweir
462cdf0e10cSrcweir //XPropertySet
getPropertySetInfo()463cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL SdXShape::getPropertySetInfo()
464cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException)
465cdf0e10cSrcweir {
466cdf0e10cSrcweir sal_uIntPtr nObjId = (sal_uIntPtr)mpShape->getPropertyMapEntries();
467cdf0e10cSrcweir SfxExtItemPropertySetInfo* pInfo = NULL;
468cdf0e10cSrcweir
469cdf0e10cSrcweir SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ?
470cdf0e10cSrcweir &gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache;
471cdf0e10cSrcweir
472cdf0e10cSrcweir SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) );
473cdf0e10cSrcweir if( aIter == pCache->end() )
474cdf0e10cSrcweir {
475cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
476cdf0e10cSrcweir pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
477cdf0e10cSrcweir pInfo->acquire();
478cdf0e10cSrcweir
479cdf0e10cSrcweir (*pCache)[ nObjId ] = pInfo;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir else
482cdf0e10cSrcweir {
483cdf0e10cSrcweir // use the already computed implementation id
484cdf0e10cSrcweir pInfo = (*aIter).second;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir
487cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xInfo( pInfo );
488cdf0e10cSrcweir return pInfo;
489cdf0e10cSrcweir }
490cdf0e10cSrcweir
setPropertyValue(const::rtl::OUString & aPropertyName,const::com::sun::star::uno::Any & aValue)491cdf0e10cSrcweir void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
492cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
493cdf0e10cSrcweir {
494cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
495cdf0e10cSrcweir
496cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
497cdf0e10cSrcweir
498cdf0e10cSrcweir if( pEntry )
499cdf0e10cSrcweir {
500cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
501cdf0e10cSrcweir if( pObj )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir SdAnimationInfo* pInfo = GetAnimationInfo((pEntry->nWID <= WID_THAT_NEED_ANIMINFO)?sal_True:sal_False);
504cdf0e10cSrcweir
505cdf0e10cSrcweir switch(pEntry->nWID)
506cdf0e10cSrcweir {
507cdf0e10cSrcweir case WID_NAVORDER:
508cdf0e10cSrcweir {
509cdf0e10cSrcweir sal_Int32 nNavOrder = 0;
510cdf0e10cSrcweir if(!(aValue >>= nNavOrder))
511cdf0e10cSrcweir throw lang::IllegalArgumentException();
512cdf0e10cSrcweir
513cdf0e10cSrcweir SdrObjList* pObjList = pObj->GetObjList();
514cdf0e10cSrcweir if( pObjList )
515cdf0e10cSrcweir pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) );
516cdf0e10cSrcweir break;
517cdf0e10cSrcweir }
518cdf0e10cSrcweir
519cdf0e10cSrcweir case WID_EFFECT:
520cdf0e10cSrcweir {
521cdf0e10cSrcweir AnimationEffect eEffect;
522cdf0e10cSrcweir if(!(aValue >>= eEffect))
523cdf0e10cSrcweir throw lang::IllegalArgumentException();
524cdf0e10cSrcweir
525cdf0e10cSrcweir EffectMigration::SetAnimationEffect( mpShape, eEffect );
526cdf0e10cSrcweir break;
527cdf0e10cSrcweir }
528cdf0e10cSrcweir case WID_TEXTEFFECT:
529cdf0e10cSrcweir {
530cdf0e10cSrcweir AnimationEffect eEffect;
531cdf0e10cSrcweir if(!(aValue >>= eEffect))
532cdf0e10cSrcweir throw lang::IllegalArgumentException();
533cdf0e10cSrcweir
534cdf0e10cSrcweir EffectMigration::SetTextAnimationEffect( mpShape, eEffect );
535cdf0e10cSrcweir break;
536cdf0e10cSrcweir }
537cdf0e10cSrcweir case WID_SPEED:
538cdf0e10cSrcweir {
539cdf0e10cSrcweir AnimationSpeed eSpeed;
540cdf0e10cSrcweir if(!(aValue>>=eSpeed))
541cdf0e10cSrcweir throw lang::IllegalArgumentException();
542cdf0e10cSrcweir
543cdf0e10cSrcweir EffectMigration::SetAnimationSpeed( mpShape, eSpeed );
544cdf0e10cSrcweir break;
545cdf0e10cSrcweir }
546*dc72cefdSArmin Le Grand case WID_ISANIMATION:
547*dc72cefdSArmin Le Grand {
548*dc72cefdSArmin Le Grand sal_Bool bIsAnimation(sal_False);
549*dc72cefdSArmin Le Grand
550*dc72cefdSArmin Le Grand if(!(aValue >>= bIsAnimation))
551*dc72cefdSArmin Le Grand {
552*dc72cefdSArmin Le Grand throw lang::IllegalArgumentException();
553*dc72cefdSArmin Le Grand }
554*dc72cefdSArmin Le Grand
555*dc72cefdSArmin Le Grand if(bIsAnimation)
556*dc72cefdSArmin Le Grand {
557*dc72cefdSArmin Le Grand SdrObjGroup* pGroup = dynamic_cast< SdrObjGroup* >(pObj);
558*dc72cefdSArmin Le Grand SdPage* pPage = dynamic_cast< SdPage* >(pGroup->GetPage());
559*dc72cefdSArmin Le Grand
560*dc72cefdSArmin Le Grand if(pGroup && pPage)
561*dc72cefdSArmin Le Grand {
562*dc72cefdSArmin Le Grand // #42894# Animated Group object, migrate that effect
563*dc72cefdSArmin Le Grand EffectMigration::CreateAnimatedGroup(*pGroup, *pPage);
564*dc72cefdSArmin Le Grand
565*dc72cefdSArmin Le Grand // #42894# unfortunately when doing this all group members have to
566*dc72cefdSArmin Le Grand // be moved to the page as direct members, else the currently
567*dc72cefdSArmin Le Grand // available forms of animation do not work. If it succeeds,
568*dc72cefdSArmin Le Grand // the group is empty and can be removed and deleted
569*dc72cefdSArmin Le Grand if(!pGroup->GetSubList()->GetObjCount())
570*dc72cefdSArmin Le Grand {
571*dc72cefdSArmin Le Grand pPage->NbcRemoveObject(pGroup->GetOrdNum());
572*dc72cefdSArmin Le Grand delete pGroup;
573*dc72cefdSArmin Le Grand }
574*dc72cefdSArmin Le Grand }
575*dc72cefdSArmin Le Grand }
576*dc72cefdSArmin Le Grand //pInfo->mbIsMovie = bIsAnimation;
577*dc72cefdSArmin Le Grand break;
578*dc72cefdSArmin Le Grand }
579cdf0e10cSrcweir case WID_BOOKMARK:
580cdf0e10cSrcweir {
581cdf0e10cSrcweir OUString aString;
582cdf0e10cSrcweir if(!(aValue >>= aString))
583cdf0e10cSrcweir throw lang::IllegalArgumentException();
584cdf0e10cSrcweir
585cdf0e10cSrcweir pInfo->SetBookmark( SdDrawPage::getUiNameFromPageApiName( aString ) );
586cdf0e10cSrcweir break;
587cdf0e10cSrcweir }
588cdf0e10cSrcweir case WID_CLICKACTION:
589cdf0e10cSrcweir ::cppu::any2enum< presentation::ClickAction >( pInfo->meClickAction, aValue);
590cdf0e10cSrcweir break;
591cdf0e10cSrcweir
592cdf0e10cSrcweir /* todo?
593cdf0e10cSrcweir case WID_PLAYFULL:
594cdf0e10cSrcweir pInfo->mbPlayFull = ::cppu::any2bool(aValue);
595cdf0e10cSrcweir break;
596cdf0e10cSrcweir */
597cdf0e10cSrcweir case WID_SOUNDFILE:
598cdf0e10cSrcweir {
599cdf0e10cSrcweir OUString aString;
600cdf0e10cSrcweir if(!(aValue >>= aString))
601cdf0e10cSrcweir throw lang::IllegalArgumentException();
602cdf0e10cSrcweir pInfo->maSoundFile = aString;
603cdf0e10cSrcweir EffectMigration::UpdateSoundEffect( mpShape, pInfo );
604cdf0e10cSrcweir break;
605cdf0e10cSrcweir }
606cdf0e10cSrcweir
607cdf0e10cSrcweir case WID_SOUNDON:
608cdf0e10cSrcweir {
609cdf0e10cSrcweir if( !(aValue >>= pInfo->mbSoundOn) )
610cdf0e10cSrcweir throw lang::IllegalArgumentException();
611cdf0e10cSrcweir EffectMigration::UpdateSoundEffect( mpShape, pInfo );
612cdf0e10cSrcweir break;
613cdf0e10cSrcweir }
614cdf0e10cSrcweir /*
615cdf0e10cSrcweir case WID_BLUESCREEN:
616cdf0e10cSrcweir {
617cdf0e10cSrcweir sal_Int32 nColor;
618cdf0e10cSrcweir if(!(aValue >>= nColor))
619cdf0e10cSrcweir throw lang::IllegalArgumentException();
620cdf0e10cSrcweir
621cdf0e10cSrcweir pInfo->maBlueScreen.SetColor( nColor );
622cdf0e10cSrcweir break;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir */
625cdf0e10cSrcweir case WID_VERB:
626cdf0e10cSrcweir {
627cdf0e10cSrcweir sal_Int32 nVerb = 0;
628cdf0e10cSrcweir if(!(aValue >>= nVerb))
629cdf0e10cSrcweir throw lang::IllegalArgumentException();
630cdf0e10cSrcweir
631cdf0e10cSrcweir pInfo->mnVerb = (sal_uInt16)nVerb;
632cdf0e10cSrcweir break;
633cdf0e10cSrcweir }
634cdf0e10cSrcweir case WID_DIMCOLOR:
635cdf0e10cSrcweir {
636cdf0e10cSrcweir sal_Int32 nColor = 0;
637cdf0e10cSrcweir
638cdf0e10cSrcweir if( !(aValue >>= nColor) )
639cdf0e10cSrcweir throw lang::IllegalArgumentException();
640cdf0e10cSrcweir
641cdf0e10cSrcweir EffectMigration::SetDimColor( mpShape, nColor );
642cdf0e10cSrcweir break;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir case WID_DIMHIDE:
645cdf0e10cSrcweir {
646cdf0e10cSrcweir sal_Bool bDimHide = sal_False;
647cdf0e10cSrcweir if( !(aValue >>= bDimHide) )
648cdf0e10cSrcweir lang::IllegalArgumentException();
649cdf0e10cSrcweir
650cdf0e10cSrcweir EffectMigration::SetDimHide( mpShape, bDimHide );
651cdf0e10cSrcweir break;
652cdf0e10cSrcweir }
653cdf0e10cSrcweir case WID_DIMPREV:
654cdf0e10cSrcweir {
655cdf0e10cSrcweir sal_Bool bDimPrevious = sal_False;
656cdf0e10cSrcweir if( !(aValue >>= bDimPrevious) )
657cdf0e10cSrcweir lang::IllegalArgumentException();
658cdf0e10cSrcweir
659cdf0e10cSrcweir EffectMigration::SetDimPrevious( mpShape, bDimPrevious );
660cdf0e10cSrcweir break;
661cdf0e10cSrcweir }
662cdf0e10cSrcweir case WID_PRESORDER:
663cdf0e10cSrcweir {
664cdf0e10cSrcweir sal_Int32 nNewPos = 0;
665cdf0e10cSrcweir if( !(aValue >>= nNewPos) )
666cdf0e10cSrcweir lang::IllegalArgumentException();
667cdf0e10cSrcweir
668cdf0e10cSrcweir EffectMigration::SetPresentationOrder( mpShape, nNewPos );
669cdf0e10cSrcweir break;
670cdf0e10cSrcweir }
671cdf0e10cSrcweir case WID_STYLE:
672cdf0e10cSrcweir SetStyleSheet( aValue );
673cdf0e10cSrcweir break;
674cdf0e10cSrcweir case WID_ISEMPTYPRESOBJ:
675cdf0e10cSrcweir SetEmptyPresObj( ::cppu::any2bool(aValue) );
676cdf0e10cSrcweir break;
677cdf0e10cSrcweir case WID_MASTERDEPEND:
678cdf0e10cSrcweir SetMasterDepend( ::cppu::any2bool(aValue) );
679cdf0e10cSrcweir break;
680cdf0e10cSrcweir case WID_ANIMPATH:
681cdf0e10cSrcweir {
682cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( aValue, uno::UNO_QUERY );
683cdf0e10cSrcweir SdrPathObj* pObj2 = xShape.is() ? dynamic_cast< SdrPathObj* >( GetSdrObjectFromXShape( xShape ) ) : NULL;
684cdf0e10cSrcweir
685cdf0e10cSrcweir if( pObj2 == NULL )
686cdf0e10cSrcweir throw lang::IllegalArgumentException();
687cdf0e10cSrcweir
688cdf0e10cSrcweir EffectMigration::SetAnimationPath( mpShape, pObj2 );
689cdf0e10cSrcweir break;
690cdf0e10cSrcweir }
691cdf0e10cSrcweir case WID_IMAGEMAP:
692cdf0e10cSrcweir {
693cdf0e10cSrcweir SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
694cdf0e10cSrcweir if( pDoc )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir ImageMap aImageMap;
697cdf0e10cSrcweir uno::Reference< uno::XInterface > xImageMap;
698cdf0e10cSrcweir aValue >>= xImageMap;
699cdf0e10cSrcweir
700cdf0e10cSrcweir if( !xImageMap.is() || !SvUnoImageMap_fillImageMap( xImageMap, aImageMap ) )
701cdf0e10cSrcweir throw lang::IllegalArgumentException();
702cdf0e10cSrcweir
703cdf0e10cSrcweir SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(pObj);
704cdf0e10cSrcweir if( pIMapInfo )
705cdf0e10cSrcweir {
706cdf0e10cSrcweir // replace existing image map
707cdf0e10cSrcweir pIMapInfo->SetImageMap( aImageMap );
708cdf0e10cSrcweir }
709cdf0e10cSrcweir else
710cdf0e10cSrcweir {
711cdf0e10cSrcweir // insert new user data with image map
712cdf0e10cSrcweir pObj->InsertUserData(new SdIMapInfo(aImageMap) );
713cdf0e10cSrcweir }
714cdf0e10cSrcweir }
715cdf0e10cSrcweir }
716cdf0e10cSrcweir }
717cdf0e10cSrcweir }
718cdf0e10cSrcweir }
719cdf0e10cSrcweir else
720cdf0e10cSrcweir {
721cdf0e10cSrcweir uno::Any aAny( aValue );
722cdf0e10cSrcweir
723cdf0e10cSrcweir if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
724cdf0e10cSrcweir {
725cdf0e10cSrcweir OUString aName;
726cdf0e10cSrcweir if( aAny >>= aName )
727cdf0e10cSrcweir {
728cdf0e10cSrcweir aName = SdLayer::convertToInternalName( aName );
729cdf0e10cSrcweir aAny <<= aName;
730cdf0e10cSrcweir }
731cdf0e10cSrcweir }
732cdf0e10cSrcweir
733cdf0e10cSrcweir mpShape->_setPropertyValue(aPropertyName, aAny);
734cdf0e10cSrcweir }
735cdf0e10cSrcweir
736cdf0e10cSrcweir if( mpModel )
737cdf0e10cSrcweir mpModel->SetModified();
738cdf0e10cSrcweir }
739cdf0e10cSrcweir
getPropertyValue(const::rtl::OUString & PropertyName)740cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL SdXShape::getPropertyValue( const ::rtl::OUString& PropertyName )
741cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
742cdf0e10cSrcweir {
743cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() );
744cdf0e10cSrcweir
745cdf0e10cSrcweir uno::Any aRet;
746cdf0e10cSrcweir
747cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
748cdf0e10cSrcweir
749cdf0e10cSrcweir if( pEntry && mpShape->GetSdrObject() )
750cdf0e10cSrcweir {
751cdf0e10cSrcweir SdAnimationInfo* pInfo = GetAnimationInfo(sal_False);
752cdf0e10cSrcweir
753cdf0e10cSrcweir switch(pEntry->nWID)
754cdf0e10cSrcweir {
755cdf0e10cSrcweir case WID_NAVORDER:
756cdf0e10cSrcweir {
757cdf0e10cSrcweir const sal_uInt32 nNavOrder = mpShape->GetSdrObject()->GetNavigationPosition();
758cdf0e10cSrcweir aRet <<= nNavOrder == SAL_MAX_UINT32 ? static_cast<sal_Int32>(-1) : static_cast< sal_Int32 >(nNavOrder);
759cdf0e10cSrcweir }
760cdf0e10cSrcweir break;
761cdf0e10cSrcweir case WID_EFFECT:
762cdf0e10cSrcweir aRet <<= EffectMigration::GetAnimationEffect( mpShape );
763cdf0e10cSrcweir break;
764cdf0e10cSrcweir case WID_TEXTEFFECT:
765cdf0e10cSrcweir aRet <<= EffectMigration::GetTextAnimationEffect( mpShape );
766cdf0e10cSrcweir break;
767cdf0e10cSrcweir case WID_ISPRESOBJ:
768cdf0e10cSrcweir aRet <<= (sal_Bool)IsPresObj();
769cdf0e10cSrcweir break;
770cdf0e10cSrcweir case WID_ISEMPTYPRESOBJ:
771cdf0e10cSrcweir aRet <<= (sal_Bool)IsEmptyPresObj();
772cdf0e10cSrcweir break;
773cdf0e10cSrcweir case WID_MASTERDEPEND:
774cdf0e10cSrcweir aRet <<= (sal_Bool)IsMasterDepend();
775cdf0e10cSrcweir break;
776cdf0e10cSrcweir case WID_SPEED:
777cdf0e10cSrcweir aRet <<= EffectMigration::GetAnimationSpeed( mpShape );
778cdf0e10cSrcweir break;
779cdf0e10cSrcweir case WID_ISANIMATION:
780cdf0e10cSrcweir aRet <<= (sal_Bool)( pInfo && pInfo->mbIsMovie);
781cdf0e10cSrcweir break;
782cdf0e10cSrcweir case WID_BOOKMARK:
783cdf0e10cSrcweir {
784cdf0e10cSrcweir OUString aString;
785cdf0e10cSrcweir if( pInfo )
786cdf0e10cSrcweir {
787cdf0e10cSrcweir SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
788cdf0e10cSrcweir // is the bookmark a page?
789cdf0e10cSrcweir sal_Bool bIsMasterPage;
790cdf0e10cSrcweir if(pDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage ) != SDRPAGE_NOTFOUND)
791cdf0e10cSrcweir {
792cdf0e10cSrcweir aString = SdDrawPage::getPageApiNameFromUiName( pInfo->GetBookmark() );
793cdf0e10cSrcweir }
794cdf0e10cSrcweir else
795cdf0e10cSrcweir {
796cdf0e10cSrcweir aString = pInfo->GetBookmark() ;
797cdf0e10cSrcweir sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
798cdf0e10cSrcweir if( nPos >= 0 )
799cdf0e10cSrcweir {
800cdf0e10cSrcweir OUString aURL( aString.copy( 0, nPos+1 ) );
801cdf0e10cSrcweir OUString aName( aString.copy( nPos+1 ) );
802cdf0e10cSrcweir if(pDoc->GetPageByName( aName, bIsMasterPage ) != SDRPAGE_NOTFOUND)
803cdf0e10cSrcweir {
804cdf0e10cSrcweir aURL += SdDrawPage::getPageApiNameFromUiName( aName );
805cdf0e10cSrcweir aString = aURL;
806cdf0e10cSrcweir }
807cdf0e10cSrcweir }
808cdf0e10cSrcweir }
809cdf0e10cSrcweir }
810cdf0e10cSrcweir
811cdf0e10cSrcweir aRet <<= aString;
812cdf0e10cSrcweir break;
813cdf0e10cSrcweir }
814cdf0e10cSrcweir case WID_CLICKACTION:
815cdf0e10cSrcweir aRet = ::cppu::enum2any< presentation::ClickAction >( pInfo?pInfo->meClickAction:presentation::ClickAction_NONE );
816cdf0e10cSrcweir break;
817cdf0e10cSrcweir case WID_PLAYFULL:
818cdf0e10cSrcweir aRet <<= (sal_Bool)( pInfo && pInfo->mbPlayFull );
819cdf0e10cSrcweir break;
820cdf0e10cSrcweir case WID_SOUNDFILE:
821cdf0e10cSrcweir aRet <<= EffectMigration::GetSoundFile( mpShape );
822cdf0e10cSrcweir break;
823cdf0e10cSrcweir case WID_SOUNDON:
824cdf0e10cSrcweir aRet <<= EffectMigration::GetSoundOn( mpShape );
825cdf0e10cSrcweir break;
826cdf0e10cSrcweir case WID_BLUESCREEN:
827cdf0e10cSrcweir aRet <<= (sal_Int32)( pInfo?pInfo->maBlueScreen.GetColor():0x00ffffff );
828cdf0e10cSrcweir break;
829cdf0e10cSrcweir case WID_VERB:
830cdf0e10cSrcweir aRet <<= (sal_Int32)( pInfo?pInfo->mnVerb:0 );
831cdf0e10cSrcweir break;
832cdf0e10cSrcweir case WID_DIMCOLOR:
833cdf0e10cSrcweir aRet <<= EffectMigration::GetDimColor( mpShape );
834cdf0e10cSrcweir break;
835cdf0e10cSrcweir case WID_DIMHIDE:
836cdf0e10cSrcweir aRet <<= EffectMigration::GetDimHide( mpShape );
837cdf0e10cSrcweir break;
838cdf0e10cSrcweir case WID_DIMPREV:
839cdf0e10cSrcweir aRet <<= EffectMigration::GetDimPrevious( mpShape );
840cdf0e10cSrcweir break;
841cdf0e10cSrcweir case WID_PRESORDER:
842cdf0e10cSrcweir aRet <<= EffectMigration::GetPresentationOrder( mpShape );
843cdf0e10cSrcweir break;
844cdf0e10cSrcweir case WID_STYLE:
845cdf0e10cSrcweir aRet = GetStyleSheet();
846cdf0e10cSrcweir break;
847cdf0e10cSrcweir case WID_ANIMPATH:
848cdf0e10cSrcweir if( pInfo && pInfo->mpPathObj )
849cdf0e10cSrcweir aRet <<= pInfo->mpPathObj->getUnoShape();
850cdf0e10cSrcweir break;
851cdf0e10cSrcweir case WID_IMAGEMAP:
852cdf0e10cSrcweir {
853cdf0e10cSrcweir uno::Reference< uno::XInterface > xImageMap;
854cdf0e10cSrcweir
855cdf0e10cSrcweir SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
856cdf0e10cSrcweir if( pDoc )
857cdf0e10cSrcweir {
858cdf0e10cSrcweir
859cdf0e10cSrcweir SdIMapInfo* pIMapInfo = pDoc->GetIMapInfo(mpShape->GetSdrObject());
860cdf0e10cSrcweir if( pIMapInfo )
861cdf0e10cSrcweir {
862cdf0e10cSrcweir const ImageMap& rIMap = pIMapInfo->GetImageMap();
863cdf0e10cSrcweir xImageMap = SvUnoImageMap_createInstance( rIMap, ImplGetSupportedMacroItems() );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir else
866cdf0e10cSrcweir {
867cdf0e10cSrcweir xImageMap = SvUnoImageMap_createInstance(ImplGetSupportedMacroItems() );
868cdf0e10cSrcweir }
869cdf0e10cSrcweir }
870cdf0e10cSrcweir
871cdf0e10cSrcweir aRet <<= uno::Reference< container::XIndexContainer >::query( xImageMap );
872cdf0e10cSrcweir break;
873cdf0e10cSrcweir }
874cdf0e10cSrcweir }
875cdf0e10cSrcweir }
876cdf0e10cSrcweir else
877cdf0e10cSrcweir {
878cdf0e10cSrcweir aRet = mpShape->_getPropertyValue(PropertyName);
879cdf0e10cSrcweir
880cdf0e10cSrcweir if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sUNO_shape_layername ) ) )
881cdf0e10cSrcweir {
882cdf0e10cSrcweir OUString aName;
883cdf0e10cSrcweir if( aRet >>= aName )
884cdf0e10cSrcweir {
885cdf0e10cSrcweir aName = SdLayer::convertToExternalName( aName );
886cdf0e10cSrcweir aRet <<= aName;
887cdf0e10cSrcweir }
888cdf0e10cSrcweir }
889cdf0e10cSrcweir }
890cdf0e10cSrcweir
891cdf0e10cSrcweir return aRet;
892cdf0e10cSrcweir }
893cdf0e10cSrcweir
894cdf0e10cSrcweir /** */
GetAnimationInfo(sal_Bool bCreate) const895cdf0e10cSrcweir SdAnimationInfo* SdXShape::GetAnimationInfo( sal_Bool bCreate ) const throw()
896cdf0e10cSrcweir {
897cdf0e10cSrcweir SdAnimationInfo* pInfo = NULL;
898cdf0e10cSrcweir
899cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
900cdf0e10cSrcweir if(pObj)
901cdf0e10cSrcweir pInfo = SdDrawDocument::GetShapeUserData(*pObj, bCreate ? true : false);
902cdf0e10cSrcweir
903cdf0e10cSrcweir return pInfo;
904cdf0e10cSrcweir }
905cdf0e10cSrcweir
getSupportedServiceNames()906cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL SdXShape::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
907cdf0e10cSrcweir {
908cdf0e10cSrcweir uno::Sequence< OUString > aSeq( mpShape->_getSupportedServiceNames() );
909cdf0e10cSrcweir
910cdf0e10cSrcweir comphelper::ServiceInfoHelper::addToSequence( aSeq, 2, "com.sun.star.presentation.Shape",
911cdf0e10cSrcweir "com.sun.star.document.LinkTarget" );
912cdf0e10cSrcweir
913cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
914cdf0e10cSrcweir if(pObj && pObj->GetObjInventor() == SdrInventor )
915cdf0e10cSrcweir {
916cdf0e10cSrcweir sal_uInt32 nInventor = pObj->GetObjIdentifier();
917cdf0e10cSrcweir switch( nInventor )
918cdf0e10cSrcweir {
919cdf0e10cSrcweir case OBJ_TITLETEXT:
920cdf0e10cSrcweir comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.TitleTextShape" );
921cdf0e10cSrcweir break;
922cdf0e10cSrcweir case OBJ_OUTLINETEXT:
923cdf0e10cSrcweir comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.OutlinerShape" );
924cdf0e10cSrcweir break;
925cdf0e10cSrcweir }
926cdf0e10cSrcweir }
927cdf0e10cSrcweir return aSeq;
928cdf0e10cSrcweir }
929cdf0e10cSrcweir
930cdf0e10cSrcweir /** checks if this is a presentation object
931cdf0e10cSrcweir */
IsPresObj() const932cdf0e10cSrcweir sal_Bool SdXShape::IsPresObj() const throw()
933cdf0e10cSrcweir {
934cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
935cdf0e10cSrcweir if(pObj)
936cdf0e10cSrcweir {
937cdf0e10cSrcweir SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
938cdf0e10cSrcweir if(pPage)
939cdf0e10cSrcweir return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE;
940cdf0e10cSrcweir }
941cdf0e10cSrcweir return sal_False;
942cdf0e10cSrcweir }
943cdf0e10cSrcweir
944cdf0e10cSrcweir /** checks if this presentation object is empty
945cdf0e10cSrcweir */
IsEmptyPresObj() const946cdf0e10cSrcweir sal_Bool SdXShape::IsEmptyPresObj() const throw()
947cdf0e10cSrcweir {
948cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
949cdf0e10cSrcweir if( (pObj != NULL) && pObj->IsEmptyPresObj() )
950cdf0e10cSrcweir {
951cdf0e10cSrcweir // check if the object is in edit, than its temporarely not empty
952cdf0e10cSrcweir SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
953cdf0e10cSrcweir if( pTextObj == 0 )
954cdf0e10cSrcweir return sal_True;
955cdf0e10cSrcweir
956cdf0e10cSrcweir OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
957cdf0e10cSrcweir if( pParaObj )
958cdf0e10cSrcweir {
959cdf0e10cSrcweir delete pParaObj;
960cdf0e10cSrcweir }
961cdf0e10cSrcweir else
962cdf0e10cSrcweir {
963cdf0e10cSrcweir return sal_True;
964cdf0e10cSrcweir }
965cdf0e10cSrcweir }
966cdf0e10cSrcweir
967cdf0e10cSrcweir return sal_False;
968cdf0e10cSrcweir }
969cdf0e10cSrcweir
970cdf0e10cSrcweir /** sets/reset the empty status of a presentation object
971cdf0e10cSrcweir */
SetEmptyPresObj(sal_Bool bEmpty)972cdf0e10cSrcweir void SdXShape::SetEmptyPresObj( sal_Bool bEmpty ) throw()
973cdf0e10cSrcweir {
974cdf0e10cSrcweir // only possible if this actually *is* a presentation object
975cdf0e10cSrcweir if( !IsPresObj() )
976cdf0e10cSrcweir return;
977cdf0e10cSrcweir
978cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
979cdf0e10cSrcweir if( pObj == NULL )
980cdf0e10cSrcweir return;
981cdf0e10cSrcweir
982cdf0e10cSrcweir if( pObj->IsEmptyPresObj() != bEmpty )
983cdf0e10cSrcweir {
984cdf0e10cSrcweir if(!bEmpty)
985cdf0e10cSrcweir {
986cdf0e10cSrcweir OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
987cdf0e10cSrcweir const sal_Bool bVertical = pOutlinerParaObject ? pOutlinerParaObject->IsVertical() : sal_False;
988cdf0e10cSrcweir
989cdf0e10cSrcweir // really delete SdrOutlinerObj at pObj
990cdf0e10cSrcweir pObj->NbcSetOutlinerParaObject(0L);
991cdf0e10cSrcweir if( bVertical && PTR_CAST( SdrTextObj, pObj ) )
992cdf0e10cSrcweir ((SdrTextObj*)pObj)->SetVerticalWriting( sal_True );
993cdf0e10cSrcweir
994cdf0e10cSrcweir SdrGrafObj* pGraphicObj = PTR_CAST( SdrGrafObj, pObj );
995cdf0e10cSrcweir if( pGraphicObj )
996cdf0e10cSrcweir {
997cdf0e10cSrcweir Graphic aEmpty;
998cdf0e10cSrcweir pGraphicObj->SetGraphic(aEmpty);
999cdf0e10cSrcweir }
1000cdf0e10cSrcweir else
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir SdrOle2Obj* pOleObj = PTR_CAST( SdrOle2Obj, pObj );
1003cdf0e10cSrcweir if( pOleObj )
1004cdf0e10cSrcweir {
1005cdf0e10cSrcweir pOleObj->SetGraphic( NULL );
1006cdf0e10cSrcweir }
1007cdf0e10cSrcweir }
1008cdf0e10cSrcweir }
1009cdf0e10cSrcweir else
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir // now set an empty OutlinerParaObject at pObj without
1012cdf0e10cSrcweir // any content but with the style of the old OutlinerParaObjects
1013cdf0e10cSrcweir // first paragraph
1014cdf0e10cSrcweir do
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL;
1017cdf0e10cSrcweir DBG_ASSERT( pDoc, "no document?" );
1018cdf0e10cSrcweir if( pDoc == NULL)
1019cdf0e10cSrcweir break;
1020cdf0e10cSrcweir
1021cdf0e10cSrcweir ::sd::Outliner* pOutliner = pDoc->GetInternalOutliner();
1022cdf0e10cSrcweir DBG_ASSERT( pOutliner, "no outliner?" );
1023cdf0e10cSrcweir if( pOutliner == NULL )
1024cdf0e10cSrcweir break;
1025cdf0e10cSrcweir
1026cdf0e10cSrcweir SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
1027cdf0e10cSrcweir DBG_ASSERT( pPage, "no page?" );
1028cdf0e10cSrcweir if( pPage == NULL )
1029cdf0e10cSrcweir break;
1030cdf0e10cSrcweir
1031cdf0e10cSrcweir OutlinerParaObject* pOutlinerParaObject = pObj->GetOutlinerParaObject();
1032cdf0e10cSrcweir pOutliner->SetText( *pOutlinerParaObject );
1033cdf0e10cSrcweir const sal_Bool bVertical = pOutliner->IsVertical();
1034cdf0e10cSrcweir
1035cdf0e10cSrcweir pOutliner->Clear();
1036cdf0e10cSrcweir pOutliner->SetVertical( bVertical );
1037cdf0e10cSrcweir pOutliner->SetStyleSheetPool( (SfxStyleSheetPool*)pDoc->GetStyleSheetPool() );
1038cdf0e10cSrcweir pOutliner->SetStyleSheet( 0, pPage->GetTextStyleSheetForObject( pObj ) );
1039cdf0e10cSrcweir pOutliner->Insert( pPage->GetPresObjText( pPage->GetPresObjKind(pObj) ) );
1040cdf0e10cSrcweir pObj->SetOutlinerParaObject( pOutliner->CreateParaObject() );
1041cdf0e10cSrcweir pOutliner->Clear();
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir while(0);
1044cdf0e10cSrcweir }
1045cdf0e10cSrcweir
1046cdf0e10cSrcweir pObj->SetEmptyPresObj(bEmpty);
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir }
1049cdf0e10cSrcweir
IsMasterDepend() const1050cdf0e10cSrcweir sal_Bool SdXShape::IsMasterDepend() const throw()
1051cdf0e10cSrcweir {
1052cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
1053cdf0e10cSrcweir return pObj && pObj->GetUserCall() != NULL;
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir
SetMasterDepend(sal_Bool bDepend)1056cdf0e10cSrcweir void SdXShape::SetMasterDepend( sal_Bool bDepend ) throw()
1057cdf0e10cSrcweir {
1058cdf0e10cSrcweir if( IsMasterDepend() != bDepend )
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
1061cdf0e10cSrcweir if( pObj )
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir if( bDepend )
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir SdPage* pPage = PTR_CAST(SdPage,pObj->GetPage());
1066cdf0e10cSrcweir pObj->SetUserCall( pPage );
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir else
1069cdf0e10cSrcweir {
1070cdf0e10cSrcweir pObj->SetUserCall( NULL );
1071cdf0e10cSrcweir }
1072cdf0e10cSrcweir }
1073cdf0e10cSrcweir }
1074cdf0e10cSrcweir }
1075cdf0e10cSrcweir
SetStyleSheet(const uno::Any & rAny)1076cdf0e10cSrcweir void SdXShape::SetStyleSheet( const uno::Any& rAny ) throw( lang::IllegalArgumentException )
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
1079cdf0e10cSrcweir if( pObj == NULL )
1080cdf0e10cSrcweir throw beans::UnknownPropertyException();
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir uno::Reference< style::XStyle > xStyle( rAny, uno::UNO_QUERY );
1083cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle );
1084cdf0e10cSrcweir
1085cdf0e10cSrcweir const SfxStyleSheet* pOldStyleSheet = pObj->GetStyleSheet();
1086cdf0e10cSrcweir if( pOldStyleSheet != pStyleSheet )
1087cdf0e10cSrcweir {
1088cdf0e10cSrcweir if( pStyleSheet == 0 || (pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS && pStyleSheet->GetFamily() != SD_STYLE_FAMILY_MASTERPAGE) )
1089cdf0e10cSrcweir throw lang::IllegalArgumentException();
1090cdf0e10cSrcweir
1091cdf0e10cSrcweir pObj->SetStyleSheet( pStyleSheet, sal_False );
1092cdf0e10cSrcweir
1093cdf0e10cSrcweir SdDrawDocument* pDoc = mpModel? mpModel->GetDoc() : NULL;
1094cdf0e10cSrcweir if( pDoc )
1095cdf0e10cSrcweir {
1096cdf0e10cSrcweir ::sd::DrawDocShell* pDocSh = pDoc->GetDocSh();
1097cdf0e10cSrcweir ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
1098cdf0e10cSrcweir
1099cdf0e10cSrcweir if( pViewSh )
1100cdf0e10cSrcweir pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_STYLE_FAMILY2 );
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir }
1103cdf0e10cSrcweir }
1104cdf0e10cSrcweir
GetStyleSheet() const1105cdf0e10cSrcweir uno::Any SdXShape::GetStyleSheet() const throw( beans::UnknownPropertyException )
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir SdrObject* pObj = mpShape->GetSdrObject();
1108cdf0e10cSrcweir if( pObj == NULL )
1109cdf0e10cSrcweir throw beans::UnknownPropertyException();
1110cdf0e10cSrcweir
1111cdf0e10cSrcweir SfxStyleSheet* pStyleSheet = pObj->GetStyleSheet();
1112cdf0e10cSrcweir // it is possible for shapes inside a draw to have a presentation style
1113cdf0e10cSrcweir // but we don't want this for the api
1114cdf0e10cSrcweir if( (pStyleSheet == NULL) || ((pStyleSheet->GetFamily() != SD_STYLE_FAMILY_GRAPHICS) && !mpModel->IsImpressDocument()) )
1115cdf0e10cSrcweir return Any();
1116cdf0e10cSrcweir
1117cdf0e10cSrcweir return Any( uno::Reference< style::XStyle >( dynamic_cast< SfxUnoStyleSheet* >( pStyleSheet ) ) );
1118cdf0e10cSrcweir }
1119cdf0e10cSrcweir
1120cdf0e10cSrcweir class SdUnoEventsAccess : public cppu::WeakImplHelper2< com::sun::star::container::XNameReplace, com::sun::star::lang::XServiceInfo >
1121cdf0e10cSrcweir {
1122cdf0e10cSrcweir private:
1123cdf0e10cSrcweir const OUString maStrOnClick;
1124cdf0e10cSrcweir const OUString maStrServiceName;
1125cdf0e10cSrcweir const OUString maStrEventType;
1126cdf0e10cSrcweir const OUString maStrPresentation;
1127cdf0e10cSrcweir const OUString maStrLibrary;
1128cdf0e10cSrcweir const OUString maStrMacroName;
1129cdf0e10cSrcweir const OUString maStrClickAction;
1130cdf0e10cSrcweir const OUString maStrBookmark;
1131cdf0e10cSrcweir const OUString maStrEffect;
1132cdf0e10cSrcweir const OUString maStrPlayFull;
1133cdf0e10cSrcweir const OUString maStrVerb;
1134cdf0e10cSrcweir const OUString maStrSoundURL;
1135cdf0e10cSrcweir const OUString maStrSpeed;
1136cdf0e10cSrcweir const OUString maStrStarBasic;
1137cdf0e10cSrcweir const OUString maStrScript;
1138cdf0e10cSrcweir
1139cdf0e10cSrcweir SdXShape* mpShape;
1140cdf0e10cSrcweir uno::Reference< document::XEventsSupplier > mxShape;
1141cdf0e10cSrcweir
1142cdf0e10cSrcweir public:
1143cdf0e10cSrcweir SdUnoEventsAccess( SdXShape* pShape ) throw();
1144cdf0e10cSrcweir
1145cdf0e10cSrcweir // XNameReplace
1146cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir // XNameAccess
1149cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
1150cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
1151cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir // XElementAccess
1154cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
1155cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
1156cdf0e10cSrcweir
1157cdf0e10cSrcweir // XServiceInfo
1158cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
1159cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
1160cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
1161cdf0e10cSrcweir };
1162cdf0e10cSrcweir
1163cdf0e10cSrcweir // XEventsSupplier
getEvents()1164cdf0e10cSrcweir uno::Reference< container::XNameReplace > SAL_CALL SdXShape::getEvents( ) throw(::com::sun::star::uno::RuntimeException)
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir return new SdUnoEventsAccess( this );
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir
SdUnoEventsAccess(SdXShape * pShape)1169cdf0e10cSrcweir SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw()
1170cdf0e10cSrcweir : maStrOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
1171cdf0e10cSrcweir maStrServiceName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.documents.Events") ),
1172cdf0e10cSrcweir maStrEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
1173cdf0e10cSrcweir maStrPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
1174cdf0e10cSrcweir maStrLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
1175cdf0e10cSrcweir maStrMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
1176cdf0e10cSrcweir maStrClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
1177cdf0e10cSrcweir maStrBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
1178cdf0e10cSrcweir maStrEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
1179cdf0e10cSrcweir maStrPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
1180cdf0e10cSrcweir maStrVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
1181cdf0e10cSrcweir maStrSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
1182cdf0e10cSrcweir maStrSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
1183cdf0e10cSrcweir maStrStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ),
1184cdf0e10cSrcweir maStrScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
1185cdf0e10cSrcweir mpShape( pShape ), mxShape( pShape )
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir }
1188cdf0e10cSrcweir
1189cdf0e10cSrcweir #define FOUND_CLICKACTION 0x0001
1190cdf0e10cSrcweir #define FOUND_BOOKMARK 0x0002
1191cdf0e10cSrcweir #define FOUND_EFFECT 0x0004
1192cdf0e10cSrcweir #define FOUND_PLAYFULL 0x0008
1193cdf0e10cSrcweir #define FOUND_VERB 0x0010
1194cdf0e10cSrcweir #define FOUND_SOUNDURL 0x0020
1195cdf0e10cSrcweir #define FOUND_SPEED 0x0040
1196cdf0e10cSrcweir #define FOUND_EVENTTYPE 0x0080
1197cdf0e10cSrcweir #define FOUND_MACRO 0x0100
1198cdf0e10cSrcweir #define FOUND_LIBRARY 0x0200
1199cdf0e10cSrcweir
clearEventsInAnimationInfo(SdAnimationInfo * pInfo)1200cdf0e10cSrcweir static void clearEventsInAnimationInfo( SdAnimationInfo* pInfo )
1201cdf0e10cSrcweir {
1202cdf0e10cSrcweir const String aEmpty;
1203cdf0e10cSrcweir pInfo->SetBookmark( aEmpty );
1204cdf0e10cSrcweir pInfo->mbSecondSoundOn = sal_False;
1205cdf0e10cSrcweir pInfo->mbSecondPlayFull = sal_False;
1206cdf0e10cSrcweir pInfo->meClickAction = presentation::ClickAction_NONE;
1207cdf0e10cSrcweir pInfo->meSecondEffect = presentation::AnimationEffect_NONE;
1208cdf0e10cSrcweir pInfo->meSecondSpeed = presentation::AnimationSpeed_MEDIUM;
1209cdf0e10cSrcweir pInfo->mnVerb = 0;
1210cdf0e10cSrcweir }
1211cdf0e10cSrcweir
1212cdf0e10cSrcweir // XNameReplace
replaceByName(const OUString & aName,const uno::Any & aElement)1213cdf0e10cSrcweir void SAL_CALL SdUnoEventsAccess::replaceByName( const OUString& aName, const uno::Any& aElement )
1214cdf0e10cSrcweir throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1215cdf0e10cSrcweir {
1216cdf0e10cSrcweir if( mpShape == NULL || aName != maStrOnClick )
1217cdf0e10cSrcweir throw container::NoSuchElementException();
1218cdf0e10cSrcweir
1219cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aProperties;
1220cdf0e10cSrcweir if( !aElement.hasValue() || aElement.getValueType() != getElementType() || !(aElement >>= aProperties) )
1221cdf0e10cSrcweir throw lang::IllegalArgumentException();
1222cdf0e10cSrcweir
1223cdf0e10cSrcweir sal_Int32 nFound = 0;
1224cdf0e10cSrcweir const beans::PropertyValue* pProperties = aProperties.getConstArray();
1225cdf0e10cSrcweir
1226cdf0e10cSrcweir OUString aStrEventType;
1227cdf0e10cSrcweir presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1228cdf0e10cSrcweir presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
1229cdf0e10cSrcweir presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
1230cdf0e10cSrcweir OUString aStrSoundURL;
1231cdf0e10cSrcweir sal_Bool bPlayFull = sal_False;
1232cdf0e10cSrcweir sal_Int32 nVerb = 0;
1233cdf0e10cSrcweir OUString aStrMacro;
1234cdf0e10cSrcweir OUString aStrLibrary;
1235cdf0e10cSrcweir OUString aStrBookmark;
1236cdf0e10cSrcweir
1237cdf0e10cSrcweir const sal_Int32 nCount = aProperties.getLength();
1238cdf0e10cSrcweir sal_Int32 nIndex;
1239cdf0e10cSrcweir for( nIndex = 0; nIndex < nCount; nIndex++, pProperties++ )
1240cdf0e10cSrcweir {
1241cdf0e10cSrcweir if( ( ( nFound & FOUND_EVENTTYPE ) == 0 ) && pProperties->Name == maStrEventType )
1242cdf0e10cSrcweir {
1243cdf0e10cSrcweir if( pProperties->Value >>= aStrEventType )
1244cdf0e10cSrcweir {
1245cdf0e10cSrcweir nFound |= FOUND_EVENTTYPE;
1246cdf0e10cSrcweir continue;
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir }
1249cdf0e10cSrcweir else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperties->Name == maStrClickAction )
1250cdf0e10cSrcweir {
1251cdf0e10cSrcweir if( pProperties->Value >>= eClickAction )
1252cdf0e10cSrcweir {
1253cdf0e10cSrcweir nFound |= FOUND_CLICKACTION;
1254cdf0e10cSrcweir continue;
1255cdf0e10cSrcweir }
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperties->Name == maStrMacroName || pProperties->Name == maStrScript ) )
1258cdf0e10cSrcweir {
1259cdf0e10cSrcweir if( pProperties->Value >>= aStrMacro )
1260cdf0e10cSrcweir {
1261cdf0e10cSrcweir nFound |= FOUND_MACRO;
1262cdf0e10cSrcweir continue;
1263cdf0e10cSrcweir }
1264cdf0e10cSrcweir }
1265cdf0e10cSrcweir else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperties->Name == maStrLibrary )
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir if( pProperties->Value >>= aStrLibrary )
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir nFound |= FOUND_LIBRARY;
1270cdf0e10cSrcweir continue;
1271cdf0e10cSrcweir }
1272cdf0e10cSrcweir }
1273cdf0e10cSrcweir else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperties->Name == maStrEffect )
1274cdf0e10cSrcweir {
1275cdf0e10cSrcweir if( pProperties->Value >>= eEffect )
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir nFound |= FOUND_EFFECT;
1278cdf0e10cSrcweir continue;
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir }
1281cdf0e10cSrcweir else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperties->Name == maStrBookmark )
1282cdf0e10cSrcweir {
1283cdf0e10cSrcweir if( pProperties->Value >>= aStrBookmark )
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir nFound |= FOUND_BOOKMARK;
1286cdf0e10cSrcweir continue;
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir }
1289cdf0e10cSrcweir else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperties->Name == maStrSpeed )
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir if( pProperties->Value >>= eSpeed )
1292cdf0e10cSrcweir {
1293cdf0e10cSrcweir nFound |= FOUND_SPEED;
1294cdf0e10cSrcweir continue;
1295cdf0e10cSrcweir }
1296cdf0e10cSrcweir }
1297cdf0e10cSrcweir else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperties->Name == maStrSoundURL )
1298cdf0e10cSrcweir {
1299cdf0e10cSrcweir if( pProperties->Value >>= aStrSoundURL )
1300cdf0e10cSrcweir {
1301cdf0e10cSrcweir nFound |= FOUND_SOUNDURL;
1302cdf0e10cSrcweir continue;
1303cdf0e10cSrcweir }
1304cdf0e10cSrcweir }
1305cdf0e10cSrcweir else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperties->Name == maStrPlayFull )
1306cdf0e10cSrcweir {
1307cdf0e10cSrcweir if( pProperties->Value >>= bPlayFull )
1308cdf0e10cSrcweir {
1309cdf0e10cSrcweir nFound |= FOUND_PLAYFULL;
1310cdf0e10cSrcweir continue;
1311cdf0e10cSrcweir }
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperties->Name == maStrVerb )
1314cdf0e10cSrcweir {
1315cdf0e10cSrcweir if( pProperties->Value >>= nVerb )
1316cdf0e10cSrcweir {
1317cdf0e10cSrcweir nFound |= FOUND_VERB;
1318cdf0e10cSrcweir continue;
1319cdf0e10cSrcweir }
1320cdf0e10cSrcweir }
1321cdf0e10cSrcweir
1322cdf0e10cSrcweir throw lang::IllegalArgumentException();
1323cdf0e10cSrcweir }
1324cdf0e10cSrcweir
1325cdf0e10cSrcweir sal_Bool bOk = sal_False;
1326cdf0e10cSrcweir do
1327cdf0e10cSrcweir {
1328cdf0e10cSrcweir if( ( nFound & FOUND_EVENTTYPE ) == 0 )
1329cdf0e10cSrcweir break;
1330cdf0e10cSrcweir
1331cdf0e10cSrcweir if( aStrEventType == maStrPresentation )
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir if( ( nFound & FOUND_CLICKACTION ) == 0 )
1334cdf0e10cSrcweir break;
1335cdf0e10cSrcweir
1336cdf0e10cSrcweir SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
1337cdf0e10cSrcweir if( presentation::ClickAction_NONE == eClickAction && NULL == pInfo )
1338cdf0e10cSrcweir {
1339cdf0e10cSrcweir bOk = sal_True;
1340cdf0e10cSrcweir break;
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir
1343cdf0e10cSrcweir if( NULL == pInfo )
1344cdf0e10cSrcweir pInfo = mpShape->GetAnimationInfo( sal_True );
1345cdf0e10cSrcweir
1346cdf0e10cSrcweir DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1347cdf0e10cSrcweir if( NULL == pInfo )
1348cdf0e10cSrcweir break;
1349cdf0e10cSrcweir
1350cdf0e10cSrcweir clearEventsInAnimationInfo( pInfo );
1351cdf0e10cSrcweir pInfo->meClickAction = eClickAction;
1352cdf0e10cSrcweir
1353cdf0e10cSrcweir switch( eClickAction )
1354cdf0e10cSrcweir {
1355cdf0e10cSrcweir case presentation::ClickAction_NONE:
1356cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE:
1357cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE:
1358cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE:
1359cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE:
1360cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE:
1361cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION:
1362cdf0e10cSrcweir {
1363cdf0e10cSrcweir bOk = sal_True;
1364cdf0e10cSrcweir }
1365cdf0e10cSrcweir break;
1366cdf0e10cSrcweir
1367cdf0e10cSrcweir case presentation::ClickAction_PROGRAM:
1368cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK:
1369cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT:
1370cdf0e10cSrcweir if( nFound & FOUND_BOOKMARK )
1371cdf0e10cSrcweir {
1372cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_BOOKMARK )
1373cdf0e10cSrcweir {
1374cdf0e10cSrcweir aStrBookmark = getUiNameFromPageApiNameImpl( aStrBookmark );
1375cdf0e10cSrcweir }
1376cdf0e10cSrcweir else if( eClickAction == presentation::ClickAction_DOCUMENT )
1377cdf0e10cSrcweir {
1378cdf0e10cSrcweir sal_Int32 nPos = aStrBookmark.lastIndexOf( sal_Unicode('#') );
1379cdf0e10cSrcweir if( nPos >= 0 )
1380cdf0e10cSrcweir {
1381cdf0e10cSrcweir OUString aURL( aStrBookmark.copy( 0, nPos+1 ) );
1382cdf0e10cSrcweir aURL += getUiNameFromPageApiNameImpl( aStrBookmark.copy( nPos+1 ) );
1383cdf0e10cSrcweir aStrBookmark = aURL;
1384cdf0e10cSrcweir }
1385cdf0e10cSrcweir }
1386cdf0e10cSrcweir
1387cdf0e10cSrcweir pInfo->SetBookmark( aStrBookmark );
1388cdf0e10cSrcweir bOk = sal_True;
1389cdf0e10cSrcweir }
1390cdf0e10cSrcweir break;
1391cdf0e10cSrcweir
1392cdf0e10cSrcweir case presentation::ClickAction_MACRO:
1393cdf0e10cSrcweir if( nFound & FOUND_MACRO )
1394cdf0e10cSrcweir {
1395cdf0e10cSrcweir pInfo->SetBookmark( aStrMacro );
1396cdf0e10cSrcweir bOk = sal_True;
1397cdf0e10cSrcweir }
1398cdf0e10cSrcweir break;
1399cdf0e10cSrcweir
1400cdf0e10cSrcweir case presentation::ClickAction_VERB:
1401cdf0e10cSrcweir if( nFound & FOUND_VERB )
1402cdf0e10cSrcweir {
1403cdf0e10cSrcweir pInfo->mnVerb = (sal_uInt16)nVerb;
1404cdf0e10cSrcweir bOk = sal_True;
1405cdf0e10cSrcweir }
1406cdf0e10cSrcweir break;
1407cdf0e10cSrcweir
1408cdf0e10cSrcweir case presentation::ClickAction_VANISH:
1409cdf0e10cSrcweir if( ( nFound & FOUND_EFFECT ) == 0 )
1410cdf0e10cSrcweir break;
1411cdf0e10cSrcweir
1412cdf0e10cSrcweir pInfo->meSecondEffect = eEffect;
1413cdf0e10cSrcweir pInfo->meSecondSpeed = nFound & FOUND_SPEED ? eSpeed : presentation::AnimationSpeed_MEDIUM;
1414cdf0e10cSrcweir
1415cdf0e10cSrcweir bOk = sal_True;
1416cdf0e10cSrcweir
1417cdf0e10cSrcweir // NOTE: No break here!!!
1418cdf0e10cSrcweir
1419cdf0e10cSrcweir case presentation::ClickAction_SOUND:
1420cdf0e10cSrcweir if( nFound & FOUND_SOUNDURL )
1421cdf0e10cSrcweir {
1422cdf0e10cSrcweir pInfo->SetBookmark( aStrSoundURL );
1423cdf0e10cSrcweir if( eClickAction != presentation::ClickAction_SOUND )
1424cdf0e10cSrcweir pInfo->mbSecondSoundOn = aStrSoundURL.getLength() != 0;
1425cdf0e10cSrcweir pInfo->mbSecondPlayFull = nFound & FOUND_PLAYFULL ? bPlayFull : sal_False;
1426cdf0e10cSrcweir
1427cdf0e10cSrcweir bOk = sal_True;
1428cdf0e10cSrcweir }
1429cdf0e10cSrcweir break;
1430cdf0e10cSrcweir case presentation::ClickAction_MAKE_FIXED_SIZE:
1431cdf0e10cSrcweir break;
1432cdf0e10cSrcweir }
1433cdf0e10cSrcweir }
1434cdf0e10cSrcweir else
1435cdf0e10cSrcweir {
1436cdf0e10cSrcweir SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_True );
1437cdf0e10cSrcweir
1438cdf0e10cSrcweir DBG_ASSERT( pInfo, "shape animation info could not be created!" );
1439cdf0e10cSrcweir if( NULL == pInfo )
1440cdf0e10cSrcweir break;
1441cdf0e10cSrcweir
1442cdf0e10cSrcweir clearEventsInAnimationInfo( pInfo );
1443cdf0e10cSrcweir pInfo->meClickAction = presentation::ClickAction_MACRO;
1444cdf0e10cSrcweir
1445cdf0e10cSrcweir if ( SfxApplication::IsXScriptURL( aStrMacro ) )
1446cdf0e10cSrcweir {
1447cdf0e10cSrcweir pInfo->SetBookmark( aStrMacro );
1448cdf0e10cSrcweir }
1449cdf0e10cSrcweir else
1450cdf0e10cSrcweir {
1451cdf0e10cSrcweir String aMacro = aStrMacro;
1452cdf0e10cSrcweir
1453cdf0e10cSrcweir String aLibName = aMacro.GetToken(0, sal_Unicode('.'));
1454cdf0e10cSrcweir String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
1455cdf0e10cSrcweir String aMacroName = aMacro.GetToken(2, sal_Unicode('.'));
1456cdf0e10cSrcweir
1457cdf0e10cSrcweir OUStringBuffer sBuffer;
1458cdf0e10cSrcweir sBuffer.append( aMacroName );
1459cdf0e10cSrcweir sBuffer.append( sal_Unicode('.') );
1460cdf0e10cSrcweir sBuffer.append( aModulName );
1461cdf0e10cSrcweir sBuffer.append( sal_Unicode('.') );
1462cdf0e10cSrcweir sBuffer.append( aLibName );
1463cdf0e10cSrcweir sBuffer.append( sal_Unicode('.') );
1464cdf0e10cSrcweir
1465cdf0e10cSrcweir if( aStrLibrary.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarOffice" ) ) )
1466cdf0e10cSrcweir {
1467cdf0e10cSrcweir sBuffer.append( OUString( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
1468cdf0e10cSrcweir }
1469cdf0e10cSrcweir else
1470cdf0e10cSrcweir {
1471cdf0e10cSrcweir sBuffer.append( aStrLibrary );
1472cdf0e10cSrcweir }
1473cdf0e10cSrcweir
1474cdf0e10cSrcweir pInfo->SetBookmark( sBuffer.makeStringAndClear() );
1475cdf0e10cSrcweir }
1476cdf0e10cSrcweir bOk = sal_True;
1477cdf0e10cSrcweir }
1478cdf0e10cSrcweir }
1479cdf0e10cSrcweir while(0);
1480cdf0e10cSrcweir
1481cdf0e10cSrcweir if( !bOk )
1482cdf0e10cSrcweir throw lang::IllegalArgumentException();
1483cdf0e10cSrcweir }
1484cdf0e10cSrcweir
1485cdf0e10cSrcweir // XNameAccess
getByName(const OUString & aName)1486cdf0e10cSrcweir uno::Any SAL_CALL SdUnoEventsAccess::getByName( const OUString& aName )
1487cdf0e10cSrcweir throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
1488cdf0e10cSrcweir {
1489cdf0e10cSrcweir if( mpShape == NULL || aName != maStrOnClick )
1490cdf0e10cSrcweir throw container::NoSuchElementException();
1491cdf0e10cSrcweir
1492cdf0e10cSrcweir SdAnimationInfo* pInfo = mpShape->GetAnimationInfo( sal_False );
1493cdf0e10cSrcweir
1494cdf0e10cSrcweir presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
1495cdf0e10cSrcweir if( pInfo )
1496cdf0e10cSrcweir eClickAction = pInfo->meClickAction;
1497cdf0e10cSrcweir
1498cdf0e10cSrcweir sal_Int32 nPropertyCount = 2;
1499cdf0e10cSrcweir switch( eClickAction )
1500cdf0e10cSrcweir {
1501cdf0e10cSrcweir case presentation::ClickAction_NONE:
1502cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE:
1503cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE:
1504cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE:
1505cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE:
1506cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE:
1507cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION:
1508cdf0e10cSrcweir break;
1509cdf0e10cSrcweir case presentation::ClickAction_PROGRAM:
1510cdf0e10cSrcweir case presentation::ClickAction_VERB:
1511cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK:
1512cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT:
1513cdf0e10cSrcweir case presentation::ClickAction_MACRO:
1514cdf0e10cSrcweir if ( !SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
1515cdf0e10cSrcweir nPropertyCount += 1;
1516cdf0e10cSrcweir break;
1517cdf0e10cSrcweir
1518cdf0e10cSrcweir case presentation::ClickAction_SOUND:
1519cdf0e10cSrcweir nPropertyCount += 2;
1520cdf0e10cSrcweir break;
1521cdf0e10cSrcweir
1522cdf0e10cSrcweir case presentation::ClickAction_VANISH:
1523cdf0e10cSrcweir nPropertyCount += 4;
1524cdf0e10cSrcweir break;
1525cdf0e10cSrcweir default:
1526cdf0e10cSrcweir break;
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir
1529cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aProperties( nPropertyCount );
1530cdf0e10cSrcweir beans::PropertyValue* pProperties = aProperties.getArray();
1531cdf0e10cSrcweir
1532cdf0e10cSrcweir uno::Any aAny;
1533cdf0e10cSrcweir
1534cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_MACRO )
1535cdf0e10cSrcweir {
1536cdf0e10cSrcweir if ( SfxApplication::IsXScriptURL( pInfo->GetBookmark() ) )
1537cdf0e10cSrcweir {
1538cdf0e10cSrcweir // Scripting Framework URL
1539cdf0e10cSrcweir aAny <<= maStrScript;;
1540cdf0e10cSrcweir pProperties->Name = maStrEventType;
1541cdf0e10cSrcweir pProperties->Handle = -1;
1542cdf0e10cSrcweir pProperties->Value = aAny;
1543cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1544cdf0e10cSrcweir pProperties++;
1545cdf0e10cSrcweir
1546cdf0e10cSrcweir aAny <<= OUString( pInfo->GetBookmark() );
1547cdf0e10cSrcweir pProperties->Name = maStrScript;
1548cdf0e10cSrcweir pProperties->Handle = -1;
1549cdf0e10cSrcweir pProperties->Value = aAny;
1550cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1551cdf0e10cSrcweir pProperties++;
1552cdf0e10cSrcweir }
1553cdf0e10cSrcweir else
1554cdf0e10cSrcweir {
1555cdf0e10cSrcweir // Old Basic macro URL
1556cdf0e10cSrcweir aAny <<= maStrStarBasic;;
1557cdf0e10cSrcweir pProperties->Name = maStrEventType;
1558cdf0e10cSrcweir pProperties->Handle = -1;
1559cdf0e10cSrcweir pProperties->Value = aAny;
1560cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1561cdf0e10cSrcweir pProperties++;
1562cdf0e10cSrcweir
1563cdf0e10cSrcweir String aMacro = pInfo->GetBookmark();
1564cdf0e10cSrcweir
1565cdf0e10cSrcweir // aMacro has got following format:
1566cdf0e10cSrcweir // "Macroname.Modulname.Libname.Documentname" or
1567cdf0e10cSrcweir // "Macroname.Modulname.Libname.Applicationsname"
1568cdf0e10cSrcweir String aMacroName = aMacro.GetToken(0, sal_Unicode('.'));
1569cdf0e10cSrcweir String aModulName = aMacro.GetToken(1, sal_Unicode('.'));
1570cdf0e10cSrcweir String aLibName = aMacro.GetToken(2, sal_Unicode('.'));
1571cdf0e10cSrcweir String aDocName = aMacro.GetToken(3, sal_Unicode('.'));
1572cdf0e10cSrcweir
1573cdf0e10cSrcweir OUStringBuffer sBuffer;
1574cdf0e10cSrcweir sBuffer.append( aLibName );
1575cdf0e10cSrcweir sBuffer.append( sal_Unicode('.') );
1576cdf0e10cSrcweir sBuffer.append( aModulName );
1577cdf0e10cSrcweir sBuffer.append( sal_Unicode('.') );
1578cdf0e10cSrcweir sBuffer.append( aMacroName );
1579cdf0e10cSrcweir
1580cdf0e10cSrcweir aAny <<= OUString( sBuffer.makeStringAndClear() );
1581cdf0e10cSrcweir pProperties->Name = maStrMacroName;
1582cdf0e10cSrcweir pProperties->Handle = -1;
1583cdf0e10cSrcweir pProperties->Value = aAny;
1584cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1585cdf0e10cSrcweir pProperties++;
1586cdf0e10cSrcweir
1587cdf0e10cSrcweir aAny <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice" ) );
1588cdf0e10cSrcweir pProperties->Name = maStrLibrary;
1589cdf0e10cSrcweir pProperties->Handle = -1;
1590cdf0e10cSrcweir pProperties->Value = aAny;
1591cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1592cdf0e10cSrcweir }
1593cdf0e10cSrcweir }
1594cdf0e10cSrcweir else
1595cdf0e10cSrcweir {
1596cdf0e10cSrcweir aAny <<= maStrPresentation;
1597cdf0e10cSrcweir pProperties->Name = maStrEventType;
1598cdf0e10cSrcweir pProperties->Handle = -1;
1599cdf0e10cSrcweir pProperties->Value = aAny;
1600cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1601cdf0e10cSrcweir pProperties++;
1602cdf0e10cSrcweir
1603cdf0e10cSrcweir aAny <<= eClickAction;
1604cdf0e10cSrcweir pProperties->Name = maStrClickAction;
1605cdf0e10cSrcweir pProperties->Handle = -1;
1606cdf0e10cSrcweir pProperties->Value = aAny;
1607cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1608cdf0e10cSrcweir pProperties++;
1609cdf0e10cSrcweir
1610cdf0e10cSrcweir switch( eClickAction )
1611cdf0e10cSrcweir {
1612cdf0e10cSrcweir case presentation::ClickAction_NONE:
1613cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE:
1614cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE:
1615cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE:
1616cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE:
1617cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE:
1618cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION:
1619cdf0e10cSrcweir break;
1620cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK:
1621cdf0e10cSrcweir {
1622cdf0e10cSrcweir const OUString aStrBookmark( getPageApiNameFromUiName( pInfo->GetBookmark()) );
1623cdf0e10cSrcweir pProperties->Name = maStrBookmark;
1624cdf0e10cSrcweir pProperties->Handle = -1;
1625cdf0e10cSrcweir pProperties->Value <<= aStrBookmark;
1626cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1627cdf0e10cSrcweir }
1628cdf0e10cSrcweir break;
1629cdf0e10cSrcweir
1630cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT:
1631cdf0e10cSrcweir case presentation::ClickAction_PROGRAM:
1632cdf0e10cSrcweir {
1633cdf0e10cSrcweir OUString aString( pInfo->GetBookmark());
1634cdf0e10cSrcweir sal_Int32 nPos = aString.lastIndexOf( sal_Unicode('#') );
1635cdf0e10cSrcweir if( nPos >= 0 )
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir OUString aURL( aString.copy( 0, nPos+1 ) );
1638cdf0e10cSrcweir aURL += getPageApiNameFromUiName( aString.copy( nPos+1 ) );
1639cdf0e10cSrcweir aString = aURL;
1640cdf0e10cSrcweir }
1641cdf0e10cSrcweir pProperties->Name = maStrBookmark;
1642cdf0e10cSrcweir pProperties->Handle = -1;
1643cdf0e10cSrcweir pProperties->Value <<= aString;
1644cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1645cdf0e10cSrcweir }
1646cdf0e10cSrcweir break;
1647cdf0e10cSrcweir
1648cdf0e10cSrcweir case presentation::ClickAction_VANISH:
1649cdf0e10cSrcweir aAny <<= pInfo->meSecondEffect;
1650cdf0e10cSrcweir pProperties->Name = maStrEffect;
1651cdf0e10cSrcweir pProperties->Handle = -1;
1652cdf0e10cSrcweir pProperties->Value = aAny;
1653cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1654cdf0e10cSrcweir pProperties++;
1655cdf0e10cSrcweir
1656cdf0e10cSrcweir aAny <<= pInfo->meSecondSpeed;
1657cdf0e10cSrcweir pProperties->Name = maStrSpeed;
1658cdf0e10cSrcweir pProperties->Handle = -1;
1659cdf0e10cSrcweir pProperties->Value = aAny;
1660cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1661cdf0e10cSrcweir pProperties++;
1662cdf0e10cSrcweir
1663cdf0e10cSrcweir // NOTE: no break here!!!
1664cdf0e10cSrcweir
1665cdf0e10cSrcweir case presentation::ClickAction_SOUND:
1666cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_SOUND || pInfo->mbSecondSoundOn )
1667cdf0e10cSrcweir {
1668cdf0e10cSrcweir aAny <<= OUString( pInfo->GetBookmark());
1669cdf0e10cSrcweir pProperties->Name = maStrSoundURL;
1670cdf0e10cSrcweir pProperties->Handle = -1;
1671cdf0e10cSrcweir pProperties->Value = aAny;
1672cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1673cdf0e10cSrcweir pProperties++;
1674cdf0e10cSrcweir
1675cdf0e10cSrcweir pProperties->Name = maStrPlayFull;
1676cdf0e10cSrcweir pProperties->Handle = -1;
1677cdf0e10cSrcweir pProperties->Value = ::cppu::bool2any(pInfo->mbSecondPlayFull);
1678cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1679cdf0e10cSrcweir }
1680cdf0e10cSrcweir break;
1681cdf0e10cSrcweir
1682cdf0e10cSrcweir case presentation::ClickAction_VERB:
1683cdf0e10cSrcweir aAny <<= (sal_Int32)pInfo->mnVerb;
1684cdf0e10cSrcweir pProperties->Name = maStrVerb;
1685cdf0e10cSrcweir pProperties->Handle = -1;
1686cdf0e10cSrcweir pProperties->Value = aAny;
1687cdf0e10cSrcweir pProperties->State = beans::PropertyState_DIRECT_VALUE;
1688cdf0e10cSrcweir break;
1689cdf0e10cSrcweir default:
1690cdf0e10cSrcweir break;
1691cdf0e10cSrcweir }
1692cdf0e10cSrcweir }
1693cdf0e10cSrcweir
1694cdf0e10cSrcweir aAny <<= aProperties;
1695cdf0e10cSrcweir return aAny;
1696cdf0e10cSrcweir }
1697cdf0e10cSrcweir
getElementNames()1698cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getElementNames( )
1699cdf0e10cSrcweir throw(uno::RuntimeException)
1700cdf0e10cSrcweir {
1701cdf0e10cSrcweir uno::Sequence< OUString > aStr( &maStrOnClick, 1 );
1702cdf0e10cSrcweir return aStr;
1703cdf0e10cSrcweir }
1704cdf0e10cSrcweir
hasByName(const OUString & aName)1705cdf0e10cSrcweir sal_Bool SAL_CALL SdUnoEventsAccess::hasByName( const OUString& aName )
1706cdf0e10cSrcweir throw(uno::RuntimeException)
1707cdf0e10cSrcweir {
1708cdf0e10cSrcweir return aName == maStrOnClick;
1709cdf0e10cSrcweir }
1710cdf0e10cSrcweir
1711cdf0e10cSrcweir // XElementAccess
getElementType()1712cdf0e10cSrcweir uno::Type SAL_CALL SdUnoEventsAccess::getElementType( )
1713cdf0e10cSrcweir throw(uno::RuntimeException)
1714cdf0e10cSrcweir {
1715cdf0e10cSrcweir return *SEQTYPE(::getCppuType((const uno::Sequence< beans::PropertyValue >*)0));
1716cdf0e10cSrcweir }
1717cdf0e10cSrcweir
hasElements()1718cdf0e10cSrcweir sal_Bool SAL_CALL SdUnoEventsAccess::hasElements( ) throw(uno::RuntimeException)
1719cdf0e10cSrcweir {
1720cdf0e10cSrcweir return sal_True;
1721cdf0e10cSrcweir }
1722cdf0e10cSrcweir
1723cdf0e10cSrcweir // XServiceInfo
getImplementationName()1724cdf0e10cSrcweir OUString SAL_CALL SdUnoEventsAccess::getImplementationName( )
1725cdf0e10cSrcweir throw(uno::RuntimeException)
1726cdf0e10cSrcweir {
1727cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdUnoEventsAccess" ) );
1728cdf0e10cSrcweir }
1729cdf0e10cSrcweir
supportsService(const OUString & ServiceName)1730cdf0e10cSrcweir sal_Bool SAL_CALL SdUnoEventsAccess::supportsService( const OUString& ServiceName )
1731cdf0e10cSrcweir throw(uno::RuntimeException)
1732cdf0e10cSrcweir {
1733cdf0e10cSrcweir return ServiceName == maStrServiceName;
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir
getSupportedServiceNames()1736cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdUnoEventsAccess::getSupportedServiceNames( )
1737cdf0e10cSrcweir throw(uno::RuntimeException)
1738cdf0e10cSrcweir {
1739cdf0e10cSrcweir uno::Sequence< OUString > aStr( &maStrServiceName, 1 );
1740cdf0e10cSrcweir return aStr;
1741cdf0e10cSrcweir }
1742cdf0e10cSrcweir
modelChanged(SdrModel * pNewModel)1743cdf0e10cSrcweir void SdXShape::modelChanged( SdrModel* pNewModel )
1744cdf0e10cSrcweir {
1745cdf0e10cSrcweir if( pNewModel )
1746cdf0e10cSrcweir {
1747cdf0e10cSrcweir uno::Reference< uno::XInterface > xModel( pNewModel->getUnoModel() );
1748cdf0e10cSrcweir mpModel = SdXImpressDocument::getImplementation( xModel );
1749cdf0e10cSrcweir }
1750cdf0e10cSrcweir else
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir mpModel = 0;
1753cdf0e10cSrcweir }
1754cdf0e10cSrcweir }
1755cdf0e10cSrcweir
pageChanged(SdrPage *)1756cdf0e10cSrcweir void SdXShape::pageChanged( SdrPage* )
1757cdf0e10cSrcweir {
1758cdf0e10cSrcweir }
1759cdf0e10cSrcweir
objectChanged(SdrObject *)1760cdf0e10cSrcweir void SdXShape::objectChanged( SdrObject* )
1761cdf0e10cSrcweir {
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir
1764