xref: /aoo41x/main/svx/source/unodraw/unoshap4.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir #include <com/sun/star/util/XModifiable.hpp>
31*cdf0e10cSrcweir #include <com/sun/star/embed/XLinkageSupport.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionHandler.hpp>
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #define _SVX_USE_UNOGLOBALS_
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <vcl/virdev.hxx>
38*cdf0e10cSrcweir #include <svx/svdoole2.hxx>
39*cdf0e10cSrcweir #include <svx/svdomedia.hxx>
40*cdf0e10cSrcweir #include <svx/svdpool.hxx>
41*cdf0e10cSrcweir #ifndef SVX_LIGHT
42*cdf0e10cSrcweir #ifndef _SOT_CLSIDS_HXX
43*cdf0e10cSrcweir #include <sot/clsids.hxx>
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir #include <sfx2/frmdescr.hxx>
46*cdf0e10cSrcweir #endif
47*cdf0e10cSrcweir #include <vcl/svapp.hxx>
48*cdf0e10cSrcweir #include <vos/mutex.hxx>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
51*cdf0e10cSrcweir #include <sfx2/objsh.hxx>
52*cdf0e10cSrcweir #include <sfx2/docfile.hxx>
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir #include <sot/storage.hxx>
55*cdf0e10cSrcweir #include <sot/exchange.hxx>
56*cdf0e10cSrcweir #include <svtools/FilterConfigItem.hxx>
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir #include <svx/svdmodel.hxx>
59*cdf0e10cSrcweir #include "shapeimpl.hxx"
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir #include <svx/unoshprp.hxx>
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir #include "svx/unoapi.hxx"
64*cdf0e10cSrcweir #include "svx/svdpagv.hxx"
65*cdf0e10cSrcweir #include "svx/svdview.hxx"
66*cdf0e10cSrcweir #include "svx/svdglob.hxx"
67*cdf0e10cSrcweir #include "svx/svdstr.hrc"
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir extern sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem = NULL, sal_Bool bPlaceable = sal_True );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir using namespace ::osl;
76*cdf0e10cSrcweir using namespace ::vos;
77*cdf0e10cSrcweir using namespace ::rtl;
78*cdf0e10cSrcweir using namespace ::cppu;
79*cdf0e10cSrcweir using namespace ::com::sun::star;
80*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
81*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
82*cdf0e10cSrcweir using namespace ::com::sun::star::container;
83*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
86*cdf0e10cSrcweir SvxOle2Shape::SvxOle2Shape( SdrObject* pObject ) throw()
87*cdf0e10cSrcweir : SvxShape( pObject, aSvxMapProvider.GetMap(SVXMAP_OLE2), aSvxMapProvider.GetPropertySet(SVXMAP_OLE2, SdrObject::GetGlobalDrawObjectItemPool())  )
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir SvxOle2Shape::SvxOle2Shape( SdrObject* pObject, const SfxItemPropertyMapEntry* pPropertyMap, const SvxItemPropertySet* pPropertySet ) throw ()
92*cdf0e10cSrcweir : SvxShape( pObject, pPropertyMap, pPropertySet  )
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir SvxOle2Shape::~SvxOle2Shape() throw()
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL SvxOle2Shape::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir 	return SvxShape::queryAggregation( rType );
103*cdf0e10cSrcweir }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir //XPropertySet
106*cdf0e10cSrcweir bool SvxOle2Shape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) 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)
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir 	switch( pProperty->nWID )
109*cdf0e10cSrcweir 	{
110*cdf0e10cSrcweir /*
111*cdf0e10cSrcweir 	case OWN_ATTR_CLSID:
112*cdf0e10cSrcweir 	{
113*cdf0e10cSrcweir 		OUString aCLSID;
114*cdf0e10cSrcweir 		if( rValue >>= aCLSID )
115*cdf0e10cSrcweir 		{
116*cdf0e10cSrcweir             // init an ole object with a global name
117*cdf0e10cSrcweir 			SdrOle2Obj* pOle2 = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
118*cdf0e10cSrcweir 			if( pOle2 )
119*cdf0e10cSrcweir 			{
120*cdf0e10cSrcweir                 uno::Reference < embed::XEmbeddedObject > xObj = pOle2->GetObjRef();
121*cdf0e10cSrcweir                 if ( !xObj.is() )
122*cdf0e10cSrcweir                 {
123*cdf0e10cSrcweir 					SvGlobalName aClassName;
124*cdf0e10cSrcweir 					if( aClassName.MakeId( aCLSID ) )
125*cdf0e10cSrcweir 					{
126*cdf0e10cSrcweir                         SfxObjectShell* pPersist = mpModel->GetPersist();
127*cdf0e10cSrcweir                         ::rtl::OUString aPersistName;
128*cdf0e10cSrcweir                         Any aAny( getPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ) ) );
129*cdf0e10cSrcweir                         aAny >>= aPersistName;
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir                         //TODO/LATER: how to cope with creation failure?!
132*cdf0e10cSrcweir                         xObj = pPersist->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aPersistName );
133*cdf0e10cSrcweir                         if( xObj.is() )
134*cdf0e10cSrcweir                         {
135*cdf0e10cSrcweir                             aAny <<= aPersistName;
136*cdf0e10cSrcweir                             setPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ), aAny );
137*cdf0e10cSrcweir                             pOle2->SetObjRef( xObj );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir                             Rectangle aRect = pOle2->GetLogicRect();
140*cdf0e10cSrcweir                             awt::Size aSz;
141*cdf0e10cSrcweir                             Size aSize( pOle2->GetLogicRect().GetSize() );
142*cdf0e10cSrcweir                             aSz.Width = aSize.Width();
143*cdf0e10cSrcweir                             aSz.Height = aSize.Height();
144*cdf0e10cSrcweir                             xObj->setVisualAreaSize( pOle2->GetAspect(), aSz );
145*cdf0e10cSrcweir 						}
146*cdf0e10cSrcweir 					}
147*cdf0e10cSrcweir                 }
148*cdf0e10cSrcweir 			}
149*cdf0e10cSrcweir 			return true;
150*cdf0e10cSrcweir 		}
151*cdf0e10cSrcweir 		break;
152*cdf0e10cSrcweir 	}
153*cdf0e10cSrcweir */
154*cdf0e10cSrcweir 	case OWN_ATTR_OLE_VISAREA:
155*cdf0e10cSrcweir 	{
156*cdf0e10cSrcweir 		// TODO/LATER: seems to make no sence for iconified object
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 		awt::Rectangle aVisArea;
159*cdf0e10cSrcweir 		if( (rValue >>= aVisArea) && mpObj->ISA(SdrOle2Obj))
160*cdf0e10cSrcweir 		{
161*cdf0e10cSrcweir 			Size aTmp( aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height );
162*cdf0e10cSrcweir             uno::Reference < embed::XEmbeddedObject > xObj = ((SdrOle2Obj*)mpObj.get())->GetObjRef();
163*cdf0e10cSrcweir             if( xObj.is() )
164*cdf0e10cSrcweir 			{
165*cdf0e10cSrcweir 				try
166*cdf0e10cSrcweir 				{
167*cdf0e10cSrcweir 					MapUnit aMapUnit( MAP_100TH_MM ); // the API handles with MAP_100TH_MM map mode
168*cdf0e10cSrcweir 					MapUnit aObjUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( embed::Aspects::MSOLE_CONTENT ) );
169*cdf0e10cSrcweir 					aTmp = OutputDevice::LogicToLogic( aTmp, aMapUnit, aObjUnit );
170*cdf0e10cSrcweir 					xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, awt::Size( aTmp.Width(), aTmp.Height() ) );
171*cdf0e10cSrcweir 				}
172*cdf0e10cSrcweir 				catch( uno::Exception& )
173*cdf0e10cSrcweir 				{
174*cdf0e10cSrcweir 					OSL_ENSURE( sal_False, "Couldn't set the visual area for the object!\n" );
175*cdf0e10cSrcweir 				}
176*cdf0e10cSrcweir 			}
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 			return true;
179*cdf0e10cSrcweir 		}
180*cdf0e10cSrcweir 		break;
181*cdf0e10cSrcweir 	}
182*cdf0e10cSrcweir 	case OWN_ATTR_OLE_ASPECT:
183*cdf0e10cSrcweir 	{
184*cdf0e10cSrcweir 		sal_Int64 nAspect = 0;
185*cdf0e10cSrcweir 		if( rValue >>= nAspect )
186*cdf0e10cSrcweir 		{
187*cdf0e10cSrcweir 			static_cast<SdrOle2Obj*>(mpObj.get())->SetAspect( nAspect );
188*cdf0e10cSrcweir 			return true;
189*cdf0e10cSrcweir 		}
190*cdf0e10cSrcweir 		break;
191*cdf0e10cSrcweir 	}
192*cdf0e10cSrcweir 	case OWN_ATTR_CLSID:
193*cdf0e10cSrcweir 	{
194*cdf0e10cSrcweir 		OUString aCLSID;
195*cdf0e10cSrcweir 		if( rValue >>= aCLSID )
196*cdf0e10cSrcweir 		{
197*cdf0e10cSrcweir 			// init a ole object with a global name
198*cdf0e10cSrcweir 			SvGlobalName aClassName;
199*cdf0e10cSrcweir 			if( aClassName.MakeId( aCLSID ) )
200*cdf0e10cSrcweir 			{
201*cdf0e10cSrcweir 				if( createObject( aClassName ) )
202*cdf0e10cSrcweir 					return true;
203*cdf0e10cSrcweir 			}
204*cdf0e10cSrcweir 		}
205*cdf0e10cSrcweir 		break;
206*cdf0e10cSrcweir 	}
207*cdf0e10cSrcweir 	case OWN_ATTR_THUMBNAIL:
208*cdf0e10cSrcweir 	{
209*cdf0e10cSrcweir 		OUString aURL;
210*cdf0e10cSrcweir 		if( rValue >>= aURL )
211*cdf0e10cSrcweir 		{
212*cdf0e10cSrcweir 			GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) );
213*cdf0e10cSrcweir 			static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic( &aGrafObj.GetGraphic() );
214*cdf0e10cSrcweir 			return true;
215*cdf0e10cSrcweir 		}
216*cdf0e10cSrcweir 		break;
217*cdf0e10cSrcweir 	}
218*cdf0e10cSrcweir 	case OWN_ATTR_VALUE_GRAPHIC:
219*cdf0e10cSrcweir 	{
220*cdf0e10cSrcweir 		uno::Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
221*cdf0e10cSrcweir 		if( xGraphic.is() )
222*cdf0e10cSrcweir 		{
223*cdf0e10cSrcweir 			SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
224*cdf0e10cSrcweir 			if( pOle )
225*cdf0e10cSrcweir 			{
226*cdf0e10cSrcweir 				GraphicObject aGrafObj( xGraphic );
227*cdf0e10cSrcweir 				const Graphic aGraphic( aGrafObj.GetGraphic() );
228*cdf0e10cSrcweir 				pOle->SetGraphicToObj( aGraphic, rtl::OUString() );
229*cdf0e10cSrcweir 			}
230*cdf0e10cSrcweir 			return true;
231*cdf0e10cSrcweir 		}
232*cdf0e10cSrcweir 		break;
233*cdf0e10cSrcweir 	}
234*cdf0e10cSrcweir 	case OWN_ATTR_PERSISTNAME:
235*cdf0e10cSrcweir     {
236*cdf0e10cSrcweir 		OUString aPersistName;
237*cdf0e10cSrcweir         if( rValue >>= aPersistName )
238*cdf0e10cSrcweir 		{
239*cdf0e10cSrcweir 			static_cast<SdrOle2Obj*>(mpObj.get())->SetPersistName( aPersistName );
240*cdf0e10cSrcweir             return true;
241*cdf0e10cSrcweir 		}
242*cdf0e10cSrcweir 		break;
243*cdf0e10cSrcweir     }
244*cdf0e10cSrcweir 	case OWN_ATTR_OLE_LINKURL:
245*cdf0e10cSrcweir 	{
246*cdf0e10cSrcweir 		OUString aLinkURL;
247*cdf0e10cSrcweir 		if( rValue >>= aLinkURL )
248*cdf0e10cSrcweir 		{
249*cdf0e10cSrcweir 			createLink( aLinkURL );
250*cdf0e10cSrcweir 			return true;
251*cdf0e10cSrcweir 		}
252*cdf0e10cSrcweir 		break;
253*cdf0e10cSrcweir 	}
254*cdf0e10cSrcweir 	default:
255*cdf0e10cSrcweir         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
256*cdf0e10cSrcweir 	}
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 	throw IllegalArgumentException();
259*cdf0e10cSrcweir }
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir bool SvxOle2Shape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
262*cdf0e10cSrcweir {
263*cdf0e10cSrcweir 	switch( pProperty->nWID )
264*cdf0e10cSrcweir 	{
265*cdf0e10cSrcweir 	case OWN_ATTR_CLSID:
266*cdf0e10cSrcweir 	{
267*cdf0e10cSrcweir 		OUString aCLSID;
268*cdf0e10cSrcweir 		SvGlobalName aClassName = GetClassName_Impl(aCLSID);
269*cdf0e10cSrcweir 		rValue <<= aCLSID;
270*cdf0e10cSrcweir 		break;
271*cdf0e10cSrcweir 	}
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 	case OWN_ATTR_INTERNAL_OLE:
274*cdf0e10cSrcweir 	{
275*cdf0e10cSrcweir 		rtl::OUString sCLSID;
276*cdf0e10cSrcweir 		rValue <<= SotExchange::IsInternal( GetClassName_Impl(sCLSID) );
277*cdf0e10cSrcweir 		break;
278*cdf0e10cSrcweir 	}
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	case OWN_ATTR_METAFILE:
281*cdf0e10cSrcweir 	{
282*cdf0e10cSrcweir 		SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
283*cdf0e10cSrcweir 		if( pObj )
284*cdf0e10cSrcweir 		{
285*cdf0e10cSrcweir 			Graphic* pGraphic = pObj->GetGraphic();
286*cdf0e10cSrcweir 			if( pGraphic )
287*cdf0e10cSrcweir 			{
288*cdf0e10cSrcweir 				sal_Bool bIsWMF = sal_False;
289*cdf0e10cSrcweir 				if ( pGraphic->IsLink() )
290*cdf0e10cSrcweir 				{
291*cdf0e10cSrcweir 					GfxLink aLnk = pGraphic->GetLink();
292*cdf0e10cSrcweir 					if ( aLnk.GetType() == GFX_LINK_TYPE_NATIVE_WMF )
293*cdf0e10cSrcweir 					{
294*cdf0e10cSrcweir 						bIsWMF = sal_True;
295*cdf0e10cSrcweir 						uno::Sequence<sal_Int8> aSeq((sal_Int8*)aLnk.GetData(), (sal_Int32) aLnk.GetDataSize());
296*cdf0e10cSrcweir 						rValue <<= aSeq;
297*cdf0e10cSrcweir 					}
298*cdf0e10cSrcweir 				}
299*cdf0e10cSrcweir 				if ( !bIsWMF )
300*cdf0e10cSrcweir 				{
301*cdf0e10cSrcweir 					GDIMetaFile aMtf;
302*cdf0e10cSrcweir 					if ( pGraphic->GetType() != GRAPHIC_BITMAP )
303*cdf0e10cSrcweir 						aMtf = pObj->GetGraphic()->GetGDIMetaFile();
304*cdf0e10cSrcweir 					else
305*cdf0e10cSrcweir 					{
306*cdf0e10cSrcweir 						VirtualDevice aVirDev;
307*cdf0e10cSrcweir 						aMtf.Record( &aVirDev );
308*cdf0e10cSrcweir 						pGraphic->Draw( &aVirDev, Point(),  pGraphic->GetPrefSize() );
309*cdf0e10cSrcweir 						aMtf.Stop();
310*cdf0e10cSrcweir 						aMtf.SetPrefSize( pGraphic->GetPrefSize() );
311*cdf0e10cSrcweir 						aMtf.SetPrefMapMode( pGraphic->GetPrefMapMode() );
312*cdf0e10cSrcweir 					}
313*cdf0e10cSrcweir 					SvMemoryStream aDestStrm( 65535, 65535 );
314*cdf0e10cSrcweir 					ConvertGDIMetaFileToWMF( aMtf, aDestStrm, NULL, sal_False );
315*cdf0e10cSrcweir                     const uno::Sequence<sal_Int8> aSeq(
316*cdf0e10cSrcweir                         static_cast< const sal_Int8* >(aDestStrm.GetData()),
317*cdf0e10cSrcweir                         aDestStrm.GetEndOfData());
318*cdf0e10cSrcweir 					rValue <<= aSeq;
319*cdf0e10cSrcweir 				}
320*cdf0e10cSrcweir 			}
321*cdf0e10cSrcweir 		}
322*cdf0e10cSrcweir 		else
323*cdf0e10cSrcweir 		{
324*cdf0e10cSrcweir 			rValue = GetBitmap( sal_True );
325*cdf0e10cSrcweir 		}
326*cdf0e10cSrcweir 		break;
327*cdf0e10cSrcweir 	}
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 	case OWN_ATTR_OLE_VISAREA:
330*cdf0e10cSrcweir 	{
331*cdf0e10cSrcweir 		awt::Rectangle aVisArea;
332*cdf0e10cSrcweir 		if( mpObj->ISA(SdrOle2Obj))
333*cdf0e10cSrcweir 		{
334*cdf0e10cSrcweir 			MapMode aMapMode( MAP_100TH_MM ); // the API uses this map mode
335*cdf0e10cSrcweir 			Size aTmp = ((SdrOle2Obj*)mpObj.get())->GetOrigObjSize( &aMapMode ); // get the size in the requested map mode
336*cdf0e10cSrcweir 			aVisArea = awt::Rectangle( 0, 0, aTmp.Width(), aTmp.Height() );
337*cdf0e10cSrcweir 		}
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 		rValue <<= aVisArea;
340*cdf0e10cSrcweir 		break;
341*cdf0e10cSrcweir 	}
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir 	case OWN_ATTR_OLESIZE:
344*cdf0e10cSrcweir 	{
345*cdf0e10cSrcweir 		Size aTmp( static_cast<SdrOle2Obj*>(mpObj.get())->GetOrigObjSize() );
346*cdf0e10cSrcweir 		rValue <<= awt::Size( aTmp.Width(), aTmp.Height() );
347*cdf0e10cSrcweir 		break;
348*cdf0e10cSrcweir 	}
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir 	case OWN_ATTR_OLE_ASPECT:
351*cdf0e10cSrcweir 	{
352*cdf0e10cSrcweir 		rValue <<= static_cast<SdrOle2Obj*>(mpObj.get())->GetAspect();
353*cdf0e10cSrcweir 		break;
354*cdf0e10cSrcweir 	}
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 	case OWN_ATTR_OLEMODEL:
357*cdf0e10cSrcweir 	case OWN_ATTR_OLE_EMBEDDED_OBJECT:
358*cdf0e10cSrcweir 	case OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT:
359*cdf0e10cSrcweir 	{
360*cdf0e10cSrcweir 		SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>( mpObj.get() );
361*cdf0e10cSrcweir 		if( pObj )
362*cdf0e10cSrcweir 		{
363*cdf0e10cSrcweir             uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
364*cdf0e10cSrcweir             if ( xObj.is()
365*cdf0e10cSrcweir 			  && ( pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT || svt::EmbeddedObjectRef::TryRunningState( xObj ) ) )
366*cdf0e10cSrcweir 			{
367*cdf0e10cSrcweir 				// Discussed with CL fue to the before GetPaintingPageView
368*cdf0e10cSrcweir 				// usage. Removed it, former fallback is used now
369*cdf0e10cSrcweir                 if ( pProperty->nWID == OWN_ATTR_OLEMODEL || pProperty->nWID == OWN_ATTR_OLE_EMBEDDED_OBJECT )
370*cdf0e10cSrcweir                 {
371*cdf0e10cSrcweir #ifdef DBG_UTIL
372*cdf0e10cSrcweir 				    const sal_Bool bSuccess(pObj->AddOwnLightClient());
373*cdf0e10cSrcweir 				    OSL_ENSURE( bSuccess, "An object without client is provided!" );
374*cdf0e10cSrcweir #else
375*cdf0e10cSrcweir 				    pObj->AddOwnLightClient();
376*cdf0e10cSrcweir #endif
377*cdf0e10cSrcweir                 }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 				if ( pProperty->nWID == OWN_ATTR_OLEMODEL )
380*cdf0e10cSrcweir 					rValue <<= pObj->GetObjRef()->getComponent();
381*cdf0e10cSrcweir 				else
382*cdf0e10cSrcweir 					rValue <<= xObj;
383*cdf0e10cSrcweir 			}
384*cdf0e10cSrcweir 		}
385*cdf0e10cSrcweir 		break;
386*cdf0e10cSrcweir 	}
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 	case OWN_ATTR_VALUE_GRAPHIC:
389*cdf0e10cSrcweir 	{
390*cdf0e10cSrcweir 		uno::Reference< graphic::XGraphic > xGraphic;
391*cdf0e10cSrcweir 		Graphic* pGraphic = static_cast<SdrOle2Obj*>( mpObj.get() )->GetGraphic();
392*cdf0e10cSrcweir 		if( pGraphic )
393*cdf0e10cSrcweir 			xGraphic = pGraphic->GetXGraphic();
394*cdf0e10cSrcweir 		rValue <<= xGraphic;
395*cdf0e10cSrcweir 		break;
396*cdf0e10cSrcweir 	}
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir 	case OWN_ATTR_THUMBNAIL:
399*cdf0e10cSrcweir 	{
400*cdf0e10cSrcweir 		OUString    aURL;
401*cdf0e10cSrcweir 		SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
402*cdf0e10cSrcweir         if( pOle )
403*cdf0e10cSrcweir 		{
404*cdf0e10cSrcweir 			Graphic* pGraphic = pOle->GetGraphic();
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir 			// if there isn't already a preview graphic set, check if we need to generate
407*cdf0e10cSrcweir 			// one if model says so
408*cdf0e10cSrcweir 			if( pGraphic == NULL && !pOle->IsEmptyPresObj() && mpModel->IsSaveOLEPreview() )
409*cdf0e10cSrcweir                 pGraphic = pOle->GetGraphic();
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 			if( pGraphic )
412*cdf0e10cSrcweir 			{
413*cdf0e10cSrcweir 				GraphicObject aObj( *pGraphic );
414*cdf0e10cSrcweir 				aURL = OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX));
415*cdf0e10cSrcweir 				aURL += OUString::createFromAscii( aObj.GetUniqueID().GetBuffer() );
416*cdf0e10cSrcweir 			}
417*cdf0e10cSrcweir 		}
418*cdf0e10cSrcweir 		rValue <<= aURL;
419*cdf0e10cSrcweir 		break;
420*cdf0e10cSrcweir 	}
421*cdf0e10cSrcweir 	case OWN_ATTR_PERSISTNAME:
422*cdf0e10cSrcweir     {
423*cdf0e10cSrcweir 		OUString    aPersistName;
424*cdf0e10cSrcweir 		SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir         if( pOle )
427*cdf0e10cSrcweir 		{
428*cdf0e10cSrcweir             aPersistName = pOle->GetPersistName();
429*cdf0e10cSrcweir 			if( aPersistName.getLength() )
430*cdf0e10cSrcweir 			{
431*cdf0e10cSrcweir                 ::comphelper::IEmbeddedHelper *pPersist = mpObj->GetModel()->GetPersist();
432*cdf0e10cSrcweir                 if( (NULL == pPersist) || !pPersist->getEmbeddedObjectContainer().HasEmbeddedObject( pOle->GetPersistName() ) )
433*cdf0e10cSrcweir 					aPersistName = OUString();
434*cdf0e10cSrcweir 			}
435*cdf0e10cSrcweir 		}
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir 		rValue <<= aPersistName;
438*cdf0e10cSrcweir 		break;
439*cdf0e10cSrcweir     }
440*cdf0e10cSrcweir 	case OWN_ATTR_OLE_LINKURL:
441*cdf0e10cSrcweir 	{
442*cdf0e10cSrcweir 		OUString    aLinkURL;
443*cdf0e10cSrcweir 		SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir         if( pOle )
446*cdf0e10cSrcweir 		{
447*cdf0e10cSrcweir 			uno::Reference< embed::XLinkageSupport > xLink( pOle->GetObjRef(), uno::UNO_QUERY );
448*cdf0e10cSrcweir 			if ( xLink.is() && xLink->isLink() )
449*cdf0e10cSrcweir 				aLinkURL = xLink->getLinkURL();
450*cdf0e10cSrcweir 		}
451*cdf0e10cSrcweir 
452*cdf0e10cSrcweir 		rValue <<= aLinkURL;
453*cdf0e10cSrcweir 		break;
454*cdf0e10cSrcweir 	}
455*cdf0e10cSrcweir 	default:
456*cdf0e10cSrcweir         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
457*cdf0e10cSrcweir 	}
458*cdf0e10cSrcweir 
459*cdf0e10cSrcweir 	return true;
460*cdf0e10cSrcweir }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir sal_Bool SvxOle2Shape::createObject( const SvGlobalName &aClassName )
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir     DBG_TESTSOLARMUTEX();
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
467*cdf0e10cSrcweir     if ( !pOle2Obj || !pOle2Obj->IsEmpty() )
468*cdf0e10cSrcweir 		return sal_False;
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir 	// create storage and inplace object
471*cdf0e10cSrcweir     ::comphelper::IEmbeddedHelper*     pPersist = mpModel->GetPersist();
472*cdf0e10cSrcweir     ::rtl::OUString              aPersistName;
473*cdf0e10cSrcweir     OUString            aTmpStr;
474*cdf0e10cSrcweir 	if( getPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ) ) >>= aTmpStr )
475*cdf0e10cSrcweir         aPersistName = aTmpStr;
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir     //TODO/LATER: how to cope with creation failure?!
478*cdf0e10cSrcweir     uno::Reference < embed::XEmbeddedObject > xObj( pPersist->getEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aPersistName ) );
479*cdf0e10cSrcweir     if( xObj.is() )
480*cdf0e10cSrcweir     {
481*cdf0e10cSrcweir         Rectangle aRect = pOle2Obj->GetLogicRect();
482*cdf0e10cSrcweir         if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 )
483*cdf0e10cSrcweir         {
484*cdf0e10cSrcweir 			// TODO/LATER: is it possible that this method is used to create an iconified object?
485*cdf0e10cSrcweir             // default size
486*cdf0e10cSrcweir 			try
487*cdf0e10cSrcweir 			{
488*cdf0e10cSrcweir             	awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->GetAspect() );
489*cdf0e10cSrcweir             	aRect.SetSize( Size( aSz.Width, aSz.Height ) );
490*cdf0e10cSrcweir 			}
491*cdf0e10cSrcweir 			catch( embed::NoVisualAreaSizeException& )
492*cdf0e10cSrcweir 			{}
493*cdf0e10cSrcweir             pOle2Obj->SetLogicRect( aRect );
494*cdf0e10cSrcweir         }
495*cdf0e10cSrcweir         else
496*cdf0e10cSrcweir         {
497*cdf0e10cSrcweir             awt::Size aSz;
498*cdf0e10cSrcweir             Size aSize = pOle2Obj->GetLogicRect().GetSize();
499*cdf0e10cSrcweir             aSz.Width = aSize.Width();
500*cdf0e10cSrcweir             aSz.Height = aSize.Height();
501*cdf0e10cSrcweir 			xObj->setVisualAreaSize(  pOle2Obj->GetAspect(), aSz );
502*cdf0e10cSrcweir         }
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir 		// connect the object after the visual area is set
505*cdf0e10cSrcweir         setPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ), Any( aTmpStr = aPersistName ) );
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir 		// the object is inserted during setting of PersistName property usually
508*cdf0e10cSrcweir 		if( pOle2Obj->IsEmpty() )
509*cdf0e10cSrcweir 			pOle2Obj->SetObjRef( xObj );
510*cdf0e10cSrcweir     }
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir     return xObj.is();
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir sal_Bool SvxOle2Shape::createLink( const ::rtl::OUString& aLinkURL )
516*cdf0e10cSrcweir {
517*cdf0e10cSrcweir     DBG_TESTSOLARMUTEX();
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 	SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
520*cdf0e10cSrcweir     if ( !pOle2Obj || !pOle2Obj->IsEmpty() )
521*cdf0e10cSrcweir 		return sal_False;
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir     ::rtl::OUString aPersistName;
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir     ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir 	uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
528*cdf0e10cSrcweir 	aMediaDescr[0].Name = ::rtl::OUString::createFromAscii( "URL" );
529*cdf0e10cSrcweir 	aMediaDescr[0].Value <<= aLinkURL;
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir 	uno::Reference< task::XInteractionHandler > xInteraction = pPersist->getInteractionHandler();
532*cdf0e10cSrcweir 	if ( xInteraction.is() )
533*cdf0e10cSrcweir 	{
534*cdf0e10cSrcweir 		aMediaDescr.realloc( 2 );
535*cdf0e10cSrcweir 		aMediaDescr[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) );
536*cdf0e10cSrcweir 		aMediaDescr[1].Value <<= xInteraction;
537*cdf0e10cSrcweir 	}
538*cdf0e10cSrcweir 
539*cdf0e10cSrcweir     //TODO/LATER: how to cope with creation failure?!
540*cdf0e10cSrcweir 	uno::Reference< embed::XEmbeddedObject > xObj =
541*cdf0e10cSrcweir 			pPersist->getEmbeddedObjectContainer().InsertEmbeddedLink( aMediaDescr , aPersistName );
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir     if( xObj.is() )
544*cdf0e10cSrcweir     {
545*cdf0e10cSrcweir         Rectangle aRect = pOle2Obj->GetLogicRect();
546*cdf0e10cSrcweir         if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 )
547*cdf0e10cSrcweir         {
548*cdf0e10cSrcweir             // default size
549*cdf0e10cSrcweir 			try
550*cdf0e10cSrcweir 			{
551*cdf0e10cSrcweir             	awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->GetAspect() );
552*cdf0e10cSrcweir             	aRect.SetSize( Size( aSz.Width, aSz.Height ) );
553*cdf0e10cSrcweir 			}
554*cdf0e10cSrcweir 			catch( embed::NoVisualAreaSizeException& )
555*cdf0e10cSrcweir 			{}
556*cdf0e10cSrcweir 			pOle2Obj->SetLogicRect( aRect );
557*cdf0e10cSrcweir         }
558*cdf0e10cSrcweir         else
559*cdf0e10cSrcweir         {
560*cdf0e10cSrcweir             awt::Size aSz;
561*cdf0e10cSrcweir             Size aSize = pOle2Obj->GetLogicRect().GetSize();
562*cdf0e10cSrcweir             aSz.Width = aSize.Width();
563*cdf0e10cSrcweir             aSz.Height = aSize.Height();
564*cdf0e10cSrcweir             xObj->setVisualAreaSize(  pOle2Obj->GetAspect(), aSz );
565*cdf0e10cSrcweir         }
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir 		// connect the object after the visual area is set
568*cdf0e10cSrcweir         setPropertyValue( OUString::createFromAscii( UNO_NAME_OLE2_PERSISTNAME ), uno::makeAny( aPersistName ) );
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir 		// the object is inserted during setting of PersistName property usually
571*cdf0e10cSrcweir 		if ( pOle2Obj->IsEmpty() )
572*cdf0e10cSrcweir 			pOle2Obj->SetObjRef( xObj );
573*cdf0e10cSrcweir     }
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir     return xObj.is();
576*cdf0e10cSrcweir }
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir void SvxOle2Shape::resetModifiedState()
579*cdf0e10cSrcweir {
580*cdf0e10cSrcweir 	::comphelper::IEmbeddedHelper* pPersist = mpModel ? mpModel->GetPersist() : 0;
581*cdf0e10cSrcweir 	if( pPersist && !pPersist->isEnableSetModified() )
582*cdf0e10cSrcweir 	{
583*cdf0e10cSrcweir 		SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
584*cdf0e10cSrcweir         if( pOle && !pOle->IsEmpty() )
585*cdf0e10cSrcweir 		{
586*cdf0e10cSrcweir             uno::Reference < util::XModifiable > xMod( pOle->GetObjRef(), uno::UNO_QUERY );
587*cdf0e10cSrcweir             if( xMod.is() )
588*cdf0e10cSrcweir                 // TODO/MBA: what's this?!
589*cdf0e10cSrcweir                 xMod->setModified( sal_False );
590*cdf0e10cSrcweir 		}
591*cdf0e10cSrcweir 	}
592*cdf0e10cSrcweir }
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir const SvGlobalName SvxOle2Shape::GetClassName_Impl(rtl::OUString& rHexCLSID)
595*cdf0e10cSrcweir {
596*cdf0e10cSrcweir     DBG_TESTSOLARMUTEX();
597*cdf0e10cSrcweir 	SvGlobalName aClassName;
598*cdf0e10cSrcweir 	SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir 	if( pOle2Obj )
601*cdf0e10cSrcweir 	{
602*cdf0e10cSrcweir 		rHexCLSID = rtl::OUString();
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir 		if( pOle2Obj->IsEmpty() )
605*cdf0e10cSrcweir 		{
606*cdf0e10cSrcweir             ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
607*cdf0e10cSrcweir             if( pPersist )
608*cdf0e10cSrcweir 			{
609*cdf0e10cSrcweir                 uno::Reference < embed::XEmbeddedObject > xObj =
610*cdf0e10cSrcweir                         pPersist->getEmbeddedObjectContainer().GetEmbeddedObject( pOle2Obj->GetPersistName() );
611*cdf0e10cSrcweir                 if ( xObj.is() )
612*cdf0e10cSrcweir 				{
613*cdf0e10cSrcweir                     aClassName = SvGlobalName( xObj->getClassID() );
614*cdf0e10cSrcweir 					rHexCLSID = aClassName.GetHexName();
615*cdf0e10cSrcweir 				}
616*cdf0e10cSrcweir             }
617*cdf0e10cSrcweir 		}
618*cdf0e10cSrcweir 
619*cdf0e10cSrcweir         if (!rHexCLSID.getLength())
620*cdf0e10cSrcweir 		{
621*cdf0e10cSrcweir             uno::Reference < embed::XEmbeddedObject > xObj( pOle2Obj->GetObjRef() );
622*cdf0e10cSrcweir             if ( xObj.is() )
623*cdf0e10cSrcweir 			{
624*cdf0e10cSrcweir                 aClassName = SvGlobalName( xObj->getClassID() );
625*cdf0e10cSrcweir 				rHexCLSID = aClassName.GetHexName();
626*cdf0e10cSrcweir             }
627*cdf0e10cSrcweir 		}
628*cdf0e10cSrcweir 	}
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir     return aClassName;
631*cdf0e10cSrcweir }
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir SvxAppletShape::SvxAppletShape( SdrObject* pObject ) throw()
636*cdf0e10cSrcweir : SvxOle2Shape( pObject, aSvxMapProvider.GetMap(SVXMAP_APPLET), aSvxMapProvider.GetPropertySet(SVXMAP_APPLET, SdrObject::GetGlobalDrawObjectItemPool())  )
637*cdf0e10cSrcweir {
638*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AppletShape" ) ) );
639*cdf0e10cSrcweir }
640*cdf0e10cSrcweir 
641*cdf0e10cSrcweir SvxAppletShape::~SvxAppletShape() throw()
642*cdf0e10cSrcweir {
643*cdf0e10cSrcweir }
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir void SvxAppletShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir 	SvxShape::Create( pNewObj, pNewPage );
648*cdf0e10cSrcweir 	const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
649*cdf0e10cSrcweir 	createObject(aAppletClassId);
650*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AppletShape" ) ) );
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir void SAL_CALL SvxAppletShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& rValue ) 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)
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir 	SvxShape::setPropertyValue( aPropertyName, rValue );
656*cdf0e10cSrcweir 	resetModifiedState();
657*cdf0e10cSrcweir }
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir void SAL_CALL SvxAppletShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
660*cdf0e10cSrcweir {
661*cdf0e10cSrcweir 	SvxShape::setPropertyValues( aPropertyNames, rValues );
662*cdf0e10cSrcweir 	resetModifiedState();
663*cdf0e10cSrcweir }
664*cdf0e10cSrcweir 
665*cdf0e10cSrcweir bool SvxAppletShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) 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)
666*cdf0e10cSrcweir {
667*cdf0e10cSrcweir 	if( (pProperty->nWID >= OWN_ATTR_APPLET_DOCBASE) && (pProperty->nWID <= OWN_ATTR_APPLET_ISSCRIPT) )
668*cdf0e10cSrcweir 	{
669*cdf0e10cSrcweir         if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
670*cdf0e10cSrcweir 		{
671*cdf0e10cSrcweir 	        uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
672*cdf0e10cSrcweir 		    if( xSet.is() )
673*cdf0e10cSrcweir 			{
674*cdf0e10cSrcweir 				// allow exceptions to pass through
675*cdf0e10cSrcweir                 xSet->setPropertyValue( rName, rValue );
676*cdf0e10cSrcweir 			}
677*cdf0e10cSrcweir 		}
678*cdf0e10cSrcweir 		return true;
679*cdf0e10cSrcweir 	}
680*cdf0e10cSrcweir 	else
681*cdf0e10cSrcweir 	{
682*cdf0e10cSrcweir         return SvxOle2Shape::setPropertyValueImpl( rName, pProperty, rValue );
683*cdf0e10cSrcweir 	}
684*cdf0e10cSrcweir }
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir bool SvxAppletShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
687*cdf0e10cSrcweir {
688*cdf0e10cSrcweir     if( (pProperty->nWID >= OWN_ATTR_APPLET_DOCBASE) && (pProperty->nWID <= OWN_ATTR_APPLET_ISSCRIPT) )
689*cdf0e10cSrcweir 	{
690*cdf0e10cSrcweir         if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
691*cdf0e10cSrcweir 		{
692*cdf0e10cSrcweir 			uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
693*cdf0e10cSrcweir 			if( xSet.is() )
694*cdf0e10cSrcweir 			{
695*cdf0e10cSrcweir                 rValue = xSet->getPropertyValue( rName );
696*cdf0e10cSrcweir 			}
697*cdf0e10cSrcweir         }
698*cdf0e10cSrcweir 		return true;
699*cdf0e10cSrcweir 	}
700*cdf0e10cSrcweir 	else
701*cdf0e10cSrcweir 	{
702*cdf0e10cSrcweir         return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
703*cdf0e10cSrcweir 	}
704*cdf0e10cSrcweir }
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir SvxPluginShape::SvxPluginShape( SdrObject* pObject ) throw()
709*cdf0e10cSrcweir : SvxOle2Shape( pObject, aSvxMapProvider.GetMap(SVXMAP_PLUGIN), aSvxMapProvider.GetPropertySet(SVXMAP_PLUGIN, SdrObject::GetGlobalDrawObjectItemPool()) )
710*cdf0e10cSrcweir {
711*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.PluginShape" ) ) );
712*cdf0e10cSrcweir }
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir SvxPluginShape::~SvxPluginShape() throw()
715*cdf0e10cSrcweir {
716*cdf0e10cSrcweir }
717*cdf0e10cSrcweir 
718*cdf0e10cSrcweir void SvxPluginShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
719*cdf0e10cSrcweir {
720*cdf0e10cSrcweir 	SvxShape::Create( pNewObj, pNewPage );
721*cdf0e10cSrcweir 	const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
722*cdf0e10cSrcweir 	createObject(aPluginClassId);
723*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.PluginShape" ) ) );
724*cdf0e10cSrcweir }
725*cdf0e10cSrcweir 
726*cdf0e10cSrcweir void SAL_CALL SvxPluginShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& rValue ) 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)
727*cdf0e10cSrcweir {
728*cdf0e10cSrcweir 	SvxShape::setPropertyValue( aPropertyName, rValue );
729*cdf0e10cSrcweir 	resetModifiedState();
730*cdf0e10cSrcweir }
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir void SAL_CALL SvxPluginShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
733*cdf0e10cSrcweir {
734*cdf0e10cSrcweir 	SvxOle2Shape::setPropertyValues( aPropertyNames, rValues );
735*cdf0e10cSrcweir 	resetModifiedState();
736*cdf0e10cSrcweir }
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir bool SvxPluginShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) 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)
739*cdf0e10cSrcweir {
740*cdf0e10cSrcweir 	if( (pProperty->nWID >= OWN_ATTR_PLUGIN_MIMETYPE) && (pProperty->nWID <= OWN_ATTR_PLUGIN_COMMANDS) )
741*cdf0e10cSrcweir 	{
742*cdf0e10cSrcweir         if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
743*cdf0e10cSrcweir 		{
744*cdf0e10cSrcweir 	        uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
745*cdf0e10cSrcweir 			if( xSet.is() )
746*cdf0e10cSrcweir 			{
747*cdf0e10cSrcweir                 // allow exceptions to pass through
748*cdf0e10cSrcweir                 xSet->setPropertyValue( rName, rValue );
749*cdf0e10cSrcweir 			}
750*cdf0e10cSrcweir 		}
751*cdf0e10cSrcweir 		return true;
752*cdf0e10cSrcweir 	}
753*cdf0e10cSrcweir 	else
754*cdf0e10cSrcweir 	{
755*cdf0e10cSrcweir         return SvxOle2Shape::setPropertyValueImpl( rName, pProperty, rValue );
756*cdf0e10cSrcweir 	}
757*cdf0e10cSrcweir }
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir bool SvxPluginShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
760*cdf0e10cSrcweir {
761*cdf0e10cSrcweir 	if( (pProperty->nWID >= OWN_ATTR_PLUGIN_MIMETYPE) && (pProperty->nWID <= OWN_ATTR_PLUGIN_COMMANDS) )
762*cdf0e10cSrcweir 	{
763*cdf0e10cSrcweir 		if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
764*cdf0e10cSrcweir 		{
765*cdf0e10cSrcweir 			uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
766*cdf0e10cSrcweir 			if( xSet.is() )
767*cdf0e10cSrcweir 			{
768*cdf0e10cSrcweir                 rValue <<= xSet->getPropertyValue( rName );
769*cdf0e10cSrcweir             }
770*cdf0e10cSrcweir 		}
771*cdf0e10cSrcweir 		return true;
772*cdf0e10cSrcweir 	}
773*cdf0e10cSrcweir 	else
774*cdf0e10cSrcweir 	{
775*cdf0e10cSrcweir         return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
776*cdf0e10cSrcweir 	}
777*cdf0e10cSrcweir }
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir SvxFrameShape::SvxFrameShape( SdrObject* pObject ) throw()
782*cdf0e10cSrcweir : SvxOle2Shape( pObject, aSvxMapProvider.GetMap(SVXMAP_FRAME), aSvxMapProvider.GetPropertySet(SVXMAP_FRAME, SdrObject::GetGlobalDrawObjectItemPool())  )
783*cdf0e10cSrcweir {
784*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FrameShape" ) ) );
785*cdf0e10cSrcweir }
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir SvxFrameShape::~SvxFrameShape() throw()
788*cdf0e10cSrcweir {
789*cdf0e10cSrcweir }
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir void SvxFrameShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw ()
792*cdf0e10cSrcweir {
793*cdf0e10cSrcweir 	SvxShape::Create( pNewObj, pNewPage );
794*cdf0e10cSrcweir 	const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
795*cdf0e10cSrcweir 	createObject(aIFrameClassId);
796*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FrameShape" ) ) );
797*cdf0e10cSrcweir }
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir void SAL_CALL SvxFrameShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& rValue ) 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)
800*cdf0e10cSrcweir {
801*cdf0e10cSrcweir 	SvxShape::setPropertyValue( aPropertyName, rValue );
802*cdf0e10cSrcweir 	resetModifiedState();
803*cdf0e10cSrcweir }
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir void SAL_CALL SvxFrameShape::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
806*cdf0e10cSrcweir {
807*cdf0e10cSrcweir 	SvxOle2Shape::setPropertyValues( aPropertyNames, rValues );
808*cdf0e10cSrcweir 	resetModifiedState();
809*cdf0e10cSrcweir }
810*cdf0e10cSrcweir 
811*cdf0e10cSrcweir bool SvxFrameShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) 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)
812*cdf0e10cSrcweir {
813*cdf0e10cSrcweir 	if( (pProperty->nWID >= OWN_ATTR_FRAME_URL) && (pProperty->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT) )
814*cdf0e10cSrcweir 	{
815*cdf0e10cSrcweir 		if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
816*cdf0e10cSrcweir 		{
817*cdf0e10cSrcweir 			uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
818*cdf0e10cSrcweir 			if( xSet.is() )
819*cdf0e10cSrcweir 			{
820*cdf0e10cSrcweir 				// allow exceptions to pass through
821*cdf0e10cSrcweir                 xSet->setPropertyValue( rName, rValue );
822*cdf0e10cSrcweir 			}
823*cdf0e10cSrcweir 		}
824*cdf0e10cSrcweir 		return true;
825*cdf0e10cSrcweir 	}
826*cdf0e10cSrcweir 	else
827*cdf0e10cSrcweir 	{
828*cdf0e10cSrcweir         return SvxOle2Shape::setPropertyValueImpl( rName, pProperty, rValue );
829*cdf0e10cSrcweir 	}
830*cdf0e10cSrcweir }
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir bool SvxFrameShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
833*cdf0e10cSrcweir {
834*cdf0e10cSrcweir 	if( (pProperty->nWID >= OWN_ATTR_FRAME_URL) && (pProperty->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT) )
835*cdf0e10cSrcweir 	{
836*cdf0e10cSrcweir 		if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
837*cdf0e10cSrcweir 		{
838*cdf0e10cSrcweir 			uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
839*cdf0e10cSrcweir 			if( xSet.is() )
840*cdf0e10cSrcweir 			{
841*cdf0e10cSrcweir                 rValue <<= xSet->getPropertyValue( rName );
842*cdf0e10cSrcweir 			}
843*cdf0e10cSrcweir 		}
844*cdf0e10cSrcweir 		return true;
845*cdf0e10cSrcweir 	}
846*cdf0e10cSrcweir 	else
847*cdf0e10cSrcweir 	{
848*cdf0e10cSrcweir         return SvxOle2Shape::getPropertyValueImpl( rName, pProperty, rValue );
849*cdf0e10cSrcweir 	}
850*cdf0e10cSrcweir }
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir /***********************************************************************
853*cdf0e10cSrcweir *                                                                      *
854*cdf0e10cSrcweir ***********************************************************************/
855*cdf0e10cSrcweir 
856*cdf0e10cSrcweir SvxMediaShape::SvxMediaShape( SdrObject* pObj ) throw()
857*cdf0e10cSrcweir :	SvxShape( pObj, aSvxMapProvider.GetMap(SVXMAP_MEDIA), aSvxMapProvider.GetPropertySet(SVXMAP_MEDIA, SdrObject::GetGlobalDrawObjectItemPool()) )
858*cdf0e10cSrcweir {
859*cdf0e10cSrcweir 	SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MediaShape" ) ) );
860*cdf0e10cSrcweir }
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir //----------------------------------------------------------------------
863*cdf0e10cSrcweir SvxMediaShape::~SvxMediaShape() throw()
864*cdf0e10cSrcweir {
865*cdf0e10cSrcweir }
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir //----------------------------------------------------------------------
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir bool SvxMediaShape::setPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) 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)
870*cdf0e10cSrcweir {
871*cdf0e10cSrcweir 	if( (pProperty->nWID >= OWN_ATTR_MEDIA_URL) && (pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM) )
872*cdf0e10cSrcweir 	{
873*cdf0e10cSrcweir 		SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() );
874*cdf0e10cSrcweir 		::avmedia::MediaItem aItem;
875*cdf0e10cSrcweir 		bool bOk = false;
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir 		switch( pProperty->nWID )
878*cdf0e10cSrcweir 		{
879*cdf0e10cSrcweir 		case OWN_ATTR_MEDIA_URL:
880*cdf0e10cSrcweir 		{
881*cdf0e10cSrcweir 			OUString aURL;
882*cdf0e10cSrcweir 			if( rValue >>= aURL )
883*cdf0e10cSrcweir 			{
884*cdf0e10cSrcweir 				bOk = true;
885*cdf0e10cSrcweir 				aItem.setURL( aURL );
886*cdf0e10cSrcweir 			}
887*cdf0e10cSrcweir 		}
888*cdf0e10cSrcweir 		break;
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir 		case( OWN_ATTR_MEDIA_LOOP ):
891*cdf0e10cSrcweir 		{
892*cdf0e10cSrcweir 			sal_Bool bLoop = sal_Bool();
893*cdf0e10cSrcweir 
894*cdf0e10cSrcweir 			if( rValue >>= bLoop )
895*cdf0e10cSrcweir 			{
896*cdf0e10cSrcweir 				bOk = true;
897*cdf0e10cSrcweir 				aItem.setLoop( bLoop );
898*cdf0e10cSrcweir 			}
899*cdf0e10cSrcweir 		}
900*cdf0e10cSrcweir 		break;
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir 		case( OWN_ATTR_MEDIA_MUTE ):
903*cdf0e10cSrcweir 		{
904*cdf0e10cSrcweir 			sal_Bool bMute = sal_Bool();
905*cdf0e10cSrcweir 
906*cdf0e10cSrcweir 			if( rValue >>= bMute )
907*cdf0e10cSrcweir 			{
908*cdf0e10cSrcweir 				bOk = true;
909*cdf0e10cSrcweir 				aItem.setMute( bMute );
910*cdf0e10cSrcweir 			}
911*cdf0e10cSrcweir 		}
912*cdf0e10cSrcweir 		break;
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir 		case( OWN_ATTR_MEDIA_VOLUMEDB ):
915*cdf0e10cSrcweir 		{
916*cdf0e10cSrcweir 			sal_Int16 nVolumeDB = sal_Int16();
917*cdf0e10cSrcweir 
918*cdf0e10cSrcweir 			if( rValue >>= nVolumeDB )
919*cdf0e10cSrcweir 			{
920*cdf0e10cSrcweir 				bOk = true;
921*cdf0e10cSrcweir 				aItem.setVolumeDB( nVolumeDB );
922*cdf0e10cSrcweir 			}
923*cdf0e10cSrcweir 		}
924*cdf0e10cSrcweir 		break;
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 		case( OWN_ATTR_MEDIA_ZOOM ):
927*cdf0e10cSrcweir 		{
928*cdf0e10cSrcweir 			::com::sun::star::media::ZoomLevel eLevel;
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir 			if( rValue >>= eLevel )
931*cdf0e10cSrcweir 			{
932*cdf0e10cSrcweir 				bOk = true;
933*cdf0e10cSrcweir 				aItem.setZoom( eLevel );
934*cdf0e10cSrcweir 			}
935*cdf0e10cSrcweir 		}
936*cdf0e10cSrcweir 		break;
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir 		default:
939*cdf0e10cSrcweir 			DBG_ERROR("SvxMediaShape::setPropertyValueImpl(), unknown argument!");
940*cdf0e10cSrcweir 		}
941*cdf0e10cSrcweir 
942*cdf0e10cSrcweir 		if( bOk )
943*cdf0e10cSrcweir 		{
944*cdf0e10cSrcweir 			pMedia->setMediaProperties( aItem );
945*cdf0e10cSrcweir 			return true;
946*cdf0e10cSrcweir 		}
947*cdf0e10cSrcweir 	}
948*cdf0e10cSrcweir 	else
949*cdf0e10cSrcweir 	{
950*cdf0e10cSrcweir         return SvxShape::setPropertyValueImpl( rName, pProperty, rValue );
951*cdf0e10cSrcweir 	}
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir 	throw IllegalArgumentException();
954*cdf0e10cSrcweir }
955*cdf0e10cSrcweir 
956*cdf0e10cSrcweir //----------------------------------------------------------------------
957*cdf0e10cSrcweir 
958*cdf0e10cSrcweir bool SvxMediaShape::getPropertyValueImpl( const ::rtl::OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
959*cdf0e10cSrcweir {
960*cdf0e10cSrcweir 	if( ( pProperty->nWID >= OWN_ATTR_MEDIA_URL ) && ( pProperty->nWID <= OWN_ATTR_MEDIA_ZOOM ) )
961*cdf0e10cSrcweir 	{
962*cdf0e10cSrcweir 		SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() );
963*cdf0e10cSrcweir 		const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() );
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 		switch( pProperty->nWID )
966*cdf0e10cSrcweir 		{
967*cdf0e10cSrcweir 			case OWN_ATTR_MEDIA_URL:
968*cdf0e10cSrcweir 				rValue <<= aItem.getURL();
969*cdf0e10cSrcweir 				break;
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir 			case( OWN_ATTR_MEDIA_LOOP ):
972*cdf0e10cSrcweir 				rValue <<= (sal_Bool) aItem.isLoop();
973*cdf0e10cSrcweir 				break;
974*cdf0e10cSrcweir 
975*cdf0e10cSrcweir 			case( OWN_ATTR_MEDIA_MUTE ):
976*cdf0e10cSrcweir 				rValue <<= (sal_Bool) aItem.isMute();
977*cdf0e10cSrcweir 				break;
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir 			case( OWN_ATTR_MEDIA_VOLUMEDB ):
980*cdf0e10cSrcweir 				rValue <<= (sal_Int16) aItem.getVolumeDB();
981*cdf0e10cSrcweir 				break;
982*cdf0e10cSrcweir 
983*cdf0e10cSrcweir 			case( OWN_ATTR_MEDIA_ZOOM ):
984*cdf0e10cSrcweir 				rValue <<= aItem.getZoom();
985*cdf0e10cSrcweir 				break;
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir 			default:
988*cdf0e10cSrcweir 				DBG_ERROR("SvxMediaShape::getPropertyValueImpl(), unknown property!");
989*cdf0e10cSrcweir 		}
990*cdf0e10cSrcweir 		return true;
991*cdf0e10cSrcweir 	}
992*cdf0e10cSrcweir 	else
993*cdf0e10cSrcweir 	{
994*cdf0e10cSrcweir         return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
995*cdf0e10cSrcweir 	}
996*cdf0e10cSrcweir }
997