20 #include <com/sun/star/util/XModifiable.hpp>
21 #include <com/sun/star/embed/XEmbeddedObject.hpp>
22 #include <com/sun/star/embed/XLinkageSupport.hpp>
23 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
24 #include <com/sun/star/embed/Aspects.hpp>
25 #include <com/sun/star/task/XInteractionHandler.hpp>
26 #include <com/sun/star/ucb/CommandFailedException.hpp>
27 #include <com/sun/star/ucb/ContentCreationException.hpp>
54 #include <config_features.h>
57 using namespace ::
cppu;
83 switch( pProperty->
nWID )
89 awt::Rectangle aVisArea;
90 if( (rValue >>= aVisArea) && dynamic_cast<const SdrOle2Obj* >(
GetSdrObject()) !=
nullptr)
92 Size aTmp( aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height );
101 xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, awt::Size( aTmp.Width(), aTmp.Height() ) );
103 catch( uno::Exception& )
105 OSL_FAIL(
"Couldn't set the visual area for the object!" );
115 sal_Int64 nAspect = 0;
116 if( rValue >>= nAspect )
126 if( rValue >>= aCLSID )
130 if( aClassName.
MakeId( aCLSID ) )
140 uno::Reference< graphic::XGraphic >
xGraphic( rValue, uno::UNO_QUERY );
143 const Graphic aGraphic(xGraphic);
151 uno::Reference< graphic::XGraphic >
xGraphic( rValue, uno::UNO_QUERY );
167 OUString aPersistName;
168 if( rValue >>= aPersistName )
171 #if OSL_DEBUG_LEVEL > 0
185 if( rValue >>= aLinkURL )
196 throw IllegalArgumentException();
201 switch( pProperty->
nWID )
230 if ( aLnk.
GetType() == GfxLinkType::NativeWmf )
233 uno::Sequence<sal_Int8>
aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.
GetData()), static_cast<sal_Int32>(aLnk.
GetDataSize()));
243 const uno::Sequence<sal_Int8>
aSeq(
244 static_cast< const sal_Int8* >(aDestStrm.GetData()),
245 aDestStrm.GetEndOfData());
259 awt::Rectangle aVisArea;
260 if( dynamic_cast<const SdrOle2Obj* >(
GetSdrObject()) !=
nullptr)
262 MapMode aMapMode( MapUnit::Map100thMM );
264 aVisArea = awt::Rectangle( 0, 0, aTmp.
Width(), aTmp.
Height() );
274 rValue <<= awt::Size( aTmp.
Width(), aTmp.
Height() );
280 rValue <<= static_cast<SdrOle2Obj*>(
GetSdrObject())->GetAspect();
291 uno::Reference < embed::XEmbeddedObject > xObj( pObj->
GetObjRef() );
300 SAL_WARN_IF(!bSuccess,
"svx.svdraw",
"An object without client is provided!");
304 rValue <<= pObj->
GetObjRef()->getComponent();
314 uno::Reference< graphic::XGraphic >
xGraphic;
324 uno::Reference< graphic::XGraphic >
xGraphic;
333 OUString aPersistName;
339 if( !aPersistName.isEmpty() )
343 aPersistName.clear();
347 rValue <<= aPersistName;
357 uno::Reference< embed::XLinkageSupport > xLink( pOle->
GetObjRef(), uno::UNO_QUERY );
358 if ( xLink.is() && xLink->isLink() )
359 aLinkURL = xLink->getLinkURL();
377 if ( !pOle2Obj || !pOle2Obj->
IsEmpty() )
382 OUString aPersistName;
385 aPersistName = aTmpStr;
391 uno::Reference<embed::XEmbeddedObject> xObj(
403 awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->
GetAspect() );
406 catch( embed::NoVisualAreaSizeException& )
415 aSz.Height = aSize.
Height();
416 if (aSz.Width != 0 || aSz.Height != 0)
419 xObj->setVisualAreaSize( pOle2Obj->
GetAspect(), aSz );
424 aTmpStr = aPersistName;
440 if ( !pOle2Obj || !pOle2Obj->
IsEmpty() )
443 OUString aPersistName;
447 uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
448 aMediaDescr[0].Name =
"URL";
449 aMediaDescr[0].Value <<= aLinkURL;
452 if ( xInteraction.is() )
454 aMediaDescr.realloc( 2 );
455 aMediaDescr[1].Name =
"InteractionHandler";
456 aMediaDescr[1].Value <<= xInteraction;
460 uno::Reference< embed::XEmbeddedObject > xObj =
472 awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->
GetAspect() );
475 catch( embed::NoVisualAreaSizeException& )
484 aSz.Height = aSize.
Height();
485 xObj->setVisualAreaSize( pOle2Obj->
GetAspect(), aSz );
504 uno::Reference < util::XModifiable > xMod( pOle->
GetObjRef(), uno::UNO_QUERY );
507 xMod->setModified(
false );
527 uno::Reference < embed::XEmbeddedObject > xObj =
537 if (rHexCLSID.isEmpty())
539 const uno::Reference < embed::XEmbeddedObject >& xObj( pOle2Obj->
GetObjRef() );
587 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
591 xSet->setPropertyValue( rName, rValue );
608 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
611 rValue = xSet->getPropertyValue( rName );
658 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
662 xSet->setPropertyValue( rName, rValue );
679 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
682 rValue = xSet->getPropertyValue( rName );
730 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
734 xSet->setPropertyValue( rName, rValue );
746 css::uno::Any& rValue)
752 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
755 rValue = xSet->getPropertyValue( rName );
789 switch( pProperty->
nWID )
792 #if HAVE_FEATURE_AVMEDIA
795 if( rValue >>= aURL )
805 #if HAVE_FEATURE_AVMEDIA
809 if( rValue >>= bLoop )
819 #if HAVE_FEATURE_AVMEDIA
823 if( rValue >>= bMute )
833 #if HAVE_FEATURE_AVMEDIA
835 sal_Int16 nVolumeDB = sal_Int16();
837 if( rValue >>= nVolumeDB )
847 #if HAVE_FEATURE_AVMEDIA
849 css::media::ZoomLevel eLevel;
851 if( rValue >>= eLevel )
861 #if HAVE_FEATURE_AVMEDIA
864 if( rValue >>= sMimeType )
874 #if HAVE_FEATURE_AVMEDIA
876 uno::Reference<graphic::XGraphic>
xGraphic(rValue, uno::UNO_QUERY);
887 #if HAVE_FEATURE_AVMEDIA
890 uno::Reference<io::XInputStream>
xStream;
891 if (rValue >>= xStream)
896 catch (
const css::ucb::ContentCreationException&)
899 throw css::lang::WrappedTargetException(
900 "ContentCreationException Setting InputStream!",
901 static_cast<OWeakObject *>(
this),
904 catch (
const css::ucb::CommandFailedException&)
907 throw css::lang::WrappedTargetException(
908 "CommandFailedException Setting InputStream!",
909 static_cast<OWeakObject *>(
this),
916 OSL_FAIL(
"SvxMediaShape::setPropertyValueImpl(), unknown argument!");
930 throw IllegalArgumentException();
947 switch( pProperty->
nWID )
950 #if HAVE_FEATURE_AVMEDIA
951 rValue <<= aItem.getURL();
956 #if HAVE_FEATURE_AVMEDIA
957 rValue <<= aItem.isLoop();
962 #if HAVE_FEATURE_AVMEDIA
963 rValue <<= aItem.isMute();
968 #if HAVE_FEATURE_AVMEDIA
969 rValue <<= aItem.getVolumeDB();
974 #if HAVE_FEATURE_AVMEDIA
975 rValue <<= aItem.getZoom();
984 catch (
const css::ucb::ContentCreationException&)
987 throw css::lang::WrappedTargetException(
988 "ContentCreationException Getting InputStream!",
989 static_cast < OWeakObject * > (
this ), anyEx );
991 catch (
const css::ucb::CommandFailedException&)
994 throw css::lang::WrappedTargetException(
995 "CommandFailedException Getting InputStream!",
996 static_cast < OWeakObject * > (
this ), anyEx );
1002 #if HAVE_FEATURE_AVMEDIA
1003 rValue <<= aItem.getTempURL();
1008 #if HAVE_FEATURE_AVMEDIA
1009 rValue <<= aItem.getMimeType();
1014 #if HAVE_FEATURE_AVMEDIA
1016 Graphic aGraphic = aItem.getGraphic();
1030 OSL_FAIL(
"SvxMediaShape::getPropertyValueImpl(), unknown property!");
#define OWN_ATTR_MEDIA_STREAM
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, css::uno::Any &rValue) override
virtual ~SvxOle2Shape() override
virtual bool isEnableSetModified() const =0
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
#define OWN_ATTR_FALLBACK_GRAPHIC
#define OWN_ATTR_OLE_ASPECT
#define OWN_ATTR_METAFILE
css::uno::Reference< css::embed::XEmbeddedObject > const & GetObjRef() const
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define OWN_ATTR_FRAME_URL
void SetPersistName(const OUString &rPersistName)
#define SO3_IFRAME_CLASSID
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, css::uno::Any &rValue) override
bool ConvertGDIMetaFileToWMF(const GDIMetaFile &rMTF, SvStream &rTargetStream, FilterConfigItem const *pConfigItem, bool bPlaceable)
#define OWN_ATTR_VALUE_GRAPHIC
css::uno::Sequence< sal_Int8 > GetByteSequence() const
virtual OUString getDocumentBaseURL() const =0
#define OWN_ATTR_FRAME_MARGIN_HEIGHT
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, const css::uno::Any &rValue) override
bool HasEmbeddedObject(const OUString &)
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
css::uno::Reference< css::embed::XEmbeddedObject > InsertEmbeddedLink(const css::uno::Sequence< css::beans::PropertyValue > &, OUString &)
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
#define OWN_ATTR_MEDIA_VOLUMEDB
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, css::uno::Any &rValue)
const sal_uInt8 * GetData() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage) override
void SetObjRef(const css::uno::Reference< css::embed::XEmbeddedObject > &rNewObjRef)
#define OWN_ATTR_MEDIA_TEMPFILEURL
#define OWN_ATTR_OLE_LINKURL
virtual ~SvxFrameShape() override
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage)
Any SAL_CALL getCaughtException()
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
virtual EmbeddedObjectContainer & getEmbeddedObjectContainer() const =0
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
const GDIMetaFile & GetGDIMetaFile() const
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, css::uno::Any &rValue) override
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
#define OWN_ATTR_PLUGIN_COMMANDS
bool createObject(const SvGlobalName &aClassName)
virtual ~SvxAppletShape() override
void SetShapeType(const OUString &ShapeType)
void SetGraphicToObj(const Graphic &aGraphic)
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, css::uno::Any &rValue) override
static bool IsInternal(const SvGlobalName &)
#define OWN_ATTR_OLE_EMBEDDED_OBJECT
#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT
virtual ~SvxPluginShape() override
#define OWN_ATTR_MEDIA_LOOP
OUString GetHexName() const
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, const css::uno::Any &rValue) override
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, css::uno::Any &rValue) override
#define OWN_ATTR_MEDIA_MIMETYPE
tools::Long Width() const
#define OWN_ATTR_OLE_VISAREA
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, const css::uno::Any &rValue) override
SdrModel & getSdrModelFromSdrObject() const
virtual void SetLogicRect(const tools::Rectangle &rRect)
#define SO3_APPLET_CLASSID
#define OWN_ATTR_THUMBNAIL
void createLink(const OUString &aLinkURL)
GfxLink GetGfxLink() const
void resetModifiedState()
#define OWN_ATTR_APPLET_ISSCRIPT
css::uno::Any GetBitmap(bool bMetaFile=false) const
css::uno::Reference< css::embed::XEmbeddedObject > GetEmbeddedObject(const OUString &, OUString const *pBaseURL=nullptr)
virtual css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler() const =0
#define OWN_ATTR_MEDIA_ZOOM
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, const css::uno::Any &rValue) override
#define OWN_ATTR_INTERNAL_OLE
sal_Int64 GetAspect() const
#define OWN_ATTR_PLUGIN_MIMETYPE
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
const Graphic & GetGraphic() const
#define SAL_WARN_IF(condition, area, stream)
::comphelper::IEmbeddedHelper * GetPersist() const
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, const css::uno::Any &rValue) override
GfxLinkType GetType() const
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage) override
#define OWN_ATTR_PERSISTNAME
SdrObject * GetSdrObject() const
tools::Long Height() const
const OUString & GetPersistName() const
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage) override
#define OWN_ATTR_APPLET_DOCBASE
Sequence< sal_Int8 > aSeq
#define OWN_ATTR_MEDIA_MUTE
SvxAppletShape(SdrObject *pObj)
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
sal_uInt32 GetDataSize() const
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
#define DBG_TESTSOLARMUTEX()
SvxFrameShape(SdrObject *pObj)
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertySimpleEntry *pProperty, const css::uno::Any &rValue)
SvxUnoPropertyMapProvider & getSvxMapProvider()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
#define SO3_PLUGIN_CLASSID
#define UNO_NAME_OLE2_PERSISTNAME
Reference< XGraphic > xGraphic
SvxOle2Shape(SdrObject *pObj)
#define OWN_ATTR_MEDIA_URL
bool MakeId(const OUString &rId)
#define OWN_ATTR_OLEMODEL
SvxPluginShape(SdrObject *pObj)
const Graphic * GetGraphic() const
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &aPropertyNames, const css::uno::Sequence< css::uno::Any > &aValues) override
virtual const tools::Rectangle & GetLogicRect() const override
SvGlobalName GetClassName_Impl(OUString &rHexCLSID)