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