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>
55 #include <config_features.h>
58 using namespace ::
cppu;
84 switch( pProperty->
nWID )
90 awt::Rectangle aVisArea;
91 if( !(rValue >>= aVisArea))
93 if(
auto pOle2Obj = dynamic_cast<SdrOle2Obj* >(
GetSdrObject()) )
95 Size aTmp( aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height );
96 uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef();
104 xObj->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, awt::Size( aTmp.Width(), aTmp.Height() ) );
106 catch( uno::Exception& )
108 OSL_FAIL(
"Couldn't set the visual area for the object!" );
118 sal_Int64 nAspect = 0;
119 if( rValue >>= nAspect )
129 if( rValue >>= aCLSID )
133 if( aClassName.
MakeId( aCLSID ) )
143 uno::Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
146 const Graphic aGraphic(xGraphic);
154 uno::Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
170 OUString aPersistName;
171 if( rValue >>= aPersistName )
174 #if OSL_DEBUG_LEVEL > 0
188 if( rValue >>= aLinkURL )
199 throw IllegalArgumentException();
204 switch( pProperty->
nWID )
233 if ( aLnk.
GetType() == GfxLinkType::NativeWmf )
236 uno::Sequence<sal_Int8>
aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.
GetData()), static_cast<sal_Int32>(aLnk.
GetDataSize()));
246 const uno::Sequence<sal_Int8>
aSeq(
247 static_cast< const sal_Int8* >(aDestStrm.GetData()),
248 aDestStrm.GetEndOfData());
262 awt::Rectangle aVisArea;
263 if( dynamic_cast<const SdrOle2Obj* >(
GetSdrObject()) !=
nullptr)
265 MapMode aMapMode( MapUnit::Map100thMM );
267 aVisArea = awt::Rectangle( 0, 0, aTmp.
Width(), aTmp.
Height() );
277 rValue <<= awt::Size( aTmp.
Width(), aTmp.
Height() );
283 rValue <<= static_cast<SdrOle2Obj*>(
GetSdrObject())->GetAspect();
294 uno::Reference < embed::XEmbeddedObject > xObj( pObj->
GetObjRef() );
303 SAL_WARN_IF(!bSuccess,
"svx.svdraw",
"An object without client is provided!");
307 rValue <<= pObj->
GetObjRef()->getComponent();
317 uno::Reference< graphic::XGraphic > xGraphic;
327 uno::Reference< graphic::XGraphic > xGraphic;
336 OUString aPersistName;
342 if( !aPersistName.isEmpty() )
346 aPersistName.clear();
350 rValue <<= aPersistName;
360 uno::Reference< embed::XLinkageSupport > xLink( pOle->
GetObjRef(), uno::UNO_QUERY );
361 if ( xLink.is() && xLink->isLink() )
362 aLinkURL = xLink->getLinkURL();
380 if ( !pOle2Obj || !pOle2Obj->
IsEmpty() )
385 OUString aPersistName;
388 aPersistName = aTmpStr;
394 uno::Reference<embed::XEmbeddedObject> xObj(
406 awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->
GetAspect() );
409 catch( embed::NoVisualAreaSizeException& )
418 aSz.Height = aSize.
Height();
419 if (aSz.Width != 0 || aSz.Height != 0)
422 xObj->setVisualAreaSize( pOle2Obj->
GetAspect(), aSz );
427 aTmpStr = aPersistName;
443 if ( !pOle2Obj || !pOle2Obj->
IsEmpty() )
446 OUString aPersistName;
454 if ( xInteraction.is() )
456 aMediaDescr.realloc( 2 );
457 auto pMediaDescr = aMediaDescr.getArray();
458 pMediaDescr[1].Name =
"InteractionHandler";
459 pMediaDescr[1].Value <<= xInteraction;
463 uno::Reference< embed::XEmbeddedObject > xObj =
475 awt::Size aSz = xObj->getVisualAreaSize( pOle2Obj->
GetAspect() );
478 catch( embed::NoVisualAreaSizeException& )
487 aSz.Height = aSize.
Height();
488 xObj->setVisualAreaSize( pOle2Obj->
GetAspect(), aSz );
507 uno::Reference < util::XModifiable > xMod( pOle->
GetObjRef(), uno::UNO_QUERY );
510 xMod->setModified(
false );
530 uno::Reference < embed::XEmbeddedObject > xObj =
540 if (rHexCLSID.isEmpty())
542 const uno::Reference < embed::XEmbeddedObject >& xObj( pOle2Obj->
GetObjRef() );
590 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
594 xSet->setPropertyValue( rName, rValue );
611 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
614 rValue = xSet->getPropertyValue( rName );
661 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
665 xSet->setPropertyValue( rName, rValue );
682 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
685 rValue = xSet->getPropertyValue( rName );
733 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
737 xSet->setPropertyValue( rName, rValue );
749 css::uno::Any& rValue)
755 uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(
GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
758 rValue = xSet->getPropertyValue( rName );
788 #if HAVE_FEATURE_AVMEDIA
794 switch( pProperty->
nWID )
797 #if HAVE_FEATURE_AVMEDIA
800 if( rValue >>= aURL )
810 #if HAVE_FEATURE_AVMEDIA
814 if( rValue >>= bLoop )
824 #if HAVE_FEATURE_AVMEDIA
828 if( rValue >>= bMute )
838 #if HAVE_FEATURE_AVMEDIA
840 sal_Int16 nVolumeDB = sal_Int16();
842 if( rValue >>= nVolumeDB )
852 #if HAVE_FEATURE_AVMEDIA
854 css::media::ZoomLevel eLevel;
856 if( rValue >>= eLevel )
866 #if HAVE_FEATURE_AVMEDIA
869 if( rValue >>= sMimeType )
879 #if HAVE_FEATURE_AVMEDIA
881 uno::Reference<graphic::XGraphic> xGraphic(rValue, uno::UNO_QUERY);
892 #if HAVE_FEATURE_AVMEDIA
895 uno::Reference<io::XInputStream>
xStream;
896 if (rValue >>= xStream)
901 catch (
const css::ucb::ContentCreationException&)
904 throw css::lang::WrappedTargetException(
905 "ContentCreationException Setting InputStream!",
906 static_cast<OWeakObject *>(
this),
909 catch (
const css::ucb::CommandFailedException&)
912 throw css::lang::WrappedTargetException(
913 "CommandFailedException Setting InputStream!",
914 static_cast<OWeakObject *>(
this),
921 OSL_FAIL(
"SvxMediaShape::setPropertyValueImpl(), unknown argument!");
924 #if HAVE_FEATURE_AVMEDIA
937 throw IllegalArgumentException();
952 #if HAVE_FEATURE_AVMEDIA
956 switch( pProperty->
nWID )
959 #if HAVE_FEATURE_AVMEDIA
960 rValue <<= aItem.getURL();
965 #if HAVE_FEATURE_AVMEDIA
966 rValue <<= aItem.isLoop();
971 #if HAVE_FEATURE_AVMEDIA
972 rValue <<= aItem.isMute();
977 #if HAVE_FEATURE_AVMEDIA
978 rValue <<= aItem.getVolumeDB();
983 #if HAVE_FEATURE_AVMEDIA
984 rValue <<= aItem.getZoom();
993 catch (
const css::ucb::ContentCreationException&)
996 throw css::lang::WrappedTargetException(
997 "ContentCreationException Getting InputStream!",
998 static_cast < OWeakObject * > (
this ), anyEx );
1000 catch (
const css::ucb::CommandFailedException&)
1003 throw css::lang::WrappedTargetException(
1004 "CommandFailedException Getting InputStream!",
1005 static_cast < OWeakObject * > (
this ), anyEx );
1011 #if HAVE_FEATURE_AVMEDIA
1012 rValue <<= aItem.getTempURL();
1017 #if HAVE_FEATURE_AVMEDIA
1018 rValue <<= aItem.getMimeType();
1023 #if HAVE_FEATURE_AVMEDIA
1025 Graphic aGraphic = aItem.getGraphic();
1039 OSL_FAIL(
"SvxMediaShape::getPropertyValueImpl(), unknown property!");
virtual ~SvxFrameShape() noexcept override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
#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 SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) 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
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define OWN_ATTR_FRAME_URL
void SetPersistName(const OUString &rPersistName)
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue)
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
#define SO3_IFRAME_CLASSID
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
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
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
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
#define OWN_ATTR_MEDIA_VOLUMEDB
const sal_uInt8 * GetData() const
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue) override
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage) override
void SetObjRef(const css::uno::Reference< css::embed::XEmbeddedObject > &rNewObjRef)
#define OWN_ATTR_MEDIA_TEMPFILEURL
constexpr tools::Long Width() const
#define OWN_ATTR_OLE_LINKURL
virtual void Create(SdrObject *pNewOpj, SvxDrawPage *pNewPage)
Any SAL_CALL getCaughtException()
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
virtual EmbeddedObjectContainer & getEmbeddedObjectContainer() const =0
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
const GDIMetaFile & GetGDIMetaFile() const
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)
void SetShapeType(const OUString &ShapeType)
void SetGraphicToObj(const Graphic &aGraphic)
static bool IsInternal(const SvGlobalName &)
#define OWN_ATTR_OLE_EMBEDDED_OBJECT
#define OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT
#define OWN_ATTR_MEDIA_LOOP
virtual bool getPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, css::uno::Any &rValue) override
OUString GetHexName() const
#define OWN_ATTR_MEDIA_MIMETYPE
bool MakeId(std::u16string_view rId)
#define OWN_ATTR_OLE_VISAREA
SdrModel & getSdrModelFromSdrObject() const
virtual void SetLogicRect(const tools::Rectangle &rRect)
#define SO3_APPLET_CLASSID
#define OWN_ATTR_THUMBNAIL
void createLink(const OUString &aLinkURL)
constexpr OUStringLiteral UNO_NAME_OLE2_PERSISTNAME
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 ~SvxOle2Shape() noexcept override
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *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)
constexpr tools::Long Height() const
::comphelper::IEmbeddedHelper * GetPersist() const
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *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
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
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
sal_uInt32 GetDataSize() const
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
#define DBG_TESTSOLARMUTEX()
SvxFrameShape(SdrObject *pObj)
SvxUnoPropertyMapProvider & getSvxMapProvider()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual ~SvxPluginShape() noexcept override
#define SO3_PLUGIN_CLASSID
SvxOle2Shape(SdrObject *pObj)
#define OWN_ATTR_MEDIA_URL
#define OWN_ATTR_OLEMODEL
SvxPluginShape(SdrObject *pObj)
const Graphic * GetGraphic() const
virtual bool setPropertyValueImpl(const OUString &rName, const SfxItemPropertyMapEntry *pProperty, const css::uno::Any &rValue)
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)
virtual ~SvxAppletShape() noexcept override