summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/shapeuno.cxx
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2001-03-27 14:27:37 +0000
committerNiklas Nebel <nn@openoffice.org>2001-03-27 14:27:37 +0000
commita096cb25b8dbcdae3bd25b87a41448989e4963bd (patch)
tree4397ec01ea2716ec955b79e680d9f5acb6ba6c7c /sc/source/ui/unoobj/shapeuno.cxx
parent65b1a28a55387ce2e09c17aa0961e8e09d64ac94 (diff)
ImageMap property
Diffstat (limited to 'sc/source/ui/unoobj/shapeuno.cxx')
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx114
1 files changed, 99 insertions, 15 deletions
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 6d30cc89b..7818f1819 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: shapeuno.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: nn $ $Date: 2001-03-23 13:05:00 $
+ * last change: $Author: nn $ $Date: 2001-03-27 15:27:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,8 @@
#include <tools/debug.hxx>
#include <comphelper/uno3.hxx>
+#include <svtools/unoevent.hxx>
+#include <svtools/unoimap.hxx>
#include <svx/svdobj.hxx>
#include <svx/unoshape.hxx>
@@ -77,12 +79,35 @@
#include "cellsuno.hxx"
#include "docsh.hxx"
#include "drwlayer.hxx"
+#include "userdat.hxx"
+#include "unonames.hxx"
#include "unoguard.hxx"
using namespace ::com::sun::star;
//------------------------------------------------------------------------
+const SfxItemPropertyMap* lcl_GetShapeMap()
+{
+ static SfxItemPropertyMap aShapeMap_Impl[] =
+ {
+ {MAP_CHAR_LEN(SC_UNONAME_IMAGEMAP), 0, &getCppuType((uno::Reference<container::XIndexContainer>*)0), 0, 0 },
+ {0,0,0,0}
+ };
+ return aShapeMap_Impl;
+}
+
+const SvEventDescription* lcl_GetSupportedMacroItems()
+{
+ static const SvEventDescription aMacroDescriptionsImpl[] =
+ {
+ { 0, NULL }
+ };
+ return aMacroDescriptionsImpl;
+}
+
+//------------------------------------------------------------------------
+
ScShapeObj::ScShapeObj( uno::Reference<drawing::XShape>& xShape )
{
comphelper::increment( m_refCount );
@@ -165,16 +190,29 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScShapeObj::getPropertySetInfo(
{
ScUnoGuard aGuard;
- //! mix own and aggregated properties
-
+ // mix own and aggregated properties:
uno::Reference<beans::XPropertySetInfo> xRet;
uno::Reference<beans::XPropertySet> xAggProp = lcl_GetPropertySet(mxShapeAgg);
if ( xAggProp.is() )
- xRet = xAggProp->getPropertySetInfo();
-
+ {
+ uno::Reference<beans::XPropertySetInfo> xAggInfo = xAggProp->getPropertySetInfo();
+ const uno::Sequence<beans::Property> aPropSeq = xAggInfo->getProperties();
+ xRet = new SfxExtItemPropertySetInfo( lcl_GetShapeMap(), aPropSeq );
+ }
return xRet;
}
+ScDocument* lcl_GetDocument( SdrObject* pObj )
+{
+ if( pObj )
+ {
+ ScDrawLayer* pModel = (ScDrawLayer*)pObj->GetModel();
+ if ( pModel )
+ return pModel->GetDocument();
+ }
+ return NULL;
+}
+
void SAL_CALL ScShapeObj::setPropertyValue(
const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException,
@@ -182,12 +220,39 @@ void SAL_CALL ScShapeObj::setPropertyValue(
uno::RuntimeException)
{
ScUnoGuard aGuard;
+ String aNameString = aPropertyName;
- //! mix own and aggregated properties
+ if ( aNameString.EqualsAscii( SC_UNONAME_IMAGEMAP ) )
+ {
+ SdrObject* pObj = GetSdrObject();
+ if ( pObj )
+ {
+ ImageMap aImageMap;
+ uno::Reference< uno::XInterface > xImageMapInt;
+ aValue >>= xImageMapInt;
- uno::Reference<beans::XPropertySet> xAggProp = lcl_GetPropertySet(mxShapeAgg);
- if ( xAggProp.is() )
- xAggProp->setPropertyValue( aPropertyName, aValue );
+ if( !xImageMapInt.is() || !SvUnoImageMap_fillImageMap( xImageMapInt, aImageMap ) )
+ throw lang::IllegalArgumentException();
+
+ ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo(pObj);
+ if( pIMapInfo )
+ {
+ // replace existing image map
+ pIMapInfo->SetImageMap( aImageMap );
+ }
+ else
+ {
+ // insert new user data with image map
+ pObj->InsertUserData(new ScIMapInfo(aImageMap) );
+ }
+ }
+ }
+ else
+ {
+ uno::Reference<beans::XPropertySet> xAggProp = lcl_GetPropertySet(mxShapeAgg);
+ if ( xAggProp.is() )
+ xAggProp->setPropertyValue( aPropertyName, aValue );
+ }
}
uno::Any SAL_CALL ScShapeObj::getPropertyValue( const rtl::OUString& aPropertyName )
@@ -195,13 +260,32 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const rtl::OUString& aPropertyNa
uno::RuntimeException)
{
ScUnoGuard aGuard;
-
- //! mix own and aggregated properties
+ String aNameString = aPropertyName;
uno::Any aAny;
- uno::Reference<beans::XPropertySet> xAggProp = lcl_GetPropertySet(mxShapeAgg);
- if ( xAggProp.is() )
- aAny = xAggProp->getPropertyValue( aPropertyName );
+ if ( aNameString.EqualsAscii( SC_UNONAME_IMAGEMAP ) )
+ {
+ uno::Reference< uno::XInterface > xImageMap;
+ SdrObject* pObj = GetSdrObject();
+ if ( pObj )
+ {
+ ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo(GetSdrObject());
+ if( pIMapInfo )
+ {
+ const ImageMap& rIMap = pIMapInfo->GetImageMap();
+ xImageMap = SvUnoImageMap_createInstance( rIMap, lcl_GetSupportedMacroItems() );
+ }
+ else
+ xImageMap = SvUnoImageMap_createInstance( lcl_GetSupportedMacroItems() );
+ }
+ aAny <<= uno::Reference< container::XIndexContainer >::query( xImageMap );
+ }
+ else
+ {
+ uno::Reference<beans::XPropertySet> xAggProp = lcl_GetPropertySet(mxShapeAgg);
+ if ( xAggProp.is() )
+ aAny = xAggProp->getPropertyValue( aPropertyName );
+ }
return aAny;
}