summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/funcuno.hxx57
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx96
2 files changed, 142 insertions, 11 deletions
diff --git a/sc/inc/funcuno.hxx b/sc/inc/funcuno.hxx
index d968d29b497b..bdafc2b9e87f 100644
--- a/sc/inc/funcuno.hxx
+++ b/sc/inc/funcuno.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: funcuno.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: nn $ $Date: 2000-10-06 17:45:51 $
+ * last change: $Author: nn $ $Date: 2000-10-12 10:15:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,9 +68,12 @@
#ifndef _COM_SUN_STAR_SHEET_XFUNCTIONACCESS_HPP_
#include <com/sun/star/sheet/XFunctionAccess.hpp>
#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
-#include <cppuhelper/implbase2.hxx>
+#ifndef _CPPUHELPER_IMPLBASE3_HXX_
+#include <cppuhelper/implbase3.hxx>
#endif
#ifndef _SFXLSTNER_HXX
@@ -78,6 +81,7 @@
#endif
class ScDocument;
+class ScDocOptions;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
@@ -104,13 +108,15 @@ public:
void Clear();
};
-class ScFunctionAccess : public cppu::WeakImplHelper2<
+class ScFunctionAccess : public cppu::WeakImplHelper3<
com::sun::star::sheet::XFunctionAccess,
+ com::sun::star::beans::XPropertySet,
com::sun::star::lang::XServiceInfo>,
public SfxListener
{
private:
ScTempDocCache aDocCache;
+ ScDocOptions* pOptions;
BOOL bInvalid;
public:
@@ -131,6 +137,47 @@ public:
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ SAL_CALL getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException);
+ 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);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName()
throw(::com::sun::star::uno::RuntimeException);
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 227187abae6e..6326bc083d7e 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: funcuno.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: nn $ $Date: 2000-10-06 17:47:37 $
+ * last change: $Author: nn $ $Date: 2000-10-12 10:16:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,7 @@
#include <tools/debug.hxx>
#include <sfx2/app.hxx>
+#include <svtools/itemprop.hxx>
#include "funcuno.hxx"
#include "miscuno.hxx"
@@ -78,14 +79,18 @@
#include "addincol.hxx"
#include "rangeseq.hxx"
#include "cell.hxx"
+#include "docoptio.hxx"
+#include "optuno.hxx"
using namespace com::sun::star;
//------------------------------------------------------------------------
-#define SCFUNCTIONACCESS_SERVICE "com.sun.star.sheet.FunctionAccess"
+// registered as implementation for service FunctionAccess,
+// also supports service SpreadsheetDocumentSettings (to set null date etc.)
-SC_SIMPLE_SERVICE_INFO( ScFunctionAccess, "ScFunctionAccess", SCFUNCTIONACCESS_SERVICE )
+#define SCFUNCTIONACCESS_SERVICE "com.sun.star.sheet.FunctionAccess"
+#define SCDOCSETTINGS_SERVICE "com.sun.star.sheet.SpreadsheetDocumentSettings"
//------------------------------------------------------------------------
@@ -176,13 +181,15 @@ void ScTempDocCache::Clear()
//------------------------------------------------------------------------
ScFunctionAccess::ScFunctionAccess() :
- bInvalid( FALSE )
+ bInvalid( FALSE ),
+ pOptions( NULL )
{
StartListening( *SFX_APP() ); // for SFX_HINT_DEINITIALIZING
}
ScFunctionAccess::~ScFunctionAccess()
{
+ delete pOptions;
}
void ScFunctionAccess::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
@@ -220,7 +227,77 @@ uno::Sequence<rtl::OUString> ScFunctionAccess::getSupportedServiceNames_Static()
return aRet;
}
-// ---
+// XServiceInfo
+
+rtl::OUString SAL_CALL ScFunctionAccess::getImplementationName() throw(uno::RuntimeException)
+{
+ return rtl::OUString::createFromAscii( "ScFunctionAccess" );
+}
+
+sal_Bool SAL_CALL ScFunctionAccess::supportsService( const rtl::OUString& rServiceName )
+ throw(uno::RuntimeException)
+{
+ String aServiceStr = rServiceName;
+ return aServiceStr.EqualsAscii( SCFUNCTIONACCESS_SERVICE ) ||
+ aServiceStr.EqualsAscii( SCDOCSETTINGS_SERVICE );
+}
+
+uno::Sequence<rtl::OUString> SAL_CALL ScFunctionAccess::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence<rtl::OUString> aRet(2);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = rtl::OUString::createFromAscii( SCFUNCTIONACCESS_SERVICE );
+ pArray[1] = rtl::OUString::createFromAscii( SCDOCSETTINGS_SERVICE );
+ return aRet;
+}
+
+// XPropertySet (document settings)
+
+uno::Reference<beans::XPropertySetInfo> SAL_CALL ScFunctionAccess::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+ static uno::Reference<beans::XPropertySetInfo> aRef =
+ new SfxItemPropertySetInfo( ScDocOptionsHelper::GetPropertyMap() );
+ return aRef;
+}
+
+void SAL_CALL ScFunctionAccess::setPropertyValue(
+ const rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+
+ if ( !pOptions )
+ pOptions = new ScDocOptions();
+
+ // options aren't initialized from configuration - always get the same default behaviour
+
+ BOOL bDone = ScDocOptionsHelper::setPropertyValue( *pOptions, aPropertyName, aValue );
+ if (!bDone)
+ throw beans::UnknownPropertyException();
+}
+
+uno::Any SAL_CALL ScFunctionAccess::getPropertyValue( const rtl::OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ ScUnoGuard aGuard;
+
+ if ( !pOptions )
+ pOptions = new ScDocOptions();
+
+ // options aren't initialized from configuration - always get the same default behaviour
+
+ return ScDocOptionsHelper::getPropertyValue( *pOptions, aPropertyName );
+}
+
+SC_IMPL_DUMMY_PROPERTY_LISTENER( ScFunctionAccess )
+
+// XFunctionAccess
BOOL lcl_AddFunctionToken( ScTokenArray& rArray, const rtl::OUString& rName )
{
@@ -309,6 +386,13 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const rtl::OUString& aName,
}
//
+ // set options (null date, etc.)
+ //
+
+ if ( pOptions )
+ pDoc->SetDocOptions( *pOptions );
+
+ //
// add arguments to token array
//