diff options
-rw-r--r-- | svx/source/unodraw/makefile.mk | 7 | ||||
-rw-r--r-- | svx/source/unodraw/shapeimpl.hxx | 169 | ||||
-rw-r--r-- | svx/source/unodraw/unopage.cxx | 77 | ||||
-rw-r--r-- | svx/source/unodraw/unopool.cxx | 16 | ||||
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 74 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap4.cxx | 704 | ||||
-rw-r--r-- | svx/source/unodraw/unoshape.cxx | 41 |
7 files changed, 1065 insertions, 23 deletions
diff --git a/svx/source/unodraw/makefile.mk b/svx/source/unodraw/makefile.mk index 2279a5b9cb98..1143da45329b 100644 --- a/svx/source/unodraw/makefile.mk +++ b/svx/source/unodraw/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.9 $ # -# last change: $Author: cl $ $Date: 2001-03-19 09:13:49 $ +# last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -83,6 +83,7 @@ CXXFILES = \ unoshape.cxx \ unoshap2.cxx \ unoshap3.cxx \ + unoshap4.cxx \ unopage.cxx \ unoshtxt.cxx \ unoshcol.cxx \ @@ -109,6 +110,7 @@ SVXLIGHTOBJFILES=\ $(OBJ)$/unoctabl.obj \ $(OBJ)$/unoshap2.obj \ $(OBJ)$/unoshap3.obj \ + $(OBJ)$/unoshap4.obj \ $(OBJ)$/unopage.obj \ $(OBJ)$/unoshtxt.obj \ $(OBJ)$/unoshcol.obj \ @@ -134,6 +136,7 @@ SLOFILES = \ $(SLO)$/unoctabl.obj \ $(SLO)$/unoshap2.obj \ $(SLO)$/unoshap3.obj \ + $(SLO)$/unoshap4.obj \ $(SLO)$/unopage.obj \ $(SLO)$/unoshtxt.obj \ $(SLO)$/unoshcol.obj \ diff --git a/svx/source/unodraw/shapeimpl.hxx b/svx/source/unodraw/shapeimpl.hxx new file mode 100644 index 000000000000..7431c1ffbbd2 --- /dev/null +++ b/svx/source/unodraw/shapeimpl.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * $RCSfile: shapeimpl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _SVX_SHAPEIMPL_HXX +#define _SVX_SHAPEIMPL_HXX + +#include "unoshape.hxx" + +class SvGlobalName; + +/*********************************************************************** +* * +***********************************************************************/ + +class SvxOle2Shape : public SvxShape +{ +public: + SvxOle2Shape( SdrObject* pObj ) throw(); + SvxOle2Shape( SdrObject* pObject, const SfxItemPropertyMap* pPropertySet ) throw (); + virtual ~SvxOle2Shape() throw(); + + sal_Bool createObject( const SvGlobalName &aClassName ); + + //XPropertySet + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +/*********************************************************************** +* * +***********************************************************************/ + +#ifndef SVX_LIGHT + +#ifndef _PLUGIN_HXX +#include <so3/plugin.hxx> +#endif + +class SvxPluginShape : public SvxOle2Shape +{ +private: + SvPlugInObjectRef mxPlugin; + +public: + SvxPluginShape( SdrObject* pObj ) throw(); + virtual ~SvxPluginShape() throw(); + + virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ) throw (); + + //XPropertySet + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +#endif + +/*********************************************************************** +* * +***********************************************************************/ + +#ifndef SVX_LIGHT + +#ifndef _APPLET_HXX +#include <so3/applet.hxx> +#endif + +class SvxAppletShape : public SvxOle2Shape +{ +private: + SvAppletObjectRef mxApplet; + +public: + SvxAppletShape( SdrObject* pObj ) throw(); + virtual ~SvxAppletShape() throw(); + + virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ) throw (); + + //XPropertySet + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +#endif + +/*********************************************************************** +* * +***********************************************************************/ + +#ifndef SVX_LIGHT + +#ifndef _FRAMEOBJ_HXX +#include <sfx2/frameobj.hxx> +#endif + +class SvxFrameShape : public SvxOle2Shape +{ +public: + SvxFrameShape( SdrObject* pObj ) throw(); + virtual ~SvxFrameShape() throw(); + + virtual void Create( SdrObject* pNewOpj, SvxDrawPage* pNewPage = NULL ) throw (); + + //XPropertySet + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) 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); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); +}; + +#endif + +#endif + + diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index fdaa9b7eda1f..e7c15c827ad3 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unopage.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: cl $ $Date: 2001-03-30 12:18:08 $ + * last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,6 +71,12 @@ #ifndef _SFXDISPATCH_HXX //autogen #include <sfx2/dispatch.hxx> #endif +#ifndef _PERSIST_HXX +#include <so3/persist.hxx> +#endif +#ifndef _SOT_CLSIDS_HXX +#include <sot/clsids.hxx> +#endif #endif /* @@ -87,7 +93,7 @@ #include "svdview.hxx" #include "svdpagv.hxx" #include "unopage.hxx" -#include "unoshape.hxx" +#include "shapeimpl.hxx" #include "globl3d.hxx" #include "polysc3d.hxx" #include "unoprov.hxx" @@ -542,6 +548,15 @@ void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, { rInventor = SdrInventor; rType = (sal_uInt16)nTempType; + + switch( rType ) + { + case OBJ_FRAME: + case OBJ_OLE2_PLUGIN: + case OBJ_OLE2_APPLET: + rType = OBJ_OLE2; + break; + } } } @@ -628,9 +643,59 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt3 case OBJ_GRAF: pRet = new SvxGraphicObject( pObj ); break; + case OBJ_FRAME: +#ifndef SVX_LIGHT + pRet = new SvxFrameShape( pObj ); + break; +#endif + case OBJ_OLE2_APPLET: +#ifndef SVX_LIGHT + pRet = new SvxAppletShape( pObj ); + break; +#endif + case OBJ_OLE2_PLUGIN: +#ifndef SVX_LIGHT + pRet = new SvxPluginShape( pObj ); + break; +#endif case OBJ_OLE2: - pRet = new SvxShape( pObj, ImplGetSvxOle2PropertyMap() ); - break; + { +#ifndef SVX_LIGHT + SvPersist *pPersist = pPage->GetSdrPage()->GetModel()->GetPersist(); + + if( pObj ) + { + const SvInfoObject *pInfo = pPersist->Find( pObj->GetName() ); + DBG_ASSERT( pInfo, "no info object for OLE object found" ); + + const SvGlobalName aClassId( pInfo->GetClassName() ); + const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID ); + const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID ); + const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID ); + + if( aPluginClassId == aClassId ) + { + pRet = new SvxPluginShape( pObj ); + nType = OBJ_OLE2_PLUGIN; + } + else if( aAppletClassId == aClassId ) + { + pRet = new SvxAppletShape( pObj ); + nType = OBJ_OLE2_APPLET; + } + else if( aIFrameClassId == aClassId ) + { + pRet = new SvxFrameShape( pObj ); + nType = OBJ_FRAME; + } + } +#endif + if( pRet == NULL ) + { + pRet = new SvxOle2Shape( pObj, ImplGetSvxOle2PropertyMap() ); + } + break; + } case OBJ_EDGE: pRet = new SvxShapeConnector( pObj ); break; @@ -648,8 +713,6 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt3 break; // case OBJ_DUMMY: // break; -// case OBJ_FRAME: -// break; case OBJ_UNO: pRet = new SvxShapeControl( pObj ); break; diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index 518c1c0b66e5..35f650cdc258 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unopool.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2001-03-14 16:39:05 $ + * last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -163,12 +163,12 @@ void SvxUnoDrawPool::getAny( SfxItemPool* pPool, const comphelper::PropertyMapEn break; } default: - pPool->GetDefaultItem( pEntry->mnHandle ).QueryValue( rValue, pEntry->mnMemberId ); + pPool->GetDefaultItem( (USHORT)pEntry->mnHandle ).QueryValue( rValue, pEntry->mnMemberId ); } // check for needed metric translation - const SfxMapUnit eMapUnit = pPool->GetMetric(pEntry->mnHandle); + const SfxMapUnit eMapUnit = pPool->GetMetric((USHORT)pEntry->mnHandle); if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM) { // map the metric of the itempool to 100th mm @@ -220,7 +220,7 @@ void SvxUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEn { Any aValue( rValue ); - const SfxMapUnit eMapUnit = pPool->GetMetric(pEntry->mnHandle); + const SfxMapUnit eMapUnit = pPool->GetMetric((USHORT)pEntry->mnHandle); if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM) { switch(eMapUnit) @@ -244,7 +244,7 @@ void SvxUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEn } } - const sal_uInt16 nWhich = pEntry->mnHandle; + const sal_uInt16 nWhich = (sal_uInt16)pEntry->mnHandle; switch( nWhich ) { case OWN_ATTR_FILLBMP_MODE: @@ -317,7 +317,7 @@ void SvxUnoDrawPool::_getPropertyStates( const comphelper::PropertyMapEntry** pp { while( *ppEntries ) { - const sal_uInt16 nWhich = (*ppEntries)->mnHandle; + const sal_uInt16 nWhich = (sal_uInt16)(*ppEntries)->mnHandle; switch( nWhich ) { @@ -366,7 +366,7 @@ void SvxUnoDrawPool::_setPropertyToDefault( const comphelper::PropertyMapEntry* SfxItemPool* pPool = getModelPool( sal_True ); if( pPool && pPool != mpDefaultsPool ) - pPool->Put( mpDefaultsPool->GetDefaultItem( pEntry->mnHandle ), pEntry->mnHandle ); + pPool->Put( mpDefaultsPool->GetDefaultItem( (USHORT)pEntry->mnHandle ), (USHORT)pEntry->mnHandle ); } Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 98d177e39f75..e9bee4e7fc27 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoprov.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: thb $ $Date: 2001-04-26 17:26:10 $ + * last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -436,12 +436,78 @@ SfxItemPropertyMap* ImplGetSvxOle2PropertyMap() { MAP_CHAR_LEN("OriginalSize"), OWN_ATTR_OLESIZE , &::getCppuType(( const ::com::sun::star::awt::Size*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, { MAP_CHAR_LEN("CLSID"), OWN_ATTR_CLSID , &::getCppuType(( const ::rtl::OUString*)0), 0, 0 }, { MAP_CHAR_LEN("IsInternal"), OWN_ATTR_INTERNAL_OLE , &::getBooleanCppuType() , ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN("VisibleArea"), OWN_ATTR_OLE_VISAREA , &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), 0, 0}, {0,0,0,0,0} }; return aOle2PropertyMap_Impl; } +SfxItemPropertyMap* ImplGetSvxPluginPropertyMap() +{ + static SfxItemPropertyMap aPluginPropertyMap_Impl[] = + { + { MAP_CHAR_LEN("PluginMimeType"), OWN_ATTR_PLUGIN_MIMETYPE , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("PluginURL"), OWN_ATTR_PLUGIN_URL , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("PluginCommands"), OWN_ATTR_PLUGIN_COMMANDS , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<::com::sun::star::beans::PropertyValue>*)0)), 0, 0}, + { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + return aPluginPropertyMap_Impl; +} + +SfxItemPropertyMap* ImplGetSvxFramePropertyMap() +{ + static SfxItemPropertyMap aFramePropertyMap_Impl[] = + { + { MAP_CHAR_LEN("FrameURL"), OWN_ATTR_FRAME_URL , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("FrameName"), OWN_ATTR_FRAME_NAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("FrameIsAutoScroll"), OWN_ATTR_FRAME_ISAUTOSCROLL , &::getBooleanCppuType() , 0, 0}, + { MAP_CHAR_LEN("FrameIsBorder"), OWN_ATTR_FRAME_ISBORDER , &::getBooleanCppuType() , 0, 0}, + { MAP_CHAR_LEN("FrameMarginWidth"), OWN_ATTR_FRAME_MARGIN_WIDTH , &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN("FrameMarginHeight"), OWN_ATTR_FRAME_MARGIN_HEIGHT, &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + return aFramePropertyMap_Impl; +} + +SfxItemPropertyMap* ImplGetSvxAppletPropertyMap() +{ + static SfxItemPropertyMap aAppletPropertyMap_Impl[] = + { + { MAP_CHAR_LEN("AppletCodeBase"), OWN_ATTR_APPLET_CODEBASE , &::getCppuType(( const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("AppletName"), OWN_ATTR_APPLET_NAME , &::getCppuType(( const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("AppletCode"), OWN_ATTR_APPLET_CODE , &::getCppuType(( const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN("AppletCommands"), OWN_ATTR_APPLET_COMMANDS , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<::com::sun::star::beans::PropertyValue>*)0)), 0, 0}, + { MAP_CHAR_LEN("AppletIsScript"), OWN_ATTR_APPLET_ISSCRIPT , &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN("Transformation"), OWN_ATTR_TRANSFORMATION , &::getCppuType((const struct com::sun::star::drawing::HomogenMatrix3*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_ZORDER), OWN_ATTR_ZORDER , &::getCppuType((const sal_Int32*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERID), SDRATTR_LAYERID , &::getCppuType((const sal_Int16*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_LAYERNAME),SDRATTR_LAYERNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP), OWN_ATTR_LDBITMAP , &::getCppuType(( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME), OWN_ATTR_LDNAME , &::getCppuType(( const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN(UNO_NAME_OLE2_METAFILE), OWN_ATTR_METAFILE , SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + {0,0,0,0,0} + }; + + return aAppletPropertyMap_Impl; +} + SfxItemPropertyMap* ImplGetSvxControlShapePropertyMap() { static SfxItemPropertyMap aControlPropertyMap_Impl[] = @@ -537,8 +603,10 @@ UHashMapEntry pSdrShapeIdentifierMap[] = UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("TextShape"), OBJ_TEXT ), UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("OLE2Shape"), OBJ_OLE2 ), UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("PageShape"), OBJ_PAGE ), - UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("FrameShape"), OBJ_FRAME ), UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("CaptionShape"), OBJ_CAPTION ), + UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("FrameShape"), OBJ_FRAME ), + UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("PluginShape"), OBJ_OLE2_PLUGIN ), + UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("AppletShape"), OBJ_OLE2_APPLET ), UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("Shape3DSceneObject"), E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG ), UHashMapEntry (RTL_CONSTASCII_STRINGPARAM("Shape3DCubeObject"), E3D_CUBEOBJ_ID | E3D_INVENTOR_FLAG ), diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx new file mode 100644 index 000000000000..b2b81c1c0cc6 --- /dev/null +++ b/svx/source/unodraw/unoshap4.cxx @@ -0,0 +1,704 @@ +/************************************************************************* + * + * $RCSfile: unoshap4.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#define _SVX_USE_UNOGLOBALS_ + +#ifndef SVX_LIGHT +#ifndef _SVDOOLE2_HXX +#include "svdoole2.hxx" +#endif +#ifndef _SOT_CLSIDS_HXX +#include <sot/clsids.hxx> +#endif +#ifndef _SFX_FRMDESCRHXX +#include <sfx2/frmdescr.hxx> +#endif +#endif + +#ifndef _SVDMODEL_HXX +#include "svdmodel.hxx" +#endif + +#ifndef _SVX_SHAPEIMPL_HXX +#include "shapeimpl.hxx" +#endif + +#include "unoshprp.hxx" + +/////////////////////////////////////////////////////////////////////// + +extern SfxItemPropertyMap* ImplGetSvxOle2PropertyMap(); +extern SfxItemPropertyMap* ImplGetSvxPluginPropertyMap(); +extern SfxItemPropertyMap* ImplGetSvxFramePropertyMap(); +extern SfxItemPropertyMap* ImplGetSvxAppletPropertyMap(); + +/////////////////////////////////////////////////////////////////////// + +using namespace ::osl; +using namespace ::vos; +using namespace ::rtl; +using namespace ::cppu; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; + +/////////////////////////////////////////////////////////////////////// + +SvxOle2Shape::SvxOle2Shape( SdrObject* pObject ) throw() +: SvxShape( pObject, ImplGetSvxOle2PropertyMap() ) +{ +} + +SvxOle2Shape::SvxOle2Shape( SdrObject* pObject, const SfxItemPropertyMap* pPropertySet ) throw () +: SvxShape( pObject, pPropertySet ) +{ +} + +SvxOle2Shape::~SvxOle2Shape() throw() +{ +} + +//XPropertySet +void SAL_CALL SvxOle2Shape::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ) +{ + if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CLSID" ) ) ) + { +#ifndef SVX_LIGHT + OUString aCLSID; + if( aValue >>= aCLSID ) + { + // init a ole object with a global name + if( pObj ) + { + SvGlobalName aClassName; + if( aClassName.MakeId( aCLSID ) ) + createObject( aClassName ); + } + } + + throw IllegalArgumentException(); +#endif + } + + SvxShape::setPropertyValue( aPropertyName, aValue ); +} + +Any SAL_CALL SvxOle2Shape::getPropertyValue( const OUString& PropertyName ) throw( UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + return SvxShape::getPropertyValue( PropertyName ); +} + + +sal_Bool SvxOle2Shape::createObject( const SvGlobalName &aClassName ) +{ +#ifndef SVX_LIGHT + const SvInPlaceObjectRef& rIPRef = ((SdrOle2Obj*)pObj)->GetObjRef(); + if(rIPRef.Is() ) + return sal_False; + + // create storage and inplace object + String aEmptyStr; + SvStorageRef aStor = new SvStorage( aEmptyStr, STREAM_STD_READWRITE ); + SvInPlaceObjectRef aIPObj = &((SvFactory*)SvInPlaceObject::ClassFactory())->CreateAndInit( aClassName, aStor); + + SvPersist* pPersist = pModel->GetPersist(); + + String aName = getName(); + + sal_Bool bOk = sal_False; + // if we already have a shape name check if its a unique + // storage name + if( aName.Len() && !pPersist->Find( aName ) ) + { + SvInfoObjectRef xSub = new SvEmbeddedInfoObject( aIPObj, aName ); + bOk = pPersist->Move( xSub, aName ); + } + else + { + // generate a unique name + + aName = String( RTL_CONSTASCII_USTRINGPARAM("Object ") ); + String aStr; + sal_Int32 i = 1; + HACK(Wegen Storage Bug 46033) + // for-Schleife wegen Storage Bug 46033 + for( sal_Int16 n = 0; n < 100; n++ ) + { + do + { + aStr = aName; + aStr += String::CreateFromInt32( i ); + i++; + } while ( pPersist->Find( aStr ) ); + + SvInfoObjectRef xSub = new SvEmbeddedInfoObject( aIPObj, aStr ); + if( pPersist->Move( xSub, aStr ) ) // Eigentuemer Uebergang + { + bOk = sal_True; + aName = aStr; + return sal_True; + } + } + } + + DBG_ASSERT( bOk, "could not create move ole stream!" ) + + if( bOk ) + pObj->SetName( aName ); + + ((SdrOle2Obj*)pObj)->SetObjRef(aIPObj); + + Rectangle aRect( ( (SdrOle2Obj*) pObj)->GetLogicRect() ); + aIPObj->SetVisAreaSize( aRect.GetSize() ); + + return bOk; +#else + return sal_False; +#endif +} + +/////////////////////////////////////////////////////////////////////// + +// the following code is currently not working in the player +#ifndef SVX_LIGHT + +static sal_Bool SvxImplFillCommandList( const Sequence< PropertyValue >& aCommandSequence, SvCommandList& aNewCommands ) +{ + const sal_Int32 nCount = aCommandSequence.getLength(); + + String aCommand, aArg; + OUString aApiArg; + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + aCommand = aCommandSequence[nIndex].Name; + + if( !( aCommandSequence[nIndex].Value >>= aApiArg ) ) + return sal_False; + + aArg = aApiArg; + aNewCommands.Append( aCommand, aArg ); + } + + return sal_True; +} + +static void SvxImplFillCommandSequence( const SvCommandList& aCommands, Sequence< PropertyValue >& aCommandSequence ) +{ + const sal_Int32 nCount = aCommands.Count(); + aCommandSequence.realloc( nCount ); + + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + const SvCommand& rCommand = aCommands[ nIndex ]; + + aCommandSequence[nIndex].Name = rCommand.GetCommand(); + aCommandSequence[nIndex].Handle = -1; + aCommandSequence[nIndex].Value = makeAny( OUString( rCommand.GetArgument() ) ); + aCommandSequence[nIndex].State = PropertyState_DIRECT_VALUE; + + } +} + +/////////////////////////////////////////////////////////////////////// + +SvxAppletShape::SvxAppletShape( SdrObject* pObject ) throw() +: SvxOle2Shape( pObject, ImplGetSvxAppletPropertyMap() ) +{ + SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AppletShape" ) ) ); +} + +SvxAppletShape::~SvxAppletShape() throw() +{ +} + +void SvxAppletShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw () +{ + SvxShape::Create( pNewObj, pNewPage ); + const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID ); + createObject(aAppletClassId); + SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.AppletShape" ) ) ); +} + +//XPropertySet +void SAL_CALL SvxAppletShape::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException ) +{ + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(aPropertyName); + + if( pObj && pModel ) + { + if(pMap == NULL ) + throw UnknownPropertyException(); + + if( pMap->nWID >= OWN_ATTR_APPLET_CODEBASE && pMap->nWID <= OWN_ATTR_APPLET_ISSCRIPT ) + { + SvAppletObjectRef xApplet = SvAppletObjectRef( ((SdrOle2Obj*)pObj)->GetObjRef() ); + DBG_ASSERT( xApplet.Is(), "wrong ole object inside applet" ); + if( !xApplet.Is() ) + return; + + switch( pMap->nWID ) + { + case OWN_ATTR_APPLET_CODEBASE: + { + OUString aCodeBase; + if( aValue >>= aCodeBase ) + { + const String aStrCodeBase( aCodeBase ); + xApplet->SetCodeBase( aStrCodeBase ); + return; + } + } + break; + case OWN_ATTR_APPLET_NAME: + { + OUString aName; + if( aValue >>= aName ) + { + const String aStrName( aName ); + xApplet->SetName( aStrName ); + return; + } + } + break; + case OWN_ATTR_APPLET_CODE: + { + OUString aCode; + if( aValue >>= aCode ) + { + const String aStrCode( aCode ); + xApplet->SetClass( aStrCode ); + return; + } + } + break; + case OWN_ATTR_APPLET_COMMANDS: + { + Sequence< PropertyValue > aCommandSequence; + if( aValue >>= aCommandSequence ) + { + SvCommandList aNewCommands; + if( SvxImplFillCommandList( aCommandSequence, aNewCommands ) ) + { + xApplet->SetCommandList( aNewCommands ); + return; + } + } + } + break; + case OWN_ATTR_APPLET_ISSCRIPT: + { + sal_Bool bScript; + if( aValue >>= bScript ) + { + xApplet->SetMayScript( bScript ); + return; + } + } + break; + } + + throw IllegalArgumentException(); + } + } + + SvxOle2Shape::setPropertyValue( aPropertyName, aValue ); +} + +Any SAL_CALL SvxAppletShape::getPropertyValue( const OUString& PropertyName ) throw( UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(PropertyName); + + if( pObj && pModel ) + { + if(pMap == NULL ) + throw UnknownPropertyException(); + + if( pMap->nWID >= OWN_ATTR_APPLET_CODEBASE && pMap->nWID <= OWN_ATTR_APPLET_ISSCRIPT ) + { + SvAppletObjectRef xApplet = SvAppletObjectRef( ((SdrOle2Obj*)pObj)->GetObjRef() ); + DBG_ASSERT( xApplet.Is(), "wrong ole object inside applet" ); + if( xApplet.Is() ) + { + + switch( pMap->nWID ) + { + case OWN_ATTR_APPLET_CODEBASE: + return makeAny( OUString( xApplet->GetCodeBase() ) ); + case OWN_ATTR_APPLET_NAME: + return makeAny( OUString( xApplet->GetName() ) ); + case OWN_ATTR_APPLET_CODE: + return makeAny( OUString( xApplet->GetClass() ) ); + case OWN_ATTR_APPLET_COMMANDS: + { + Sequence< PropertyValue > aCommandSequence; + SvxImplFillCommandSequence( xApplet->GetCommandList(), aCommandSequence ); + return makeAny( aCommandSequence ); + } + case OWN_ATTR_APPLET_ISSCRIPT: + return makeAny( (sal_Bool) xApplet->IsMayScript() ); + } + } + + Any aAny; + return aAny; + } + } + + return SvxOle2Shape::getPropertyValue( PropertyName ); +} + +/////////////////////////////////////////////////////////////////////// + +SvxPluginShape::SvxPluginShape( SdrObject* pObject ) throw() +: SvxOle2Shape( pObject, ImplGetSvxPluginPropertyMap() ) +{ + SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.PluginShape" ) ) ); +} + +SvxPluginShape::~SvxPluginShape() throw() +{ +} + +void SvxPluginShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw () +{ + SvxShape::Create( pNewObj, pNewPage ); + const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID ); + createObject(aPluginClassId); + SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.PluginShape" ) ) ); +} + +//XPropertySet +void SAL_CALL SvxPluginShape::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) + throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +{ + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(aPropertyName); + + if( pObj && pModel ) + { + if(pMap == NULL ) + throw UnknownPropertyException(); + + if( pMap->nWID >= OWN_ATTR_PLUGIN_MIMETYPE && pMap->nWID <= OWN_ATTR_PLUGIN_COMMANDS ) + { + SvPlugInObjectRef xPlugin = SvPlugInObjectRef( ((SdrOle2Obj*)pObj)->GetObjRef() ); + DBG_ASSERT( xPlugin.Is(), "wrong ole object inside plugin" ); + if( !xPlugin.Is() ) + return; + + switch( pMap->nWID ) + { + case OWN_ATTR_PLUGIN_MIMETYPE: + { + OUString aMimeType; + if( aValue >>= aMimeType ) + { + const String aStrMimeType( aMimeType ); + xPlugin->SetMimeType( aStrMimeType ); + return; + } + } + break; + case OWN_ATTR_PLUGIN_URL: + { + OUString aURL; + if( aValue >>= aURL ) + { + const String aStrURL( aURL ); + xPlugin->SetURL( aStrURL ); + return; + } + } + break; + case OWN_ATTR_PLUGIN_COMMANDS: + { + Sequence< PropertyValue > aCommandSequence; + if( aValue >>= aCommandSequence ) + { + SvCommandList aNewCommands; + if( SvxImplFillCommandList( aCommandSequence, aNewCommands ) ) + { + xPlugin->SetCommandList( aNewCommands ); + return; + } + } + } + break; + } + + throw IllegalArgumentException(); + } + } + + SvxOle2Shape::setPropertyValue( aPropertyName, aValue ); +} + +Any SAL_CALL SvxPluginShape::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(PropertyName); + + if( pObj && pModel ) + { + if(pMap == NULL ) + throw UnknownPropertyException(); + + if( pMap->nWID >= OWN_ATTR_PLUGIN_MIMETYPE && pMap->nWID <= OWN_ATTR_PLUGIN_COMMANDS ) + { + SvPlugInObjectRef xPlugin = SvPlugInObjectRef( ((SdrOle2Obj*)pObj)->GetObjRef() ); + DBG_ASSERT( xPlugin.Is(), "wrong ole object inside plugin" ); + if( xPlugin.Is() ) + { + + switch( pMap->nWID ) + { + case OWN_ATTR_PLUGIN_MIMETYPE: + return makeAny( OUString( xPlugin->GetMimeType() ) ); + case OWN_ATTR_PLUGIN_URL: + return makeAny( OUString( xPlugin->GetURL()->GetMainURL() ) ); + case OWN_ATTR_PLUGIN_COMMANDS: + { + Sequence< PropertyValue > aCommandSequence; + SvxImplFillCommandSequence( xPlugin->GetCommandList(), aCommandSequence ); + return makeAny( aCommandSequence ); + } + } + } + + Any aAny; + return aAny; + } + } + + return SvxOle2Shape::getPropertyValue( PropertyName ); +} + +/////////////////////////////////////////////////////////////////////// + +SvxFrameShape::SvxFrameShape( SdrObject* pObject ) throw() +: SvxOle2Shape( pObject, ImplGetSvxFramePropertyMap() ) +{ + SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FrameShape" ) ) ); +} + +SvxFrameShape::~SvxFrameShape() throw() +{ +} + +void SvxFrameShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) throw () +{ + SvxShape::Create( pNewObj, pNewPage ); + const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID ); + createObject(aIFrameClassId); + SetShapeType( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FrameShape" ) ) ); +} + +//XPropertySet +void SAL_CALL SvxFrameShape::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) + throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) +{ + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(aPropertyName); + + Any aAny; + if( pObj && pModel ) + { + if(pMap == NULL ) + throw UnknownPropertyException(); + + if( pMap->nWID >= OWN_ATTR_FRAME_URL && pMap->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT ) + { + SfxFrameObjectRef xFrame = SfxFrameObjectRef( ((SdrOle2Obj*)pObj)->GetObjRef() ); + DBG_ASSERT( xFrame.Is(), "wrong ole object inside frame" ); + if( !xFrame.Is() ) + return; + + SfxFrameDescriptor *pDescriptor = xFrame->GetFrameDescriptor()->Clone( NULL ); + DBG_ASSERT( pDescriptor, "no descriptor for frame!" ); + if( !pDescriptor ) + return; + + switch( pMap->nWID ) + { + case OWN_ATTR_FRAME_URL: + { + OUString aURL; + if( aValue >>= aURL ) + { + const String aStrURL( aURL ); + pDescriptor->SetURL( aStrURL ); + xFrame->SetFrameDescriptor( pDescriptor ); + return; + } + } + break; + case OWN_ATTR_FRAME_NAME: + { + OUString aName; + if( aValue >>= aName ) + { + const String aStrName( aName ); + pDescriptor->SetName( aStrName ); + xFrame->SetFrameDescriptor( pDescriptor ); + return; + } + } + break; + case OWN_ATTR_FRAME_ISAUTOSCROLL: + { + sal_Bool bScroll; + if( aValue >>= bScroll ) + { + pDescriptor->SetScrollingMode( bScroll ? ScrollingYes : ScrollingNo ); + xFrame->SetFrameDescriptor( pDescriptor ); + return; + } + } + break; + case OWN_ATTR_FRAME_ISBORDER: + { + sal_Bool bBorder; + if( aValue >>= bBorder ) + { + pDescriptor->SetFrameBorder( bBorder ); + xFrame->SetFrameDescriptor( pDescriptor ); + return; + } + } + break; + + case OWN_ATTR_FRAME_MARGIN_WIDTH: + { + sal_Int32 nMargin; + if( aValue >>= nMargin ) + { + const Size aNewMargin( nMargin, pDescriptor->GetMargin().Height() ); + pDescriptor->SetMargin( aNewMargin ); + xFrame->SetFrameDescriptor( pDescriptor ); + return; + } + } + break; + case OWN_ATTR_FRAME_MARGIN_HEIGHT: + { + sal_Int32 nMargin; + if( aValue >>= nMargin ) + { + const Size aNewMargin( pDescriptor->GetMargin().Width(), nMargin ); + pDescriptor->SetMargin( aNewMargin ); + xFrame->SetFrameDescriptor( pDescriptor ); + return; + } + } + break; + } + + throw IllegalArgumentException(); + } + } + + SvxOle2Shape::setPropertyValue( aPropertyName, aValue ); +} + +Any SAL_CALL SvxFrameShape::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) +{ + const SfxItemPropertyMap* pMap = aPropSet.getPropertyMapEntry(PropertyName); + + Any aAny; + if( pObj && pModel ) + { + if(pMap == NULL ) + throw UnknownPropertyException(); + + if( pMap->nWID >= OWN_ATTR_FRAME_URL && pMap->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT ) + { + SfxFrameObjectRef xFrame = SfxFrameObjectRef( ((SdrOle2Obj*)pObj)->GetObjRef() ); + DBG_ASSERT( xFrame.Is(), "wrong ole object inside frame" ); + if( !xFrame.Is() ) + { + Any aAny; + return aAny; + } + + const SfxFrameDescriptor *pDescriptor = xFrame->GetFrameDescriptor(); + DBG_ASSERT( pDescriptor, "no descriptor for frame!" ); + + switch( pMap->nWID ) + { + case OWN_ATTR_FRAME_URL: + return makeAny( OUString( pDescriptor->GetURL().GetMainURL() ) ); + case OWN_ATTR_FRAME_NAME: + return makeAny( OUString( pDescriptor->GetName() ) ); + case OWN_ATTR_FRAME_ISAUTOSCROLL: + return makeAny( (sal_Bool)(pDescriptor->GetScrollingMode() == ScrollingYes) ); + case OWN_ATTR_FRAME_ISBORDER: + return makeAny( (sal_Bool)pDescriptor->IsFrameBorderOn() ); + case OWN_ATTR_FRAME_MARGIN_WIDTH: + return makeAny( (sal_Int32)pDescriptor->GetMargin().Width() ); + case OWN_ATTR_FRAME_MARGIN_HEIGHT: + return makeAny( (sal_Int32)pDescriptor->GetMargin().Height() ); + } + throw IllegalArgumentException(); + } + } + + return SvxOle2Shape::getPropertyValue( PropertyName ); +} + +#endif diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index b8b163268d3b..0f8c535dd106 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoshape.cxx,v $ * - * $Revision: 1.46 $ + * $Revision: 1.47 $ * - * last change: $Author: aw $ $Date: 2001-04-19 16:52:22 $ + * last change: $Author: cl $ $Date: 2001-04-30 10:06:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1400,7 +1400,24 @@ void SAL_CALL SvxShape::setPropertyValue( const OUString& rPropertyName, const u } break; } - + case OWN_ATTR_OLE_VISAREA: + { +#ifndef SVX_LIGHT + awt::Rectangle aVisArea; + if( (rVal >>= aVisArea) && pObj->ISA(SdrOle2Obj)) + { + SdrOle2Obj& aObj = *(SdrOle2Obj*)pObj; + const SvInPlaceObjectRef& xInplace = aObj.GetObjRef(); + if( xInplace.Is() ) + { + Rectangle aTmpArea( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height ); + xInplace->SetVisArea( aTmpArea ); + return; + } +#endif + } + break; + } case XATTR_FILLBITMAP: case XATTR_FILLGRADIENT: case XATTR_FILLHATCH: @@ -1670,6 +1687,24 @@ uno::Any SAL_CALL SvxShape::getPropertyValue( const OUString& PropertyName ) aAny <<= xBmp; break; } + case OWN_ATTR_OLE_VISAREA: + { + awt::Rectangle aVisArea; +#ifndef SVX_LIGHT + if( pObj->ISA(SdrOle2Obj)) + { + SdrOle2Obj& aObj = *(SdrOle2Obj*)pObj; + const SvInPlaceObjectRef& xInplace = aObj.GetObjRef(); + if( xInplace.Is() ) + { + Rectangle aTmpArea( xInplace->GetVisArea() ); + aVisArea = awt::Rectangle( aTmpArea.Left(), aTmpArea.Top(), aTmpArea.GetWidth(), aTmpArea.GetHeight() ); + } + } +#endif + aAny <<= aVisArea; + break; + } case OWN_ATTR_OLESIZE: { awt::Size aSize; |