summaryrefslogtreecommitdiff
path: root/shell/source/backends
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2009-10-01 13:40:46 +0200
committersb <sb@openoffice.org>2009-10-01 13:40:46 +0200
commite573925559daab2f374c9b485290e28751978b52 (patch)
tree5e5ca0588d2f819336683f02b822be5949c10885 /shell/source/backends
parent3ffb5481b5e116c4a39dd07335439e711f0ca706 (diff)
#i101955# changed platform backend interface once again, from XNameAccess to XPropertySet
Diffstat (limited to 'shell/source/backends')
-rw-r--r--shell/source/backends/desktopbe/desktopbackend.cxx154
-rw-r--r--shell/source/backends/gconfbe/gconfaccess.cxx7
-rw-r--r--shell/source/backends/gconfbe/gconfaccess.hxx4
-rw-r--r--shell/source/backends/gconfbe/gconfbackend.cxx120
-rw-r--r--shell/source/backends/kde4be/kde4access.cxx45
-rw-r--r--shell/source/backends/kde4be/kde4access.hxx5
-rw-r--r--shell/source/backends/kde4be/kde4backend.cxx159
-rw-r--r--shell/source/backends/kdebe/kdeaccess.cxx45
-rw-r--r--shell/source/backends/kdebe/kdeaccess.hxx5
-rw-r--r--shell/source/backends/kdebe/kdebackend.cxx159
-rw-r--r--shell/source/backends/localebe/localebackend.cxx69
-rw-r--r--shell/source/backends/localebe/localebackend.hxx75
-rw-r--r--shell/source/backends/macbe/macbackend.cxx138
-rw-r--r--shell/source/backends/macbe/macbackend.hxx75
-rw-r--r--shell/source/backends/macbe/macbelayer.cxx443
-rw-r--r--shell/source/backends/macbe/macbelayer.hxx104
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.cxx152
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.hxx109
18 files changed, 764 insertions, 1104 deletions
diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx
index a214b08edb18..41d0c89f96b7 100644
--- a/shell/source/backends/desktopbe/desktopbackend.cxx
+++ b/shell/source/backends/desktopbe/desktopbackend.cxx
@@ -31,19 +31,25 @@
#include "sal/config.h"
#include "boost/noncopyable.hpp"
-#include "com/sun/star/container/NoSuchElementException.hpp"
-#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/beans/Optional.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XVetoableChangeListener.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
-#include "com/sun/star/uno/Type.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XCurrentContext.hpp"
-#include "cppu/unotype.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/implementationentry.hxx"
@@ -76,7 +82,7 @@ css::uno::Sequence< rtl::OUString > SAL_CALL getDefaultSupportedServiceNames() {
class Default:
public cppu::WeakImplHelper2<
- css::lang::XServiceInfo, css::container::XNameAccess >,
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
private boost::noncopyable
{
public:
@@ -97,73 +103,105 @@ private:
getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return getDefaultSupportedServiceNames(); }
- virtual css::uno::Type SAL_CALL getElementType()
- throw (css::uno::RuntimeException)
- { return cppu::UnoType< cppu::UnoVoidType >::get(); }
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
- virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
- { return true; }
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getByName(rtl::OUString const & aName)
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
+ css::beans::UnknownPropertyException,
css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames()
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
- virtual sal_Bool SAL_CALL hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
};
-css::uno::Any Default::getByName(rtl::OUString const & aName)
+void Default::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- if (!hasByName(aName)) {
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
- }
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Sequence< rtl::OUString > Default::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(13);
- names[0] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("EnableATToolSupport"));
- names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExternalMailer"));
- names[2] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("SourceViewFontHeight"));
- names[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SourceViewFontName"));
- names[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable"));
- names[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName"));
- names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort"));
- names[7] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName"));
- names[8] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort"));
- names[9] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName"));
- names[10] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort"));
- names[11] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"));
- names[12] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType"));
- return names;
-}
-
-sal_Bool Default::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
+css::uno::Any Default::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- css::uno::Sequence< rtl::OUString > names(getElementNames());
- for (sal_Int32 i = 0; i < names.getLength(); ++i) {
- if (aName == names[i]) {
- return true;
- }
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ExternalMailer")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
+ {
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
}
- return false;
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
css::uno::Reference< css::uno::XInterface > createBackend(
diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
index 8391eda712fa..20de0af6ef3d 100644
--- a/shell/source/backends/gconfbe/gconfaccess.cxx
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -824,7 +824,8 @@ ConfigurationValue const ConfigurationValues[] =
std::size_t const nConfigurationValues =
sizeof ConfigurationValues / sizeof ConfigurationValues[0];
-css::uno::Any getValue(ConfigurationValue const & data) {
+css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data)
+{
GConfClient* aClient = getGconfClient();
GConfValue* aGconfValue;
if( ( data.nDependsOn == SETTINGS_LAST ) || isDependencySatisfied( aClient, data ) )
@@ -841,10 +842,10 @@ css::uno::Any getValue(ConfigurationValue const & data) {
gconf_value_free( aGconfValue );
- return value;
+ return css::beans::Optional< css::uno::Any >(true, value);
}
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ return css::beans::Optional< css::uno::Any >();
}
}
diff --git a/shell/source/backends/gconfbe/gconfaccess.hxx b/shell/source/backends/gconfbe/gconfaccess.hxx
index c986fd338da9..ad156974b150 100644
--- a/shell/source/backends/gconfbe/gconfaccess.hxx
+++ b/shell/source/backends/gconfbe/gconfaccess.hxx
@@ -34,6 +34,7 @@
#include <cstddef>
+#include "com/sun/star/beans/Optional.hpp"
#include "gconf/gconf-client.h"
#include "sal/types.h"
@@ -112,7 +113,8 @@ extern ConfigurationValue const ConfigurationValues[];
extern std::size_t const nConfigurationValues;
-com::sun::star::uno::Any getValue(ConfigurationValue const & data);
+com::sun::star::beans::Optional< com::sun::star::uno::Any > getValue(
+ ConfigurationValue const & data);
}
diff --git a/shell/source/backends/gconfbe/gconfbackend.cxx b/shell/source/backends/gconfbe/gconfbackend.cxx
index 2410ca85171f..27b098996b2a 100644
--- a/shell/source/backends/gconfbe/gconfbackend.cxx
+++ b/shell/source/backends/gconfbe/gconfbackend.cxx
@@ -33,18 +33,24 @@
#include <cstddef>
#include "boost/noncopyable.hpp"
-#include "com/sun/star/container/NoSuchElementException.hpp"
-#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/beans/Optional.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XVetoableChangeListener.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
-#include "com/sun/star/uno/Type.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XCurrentContext.hpp"
-#include "cppu/unotype.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/implementationentry.hxx"
@@ -78,7 +84,7 @@ css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() {
class Service:
public cppu::WeakImplHelper2<
- css::lang::XServiceInfo, css::container::XNameAccess >,
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
private boost::noncopyable
{
public:
@@ -99,23 +105,55 @@ private:
getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return getServiceSupportedServiceNames(); }
- virtual css::uno::Type SAL_CALL getElementType()
- throw (css::uno::RuntimeException)
- { return cppu::UnoType< cppu::UnoVoidType >::get(); }
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
- virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
- { return true; }
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getByName(rtl::OUString const & aName)
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
+ css::beans::UnknownPropertyException,
css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames()
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
- virtual sal_Bool SAL_CALL hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
bool enabled_;
};
@@ -136,47 +174,35 @@ Service::Service(): enabled_(false) {
}
}
-css::uno::Any Service::getByName(rtl::OUString const & aName)
+void Service::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- for (std::size_t i = 0; i < gconfaccess::nConfigurationValues; ++i) {
- if (aName.equalsAscii(
- gconfaccess::ConfigurationValues[i].OOoConfItem))
- {
- return enabled_
- ? gconfaccess::getValue(gconfaccess::ConfigurationValues[i])
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- }
- }
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Sequence< rtl::OUString > Service::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(
- gconfaccess::nConfigurationValues);
- for (std::size_t i = 0; i < gconfaccess::nConfigurationValues; ++i) {
- names[i] = rtl::OUString::createFromAscii(
- gconfaccess::ConfigurationValues[i].OOoConfItem);
- }
- return names;
-}
-
-sal_Bool Service::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
+css::uno::Any Service::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
for (std::size_t i = 0; i < gconfaccess::nConfigurationValues; ++i) {
- if (aName.equalsAscii(
+ if (PropertyName.equalsAscii(
gconfaccess::ConfigurationValues[i].OOoConfItem))
{
- return true;
+ return css::uno::makeAny(
+ enabled_
+ ? gconfaccess::getValue(gconfaccess::ConfigurationValues[i])
+ : css::beans::Optional< css::uno::Any >());
}
}
- return false;
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
diff --git a/shell/source/backends/kde4be/kde4access.cxx b/shell/source/backends/kde4be/kde4access.cxx
index fc3ae7043330..888f5cdc82fe 100644
--- a/shell/source/backends/kde4be/kde4access.cxx
+++ b/shell/source/backends/kde4be/kde4access.cxx
@@ -43,6 +43,8 @@
#include "rtl/string.h"
#include "rtl/ustring.hxx"
+#include "kde4access.hxx"
+
#define SPACE ' '
#define COMMA ','
#define SEMI_COLON ';'
@@ -56,7 +58,7 @@ namespace uno = css::uno ;
}
-css::uno::Any getValue(rtl::OUString const & id) {
+css::beans::Optional< css::uno::Any > getValue(rtl::OUString const & id) {
if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) {
KEMailSettings aEmailSettings;
QString aClientProgram;
@@ -68,7 +70,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
else
aClientProgram = aClientProgram.section(SPACE, 0, 0);
sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
- return uno::makeAny( sClientProgram );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sClientProgram ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")))
{
@@ -77,7 +80,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
aFixedFont = KGlobalSettings::fixedFont();
nFontHeight = aFixedFont.pointSize();
- return uno::makeAny( nFontHeight );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nFontHeight ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")))
{
@@ -88,13 +92,15 @@ css::uno::Any getValue(rtl::OUString const & id) {
aFixedFont = KGlobalSettings::fixedFont();
aFontName = aFixedFont.family();
sFontName = (const sal_Unicode *) aFontName.utf16();
- return uno::makeAny( sFontName );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sFontName ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport")))
{
/* does not make much sense without an accessibility bridge */
sal_Bool ATToolSupport = sal_False;
- return uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
{
@@ -105,7 +111,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
- return uno::makeAny( sDocumentsURL );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sDocumentsURL ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
{
@@ -130,7 +137,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KUrl aProxy(aFTPProxy);
::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
- return uno::makeAny( sProxy );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
@@ -156,7 +164,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KUrl aProxy(aFTPProxy);
sal_Int32 nPort = aProxy.port();
- return uno::makeAny( nPort );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
@@ -182,7 +191,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KUrl aProxy(aHTTPProxy);
::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
- return uno::makeAny( sProxy );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
@@ -208,7 +218,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KUrl aProxy(aHTTPProxy);
sal_Int32 nPort = aProxy.port();
- return uno::makeAny( nPort );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
@@ -234,7 +245,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KUrl aProxy(aHTTPSProxy);
::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
- return uno::makeAny( sProxy );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
@@ -260,7 +272,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KUrl aProxy(aHTTPSProxy);
sal_Int32 nPort = aProxy.port();
- return uno::makeAny( nPort );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
}
} else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) {
QString aNoProxyFor;
@@ -281,7 +294,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
- return uno::makeAny( sNoProxyFor );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sNoProxyFor ) );
}
} else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) {
int nProxyType;
@@ -296,11 +310,12 @@ css::uno::Any getValue(rtl::OUString const & id) {
default: // No proxy is used
nProxyType = 0;
}
- return uno::makeAny( (sal_Int32) nProxyType );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( (sal_Int32) nProxyType ) );
} else {
OSL_ASSERT(false); // this cannot happen
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ return css::beans::Optional< css::uno::Any >();
}
}
diff --git a/shell/source/backends/kde4be/kde4access.hxx b/shell/source/backends/kde4be/kde4access.hxx
index 043dff6476ec..2edd2f3a8686 100644
--- a/shell/source/backends/kde4be/kde4access.hxx
+++ b/shell/source/backends/kde4be/kde4access.hxx
@@ -32,6 +32,8 @@
#include "sal/config.h"
+#include "com/sun/star/beans/Optional.hpp"
+
namespace com { namespace sun { namespace star { namespace uno {
class Any;
} } } }
@@ -39,7 +41,8 @@ namespace rtl { class OUString; }
namespace kde4access {
-com::sun::star::uno::Any getValue(rtl::OUString const & id);
+com::sun::star::beans::Optional< com::sun::star::uno::Any > getValue(
+ rtl::OUString const & id);
}
diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx
index feef44562d49..e2f7e4c813f1 100644
--- a/shell/source/backends/kde4be/kde4backend.cxx
+++ b/shell/source/backends/kde4be/kde4backend.cxx
@@ -33,18 +33,24 @@
#include "kapplication.h"
#include "boost/noncopyable.hpp"
-#include "com/sun/star/container/NoSuchElementException.hpp"
-#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/beans/Optional.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XVetoableChangeListener.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
-#include "com/sun/star/uno/Type.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XCurrentContext.hpp"
-#include "cppu/unotype.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/implementationentry.hxx"
@@ -77,7 +83,7 @@ css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() {
class Service:
public cppu::WeakImplHelper2<
- css::lang::XServiceInfo, css::container::XNameAccess >,
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
private boost::noncopyable
{
public:
@@ -98,23 +104,55 @@ private:
getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return getServiceSupportedServiceNames(); }
- virtual css::uno::Type SAL_CALL getElementType()
- throw (css::uno::RuntimeException)
- { return cppu::UnoType< cppu::UnoVoidType >::get(); }
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
- virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
- { return true; }
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getByName(rtl::OUString const & aName)
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
+ css::beans::UnknownPropertyException,
css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames()
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
- virtual sal_Bool SAL_CALL hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
bool enabled_;
};
@@ -133,56 +171,57 @@ Service::Service(): enabled_(false) {
}
}
-css::uno::Any Service::getByName(rtl::OUString const & aName)
+void Service::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- if (!hasByName(aName)) {
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
- }
- return enabled_
- ? kde4access::getValue(aName)
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Sequence< rtl::OUString > Service::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(13);
- names[0] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("EnableATToolSupport"));
- names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExternalMailer"));
- names[2] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("SourceViewFontHeight"));
- names[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SourceViewFontName"));
- names[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable"));
- names[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName"));
- names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort"));
- names[7] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName"));
- names[8] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort"));
- names[9] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName"));
- names[10] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort"));
- names[11] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"));
- names[12] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType"));
- return names;
-}
-
-sal_Bool Service::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
+css::uno::Any Service::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- css::uno::Sequence< rtl::OUString > names(getElementNames());
- for (sal_Int32 i = 0; i < names.getLength(); ++i) {
- if (aName == names[i]) {
- return true;
- }
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ExternalMailer")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
+ {
+ return css::uno::makeAny(
+ enabled_
+ ? kde4access::getValue(PropertyName)
+ : css::beans::Optional< css::uno::Any >());
}
- return false;
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
diff --git a/shell/source/backends/kdebe/kdeaccess.cxx b/shell/source/backends/kdebe/kdeaccess.cxx
index 9dd9ecd7478b..dcb1df9c95b0 100644
--- a/shell/source/backends/kdebe/kdeaccess.cxx
+++ b/shell/source/backends/kdebe/kdeaccess.cxx
@@ -38,6 +38,8 @@
#include "rtl/ustring.hxx"
#include "vcl/kde_headers.h"
+#include "kdeaccess.hxx"
+
#define SPACE ' '
#define COMMA ','
#define SEMI_COLON ';'
@@ -51,7 +53,7 @@ namespace uno = css::uno ;
}
-css::uno::Any getValue(rtl::OUString const & id) {
+css::beans::Optional< css::uno::Any > getValue(rtl::OUString const & id) {
if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) {
KEMailSettings aEmailSettings;
QString aClientProgram;
@@ -63,7 +65,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
else
aClientProgram = aClientProgram.section(SPACE, 0, 0);
sClientProgram = (const sal_Unicode *) aClientProgram.ucs2();
- return uno::makeAny( sClientProgram );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sClientProgram ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")))
{
@@ -72,7 +75,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
aFixedFont = KGlobalSettings::fixedFont();
nFontHeight = aFixedFont.pointSize();
- return uno::makeAny( nFontHeight );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nFontHeight ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")))
{
@@ -83,13 +87,15 @@ css::uno::Any getValue(rtl::OUString const & id) {
aFixedFont = KGlobalSettings::fixedFont();
aFontName = aFixedFont.family();
sFontName = (const sal_Unicode *) aFontName.ucs2();
- return uno::makeAny( sFontName );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sFontName ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport")))
{
/* does not make much sense without an accessibility bridge */
sal_Bool ATToolSupport = sal_False;
- return uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
{
@@ -100,7 +106,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2();
osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
- return uno::makeAny( sDocumentsURL );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sDocumentsURL ) );
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
{
@@ -125,7 +132,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KURL aProxy(aFTPProxy);
::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
- return uno::makeAny( sProxy );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
@@ -151,7 +159,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KURL aProxy(aFTPProxy);
sal_Int32 nPort = aProxy.port();
- return uno::makeAny( nPort );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
@@ -177,7 +186,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KURL aProxy(aHTTPProxy);
::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
- return uno::makeAny( sProxy );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
@@ -203,7 +213,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KURL aProxy(aHTTPProxy);
sal_Int32 nPort = aProxy.port();
- return uno::makeAny( nPort );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
@@ -229,7 +240,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KURL aProxy(aHTTPSProxy);
::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
- return uno::makeAny( sProxy );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
}
} else if (id.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
@@ -255,7 +267,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
{
KURL aProxy(aHTTPSProxy);
sal_Int32 nPort = aProxy.port();
- return uno::makeAny( nPort );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
}
} else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) {
QString aNoProxyFor;
@@ -276,7 +289,8 @@ css::uno::Any getValue(rtl::OUString const & id) {
aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
sNoProxyFor = (const sal_Unicode *) aNoProxyFor.ucs2();
- return uno::makeAny( sNoProxyFor );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sNoProxyFor ) );
}
} else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) {
int nProxyType;
@@ -291,11 +305,12 @@ css::uno::Any getValue(rtl::OUString const & id) {
default: // No proxy is used
nProxyType = 0;
}
- return uno::makeAny( (sal_Int32) nProxyType );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( (sal_Int32) nProxyType ) );
} else {
OSL_ASSERT(false); // this cannot happen
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ return css::beans::Optional< css::uno::Any >();
}
}
diff --git a/shell/source/backends/kdebe/kdeaccess.hxx b/shell/source/backends/kdebe/kdeaccess.hxx
index cb916a44d61b..5e61f5a224e0 100644
--- a/shell/source/backends/kdebe/kdeaccess.hxx
+++ b/shell/source/backends/kdebe/kdeaccess.hxx
@@ -32,6 +32,8 @@
#include "sal/config.h"
+#include "com/sun/star/beans/Optional.hpp"
+
namespace com { namespace sun { namespace star { namespace uno {
class Any;
} } } }
@@ -39,7 +41,8 @@ namespace rtl { class OUString; }
namespace kdeaccess {
-com::sun::star::uno::Any getValue(rtl::OUString const & id);
+com::sun::star::beans::Optional< com::sun::star::uno::Any > getValue(
+ rtl::OUString const & id);
}
diff --git a/shell/source/backends/kdebe/kdebackend.cxx b/shell/source/backends/kdebe/kdebackend.cxx
index 0f52c2a917c1..743971a0d9e2 100644
--- a/shell/source/backends/kdebe/kdebackend.cxx
+++ b/shell/source/backends/kdebe/kdebackend.cxx
@@ -31,18 +31,24 @@
#include "sal/config.h"
#include "boost/noncopyable.hpp"
-#include "com/sun/star/container/NoSuchElementException.hpp"
-#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/beans/Optional.hpp"
+#include "com/sun/star/beans/PropertyVetoException.hpp"
+#include "com/sun/star/beans/UnknownPropertyException.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XVetoableChangeListener.hpp"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/WrappedTargetException.hpp"
#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
-#include "com/sun/star/uno/Type.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XCurrentContext.hpp"
-#include "cppu/unotype.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/implementationentry.hxx"
@@ -76,7 +82,7 @@ css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() {
class Service:
public cppu::WeakImplHelper2<
- css::lang::XServiceInfo, css::container::XNameAccess >,
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
private boost::noncopyable
{
public:
@@ -97,23 +103,55 @@ private:
getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return getServiceSupportedServiceNames(); }
- virtual css::uno::Type SAL_CALL getElementType()
- throw (css::uno::RuntimeException)
- { return cppu::UnoType< cppu::UnoVoidType >::get(); }
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
- virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException)
- { return true; }
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getByName(rtl::OUString const & aName)
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
+ css::beans::UnknownPropertyException,
css::lang::WrappedTargetException, css::uno::RuntimeException);
- virtual css::uno::Sequence< rtl::OUString > SAL_CALL getElementNames()
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
- virtual sal_Bool SAL_CALL hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
bool enabled_;
};
@@ -132,56 +170,57 @@ Service::Service(): enabled_(false) {
}
}
-css::uno::Any Service::getByName(rtl::OUString const & aName)
+void Service::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- if (!hasByName(aName)) {
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
- }
- return enabled_
- ? kdeaccess::getValue(aName)
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Sequence< rtl::OUString > Service::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(13);
- names[0] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("EnableATToolSupport"));
- names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExternalMailer"));
- names[2] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("SourceViewFontHeight"));
- names[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SourceViewFontName"));
- names[4] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable"));
- names[5] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName"));
- names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort"));
- names[7] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName"));
- names[8] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort"));
- names[9] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName"));
- names[10] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort"));
- names[11] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"));
- names[12] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType"));
- return names;
-}
-
-sal_Bool Service::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
+css::uno::Any Service::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- css::uno::Sequence< rtl::OUString > names(getElementNames());
- for (sal_Int32 i = 0; i < names.getLength(); ++i) {
- if (aName == names[i]) {
- return true;
- }
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("EnableATToolSupport")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ExternalMailer")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) ||
+ PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
+ {
+ return css::uno::makeAny(
+ enabled_
+ ? kdeaccess::getValue(PropertyName)
+ : css::beans::Optional< css::uno::Any >());
}
- return false;
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx
index 5df54b055929..75544c6d7f05 100644
--- a/shell/source/backends/localebe/localebackend.cxx
+++ b/shell/source/backends/localebe/localebackend.cxx
@@ -32,6 +32,7 @@
#include "precompiled_shell.hxx"
#include "localebackend.hxx"
+#include <com/sun/star/beans/Optional.hpp>
#include <osl/time.h>
#include <stdio.h>
@@ -282,51 +283,47 @@ rtl::OUString LocaleBackend::getSystemLocale(void)
}
//------------------------------------------------------------------------------
-css::uno::Type LocaleBackend::getElementType() throw(css::uno::RuntimeException)
-{
- return cppu::UnoType< cppu::UnoVoidType >::get();
-}
-
-sal_Bool LocaleBackend::hasElements() throw(css::uno::RuntimeException)
+void LocaleBackend::setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- return true;
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Any LocaleBackend::getByName(rtl::OUString const & aName)
+css::uno::Any LocaleBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Locale"))) {
- return css::uno::makeAny(getLocale());
- } else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SystemLocale"))) {
- return css::uno::makeAny(getSystemLocale());
- } else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UILocale"))) {
- return css::uno::makeAny(getUILocale());
+ if (PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Locale"))) {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, css::uno::makeAny(getLocale())));
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SystemLocale")))
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, css::uno::makeAny(getSystemLocale())));
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("UILocale")))
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, css::uno::makeAny(getUILocale())));
} else {
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
}
-css::uno::Sequence< rtl::OUString > LocaleBackend::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(3);
- names[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Locale"));
- names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SystemLocale"));
- names[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale"));
- return names;
-}
-
-sal_Bool LocaleBackend::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
-{
- return aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Locale")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("SystemLocale")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UILocale"));
-}
-
//------------------------------------------------------------------------------
rtl::OUString SAL_CALL LocaleBackend::getBackendName(void) {
diff --git a/shell/source/backends/localebe/localebackend.hxx b/shell/source/backends/localebe/localebackend.hxx
index 5e5083694325..954a2bba9a0a 100644
--- a/shell/source/backends/localebe/localebackend.hxx
+++ b/shell/source/backends/localebe/localebackend.hxx
@@ -31,7 +31,7 @@
#ifndef _FIXEDVALUEBACKEND_HXX_
#define _FIXEDVALUEBACKEND_HXX_
-#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase2.hxx>
#include <rtl/string.hxx>
@@ -42,7 +42,7 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
class LocaleBackend : public ::cppu::WeakImplHelper2 <
- css::container::XNameAccess,
+ css::beans::XPropertySet,
lang::XServiceInfo > {
public :
@@ -75,27 +75,56 @@ class LocaleBackend : public ::cppu::WeakImplHelper2 <
*/
static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
- //XNameAccess
- virtual uno::Type SAL_CALL
- getElementType()
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- hasElements()
- throw (uno::RuntimeException);
-
- virtual uno::Any SAL_CALL
- getByName( const rtl::OUString& aName )
- throw (css::container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException);
-
- virtual uno::Sequence<rtl::OUString> SAL_CALL
- getElementNames()
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- hasByName( const rtl::OUString& aName )
- throw (uno::RuntimeException);
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
+
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
protected:
/**
diff --git a/shell/source/backends/macbe/macbackend.cxx b/shell/source/backends/macbe/macbackend.cxx
index f532e943e9c7..5c408e059da4 100644
--- a/shell/source/backends/macbe/macbackend.cxx
+++ b/shell/source/backends/macbe/macbackend.cxx
@@ -41,6 +41,7 @@
#include "macbackend.hxx"
+#include "com/sun/star/beans/Optional.hpp"
#include "rtl/ustrbuf.hxx"
#include "osl/file.h"
@@ -211,22 +212,28 @@ rtl::OUString GetOUString( NSString* pStr )
return aBuf.makeStringAndClear();
}
-css::uno::Type MacOSXBackend::getElementType() throw(css::uno::RuntimeException)
-{
- return cppu::UnoType< cppu::UnoVoidType >::get();
-}
-
-sal_Bool MacOSXBackend::hasElements() throw(css::uno::RuntimeException)
+void MacOSXBackend::setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- return true;
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
+css::uno::Any MacOSXBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("WorkPathVariable"))) {
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
+ {
rtl::OUString aDocDir;
NSArray* pPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, true );
if( pPaths && [pPaths count] > 0 )
@@ -237,7 +244,9 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
if( aDocDir.getLength() > 0 &&
osl_getFileURLFromSystemPath( aDocDir.pData, &aDocURL.pData ) == osl_File_E_None )
{
- return css::uno::makeAny(aDocURL);
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, css::uno::makeAny( aDocURL ) ) );
}
else
{
@@ -248,8 +257,8 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
{
OSL_TRACE( "Got nil or empty list of user document directories" );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
{
ProxyEntry aFtpProxy;
@@ -268,10 +277,12 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// ftp proxy name
if( aFtpProxy.Server.getLength() > 0 )
{
- return uno::makeAny( aFtpProxy.Server );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aFtpProxy.Server ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
{
ProxyEntry aFtpProxy;
@@ -290,10 +301,12 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// ftp proxy port
if( aFtpProxy.Port > 0 )
{
- return uno::makeAny( aFtpProxy.Port );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aFtpProxy.Port ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
{
ProxyEntry aHttpProxy;
@@ -312,10 +325,12 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// http proxy name
if( aHttpProxy.Server.getLength() > 0 )
{
- return uno::makeAny( aHttpProxy.Server );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpProxy.Server ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
{
ProxyEntry aHttpProxy;
@@ -334,10 +349,12 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// http proxy port
if( aHttpProxy.Port > 0 )
{
- return uno::makeAny( aHttpProxy.Port );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpProxy.Port ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
{
ProxyEntry aHttpsProxy;
@@ -356,10 +373,12 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// https proxy name
if( aHttpsProxy.Server.getLength() > 0 )
{
- return uno::makeAny( aHttpsProxy.Server );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpsProxy.Server ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
{
ProxyEntry aHttpsProxy;
@@ -378,16 +397,20 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// https proxy port
if( aHttpsProxy.Port > 0 )
{
- return uno::makeAny( aHttpsProxy.Port );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpsProxy.Port ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
{
// override default for ProxyType, which is "0" meaning "No proxies".
sal_Int32 nProperties = 1;
- return uno::makeAny( nProperties );
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nProperties ) ) );
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
{
rtl::OUString aProxyBypassList;
@@ -419,51 +442,18 @@ css::uno::Any MacOSXBackend::getByName(rtl::OUString const & aName)
// fill proxy bypass list
if( aProxyBypassList.getLength() > 0 )
{
- return uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) );
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true,
+ uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) ) ) );
}
- return css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
} else {
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
}
-css::uno::Sequence< rtl::OUString > MacOSXBackend::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(9);
- names[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("WorkPathVariable"));
- names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName"));
- names[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort"));
- names[3] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName"));
- names[4] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort"));
- names[5] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName"));
- names[6] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort"));
- names[7] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"));
- names[8] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType"));
- return names;
-}
-
-sal_Bool MacOSXBackend::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
-{
- return aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) ||
- aName.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) ||
- aName.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"));
-}
-
//------------------------------------------------------------------------------
rtl::OUString SAL_CALL MacOSXBackend::getBackendName(void)
diff --git a/shell/source/backends/macbe/macbackend.hxx b/shell/source/backends/macbe/macbackend.hxx
index cd15aa83e11a..ef919f077cb1 100644
--- a/shell/source/backends/macbe/macbackend.hxx
+++ b/shell/source/backends/macbe/macbackend.hxx
@@ -31,7 +31,7 @@
#ifndef _MACBACKEND_HXX_
#define _MACBACKEND_HXX_
-#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <cppuhelper/implbase2.hxx>
#include <rtl/string.hxx>
@@ -43,7 +43,7 @@ namespace css = com::sun::star;
namespace uno = css::uno;
namespace lang = css::lang;
-class MacOSXBackend : public ::cppu::WeakImplHelper2 <css::container::XNameAccess, lang::XServiceInfo >
+class MacOSXBackend : public ::cppu::WeakImplHelper2 <css::beans::XPropertySet, lang::XServiceInfo >
{
public:
@@ -74,27 +74,56 @@ public:
*/
static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void);
- //XNameAccess
- virtual uno::Type SAL_CALL
- getElementType()
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- hasElements()
- throw (uno::RuntimeException);
-
- virtual uno::Any SAL_CALL
- getByName( const rtl::OUString& aName )
- throw (css::container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException);
-
- virtual uno::Sequence<rtl::OUString> SAL_CALL
- getElementNames()
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- hasByName( const rtl::OUString& aName )
- throw (uno::RuntimeException);
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
+
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
protected:
diff --git a/shell/source/backends/macbe/macbelayer.cxx b/shell/source/backends/macbe/macbelayer.cxx
deleted file mode 100644
index ea0d3cb63fb7..000000000000
--- a/shell/source/backends/macbe/macbelayer.cxx
+++ /dev/null
@@ -1,443 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: macbelayer.cxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_shell.hxx"
-
-// For MAXHOSTNAMELEN constant
-#include <sys/param.h>
-
-#include <premac.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-#include <Foundation/NSPathUtilities.h>
-#include <postmac.h>
-
-#include "macbelayer.hxx"
-
-#include "rtl/ustrbuf.hxx"
-#include "osl/file.h"
-
-#define SPACE ' '
-#define SEMI_COLON ';'
-
-typedef struct
-{
- rtl::OUString Server;
- sal_Int32 Port;
-} ProxyEntry;
-
-typedef enum {
- sHTTP,
- sHTTPS,
- sFTP
-} ServiceType;
-
-//------------------------------------------------------------------------
-// helper functions
-//------------------------------------------------------------------------
-
-namespace // private
-{
-
-/*
- * Returns current proxy settings for selected service type (HTTP or
- * FTP) as a C string (in the buffer specified by host and hostSize)
- * and a port number.
- */
-
-bool GetProxySetting(ServiceType sType, char *host, size_t hostSize, UInt16 *port)
-{
- bool result;
- CFDictionaryRef proxyDict;
- CFNumberRef enableNum;
- int enable;
- CFStringRef hostStr;
- CFNumberRef portNum;
- int portInt;
-
- proxyDict = SCDynamicStoreCopyProxies(NULL);
-
- if (!proxyDict)
- return false;
-
- CFStringRef proxiesEnable;
- CFStringRef proxiesProxy;
- CFStringRef proxiesPort;
-
- switch ( sType )
- {
- case sHTTP : proxiesEnable = kSCPropNetProxiesHTTPEnable;
- proxiesProxy = kSCPropNetProxiesHTTPProxy;
- proxiesPort = kSCPropNetProxiesHTTPPort;
- break;
- case sHTTPS: proxiesEnable = kSCPropNetProxiesHTTPSEnable;
- proxiesProxy = kSCPropNetProxiesHTTPSProxy;
- proxiesPort = kSCPropNetProxiesHTTPSPort;
- break;
- default: proxiesEnable = kSCPropNetProxiesFTPEnable;
- proxiesProxy = kSCPropNetProxiesFTPProxy;
- proxiesPort = kSCPropNetProxiesFTPPort;
- break;
- }
- // Proxy enabled?
- enableNum = (CFNumberRef) CFDictionaryGetValue( proxyDict,
- proxiesEnable );
-
- result = (enableNum != NULL) && (CFGetTypeID(enableNum) == CFNumberGetTypeID());
-
- if (result)
- result = CFNumberGetValue(enableNum, kCFNumberIntType, &enable) && (enable != 0);
-
- // Proxy enabled -> get hostname
- if (result)
- {
- hostStr = (CFStringRef) CFDictionaryGetValue( proxyDict,
- proxiesProxy );
-
- result = (hostStr != NULL) && (CFGetTypeID(hostStr) == CFStringGetTypeID());
- }
-
- if (result)
- result = CFStringGetCString(hostStr, host, (CFIndex) hostSize, kCFStringEncodingASCII);
-
- // Get proxy port
- if (result)
- {
- portNum = (CFNumberRef) CFDictionaryGetValue( proxyDict,
- proxiesPort );
-
- result = (portNum != NULL) && (CFGetTypeID(portNum) == CFNumberGetTypeID());
- }
- else
- {
- CFRelease(proxyDict);
- return false;
- }
-
- if (result)
- result = CFNumberGetValue(portNum, kCFNumberIntType, &portInt);
-
- if (result)
- *port = (UInt16) portInt;
-
- if (proxyDict)
- CFRelease(proxyDict);
-
- if (!result)
- {
- *host = 0;
- *port = 0;
- }
-
- return result;
-}
-
-} // end private namespace
-
-//------------------------------------------------------------------------------
-
-MacOSXLayer::MacOSXLayer( const uno::Reference<uno::XComponentContext>& xContext)
-{
- //Create instance of LayerContentDescriber Service
- rtl::OUString const k_sLayerDescriberService(
- RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.LayerDescriber"));
-
- typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
- uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
- if( xServiceManager.is() )
- {
- m_xLayerContentDescriber = LayerDescriber::query(
- xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
- }
- else
- {
- OSL_TRACE("Could not retrieve ServiceManager");
- }
-
-}
-
-//------------------------------------------------------------------------------
-
-rtl::OUString CFStringToOUString(const CFStringRef sOrig) {
- CFRetain(sOrig);
-
- CFIndex nStringLen = CFStringGetLength(sOrig)+1;
-
- // Allocate a c string buffer
- char sBuffer[nStringLen];
-
- CFStringGetCString(sOrig, sBuffer, nStringLen, kCFStringEncodingASCII);
-
- CFRelease(sOrig);
-
- return rtl::OUString::createFromAscii((sal_Char*)sBuffer);
-}
-
-void SAL_CALL MacOSXLayer::readData(
- const uno::Reference<backend::XLayerHandler>& xHandler)
- throw ( backend::MalformedDataException,
- lang::NullPointerException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
-
- if (m_xLayerContentDescriber.is())
- {
- rtl::OUString aProxyBypassList;
-
- CFArrayRef rExceptionsList;
- CFDictionaryRef rProxyDict = SCDynamicStoreCopyProxies(NULL);
-
- if (!rProxyDict)
- rExceptionsList = false;
- else
- rExceptionsList = (CFArrayRef) CFDictionaryGetValue(rProxyDict, kSCPropNetProxiesExceptionsList);
-
- if (rExceptionsList)
- {
- for (CFIndex idx = 0; idx < CFArrayGetCount(rExceptionsList); idx++)
- {
- CFStringRef rException = (CFStringRef) CFArrayGetValueAtIndex(rExceptionsList, idx);
-
- if (idx>0)
- aProxyBypassList += rtl::OUString::createFromAscii( ";" );
-
- aProxyBypassList += CFStringToOUString(rException);
- }
- }
-
- if (rProxyDict)
- CFRelease(rProxyDict);
-
- // override default for ProxyType, which is "0" meaning "No proxies".
- // CAUTION: if you add properties, please increase the sequence size here !
- uno::Sequence<backend::PropertyInfo> aPropInfoList(8);
- sal_Int32 nProperties = 1;
-
- aPropInfoList[0].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") );
- aPropInfoList[0].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[0].Protected = sal_False;
- aPropInfoList[0].Value = uno::makeAny( nProperties );
-
- // fill proxy bypass list
- if( aProxyBypassList.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) );
- }
-
- ProxyEntry aHttpProxy;
- ProxyEntry aHttpsProxy;
- ProxyEntry aFtpProxy;
-
- char host[MAXHOSTNAMELEN];
- UInt16 port;
- bool retVal;
-
- retVal = GetProxySetting(sHTTP, host, 100, &port);
-
- if (retVal)
- {
- aHttpProxy.Server = rtl::OUString::createFromAscii( host );
- aHttpProxy.Port = port;
- }
-
- retVal = GetProxySetting(sHTTPS, host, 100, &port);
-
- if (retVal)
- {
- aHttpsProxy.Server = rtl::OUString::createFromAscii( host );
- aHttpsProxy.Port = port;
- }
-
- retVal = GetProxySetting(sFTP, host, 100, &port);
-
- if (retVal)
- {
- aFtpProxy.Server = rtl::OUString::createFromAscii( host );
- aFtpProxy.Port = port;
- }
-
- // http proxy name
- if( aHttpProxy.Server.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpProxy.Server );
- }
-
- // http proxy port
- if( aHttpProxy.Port > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpProxy.Port );
- }
-
- // https proxy name
- if( aHttpsProxy.Server.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpsProxy.Server );
- }
-
- // https proxy port
- if( aHttpsProxy.Port > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aHttpsProxy.Port );
- }
-
- // ftp proxy name
- if( aFtpProxy.Server.getLength() > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aFtpProxy.Server );
- }
-
- // ftp proxy port
- if( aFtpProxy.Port > 0 )
- {
- aPropInfoList[nProperties].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") );
- aPropInfoList[nProperties].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "int" ) );
- aPropInfoList[nProperties].Protected = sal_False;
- aPropInfoList[nProperties++].Value = uno::makeAny( aFtpProxy.Port );
- }
-
- // resize the property info list appropriately
- aPropInfoList.realloc(nProperties);
-
- m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
- }
- else
- {
- OSL_TRACE("Could not create com.sun.star.configuration.backend.LayerContentDescriber Service");
- }
-}
-
-//------------------------------------------------------------------------------
-
-rtl::OUString SAL_CALL MacOSXLayer::getTimestamp(void)
- throw (uno::RuntimeException)
-{
- // FIXME: Always new timestamp!?
- rtl::OUString aTimestamp = rtl::OUString::valueOf( time(NULL) );
-
- return aTimestamp;
-}
-
-//------------------------------------------------------------------------------
-
-rtl::OUString GetOUString( NSString* pStr )
-{
- if( ! pStr )
- return rtl::OUString();
- int nLen = [pStr length];
- if( nLen == 0 )
- return rtl::OUString();
-
- rtl::OUStringBuffer aBuf( nLen+1 );
- aBuf.setLength( nLen );
- [pStr getCharacters: const_cast<sal_Unicode*>(aBuf.getStr())];
- return aBuf.makeStringAndClear();
-}
-
-void SAL_CALL MacOSXPathLayer::readData(
- const uno::Reference<backend::XLayerHandler>& i_xHandler)
- throw ( backend::MalformedDataException,
- lang::NullPointerException,
- lang::WrappedTargetException,
- uno::RuntimeException)
-{
- if (m_xLayerContentDescriber.is())
- {
- rtl::OUString aDocDir;
- NSArray* pPaths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, true );
- if( pPaths && [pPaths count] > 0 )
- {
- aDocDir = GetOUString( [pPaths objectAtIndex: 0] );
-
- rtl::OUString aDocURL;
- if( aDocDir.getLength() > 0 &&
- osl_getFileURLFromSystemPath( aDocDir.pData, &aDocURL.pData ) == osl_File_E_None )
- {
- uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
-
- aPropInfoList[0].Name = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work" ) );
- aPropInfoList[0].Type = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "string" ) );
- aPropInfoList[0].Protected = sal_False;
- aPropInfoList[0].Value <<= aDocURL;
-
- m_xLayerContentDescriber->describeLayer(i_xHandler, aPropInfoList);
- }
- else
- {
- OSL_TRACE( "user documents list contains empty file path or conversion failed" );
- }
- }
- else
- {
- OSL_TRACE( "Got nil or empty list of user document directories" );
- }
- }
- else
- {
- OSL_TRACE("Could not create com.sun.star.configuration.backend.LayerContentDescriber Service");
- }
-}
-
diff --git a/shell/source/backends/macbe/macbelayer.hxx b/shell/source/backends/macbe/macbelayer.hxx
deleted file mode 100644
index a1f27148d1a3..000000000000
--- a/shell/source/backends/macbe/macbelayer.hxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: macbelayer.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MACBELAYER_HXX_
-#define _MACBELAYER_HXX_
-
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/configuration/backend/XLayer.hpp>
-#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
-#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
-
-#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
-#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-#endif
-#include <com/sun/star/util/XTimeStamped.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <cppuhelper/implbase2.hxx>
-
-namespace css = com::sun::star;
-namespace uno = css::uno;
-namespace lang = css::lang;
-namespace backend = css::configuration::backend;
-namespace util = css::util;
-
-/**
- Implementation of the XLayer interfaces for fixed values
- */
-
-class MacOSXLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
-{
-public:
-
- /**
- Constructor given the requested component name
-
- @param aTimestamp timestamp indicating last modifictaion
- */
- MacOSXLayer(const uno::Reference<uno::XComponentContext>& xContext);
-
- /** Destructor */
- virtual ~MacOSXLayer(void) {}
-
- // XLayer
- virtual void SAL_CALL readData(const uno::Reference<backend::XLayerHandler>& xHandler)
- throw ( backend::MalformedDataException,
- lang::NullPointerException,
- lang::WrappedTargetException,
- uno::RuntimeException);
-
- // XTimeStamped
- virtual rtl::OUString SAL_CALL getTimestamp(void)
- throw (uno::RuntimeException);
-
-protected:
-
- rtl::OUString m_aComponent;
-
- uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber;
-
-};
-
-class MacOSXPathLayer : public MacOSXLayer
-{
- public:
- MacOSXPathLayer(const uno::Reference<uno::XComponentContext>& i_xContext) :
- MacOSXLayer( i_xContext ) {}
- virtual ~MacOSXPathLayer() {}
-
- // XLayer
- virtual void SAL_CALL readData(const uno::Reference<backend::XLayerHandler>& i_xHandler)
- throw ( backend::MalformedDataException,
- lang::NullPointerException,
- lang::WrappedTargetException,
- uno::RuntimeException);
-};
-
-#endif // _MACBELAYER_HXX_
diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx
index 344eefa1a08d..8daa9d690c2b 100644
--- a/shell/source/backends/wininetbe/wininetbackend.cxx
+++ b/shell/source/backends/wininetbe/wininetbackend.cxx
@@ -114,10 +114,7 @@ namespace // private
//------------------------------------------------------------------------------
-WinInetBackend::WinInetBackend():
- hasProxyType_(false), hasNoProxy_(false), hasHttpProxyName_(false),
- hasHttpProxyPort_(false), hasHttpsProxyName_(false),
- hasHttpsProxyPort_(false), hasFtpProxyName_(false), hasFtpProxyPort_(false)
+WinInetBackend::WinInetBackend()
{
Library hWinInetDll( LoadLibrary( WININET_DLL_NAME ) );
if( hWinInetDll.module )
@@ -166,8 +163,8 @@ WinInetBackend::WinInetBackend():
// override default for ProxyType, which is "0" meaning "No proxies".
sal_Int32 nProperties = 1;
- valueProxyType_ = nProperties;
- hasProxyType_ = true;
+ valueProxyType_.IsPresent = true;
+ valueProxyType_.Value <<= nProperties;
// fill proxy bypass list
if( aProxyBypassList.getLength() > 0 )
@@ -192,8 +189,8 @@ WinInetBackend::WinInetBackend():
aProxyBypassList = aReverseList.makeStringAndClear();
- valueNoProxy_ = aProxyBypassList.replace( SPACE, SEMI_COLON );
- hasNoProxy_ = true;
+ valueNoProxy_.IsPresent = true;
+ valueNoProxy_.Value <<= aProxyBypassList.replace( SPACE, SEMI_COLON );
}
if( aProxyList.getLength() > 0 )
@@ -246,43 +243,43 @@ WinInetBackend::WinInetBackend():
// http proxy name
if( aHttpProxy.Server.getLength() > 0 )
{
- valueHttpProxyName_ = aHttpProxy.Server;
- hasHttpProxyName_ = true;
+ valueHttpProxyName_.IsPresent = true;
+ valueHttpProxyName_.Value <<= aHttpProxy.Server;
}
// http proxy port
if( aHttpProxy.Port.getLength() > 0 )
{
- valueHttpProxyPort_ = aHttpProxy.Port.toInt32();
- hasHttpProxyPort_ = true;
+ valueHttpProxyPort_.IsPresent = true;
+ valueHttpProxyPort_.Value <<= aHttpProxy.Port.toInt32();
}
// https proxy name
if( aHttpsProxy.Server.getLength() > 0 )
{
- valueHttpsProxyName_ = aHttpsProxy.Server;
- valueHttpsProxyPort_ = true;
+ valueHttpsProxyName_.IsPresent = true;
+ valueHttpsProxyName_.Value <<= aHttpsProxy.Server;
}
// https proxy port
if( aHttpsProxy.Port.getLength() > 0 )
{
- valueHttpsProxyPort_ = aHttpsProxy.Port.toInt32();
- hasHttpsProxyPort_ = true;
+ valueHttpsProxyPort_.IsPresent = true;
+ valueHttpsProxyPort_.Value <<= aHttpsProxy.Port.toInt32();
}
// ftp proxy name
if( aFtpProxy.Server.getLength() > 0 )
{
- valueFtpProxyName_ = aFtpProxy.Server;
- hasFtpProxyName_ = true;
+ valueFtpProxyName_.IsPresent = true;
+ valueFtpProxyName_.Value <<= aFtpProxy.Server;
}
// ftp proxy port
if( aFtpProxy.Port.getLength() > 0 )
{
- valueFtpProxyPort_ = aFtpProxy.Port.toInt32();
- hasFtpProxyPort_ = true;
+ valueFtpProxyPort_.IsPresent = true;
+ valueFtpProxyPort_.Value <<= aFtpProxy.Port.toInt32();
}
}
}
@@ -304,108 +301,63 @@ WinInetBackend* WinInetBackend::createInstance()
// ---------------------------------------------------------------------------------------
-css::uno::Type WinInetBackend::getElementType() throw(css::uno::RuntimeException)
-{
- return cppu::UnoType< cppu::UnoVoidType >::get();
-}
-
-sal_Bool WinInetBackend::hasElements() throw(css::uno::RuntimeException)
+void WinInetBackend::setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- return true;
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
}
-css::uno::Any WinInetBackend::getByName(rtl::OUString const & aName)
+css::uno::Any WinInetBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
throw (
- css::container::NoSuchElementException,
- css::lang::WrappedTargetException, css::uno::RuntimeException)
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
{
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName"))) {
- return hasFtpProxyName_
- ? uno::makeAny( valueFtpProxyName_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
+ {
+ return css::uno::makeAny(valueFtpProxyName_);
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
{
- return hasFtpProxyPort_
- ? uno::makeAny( valueFtpProxyPort_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(valueFtpProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
{
- return hasHttpProxyName_
- ? uno::makeAny( valueHttpProxyName_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(valueHttpProxyName_);
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
{
- return hasHttpProxyPort_
- ? uno::makeAny( valueHttpProxyPort_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(valueHttpProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
{
- return hasHttpsProxyName_
- ? uno::makeAny( valueHttpsProxyName_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(valueHttpsProxyName_);
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
{
- return hasHttpsProxyPort_
- ? uno::makeAny( valueHttpsProxyPort_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
+ return css::uno::makeAny(valueHttpsProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
{
- return hasNoProxy_
- ? uno::makeAny( valueNoProxy_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
- } else if (aName.equalsAsciiL(
+ return css::uno::makeAny(valueNoProxy_);
+ } else if (PropertyName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
{
- return hasProxyType_
- ? uno::makeAny( valueProxyType_ )
- : css::uno::makeAny(cppu::UnoType< cppu::UnoVoidType >::get());
+ return css::uno::makeAny(valueProxyType_);
} else {
- throw css::container::NoSuchElementException(
- aName, static_cast< cppu::OWeakObject * >(this));
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
}
}
-css::uno::Sequence< rtl::OUString > WinInetBackend::getElementNames()
- throw (css::uno::RuntimeException)
-{
- css::uno::Sequence< rtl::OUString > names(8);
- names[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName"));
- names[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort"));
- names[2] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName"));
- names[3] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort"));
- names[4] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyName"));
- names[5] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPSProxyPort"));
- names[6] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"));
- names[7] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType"));
- return names;
-}
-
-sal_Bool WinInetBackend::hasByName(rtl::OUString const & aName)
- throw (css::uno::RuntimeException)
-{
- return
- aName.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")) ||
- aName.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")) ||
- aName.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")) ||
- aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"));
-}
-
//------------------------------------------------------------------------------
rtl::OUString SAL_CALL WinInetBackend::getBackendName(void) {
diff --git a/shell/source/backends/wininetbe/wininetbackend.hxx b/shell/source/backends/wininetbe/wininetbackend.hxx
index 776fdc5e9c16..d1ba7c59d2a4 100644
--- a/shell/source/backends/wininetbe/wininetbackend.hxx
+++ b/shell/source/backends/wininetbe/wininetbackend.hxx
@@ -31,9 +31,9 @@
#ifndef _FIXEDVALUEBACKEND_HXX_
#define _FIXEDVALUEBACKEND_HXX_
-#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/Optional.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
#include <cppuhelper/implbase2.hxx>
#include <rtl/string.hxx>
@@ -42,7 +42,7 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
class WinInetBackend : public ::cppu::WeakImplHelper2 <
- css::container::XNameAccess,
+ css::beans::XPropertySet,
lang::XServiceInfo > {
public :
@@ -75,27 +75,56 @@ class WinInetBackend : public ::cppu::WeakImplHelper2 <
*/
static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
- //XNameAccess
- virtual uno::Type SAL_CALL
- getElementType()
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- hasElements()
- throw (uno::RuntimeException);
-
- virtual uno::Any SAL_CALL
- getByName( const rtl::OUString& aName )
- throw (css::container::NoSuchElementException,
- lang::WrappedTargetException, uno::RuntimeException);
-
- virtual uno::Sequence<rtl::OUString> SAL_CALL
- getElementNames()
- throw (uno::RuntimeException);
-
- virtual sal_Bool SAL_CALL
- hasByName( const rtl::OUString& aName )
- throw (uno::RuntimeException);
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (css::uno::RuntimeException)
+ { return css::uno::Reference< css::beans::XPropertySetInfo >(); }
+
+ virtual void SAL_CALL setPropertyValue(
+ rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removePropertyChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XPropertyChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL addVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
+
+ virtual void SAL_CALL removeVetoableChangeListener(
+ rtl::OUString const &,
+ css::uno::Reference< css::beans::XVetoableChangeListener > const &)
+ throw (
+ css::beans::UnknownPropertyException,
+ css::lang::WrappedTargetException, css::uno::RuntimeException)
+ {}
protected:
/**
@@ -109,22 +138,22 @@ class WinInetBackend : public ::cppu::WeakImplHelper2 <
~WinInetBackend(void) ;
private:
- sal_Int32 valueProxyType_;
- rtl::OUString valueNoProxy_;
- rtl::OUString valueHttpProxyName_;
- sal_Int32 valueHttpProxyPort_;
- rtl::OUString valueHttpsProxyName_;
- sal_Int32 valueHttpsProxyPort_;
- rtl::OUString valueFtpProxyName_;
- sal_Int32 valueFtpProxyPort_;
- bool hasProxyType_;
- bool hasNoProxy_;
- bool hasHttpProxyName_;
- bool hasHttpProxyPort_;
- bool hasHttpsProxyName_;
- bool hasHttpsProxyPort_;
- bool hasFtpProxyName_;
- bool hasFtpProxyPort_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueProxyType_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueNoProxy_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpProxyName_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpProxyPort_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpsProxyName_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueHttpsProxyPort_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueFtpProxyName_;
+ com::sun::star::beans::Optional< com::sun::star::uno::Any >
+ valueFtpProxyPort_;
} ;