summaryrefslogtreecommitdiff
path: root/shell/source/backends
diff options
context:
space:
mode:
Diffstat (limited to 'shell/source/backends')
-rw-r--r--shell/source/backends/desktopbe/desktopbackend.cxx290
-rw-r--r--shell/source/backends/desktopbe/desktopbe1-ucd.txt6
-rw-r--r--shell/source/backends/desktopbe/makefile.mk53
-rw-r--r--shell/source/backends/gconfbe/gconfaccess.cxx848
-rw-r--r--shell/source/backends/gconfbe/gconfaccess.hxx119
-rw-r--r--shell/source/backends/gconfbe/gconfbackend.cxx239
-rw-r--r--shell/source/backends/gconfbe/gconfbe1-ucd.txt6
-rw-r--r--shell/source/backends/gconfbe/makefile.mk96
-rw-r--r--shell/source/backends/gconfbe/orbit.h39
-rw-r--r--shell/source/backends/kde4be/kde4access.cxx319
-rw-r--r--shell/source/backends/kde4be/kde4access.hxx47
-rw-r--r--shell/source/backends/kde4be/kde4backend.cxx258
-rw-r--r--shell/source/backends/kde4be/kde4be1-ucd.txt6
-rw-r--r--shell/source/backends/kde4be/makefile.mk81
-rw-r--r--shell/source/backends/kdebe/kdeaccess.cxx315
-rw-r--r--shell/source/backends/kdebe/kdeaccess.hxx47
-rw-r--r--shell/source/backends/kdebe/kdebackend.cxx258
-rw-r--r--shell/source/backends/kdebe/kdebe1-ucd.txt6
-rw-r--r--shell/source/backends/kdebe/makefile.mk81
-rw-r--r--shell/source/backends/localebe/localebackend.cxx367
-rw-r--r--shell/source/backends/localebe/localebackend.hxx149
-rw-r--r--shell/source/backends/localebe/localebe.xml35
-rw-r--r--shell/source/backends/localebe/localebecdef.cxx94
-rw-r--r--shell/source/backends/localebe/makefile.mk72
-rw-r--r--shell/source/backends/macbe/macbackend.cxx499
-rw-r--r--shell/source/backends/macbe/macbackend.hxx138
-rw-r--r--shell/source/backends/macbe/macbe.xml35
-rw-r--r--shell/source/backends/macbe/macbecdef.cxx94
-rw-r--r--shell/source/backends/macbe/makefile.mk78
-rw-r--r--shell/source/backends/wininetbe/makefile.mk68
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.cxx403
-rw-r--r--shell/source/backends/wininetbe/wininetbackend.hxx157
-rw-r--r--shell/source/backends/wininetbe/wininetbe.xml35
-rw-r--r--shell/source/backends/wininetbe/wininetbecdef.cxx95
34 files changed, 5433 insertions, 0 deletions
diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx
new file mode 100644
index 000000000000..21371755b479
--- /dev/null
+++ b/shell/source/backends/desktopbe/desktopbackend.cxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include "boost/noncopyable.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/XComponentContext.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/diagnose.h"
+#include "rtl/string.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/current_context.hxx"
+#include "uno/lbnames.h"
+
+namespace {
+
+namespace css = com::sun::star;
+
+rtl::OUString SAL_CALL getDefaultImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.DesktopBackend"));
+}
+
+css::uno::Sequence< rtl::OUString > SAL_CALL getDefaultSupportedServiceNames() {
+ rtl::OUString name(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.DesktopBackend"));
+ return css::uno::Sequence< rtl::OUString >(&name, 1);
+}
+
+class Default:
+ public cppu::WeakImplHelper2<
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
+ private boost::noncopyable
+{
+public:
+ Default() {}
+
+private:
+ virtual ~Default() {}
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return getDefaultImplementationName(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return getDefaultSupportedServiceNames(); }
+
+ 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)
+ {}
+};
+
+void Default::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any Default::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ 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 >());
+ }
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+}
+
+css::uno::Reference< css::uno::XInterface > createBackend(
+ css::uno::Reference< css::uno::XComponentContext > const & context,
+ rtl::OUString const & name)
+{
+ try {
+ return css::uno::Reference< css::lang::XMultiComponentFactory >(
+ context->getServiceManager(), css::uno::UNO_SET_THROW)->
+ createInstanceWithContext(name, context);
+ } catch (css::uno::RuntimeException &) {
+ // Assuming these exceptions are real errors:
+ throw;
+ } catch (css::uno::Exception & e) {
+ // Assuming these exceptions indicate that the service is not installed:
+ OSL_TRACE(
+ "createInstance(%s) failed with %s",
+ rtl::OUStringToOString(name, RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ return css::uno::Reference< css::uno::XInterface >();
+ }
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const & context)
+{
+ rtl::OUString desktop;
+ css::uno::Reference< css::uno::XCurrentContext > current(
+ css::uno::getCurrentContext());
+ if (current.is()) {
+ current->getValueByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("system.desktop-environment"))) >>=
+ desktop;
+ }
+ // Fall back to the default if the specific backend is not available:
+ css::uno::Reference< css::uno::XInterface > backend;
+ if (desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("GNOME"))) {
+ backend = createBackend(
+ context,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.GconfBackend")));
+ } else if (desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE"))) {
+ backend = createBackend(
+ context,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.KDEBackend")));
+ } else if (desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE4"))) {
+ backend = createBackend(
+ context,
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.KDE4Backend")));
+ }
+ return backend.is()
+ ? backend : static_cast< cppu::OWeakObject * >(new Default);
+}
+
+static cppu::ImplementationEntry const services[] = {
+ { &createInstance, &getDefaultImplementationName,
+ &getDefaultSupportedServiceNames, &cppu::createSingleComponentFactory, 0,
+ 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+ char const ** ppEnvTypeName, uno_Environment **)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey)
+{
+ return component_writeInfoHelper(pServiceManager, pRegistryKey, services);
+}
diff --git a/shell/source/backends/desktopbe/desktopbe1-ucd.txt b/shell/source/backends/desktopbe/desktopbe1-ucd.txt
new file mode 100644
index 000000000000..fd874a82ead5
--- /dev/null
+++ b/shell/source/backends/desktopbe/desktopbe1-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.configuration.backend.DesktopBackend
+ComponentName=desktopbe1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.configuration.backend.DesktopBackend
diff --git a/shell/source/backends/desktopbe/makefile.mk b/shell/source/backends/desktopbe/makefile.mk
new file mode 100644
index 000000000000..29260821d551
--- /dev/null
+++ b/shell/source/backends/desktopbe/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#***********************************************************************/
+
+PRJ = ../../..
+PRJNAME = shell
+TARGET = desktopbe
+
+ENABLE_EXCEPTIONS = TRUE
+VISIBILITY_HIDDEN = TRUE
+
+.INCLUDE: settings.mk
+
+DLLPRE =
+
+SLOFILES = $(SLO)/desktopbackend.obj
+
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1STDLIBS = \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+SHL1TARGET = desktopbe1.uno
+SHL1USE_EXPORTS = name
+DEF1NAME = $(SHL1TARGET)
+
+UNIXTEXT = $(MISC)/desktopbe1-ucd.txt
+
+.INCLUDE: target.mk
diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
new file mode 100644
index 000000000000..64d0e2e94eae
--- /dev/null
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -0,0 +1,848 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include <string.h>
+
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "osl/file.hxx"
+#include "osl/security.hxx"
+#include "osl/thread.h"
+#include "rtl/strbuf.hxx"
+#include "rtl/ustrbuf.hxx"
+
+#include "gconfaccess.hxx"
+
+#define GCONF_PROXY_MODE_KEY "/system/proxy/mode"
+#define GCONF_AUTO_SAVE_KEY "/apps/openoffice/auto_save"
+
+namespace gconfaccess {
+
+namespace {
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+using namespace rtl;
+
+GConfClient* getGconfClient()
+{
+ static GConfClient* mClient= 0;
+ if (mClient == NULL)
+ {
+ /* initialize glib object type library */
+ g_type_init();
+
+ GError* aError = NULL;
+ if (!gconf_init(0, NULL, &aError))
+ {
+ rtl::OUStringBuffer msg;
+ msg.appendAscii("GconfBackend:GconfLayer: Cannot Initialize Gconf connection - " );
+ msg.appendAscii(aError->message);
+
+ g_error_free(aError);
+ aError = NULL;
+ throw uno::RuntimeException(msg.makeStringAndClear(),NULL);
+ }
+
+ mClient = gconf_client_get_default();
+ if (!mClient)
+ {
+ throw uno::RuntimeException(rtl::OUString::createFromAscii
+ ("GconfBackend:GconfLayer: Cannot Initialize Gconf connection"),NULL);
+ }
+
+ static const char * const PreloadValuesList[] =
+ {
+ "/desktop/gnome/interface",
+ "/system/proxy",
+ "/system/http_proxy/host",
+ "/desktop/gnome/url-handlers/mailto",
+#ifdef ENABLE_LOCKDOWN
+ "/apps/openoffice",
+ "/desktop/gnome/lockdown",
+ "/apps/openoffice/lockdown",
+#endif // ENABLE_LOCKDOWN
+ NULL
+ };
+ int i = 0;
+ while( PreloadValuesList[i] != NULL )
+ gconf_client_preload( mClient, PreloadValuesList[i++], GCONF_CLIENT_PRELOAD_ONELEVEL, NULL );
+ }
+
+ return mClient;
+}
+
+static OUString xdg_user_dir_lookup (const char *type)
+{
+ char *config_home;
+ char *p;
+ int relative;
+ bool bError = false;
+
+ osl::Security aSecurity;
+ oslFileHandle handle;
+ OUString aHomeDirURL;
+ OUString aDocumentsDirURL;
+ OUString aConfigFileURL;
+ OUStringBuffer aUserDirBuf;
+
+ if (!aSecurity.getHomeDir( aHomeDirURL ) )
+ {
+ osl::FileBase::getFileURLFromSystemPath(rtl::OUString::createFromAscii("/tmp"), aDocumentsDirURL);
+ return aDocumentsDirURL;
+ }
+
+ config_home = getenv ("XDG_CONFIG_HOME");
+ if (config_home == NULL || config_home[0] == 0)
+ {
+ aConfigFileURL = OUString(aHomeDirURL);
+ aConfigFileURL += OUString::createFromAscii( "/.config/user-dirs.dirs" );
+ }
+ else
+ {
+ aConfigFileURL = OUString::createFromAscii(config_home);
+ aConfigFileURL += OUString::createFromAscii( "/user-dirs.dirs" );
+ }
+
+ if(osl_File_E_None == osl_openFile(aConfigFileURL.pData, &handle, osl_File_OpenFlag_Read))
+ {
+ rtl::ByteSequence seq;
+ while (osl_File_E_None == osl_readLine(handle , (sal_Sequence **)&seq))
+ {
+ /* Remove newline at end */
+ int len = seq.getLength();
+ if(len>0 && seq[len-1] == '\n')
+ seq[len-1] = 0;
+
+ p = (char *)seq.getArray();
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+
+ if (strncmp (p, "XDG_", 4) != 0)
+ continue;
+ p += 4;
+ if (strncmp (p, type, strlen (type)) != 0)
+ continue;
+ p += strlen (type);
+ if (strncmp (p, "_DIR", 4) != 0)
+ continue;
+ p += 4;
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+
+ if (*p != '=')
+ continue;
+ p++;
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+
+ if (*p != '"')
+ continue;
+ p++;
+
+ relative = 0;
+ if (strncmp (p, "$HOME/", 6) == 0)
+ {
+ p += 6;
+ relative = 1;
+ }
+ else if (*p != '/')
+ continue;
+
+ if (relative)
+ {
+ aUserDirBuf = OUStringBuffer(aHomeDirURL);
+ aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/" ) );
+ }
+ else
+ {
+ aUserDirBuf = OUStringBuffer();
+ }
+
+ while (*p && *p != '"')
+ {
+ if ((*p == '\\') && (*(p+1) != 0))
+ p++;
+ aUserDirBuf.append((sal_Unicode)*p++);
+ }
+ }
+ osl_closeFile(handle);
+ }
+ else
+ bError = true;
+
+ if (aUserDirBuf.getLength()>0 && !bError)
+ {
+ aDocumentsDirURL = aUserDirBuf.makeStringAndClear();
+ osl::Directory aDocumentsDir( aDocumentsDirURL );
+ if( osl::FileBase::E_None == aDocumentsDir.open() )
+ return aDocumentsDirURL;
+ }
+
+ /* Special case desktop for historical compatibility */
+ if (strcmp (type, "DESKTOP") == 0)
+ {
+ aUserDirBuf = OUStringBuffer(aHomeDirURL);
+ aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Desktop" ) );
+ return aUserDirBuf.makeStringAndClear();
+ }
+ else
+ {
+ aUserDirBuf = OUStringBuffer(aHomeDirURL);
+ aUserDirBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/Documents" ) );
+ return aUserDirBuf.makeStringAndClear();
+ }
+}
+
+//------------------------------------------------------------------------------
+
+uno::Any makeAnyOfGconfValue( GConfValue *aGconfValue )
+{
+ switch( aGconfValue->type )
+ {
+ case GCONF_VALUE_BOOL:
+ return uno::makeAny( (sal_Bool) gconf_value_get_bool( aGconfValue ) );
+
+ case GCONF_VALUE_INT:
+ return uno::makeAny( (sal_Int32) gconf_value_get_int( aGconfValue ) );
+
+ case GCONF_VALUE_STRING:
+ return uno::makeAny( OStringToOUString( rtl::OString(
+ gconf_value_get_string(aGconfValue) ), RTL_TEXTENCODING_UTF8 ) );
+
+ default:
+ fprintf( stderr, "makeAnyOfGconfValue: Type not handled.\n" );
+ break;
+ }
+
+ return uno::Any();
+}
+
+//------------------------------------------------------------------------------
+
+static void splitFontName( GConfValue *aGconfValue, rtl::OUString &rName, sal_Int16 &rHeight)
+{
+ rtl::OString aFont( gconf_value_get_string( aGconfValue ) );
+ aFont.trim();
+ sal_Int32 nIdx = aFont.lastIndexOf( ' ' );
+ if (nIdx < 1) { // urk
+ rHeight = 12;
+ nIdx = aFont.getLength();
+ } else {
+ rtl::OString aSize = aFont.copy( nIdx + 1 );
+ rHeight = static_cast<sal_Int16>( aSize.toInt32() );
+ }
+
+ rName = rtl::OStringToOUString( aFont.copy( 0, nIdx ), RTL_TEXTENCODING_UTF8 );
+}
+
+//------------------------------------------------------------------------------
+
+uno::Any translateToOOo( const ConfigurationValue aValue, GConfValue *aGconfValue )
+{
+
+ switch( aValue.nSettingId )
+ {
+ case SETTING_PROXY_MODE:
+ {
+ rtl::OUString aProxyMode;
+ uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
+ aOriginalValue >>= aProxyMode;
+
+ if( aProxyMode.equals( rtl::OUString::createFromAscii( "manual" ) ) )
+ return uno::makeAny( (sal_Int32) 1 );
+ else if( aProxyMode.equals( rtl::OUString::createFromAscii( "none" ) ) )
+ return uno::makeAny( (sal_Int32) 0 );
+ }
+ break;
+
+ case SETTING_NO_PROXY_FOR:
+ {
+ rtl::OStringBuffer aBuffer;
+ if( (GCONF_VALUE_LIST == aGconfValue->type) && (GCONF_VALUE_STRING == gconf_value_get_list_type(aGconfValue)) )
+ {
+ GSList * list = gconf_value_get_list(aGconfValue);
+ for(; list; list = g_slist_next(list))
+ {
+ aBuffer.append(gconf_value_get_string((GConfValue *) list->data));
+ aBuffer.append(";");
+ }
+ // Remove trailing ";"
+ aBuffer.setLength(aBuffer.getLength()-1);
+ return uno::makeAny(rtl::OStringToOUString(aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
+ }
+ else
+ g_warning( "unexpected type for ignore_hosts" );
+ }
+ break;
+
+ case SETTING_MAILER_PROGRAM:
+ {
+ rtl::OUString aMailer;
+ uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
+ aOriginalValue >>= aMailer;
+ sal_Int32 nIndex = 0;
+ return uno::makeAny( aMailer.getToken( 0, ' ', nIndex ) );
+ }
+
+#ifdef ENABLE_LOCKDOWN
+ // "short" values need to be returned a sal_Int16
+ case SETTING_FONT_ANTI_ALIASING_MIN_PIXEL:
+ case SETTING_SYMBOL_SET:
+ {
+ sal_Int32 nShortValue;
+ uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
+ aOriginalValue >>= nShortValue;
+ return uno::makeAny( (sal_Int16) nShortValue );
+ }
+ break;
+#endif // ENABLE_LOCKDOWN
+
+ // "boolean" values that need a string to be returned
+ case SETTING_ENABLE_ACCESSIBILITY:
+#ifdef ENABLE_LOCKDOWN
+ case SETTING_DISABLE_PRINTING:
+#endif // ENABLE_LOCKDOWN
+ {
+ sal_Bool bBooleanValue = false;
+ uno::Any aOriginalValue = makeAnyOfGconfValue( aGconfValue );
+ aOriginalValue >>= bBooleanValue;
+ return uno::makeAny( rtl::OUString::valueOf( (sal_Bool) bBooleanValue ) );
+ }
+
+ case SETTING_WORK_DIRECTORY:
+ {
+ rtl::OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
+
+ return uno::makeAny( aDocumentsDirURL );
+ }
+
+ case SETTING_USER_GIVENNAME:
+ {
+ rtl::OUString aCompleteName( rtl::OStringToOUString(
+ g_get_real_name(), osl_getThreadTextEncoding() ) );
+ sal_Int32 nIndex = 0;
+ rtl::OUString aGivenName;
+ do
+ aGivenName = aCompleteName.getToken( 0, ' ', nIndex );
+ while ( nIndex == 0 );
+
+ return uno::makeAny( aGivenName );
+
+ }
+
+ case SETTING_USER_SURNAME:
+ {
+ rtl::OUString aCompleteName( rtl::OStringToOUString(
+ g_get_real_name(), osl_getThreadTextEncoding() ) );
+ sal_Int32 nIndex = 0;
+ rtl::OUString aSurname;
+ do
+ aSurname = aCompleteName.getToken( 0, ' ', nIndex );
+ while ( nIndex >= 0 );
+
+ return uno::makeAny( aSurname );
+ }
+
+ case SETTING_SOURCEVIEWFONT_NAME:
+ case SETTING_SOURCEVIEWFONT_HEIGHT:
+ {
+ rtl::OUString aName;
+ sal_Int16 nHeight;
+
+ splitFontName (aGconfValue, aName, nHeight);
+ if (aValue.nSettingId == SETTING_SOURCEVIEWFONT_NAME)
+ return uno::makeAny( aName );
+ else
+ return uno::makeAny( nHeight );
+ }
+
+
+ default:
+ fprintf( stderr, "Unhandled setting to translate.\n" );
+ break;
+ }
+
+ return uno::Any();
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL isDependencySatisfied( GConfClient* aClient, const ConfigurationValue aValue )
+{
+ switch( aValue.nDependsOn )
+ {
+ case SETTING_PROXY_MODE:
+ {
+ GConfValue* aGconfValue = gconf_client_get( aClient, GCONF_PROXY_MODE_KEY, NULL );
+
+ if ( aGconfValue != NULL )
+ {
+ bool bOk = g_strcasecmp( "manual", gconf_value_get_string( aGconfValue ) ) == 0;
+ gconf_value_free( aGconfValue );
+ if (bOk) return sal_True;
+ }
+ }
+ break;
+
+ case SETTING_WORK_DIRECTORY:
+ {
+ rtl::OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
+ osl::Directory aDocumentsDir( aDocumentsDirURL );
+
+ if( osl::FileBase::E_None == aDocumentsDir.open() )
+ return sal_True;
+ }
+ break;
+
+ case SETTING_USER_GIVENNAME:
+ {
+ rtl::OUString aCompleteName( rtl::OStringToOUString(
+ g_get_real_name(), osl_getThreadTextEncoding() ) );
+ if( !aCompleteName.equalsAscii( "Unknown" ) )
+ return sal_True;
+ }
+ break;
+
+ case SETTING_USER_SURNAME:
+ {
+ rtl::OUString aCompleteName( rtl::OStringToOUString(
+ g_get_real_name(), osl_getThreadTextEncoding() ) );
+ if( !aCompleteName.equalsAscii( "Unknown" ) )
+ {
+ if( aCompleteName.trim().indexOf(rtl::OUString::createFromAscii(" "), 0) != -1 )
+ return sal_True;
+ }
+ }
+ break;
+
+#ifdef ENABLE_LOCKDOWN
+ case SETTING_AUTO_SAVE:
+ {
+ GConfValue* aGconfValue = gconf_client_get( aClient, GCONF_AUTO_SAVE_KEY, NULL );
+
+ if( ( aGconfValue != NULL ) )
+ {
+ bool bOk = gconf_value_get_bool( aGconfValue );
+ gconf_value_free( aGconfValue );
+ if (bOk) return sal_True;
+ }
+ }
+ break;
+#endif // ENABLE_LOCKDOWN
+
+ default:
+ fprintf( stderr, "Unhandled setting to check dependency.\n" );
+ break;
+ }
+
+ return sal_False;
+}
+
+}
+
+ConfigurationValue const ConfigurationValues[] =
+{
+ {
+ SETTING_ENABLE_ACCESSIBILITY,
+ "/desktop/gnome/interface/accessibility",
+ "EnableATToolSupport",
+ sal_True,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_PROXY_MODE,
+ GCONF_PROXY_MODE_KEY,
+ "ooInetProxyType",
+ sal_True,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_PROXY_HTTP_HOST,
+ "/system/http_proxy/host",
+ "ooInetHTTPProxyName",
+ sal_False,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_PROXY_HTTP_PORT,
+ "/system/http_proxy/port",
+ "ooInetHTTPProxyPort",
+ sal_False,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_PROXY_HTTPS_HOST,
+ "/system/proxy/secure_host",
+ "ooInetHTTPSProxyName",
+ sal_False,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_PROXY_HTTPS_PORT,
+ "/system/proxy/secure_port",
+ "ooInetHTTPSProxyPort",
+ sal_False,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_PROXY_FTP_HOST,
+ "/system/proxy/ftp_host",
+ "ooInetFTPProxyName",
+ sal_False,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_PROXY_FTP_PORT,
+ "/system/proxy/ftp_port",
+ "ooInetFTPProxyPort",
+ sal_False,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_NO_PROXY_FOR,
+ "/system/http_proxy/ignore_hosts",
+ "ooInetNoProxy",
+ sal_True,
+ SETTING_PROXY_MODE
+ },
+
+ {
+ SETTING_MAILER_PROGRAM,
+ "/desktop/gnome/url-handlers/mailto/command",
+ "ExternalMailer",
+ sal_True,
+ SETTINGS_LAST
+ },
+ {
+ SETTING_SOURCEVIEWFONT_NAME,
+ "/desktop/gnome/interface/monospace_font_name",
+ "SourceViewFontName",
+ sal_True,
+ SETTINGS_LAST
+ },
+ {
+ SETTING_SOURCEVIEWFONT_HEIGHT,
+ "/desktop/gnome/interface/monospace_font_name",
+ "SourceViewFontHeight",
+ sal_True,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_WORK_DIRECTORY,
+ "/desktop/gnome/url-handlers/mailto/command", // dummy
+ "WorkPathVariable",
+ sal_True,
+ SETTING_WORK_DIRECTORY, // so that the existence of the dir can be checked
+ },
+
+#ifdef ENABLE_LOCKDOWN
+ {
+ SETTING_WRITER_DEFAULT_DOC_FORMAT,
+ "/apps/openoffice/writer_default_document_format",
+ "TextDocumentSetupFactoryDefaultFilter",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_IMPRESS_DEFAULT_DOC_FORMAT,
+ "/apps/openoffice/impress_default_document_format",
+ "PresentationDocumentSetupFactoryDefaultFilter",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_CALC_DEFAULT_DOC_FORMAT,
+ "/apps/openoffice/calc_default_document_format",
+ "SpreadsheetDocumentSetupFactoryDefaultFilter",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_AUTO_SAVE,
+ GCONF_AUTO_SAVE_KEY,
+ "AutoSaveEnabled",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_AUTO_SAVE_INTERVAL,
+ "/apps/openoffice/auto_save_interval",
+ "AutoSaveTimeIntervall",
+ sal_False,
+ SETTING_AUTO_SAVE
+ },
+
+ {
+ SETTING_USER_GIVENNAME,
+ "/desktop/gnome/url-handlers/mailto/command", // dummy
+ "givenname",
+ sal_True,
+ SETTING_USER_GIVENNAME
+ },
+
+ {
+ SETTING_USER_SURNAME,
+ "/desktop/gnome/url-handlers/mailto/command", // dummy
+ "sn",
+ sal_True,
+ SETTING_USER_SURNAME
+ },
+
+ {
+ SETTING_DISABLE_PRINTING,
+ "/desktop/gnome/lockdown/disable_printing",
+ "DisablePrinting",
+ sal_True,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_USE_SYSTEM_FILE_DIALOG,
+ "/apps/openoffice/use_system_file_dialog",
+ "UseSystemFileDialog",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_PRINTING_MODIFIES_DOCUMENT,
+ "/apps/openoffice/printing_modifies_doc",
+ "PrintingModifiesDocument",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_SHOW_ICONS_IN_MENUS,
+ "/apps/openoffice/show_menu_icons",
+ "ShowIconsInMenues",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_SHOW_INACTIVE_MENUITEMS,
+ "/apps/openoffice/show_menu_inactive_items",
+ "DontHideDisabledEntry",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_SHOW_FONT_PREVIEW,
+ "/apps/openoffice/show_font_preview",
+ "ShowFontBoxWYSIWYG",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_SHOW_FONT_HISTORY,
+ "/apps/openoffice/show_font_history",
+ "FontViewHistory",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_ENABLE_OPENGL,
+ "/apps/openoffice/use_opengl",
+ "OpenGL",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_OPTIMIZE_OPENGL,
+ "/apps/openoffice/optimize_opengl",
+ "OpenGL_Faster",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_USE_SYSTEM_FONT,
+ "/apps/openoffice/use_system_font",
+ "AccessibilityIsSystemFont",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_USE_FONT_ANTI_ALIASING,
+ "/apps/openoffice/use_font_anti_aliasing",
+ "FontAntiAliasingEnabled",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_FONT_ANTI_ALIASING_MIN_PIXEL,
+ "/apps/openoffice/font_anti_aliasing_min_pixel",
+ "FontAntiAliasingMinPixelHeight",
+ sal_True,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_WARN_CREATE_PDF,
+ "/apps/openoffice/lockdown/warn_info_create_pdf",
+ "WarnCreatePDF",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_WARN_PRINT_DOC,
+ "/apps/openoffice/lockdown/warn_info_printing",
+ "WarnPrintDoc",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_WARN_SAVEORSEND_DOC,
+ "/apps/openoffice/lockdown/warn_info_saving",
+ "WarnSaveOrSendDoc",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_WARN_SIGN_DOC,
+ "/apps/openoffice/lockdown/warn_info_signing",
+ "WarnSignDoc",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_REMOVE_PERSONAL_INFO,
+ "/apps/openoffice/lockdown/remove_personal_info_on_save",
+ "Scripting/RemovePersonalInfoOnSaving",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_RECOMMEND_PASSWORD,
+ "/apps/openoffice/lockdown/recommend_password_on_save",
+ "RecommendPasswordProtection",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_UNDO_STEPS,
+ "/apps/openoffice/undo_steps",
+ "UndoSteps",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_SYMBOL_SET,
+ "/apps/openoffice/icon_size",
+ "SymbolSet",
+ sal_True,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_MACRO_SECURITY_LEVEL,
+ "/apps/openoffice/lockdown/macro_security_level",
+ "MacroSecurityLevel",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_CREATE_BACKUP,
+ "/apps/openoffice/create_backup",
+ "CreateBackup",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+ {
+ SETTING_WARN_ALIEN_FORMAT,
+ "/apps/openoffice/warn_alien_format",
+ "WarnAlienFormat",
+ sal_False,
+ SETTINGS_LAST
+ },
+
+#endif // ENABLE_LOCKDOWN
+};
+
+std::size_t const nConfigurationValues =
+ sizeof ConfigurationValues / sizeof ConfigurationValues[0];
+
+css::beans::Optional< css::uno::Any > getValue(ConfigurationValue const & data)
+{
+ GConfClient* aClient = getGconfClient();
+ GConfValue* aGconfValue;
+ if( ( data.nDependsOn == SETTINGS_LAST ) || isDependencySatisfied( aClient, data ) )
+ {
+ aGconfValue = gconf_client_get( aClient, data.GconfItem, NULL );
+
+ if( aGconfValue != NULL )
+ {
+ css::uno::Any value;
+ if( data.bNeedsTranslation )
+ value = translateToOOo( data, aGconfValue );
+ else
+ value = makeAnyOfGconfValue( aGconfValue );
+
+ gconf_value_free( aGconfValue );
+
+ return css::beans::Optional< css::uno::Any >(true, value);
+ }
+ }
+ return css::beans::Optional< css::uno::Any >();
+}
+
+}
diff --git a/shell/source/backends/gconfbe/gconfaccess.hxx b/shell/source/backends/gconfbe/gconfaccess.hxx
new file mode 100644
index 000000000000..7fdd82ff05e7
--- /dev/null
+++ b/shell/source/backends/gconfbe/gconfaccess.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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 INCLUDED_SHELL_SOURCE_BACKENDS_GCONFBE_GCONFACCESS_HXX
+#define INCLUDED_SHELL_SOURCE_BACKENDS_GCONFBE_GCONFACCESS_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "com/sun/star/beans/Optional.hpp"
+#include "gconf/gconf-client.h"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any;
+} } } }
+
+namespace gconfaccess {
+
+enum ConfigurationSetting
+{
+ SETTING_PROXY_MODE,
+ SETTING_PROXY_HTTP_HOST,
+ SETTING_PROXY_HTTP_PORT,
+ SETTING_PROXY_HTTPS_HOST,
+ SETTING_PROXY_HTTPS_PORT,
+ SETTING_PROXY_FTP_HOST,
+ SETTING_PROXY_FTP_PORT,
+ SETTING_NO_PROXY_FOR,
+ SETTING_ENABLE_ACCESSIBILITY,
+ SETTING_MAILER_PROGRAM,
+ SETTING_WORK_DIRECTORY,
+ SETTING_SOURCEVIEWFONT_NAME,
+ SETTING_SOURCEVIEWFONT_HEIGHT,
+ SETTING_USER_GIVENNAME,
+ SETTING_USER_SURNAME,
+
+#ifdef ENABLE_LOCKDOWN
+
+ SETTING_DISABLE_PRINTING,
+ SETTING_USE_SYSTEM_FILE_DIALOG,
+ SETTING_PRINTING_MODIFIES_DOCUMENT,
+ SETTING_SHOW_ICONS_IN_MENUS,
+ SETTING_SHOW_INACTIVE_MENUITEMS,
+ SETTING_SHOW_FONT_PREVIEW,
+ SETTING_SHOW_FONT_HISTORY,
+ SETTING_ENABLE_OPENGL,
+ SETTING_OPTIMIZE_OPENGL,
+ SETTING_SAVE_DOCUMENT_WINDOWS,
+ SETTING_SAVE_DOCUMENT_VIEW_INFO,
+ SETTING_USE_SYSTEM_FONT,
+ SETTING_USE_FONT_ANTI_ALIASING,
+ SETTING_FONT_ANTI_ALIASING_MIN_PIXEL,
+ SETTING_WARN_CREATE_PDF,
+ SETTING_WARN_PRINT_DOC,
+ SETTING_WARN_SAVEORSEND_DOC,
+ SETTING_WARN_SIGN_DOC,
+ SETTING_REMOVE_PERSONAL_INFO,
+ SETTING_RECOMMEND_PASSWORD,
+ SETTING_UNDO_STEPS,
+ SETTING_SYMBOL_SET,
+ SETTING_MACRO_SECURITY_LEVEL,
+ SETTING_CREATE_BACKUP,
+ SETTING_WARN_ALIEN_FORMAT,
+ SETTING_AUTO_SAVE,
+ SETTING_AUTO_SAVE_INTERVAL,
+ SETTING_WRITER_DEFAULT_DOC_FORMAT,
+ SETTING_IMPRESS_DEFAULT_DOC_FORMAT,
+ SETTING_CALC_DEFAULT_DOC_FORMAT,
+
+#endif // ENABLE_LOCKDOWN
+
+ SETTINGS_LAST
+};
+
+struct ConfigurationValue
+{
+ const ConfigurationSetting nSettingId;
+ const gchar *GconfItem;
+ const char *OOoConfItem;
+ const sal_Bool bNeedsTranslation;
+ const ConfigurationSetting nDependsOn;
+};
+
+extern ConfigurationValue const ConfigurationValues[];
+
+extern std::size_t const nConfigurationValues;
+
+com::sun::star::beans::Optional< com::sun::star::uno::Any > getValue(
+ ConfigurationValue const & data);
+
+}
+
+#endif
diff --git a/shell/source/backends/gconfbe/gconfbackend.cxx b/shell/source/backends/gconfbe/gconfbackend.cxx
new file mode 100644
index 000000000000..122d1cad02b3
--- /dev/null
+++ b/shell/source/backends/gconfbe/gconfbackend.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "boost/noncopyable.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/XComponentContext.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/weak.hxx"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/current_context.hxx"
+#include "uno/lbnames.h"
+
+#include "gconfaccess.hxx"
+#include "orbit.h"
+
+namespace {
+
+namespace css = com::sun::star;
+
+rtl::OUString SAL_CALL getServiceImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.GconfBackend"));
+}
+
+css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() {
+ rtl::OUString name(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.GconfBackend"));
+ return css::uno::Sequence< rtl::OUString >(&name, 1);
+}
+
+class Service:
+ public cppu::WeakImplHelper2<
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
+ private boost::noncopyable
+{
+public:
+ Service();
+
+private:
+ virtual ~Service() {}
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return getServiceImplementationName(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return getServiceSupportedServiceNames(); }
+
+ 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)
+ {}
+
+ bool enabled_;
+};
+
+Service::Service(): enabled_(false) {
+ css::uno::Reference< css::uno::XCurrentContext > context(
+ css::uno::getCurrentContext());
+ if (context.is()) {
+ rtl::OUString desktop;
+ context->getValueByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("system.desktop-environment"))) >>=
+ desktop;
+ enabled_ = desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("GNOME")) &&
+ ((orbit_major_version == 2 && orbit_minor_version >= 8) ||
+ orbit_major_version > 2);
+ // ORBit-2 versions < 2.8 cause a deadlock with the gtk+ VCL plugin
+ }
+}
+
+void Service::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+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 (PropertyName.equalsAscii(
+ gconfaccess::ConfigurationValues[i].OOoConfItem))
+ {
+ return css::uno::makeAny(
+ enabled_
+ ? gconfaccess::getValue(gconfaccess::ConfigurationValues[i])
+ : css::beans::Optional< css::uno::Any >());
+ }
+ }
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const &)
+{
+ return static_cast< cppu::OWeakObject * >(new Service);
+}
+
+static cppu::ImplementationEntry const services[] = {
+ { &createInstance, &getServiceImplementationName,
+ &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, 0,
+ 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+ char const ** ppEnvTypeName, uno_Environment **)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey)
+{
+ return component_writeInfoHelper(pServiceManager, pRegistryKey, services);
+}
diff --git a/shell/source/backends/gconfbe/gconfbe1-ucd.txt b/shell/source/backends/gconfbe/gconfbe1-ucd.txt
new file mode 100644
index 000000000000..daa5444ff0c5
--- /dev/null
+++ b/shell/source/backends/gconfbe/gconfbe1-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.configuration.backend.GconfBackend
+ComponentName=gconfbe1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.configuration.backend.GconfBackend
diff --git a/shell/source/backends/gconfbe/makefile.mk b/shell/source/backends/gconfbe/makefile.mk
new file mode 100644
index 000000000000..a8d9b23aa9df
--- /dev/null
+++ b/shell/source/backends/gconfbe/makefile.mk
@@ -0,0 +1,96 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=gconfbe
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# no "lib" prefix
+DLLPRE =
+UCDSRCEXT = txt
+
+.IF "$(ENABLE_LOCKDOWN)" == "YES"
+CFLAGS+=-DENABLE_LOCKDOWN
+.ENDIF
+
+.IF "$(ENABLE_GCONF)"!=""
+COMPILER_WARN_ALL=TRUE
+PKGCONFIG_MODULES=gconf-2.0 gobject-2.0 ORBit-2.0 glib-2.0
+.INCLUDE: pkg_config.mk
+
+.IF "$(OS)" == "SOLARIS"
+LINKFLAGS+=-z nodefs
+.ENDIF # "$(OS)" == "SOLARIS"
+
+.IF "$(OS)" == "LINUX"
+# hack for faked SO environment
+CFLAGS+=-gdwarf-2
+PKGCONFIG_LIBS!:=-Wl,--export-dynamic $(PKGCONFIG_LIBS)
+.ENDIF
+
+# --- Files ---
+
+
+SLOFILES=\
+ $(SLO)$/gconfaccess.obj \
+ $(SLO)$/gconfbackend.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1STDLIBS+=$(PKGCONFIG_LIBS)
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.ENDIF # "$(ENABLE_GCONF)"!=""
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/$(TARGET)1-ucd.txt
+
+$(MISC)/$(TARGET)1-ucd.txt : $$(@:b).$(UCDSRCEXT)
+ cat $< | tr -d "\015" > $@
+
diff --git a/shell/source/backends/gconfbe/orbit.h b/shell/source/backends/gconfbe/orbit.h
new file mode 100644
index 000000000000..2858e8100dc8
--- /dev/null
+++ b/shell/source/backends/gconfbe/orbit.h
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 INCLUDED_SHELL_SOURCE_BACKENDS_GCONFBE_ORBIT_H
+#define INCLUDED_SHELL_SOURCE_BACKENDS_GCONFBE_ORBIT_H
+
+#include "sal/config.h"
+
+#if defined __GNUC__
+#pragma GCC system_header
+#endif
+
+#include <orbit/orbit.h>
+
+#endif
diff --git a/shell/source/backends/kde4be/kde4access.cxx b/shell/source/backends/kde4be/kde4access.cxx
new file mode 100644
index 000000000000..336d2d4a458e
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4access.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include "QFont"
+#include "QString"
+#include "kemailsettings.h"
+#include "kglobalsettings.h"
+#include "kprotocolmanager.h"
+
+#include "com/sun/star/uno/Any.hxx"
+#include "cppu/unotype.hxx"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "rtl/string.h"
+#include "rtl/ustring.hxx"
+
+#include "kde4access.hxx"
+
+#define SPACE ' '
+#define COMMA ','
+#define SEMI_COLON ';'
+
+namespace kde4access {
+
+namespace {
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+
+}
+
+css::beans::Optional< css::uno::Any > getValue(rtl::OUString const & id) {
+ if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) {
+ KEMailSettings aEmailSettings;
+ QString aClientProgram;
+ ::rtl::OUString sClientProgram;
+
+ aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ if ( aClientProgram.isEmpty() )
+ aClientProgram = "kmail";
+ else
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+ sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sClientProgram ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")))
+ {
+ QFont aFixedFont;
+ short nFontHeight;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ nFontHeight = aFixedFont.pointSize();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nFontHeight ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")))
+ {
+ QFont aFixedFont;
+ QString aFontName;
+ :: rtl::OUString sFontName;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ aFontName = aFixedFont.family();
+ sFontName = (const sal_Unicode *) aFontName.utf16();
+ 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 css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
+ {
+ QString aDocumentsDir( KGlobalSettings::documentPath() );
+ rtl::OUString sDocumentsDir;
+ rtl::OUString sDocumentsURL;
+ if ( aDocumentsDir.endsWith(QChar('/')) )
+ aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
+ sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
+ osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sDocumentsURL ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
+ {
+ QString aFTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aFTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
+ {
+ QString aFTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aFTPProxy);
+ sal_Int32 nPort = aProxy.port();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
+ {
+ QString aHTTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.openoffice.org") );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
+ {
+ QString aHTTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://http.openoffice.org") );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPProxy);
+ sal_Int32 nPort = aProxy.port();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
+ {
+ QString aHTTPSProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.openoffice.org") );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPSProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
+ {
+ QString aHTTPSProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://https.openoffice.org") );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPSProxy);
+ sal_Int32 nPort = aProxy.port();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
+ }
+ } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) {
+ QString aNoProxyFor;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aNoProxyFor.isEmpty() )
+ {
+ ::rtl::OUString sNoProxyFor;
+
+ aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
+ sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sNoProxyFor ) );
+ }
+ } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) {
+ int nProxyType;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+ nProxyType = 1;
+ break;
+ default: // No proxy is used
+ nProxyType = 0;
+ }
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( (sal_Int32) nProxyType ) );
+ } else {
+ OSL_ASSERT(false); // this cannot happen
+ }
+ return css::beans::Optional< css::uno::Any >();
+}
+
+}
diff --git a/shell/source/backends/kde4be/kde4access.hxx b/shell/source/backends/kde4be/kde4access.hxx
new file mode 100644
index 000000000000..bfb7bc1ac945
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4access.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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 INCLUDED_SHELL_SOURCE_BACKENDS_KDE4BE_KDE4ACCESS_HXX
+#define INCLUDED_SHELL_SOURCE_BACKENDS_KDE4BE_KDE4ACCESS_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/beans/Optional.hpp"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any;
+} } } }
+namespace rtl { class OUString; }
+
+namespace kde4access {
+
+com::sun::star::beans::Optional< com::sun::star::uno::Any > getValue(
+ rtl::OUString const & id);
+
+}
+
+#endif
diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx
new file mode 100644
index 000000000000..44ddb49bd025
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include "kapplication.h"
+
+#include "boost/noncopyable.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/XComponentContext.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/weak.hxx"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/current_context.hxx"
+#include "uno/lbnames.h"
+
+#include "kde4access.hxx"
+
+namespace {
+
+namespace css = com::sun::star;
+
+rtl::OUString SAL_CALL getServiceImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.KDE4Backend"));
+}
+
+css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() {
+ rtl::OUString name(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.KDE4Backend"));
+ return css::uno::Sequence< rtl::OUString >(&name, 1);
+}
+
+class Service:
+ public cppu::WeakImplHelper2<
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
+ private boost::noncopyable
+{
+public:
+ Service();
+
+private:
+ virtual ~Service() {}
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return getServiceImplementationName(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return getServiceSupportedServiceNames(); }
+
+ 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)
+ {}
+
+ bool enabled_;
+};
+
+Service::Service(): enabled_(false) {
+ css::uno::Reference< css::uno::XCurrentContext > context(
+ css::uno::getCurrentContext());
+ if (context.is()) {
+ rtl::OUString desktop;
+ context->getValueByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("system.desktop-environment"))) >>=
+ desktop;
+ enabled_ = desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE4")) &&
+ KApplication::kApplication() != 0;
+ }
+}
+
+void Service::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any Service::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ 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 >());
+ }
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const &)
+{
+ return static_cast< cppu::OWeakObject * >(new Service);
+}
+
+static cppu::ImplementationEntry const services[] = {
+ { &createInstance, &getServiceImplementationName,
+ &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, 0,
+ 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+ char const ** ppEnvTypeName, uno_Environment **)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey)
+{
+ return component_writeInfoHelper(pServiceManager, pRegistryKey, services);
+}
diff --git a/shell/source/backends/kde4be/kde4be1-ucd.txt b/shell/source/backends/kde4be/kde4be1-ucd.txt
new file mode 100644
index 000000000000..9671199b26e3
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4be1-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend
+ComponentName=kde4be1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.configuration.backend.KDE4Backend
diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk
new file mode 100644
index 000000000000..1f9093a95aee
--- /dev/null
+++ b/shell/source/backends/kde4be/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=kde4be
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# For some of the included external KDE headers, GCC complains about shadowed
+# symbols in instantiated template code only at the end of a compilation unit,
+# so the only solution is to disable that warning here:
+.IF "$(COM)" == "GCC"
+CFLAGSCXX+=-Wno-shadow
+.ENDIF
+
+UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt
+
+# no "lib" prefix
+DLLPRE =
+
+.IF "$(ENABLE_KDE4)" == "TRUE"
+
+CFLAGS+=$(KDE4_CFLAGS)
+
+# --- Files ---
+
+SLOFILES=\
+ $(SLO)$/kde4access.obj \
+ $(SLO)$/kde4backend.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(KDE4_LIBS) -lkio
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.ENDIF
+
+# --- Targets ---
+
+.INCLUDE : target.mk
diff --git a/shell/source/backends/kdebe/kdeaccess.cxx b/shell/source/backends/kdebe/kdeaccess.cxx
new file mode 100644
index 000000000000..618d74b5eacf
--- /dev/null
+++ b/shell/source/backends/kdebe/kdeaccess.cxx
@@ -0,0 +1,315 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include "com/sun/star/uno/Any.hxx"
+#include "cppu/unotype.hxx"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "rtl/string.h"
+#include "rtl/ustring.hxx"
+
+#include "kde_headers.h"
+
+#include "kdeaccess.hxx"
+
+#define SPACE ' '
+#define COMMA ','
+#define SEMI_COLON ';'
+
+namespace kdeaccess {
+
+namespace {
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+
+}
+
+css::beans::Optional< css::uno::Any > getValue(rtl::OUString const & id) {
+ if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ExternalMailer"))) {
+ KEMailSettings aEmailSettings;
+ QString aClientProgram;
+ ::rtl::OUString sClientProgram;
+
+ aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ if ( aClientProgram.isEmpty() )
+ aClientProgram = "kmail";
+ else
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+ sClientProgram = (const sal_Unicode *) aClientProgram.ucs2();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sClientProgram ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontHeight")))
+ {
+ QFont aFixedFont;
+ short nFontHeight;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ nFontHeight = aFixedFont.pointSize();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nFontHeight ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("SourceViewFontName")))
+ {
+ QFont aFixedFont;
+ QString aFontName;
+ :: rtl::OUString sFontName;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ aFontName = aFixedFont.family();
+ sFontName = (const sal_Unicode *) aFontName.ucs2();
+ 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 css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
+ {
+ QString aDocumentsDir( KGlobalSettings::documentPath() );
+ rtl::OUString sDocumentsDir;
+ rtl::OUString sDocumentsURL;
+ if ( aDocumentsDir.endsWith(QChar('/')) )
+ aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
+ sDocumentsDir = (const sal_Unicode *) aDocumentsDir.ucs2();
+ osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sDocumentsURL ) );
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
+ {
+ QString aFTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aFTPProxy = KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KURL aProxy(aFTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
+ {
+ QString aFTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aFTPProxy = KProtocolManager::proxyForURL( "ftp://ftp.openoffice.org" );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KURL aProxy(aFTPProxy);
+ sal_Int32 nPort = aProxy.port();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
+ {
+ QString aHTTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPProxy = KProtocolManager::proxyForURL( "http://http.openoffice.org" );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KURL aProxy(aHTTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
+ {
+ QString aHTTPProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPProxy = KProtocolManager::proxyForURL( "http://http.openoffice.org" );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KURL aProxy(aHTTPProxy);
+ sal_Int32 nPort = aProxy.port();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
+ {
+ QString aHTTPSProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPSProxy = KProtocolManager::proxyForURL( "https://https.openoffice.org" );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KURL aProxy(aHTTPSProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().ucs2();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sProxy ) );
+ }
+ } else if (id.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
+ {
+ QString aHTTPSProxy;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ aHTTPSProxy = KProtocolManager::proxyFor( "HTTPS" );
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ aHTTPSProxy = KProtocolManager::proxyForURL( "https://https.openoffice.org" );
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KURL aProxy(aHTTPSProxy);
+ sal_Int32 nPort = aProxy.port();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nPort ) );
+ }
+ } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy"))) {
+ QString aNoProxyFor;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ break;
+ default: // No proxy is used
+ break;
+ }
+ if ( !aNoProxyFor.isEmpty() )
+ {
+ ::rtl::OUString sNoProxyFor;
+
+ aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
+ sNoProxyFor = (const sal_Unicode *) aNoProxyFor.ucs2();
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( sNoProxyFor ) );
+ }
+ } else if (id.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ooInetProxyType"))) {
+ int nProxyType;
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+ nProxyType = 1;
+ break;
+ default: // No proxy is used
+ nProxyType = 0;
+ }
+ return css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( (sal_Int32) nProxyType ) );
+ } else {
+ OSL_ASSERT(false); // this cannot happen
+ }
+ return css::beans::Optional< css::uno::Any >();
+}
+
+}
diff --git a/shell/source/backends/kdebe/kdeaccess.hxx b/shell/source/backends/kdebe/kdeaccess.hxx
new file mode 100644
index 000000000000..36a22e23db9a
--- /dev/null
+++ b/shell/source/backends/kdebe/kdeaccess.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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 INCLUDED_SHELL_SOURCE_BACKENDS_KDEBE_KDEACCESS_HXX
+#define INCLUDED_SHELL_SOURCE_BACKENDS_KDEBE_KDEACCESS_HXX
+
+#include "sal/config.h"
+
+#include "com/sun/star/beans/Optional.hpp"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any;
+} } } }
+namespace rtl { class OUString; }
+
+namespace kdeaccess {
+
+com::sun::star::beans::Optional< com::sun::star::uno::Any > getValue(
+ rtl::OUString const & id);
+
+}
+
+#endif
diff --git a/shell/source/backends/kdebe/kdebackend.cxx b/shell/source/backends/kdebe/kdebackend.cxx
new file mode 100644
index 000000000000..53a00cf35987
--- /dev/null
+++ b/shell/source/backends/kdebe/kdebackend.cxx
@@ -0,0 +1,258 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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.
+*
+************************************************************************/
+
+#include "precompiled_shell.hxx"
+#include "sal/config.h"
+
+#include "boost/noncopyable.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/XComponentContext.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/weak.hxx"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/current_context.hxx"
+#include "uno/lbnames.h"
+
+#include "kde_headers.h"
+
+#include "kdeaccess.hxx"
+
+namespace {
+
+namespace css = com::sun::star;
+
+rtl::OUString SAL_CALL getServiceImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.KDEBackend"));
+}
+
+css::uno::Sequence< rtl::OUString > SAL_CALL getServiceSupportedServiceNames() {
+ rtl::OUString name(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.backend.KDEBackend"));
+ return css::uno::Sequence< rtl::OUString >(&name, 1);
+}
+
+class Service:
+ public cppu::WeakImplHelper2<
+ css::lang::XServiceInfo, css::beans::XPropertySet >,
+ private boost::noncopyable
+{
+public:
+ Service();
+
+private:
+ virtual ~Service() {}
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return getServiceImplementationName(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return getServiceSupportedServiceNames(); }
+
+ 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)
+ {}
+
+ bool enabled_;
+};
+
+Service::Service(): enabled_(false) {
+ css::uno::Reference< css::uno::XCurrentContext > context(
+ css::uno::getCurrentContext());
+ if (context.is()) {
+ rtl::OUString desktop;
+ context->getValueByName(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("system.desktop-environment"))) >>=
+ desktop;
+ enabled_ = desktop.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("KDE")) &&
+ KApplication::kApplication() != 0;
+ }
+}
+
+void Service::setPropertyValue(rtl::OUString const &, css::uno::Any const &)
+ throw (
+ css::beans::UnknownPropertyException, css::beans::PropertyVetoException,
+ css::lang::IllegalArgumentException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any Service::getPropertyValue(rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ 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 >());
+ }
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
+ css::uno::Reference< css::uno::XComponentContext > const &)
+{
+ return static_cast< cppu::OWeakObject * >(new Service);
+}
+
+static cppu::ImplementationEntry const services[] = {
+ { &createInstance, &getServiceImplementationName,
+ &getServiceSupportedServiceNames, &cppu::createSingleComponentFactory, 0,
+ 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+ char const ** ppEnvTypeName, uno_Environment **)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ void * pServiceManager, void * pRegistryKey)
+{
+ return component_writeInfoHelper(pServiceManager, pRegistryKey, services);
+}
diff --git a/shell/source/backends/kdebe/kdebe1-ucd.txt b/shell/source/backends/kdebe/kdebe1-ucd.txt
new file mode 100644
index 000000000000..adf7e17431f8
--- /dev/null
+++ b/shell/source/backends/kdebe/kdebe1-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+ImplementationName=com.sun.star.comp.configuration.backend.KDEBackend
+ComponentName=kdebe1.uno.so
+LoaderName=com.sun.star.loader.SharedLibrary
+[SupportedServices]
+com.sun.star.configuration.backend.KDEBackend
diff --git a/shell/source/backends/kdebe/makefile.mk b/shell/source/backends/kdebe/makefile.mk
new file mode 100644
index 000000000000..31bf77b47b54
--- /dev/null
+++ b/shell/source/backends/kdebe/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=kdebe
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# For some of the included external KDE headers, GCC complains about shadowed
+# symbols in instantiated template code only at the end of a compilation unit,
+# so the only solution is to disable that warning here:
+.IF "$(COM)" == "GCC"
+CFLAGSCXX+=-Wno-shadow
+.ENDIF
+
+UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt
+
+# no "lib" prefix
+DLLPRE =
+
+.IF "$(ENABLE_KDE)" == "TRUE"
+
+CFLAGS+=$(KDE_CFLAGS)
+
+# --- Files ---
+
+SLOFILES=\
+ $(SLO)$/kdeaccess.obj \
+ $(SLO)$/kdebackend.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1LINKFLAGS+=$(KDE_LIBS) -lkio
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.ENDIF # "$(ENABLE_KDE)" == "TRUE"
+
+# --- Targets ---
+
+.INCLUDE : target.mk
diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx
new file mode 100644
index 000000000000..1335d4a7fa50
--- /dev/null
+++ b/shell/source/backends/localebe/localebackend.cxx
@@ -0,0 +1,367 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#include "localebackend.hxx"
+#include <com/sun/star/beans/Optional.hpp>
+#include <osl/time.h>
+
+#include <stdio.h>
+
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
+
+#include <rtl/ustrbuf.hxx>
+#include <locale.h>
+#include <string.h>
+
+/*
+ * Note: setlocale is not at all thread safe, so is this code. It could
+ * especially interfere with the stuff VCL is doing, so make sure this
+ * is called from the main thread only.
+ */
+
+static rtl::OUString ImplGetLocale(int category)
+{
+ const char *locale = setlocale(category, "");
+
+ // Return "en-US" for C locales
+ if( (locale == NULL) || ( locale[0] == 'C' && locale[1] == '\0' ) )
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en-US" ) );
+
+
+ const char *cp;
+ const char *uscore = NULL;
+
+ // locale string have the format lang[_ctry][.encoding][@modifier]
+ // we are only interested in the first two items, so we handle
+ // '.' and '@' as string end.
+ for (cp = locale; *cp; cp++)
+ {
+ if (*cp == '_')
+ uscore = cp;
+ if (*cp == '.' || *cp == '@')
+ break;
+ }
+
+ rtl::OUStringBuffer aLocaleBuffer;
+ if( uscore != NULL )
+ {
+ aLocaleBuffer.appendAscii(locale, uscore++ - locale);
+ aLocaleBuffer.appendAscii("-");
+ aLocaleBuffer.appendAscii(uscore, cp - uscore);
+ }
+ else
+ {
+ aLocaleBuffer.appendAscii(locale, cp - locale);
+ }
+
+ return aLocaleBuffer.makeStringAndClear();
+}
+
+#elif defined(MACOSX)
+
+#include <rtl/ustrbuf.hxx>
+#include <locale.h>
+#include <string.h>
+
+#include <premac.h>
+#include <CoreServices/CoreServices.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <postmac.h>
+
+namespace /* private */
+{
+
+ void OUStringBufferAppendCFString(rtl::OUStringBuffer& buffer, const CFStringRef s)
+ {
+ CFIndex lstr = CFStringGetLength(s);
+ for (CFIndex i = 0; i < lstr; i++)
+ buffer.append(CFStringGetCharacterAtIndex(s, i));
+ }
+
+ template <typename T>
+ class CFGuard
+ {
+ public:
+ explicit CFGuard(T& rT) : rT_(rT) {}
+ ~CFGuard() { if (rT_) CFRelease(rT_); }
+ private:
+ T& rT_;
+ };
+
+ typedef CFGuard<CFArrayRef> CFArrayGuard;
+ typedef CFGuard<CFStringRef> CFStringGuard;
+ typedef CFGuard<CFTypeRef> CFTypeRefGuard;
+
+ /* For more information on the Apple locale concept please refer to
+ http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFLocales/Articles/CFLocaleConcepts.html
+ According to this documentation a locale identifier has the format: language[_country][_variant]*
+ e.g. es_ES_PREEURO -> spain prior Euro support
+ Note: The calling code should be able to handle locales with only language information e.g. 'en' for certain
+ UI languages just the language code will be returned.
+ */
+
+ CFStringRef ImplGetAppPreference(const char* pref)
+ {
+ CFStringRef csPref = CFStringCreateWithCString(NULL, pref, kCFStringEncodingASCII);
+ CFStringGuard csRefGuard(csPref);
+
+ CFTypeRef ref = CFPreferencesCopyAppValue(csPref, kCFPreferencesCurrentApplication);
+ CFTypeRefGuard refGuard(ref);
+
+ if (ref == NULL)
+ return NULL;
+
+ CFStringRef sref = (CFGetTypeID(ref) == CFArrayGetTypeID()) ? (CFStringRef)CFArrayGetValueAtIndex((CFArrayRef)ref, 0) : (CFStringRef)ref;
+
+ // NOTE: this API is only available with Mac OS X >=10.3. We need to use it because
+ // Apple used non-ISO values on systems <10.2 like "German" for instance but didn't
+ // upgrade those values during upgrade to newer Mac OS X versions. See also #i54337#
+ return CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, sref);
+ }
+
+ rtl::OUString ImplGetLocale(const char* pref)
+ {
+ CFStringRef sref = ImplGetAppPreference(pref);
+ CFStringGuard srefGuard(sref);
+
+ rtl::OUStringBuffer aLocaleBuffer;
+ aLocaleBuffer.appendAscii("en-US"); // initialize with fallback value
+
+ if (sref != NULL)
+ {
+ // split the string into substrings; the first two (if there are two) substrings
+ // are language and country
+ CFArrayRef subs = CFStringCreateArrayBySeparatingStrings(NULL, sref, CFSTR("_"));
+ CFArrayGuard subsGuard(subs);
+
+ if (subs != NULL)
+ {
+ aLocaleBuffer.setLength(0); // clear buffer which still contains fallback value
+
+ CFStringRef lang = (CFStringRef)CFArrayGetValueAtIndex(subs, 0);
+ OUStringBufferAppendCFString(aLocaleBuffer, lang);
+
+ // country also available? Assumption: if the array contains more than one
+ // value the second value is always the country!
+ if (CFArrayGetCount(subs) > 1)
+ {
+ aLocaleBuffer.appendAscii("-");
+ CFStringRef country = (CFStringRef)CFArrayGetValueAtIndex(subs, 1);
+ OUStringBufferAppendCFString(aLocaleBuffer, country);
+ }
+ }
+ }
+ return aLocaleBuffer.makeStringAndClear();
+ }
+
+} // namespace /* private */
+
+#endif
+
+// -------------------------------------------------------------------------------
+
+#ifdef WNT
+
+#ifdef WINVER
+#undef WINVER
+#endif
+#define WINVER 0x0501
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+rtl::OUString ImplGetLocale(LCID lcid)
+{
+ TCHAR buffer[8];
+ LPTSTR cp = buffer;
+
+ cp += GetLocaleInfo( lcid, LOCALE_SISO639LANGNAME , buffer, 4 );
+ if( cp > buffer )
+ {
+ if( 0 < GetLocaleInfo( lcid, LOCALE_SISO3166CTRYNAME, cp, buffer + 8 - cp) )
+ // #i50822# minus character must be written before cp
+ *(cp - 1) = '-';
+
+ return rtl::OUString::createFromAscii(buffer);
+ }
+
+ return rtl::OUString();
+}
+
+#endif // WNT
+
+// -------------------------------------------------------------------------------
+
+LocaleBackend::LocaleBackend()
+{
+}
+
+//------------------------------------------------------------------------------
+
+LocaleBackend::~LocaleBackend(void)
+{
+}
+
+//------------------------------------------------------------------------------
+
+LocaleBackend* LocaleBackend::createInstance()
+{
+ return new LocaleBackend;
+}
+
+// ---------------------------------------------------------------------------------------
+
+rtl::OUString LocaleBackend::getLocale(void)
+{
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
+ return ImplGetLocale(LC_CTYPE);
+#elif defined (MACOSX)
+ return ImplGetLocale("AppleLocale");
+#elif defined WNT
+ return ImplGetLocale( GetUserDefaultLCID() );
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString LocaleBackend::getUILocale(void)
+{
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(OS2)
+ return ImplGetLocale(LC_MESSAGES);
+#elif defined(MACOSX)
+ return ImplGetLocale("AppleLanguages");
+#elif defined WNT
+ return ImplGetLocale( MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT) );
+#endif
+}
+
+// ---------------------------------------------------------------------------------------
+
+rtl::OUString LocaleBackend::getSystemLocale(void)
+{
+// note: the implementation differs from getLocale() only on Windows
+#if defined WNT
+ return ImplGetLocale( GetSystemDefaultLCID() );
+#else
+ return getLocale();
+#endif
+}
+//------------------------------------------------------------------------------
+
+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)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any LocaleBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ 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::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL LocaleBackend::getBackendName(void) {
+ return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.LocaleBackend") ;
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL LocaleBackend::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendName() ;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void)
+{
+ uno::Sequence<rtl::OUString> aServiceNameList(1);
+ aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.LocaleBackend")) ;
+ return aServiceNameList ;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL LocaleBackend::supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
+
+ for(sal_Int32 i = 0; i < svc.getLength(); ++i )
+ if(svc[i] == aServiceName)
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL LocaleBackend::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendServiceNames() ;
+}
diff --git a/shell/source/backends/localebe/localebackend.hxx b/shell/source/backends/localebe/localebackend.hxx
new file mode 100644
index 000000000000..29950a3df913
--- /dev/null
+++ b/shell/source/backends/localebe/localebackend.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _FIXEDVALUEBACKEND_HXX_
+#define _FIXEDVALUEBACKEND_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/string.hxx>
+
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+
+class LocaleBackend : public ::cppu::WeakImplHelper2 <
+ css::beans::XPropertySet,
+ lang::XServiceInfo > {
+
+ public :
+
+ static LocaleBackend* createInstance();
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL
+ getImplementationName( )
+ throw (uno::RuntimeException) ;
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const rtl::OUString& aServiceName )
+ throw (uno::RuntimeException) ;
+
+ virtual uno::Sequence<rtl::OUString> SAL_CALL
+ getSupportedServiceNames( )
+ throw (uno::RuntimeException) ;
+
+ /**
+ Provides the implementation name.
+
+ @return implementation name
+ */
+ static rtl::OUString SAL_CALL getBackendName(void) ;
+ /**
+ Provides the supported services names
+
+ @return service names
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
+
+ // 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:
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ LocaleBackend();
+
+ /** Destructor */
+ ~LocaleBackend(void) ;
+
+ private:
+ // Returns the user locale
+ static rtl::OUString getLocale(void);
+
+ // Returns the user UI locale
+ static rtl::OUString getUILocale(void);
+
+ // Returns the system default locale
+ static rtl::OUString getSystemLocale(void);
+} ;
+
+
+#endif // _FIXEDVALUEBACKEND_HXX_
diff --git a/shell/source/backends/localebe/localebe.xml b/shell/source/backends/localebe/localebe.xml
new file mode 100644
index 000000000000..3c22a4970881
--- /dev/null
+++ b/shell/source/backends/localebe/localebe.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>localebe1</module-name>
+ <component-description>
+ <author> Oliver Braun </author>
+ <name>com.sun.star.comp.configuration.backend.LocaleBackend</name>
+ <description> The </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.comp.configuration.backend.LocaleBackend</supported-service>
+ <service-dependency>...</service-dependency>
+ <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
+ <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
+ <type>com.sun.star.configuration.backend.XLayerHandler</type>
+ <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
+ <type>com.sun.star.lang.XMultiComponentFactory</type>
+ <type>com.sun.star.lang.XServiceInfo</type>
+ <type>com.sun.star.lang.XSingleComponentFactory</type>
+ <type>com.sun.star.lang.XTypeProvider</type>
+ <type>com.sun.star.uno.TypeClass</type>
+ <type>com.sun.star.uno.XAggregation</type>
+ <type>com.sun.star.uno.XComponentContext</type>
+ <type>com.sun.star.uno.XCurrentContext</type>
+ <type>com.sun.star.uno.XWeak</type>
+ <type>com.sun.star.registry.XRegistryKey</type>
+ </component-description>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
+ <runtime-module-dependency>cppu3</runtime-module-dependency>
+ <runtime-module-dependency>sal3</runtime-module-dependency>
+</module-description>
diff --git a/shell/source/backends/localebe/localebecdef.cxx b/shell/source/backends/localebe/localebecdef.cxx
new file mode 100644
index 000000000000..576501e4da9f
--- /dev/null
+++ b/shell/source/backends/localebe/localebecdef.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#include <localebackend.hxx>
+
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+
+//------------------------------------------------------------------------------
+
+static uno::Reference<uno::XInterface> SAL_CALL createLocaleBackend(
+ const uno::Reference<uno::XComponentContext>&){
+
+ return * LocaleBackend::createInstance();
+}
+
+//------------------------------------------------------------------------------
+
+static const cppu::ImplementationEntry kImplementations_entries[] =
+{
+ {
+ createLocaleBackend,
+ LocaleBackend::getBackendName,
+ LocaleBackend::getBackendServiceNames,
+ cppu::createSingleComponentFactory,
+ NULL,
+ 0
+ },
+ { NULL, NULL, NULL, NULL, NULL, 0 }
+} ;
+
+//------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **aEnvTypeName, uno_Environment ** /*aEnvironment*/) {
+
+ *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void *pRegistryKey) {
+ return cppu::component_writeInfoHelper(
+ pServiceManager, pRegistryKey, kImplementations_entries);
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory( const sal_Char *aImplementationName,
+ void *aServiceManager,
+ void *aRegistryKey) {
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries) ;
+}
+
+//------------------------------------------------------------------------------
+
diff --git a/shell/source/backends/localebe/makefile.mk b/shell/source/backends/localebe/makefile.mk
new file mode 100644
index 000000000000..bd12bcdb28ce
--- /dev/null
+++ b/shell/source/backends/localebe/makefile.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=localebe
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+COMP1TYPELIST=$(TARGET)
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+DLLPRE =
+
+# --- Files ---
+
+SLOFILES=\
+ $(SLO)$/localebecdef.obj \
+ $(SLO)$/localebackend.obj
+
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+.IF "$(OS)"=="MACOSX"
+SHL1STDLIBS+= -framework CoreServices
+.ENDIF
+
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/shell/source/backends/macbe/macbackend.cxx b/shell/source/backends/macbe/macbackend.cxx
new file mode 100644
index 000000000000..b07afb2e6701
--- /dev/null
+++ b/shell/source/backends/macbe/macbackend.cxx
@@ -0,0 +1,499 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 "macbackend.hxx"
+
+#include "com/sun/star/beans/Optional.hpp"
+#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
+
+//------------------------------------------------------------------------------
+
+MacOSXBackend::MacOSXBackend()
+{
+}
+
+//------------------------------------------------------------------------------
+
+MacOSXBackend::~MacOSXBackend(void)
+{
+}
+
+//------------------------------------------------------------------------------
+
+MacOSXBackend* MacOSXBackend::createInstance()
+{
+ return new MacOSXBackend;
+}
+
+// ---------------------------------------------------------------------------------------
+
+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);
+}
+
+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 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)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any MacOSXBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("WorkPathVariable")))
+ {
+ 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 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, css::uno::makeAny( aDocURL ) ) );
+ }
+ 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" );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
+ {
+ ProxyEntry aFtpProxy;
+
+ char host[MAXHOSTNAMELEN];
+ UInt16 port;
+ bool retVal;
+
+ retVal = GetProxySetting(sFTP, host, 100, &port);
+
+ if (retVal)
+ {
+ aFtpProxy.Server = rtl::OUString::createFromAscii( host );
+ }
+
+ // ftp proxy name
+ if( aFtpProxy.Server.getLength() > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aFtpProxy.Server ) ) );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
+ {
+ ProxyEntry aFtpProxy;
+
+ char host[MAXHOSTNAMELEN];
+ UInt16 port;
+ bool retVal;
+
+ retVal = GetProxySetting(sFTP, host, 100, &port);
+
+ if (retVal)
+ {
+ aFtpProxy.Port = port;
+ }
+
+ // ftp proxy port
+ if( aFtpProxy.Port > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aFtpProxy.Port ) ) );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
+ {
+ ProxyEntry aHttpProxy;
+
+ char host[MAXHOSTNAMELEN];
+ UInt16 port;
+ bool retVal;
+
+ retVal = GetProxySetting(sHTTP, host, 100, &port);
+
+ if (retVal)
+ {
+ aHttpProxy.Server = rtl::OUString::createFromAscii( host );
+ }
+
+ // http proxy name
+ if( aHttpProxy.Server.getLength() > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpProxy.Server ) ) );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
+ {
+ ProxyEntry aHttpProxy;
+
+ char host[MAXHOSTNAMELEN];
+ UInt16 port;
+ bool retVal;
+
+ retVal = GetProxySetting(sHTTP, host, 100, &port);
+
+ if (retVal)
+ {
+ aHttpProxy.Port = port;
+ }
+
+ // http proxy port
+ if( aHttpProxy.Port > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpProxy.Port ) ) );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
+ {
+ ProxyEntry aHttpsProxy;
+
+ char host[MAXHOSTNAMELEN];
+ UInt16 port;
+ bool retVal;
+
+ retVal = GetProxySetting(sHTTPS, host, 100, &port);
+
+ if (retVal)
+ {
+ aHttpsProxy.Server = rtl::OUString::createFromAscii( host );
+ }
+
+ // https proxy name
+ if( aHttpsProxy.Server.getLength() > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpsProxy.Server ) ) );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
+ {
+ ProxyEntry aHttpsProxy;
+
+ char host[MAXHOSTNAMELEN];
+ UInt16 port;
+ bool retVal;
+
+ retVal = GetProxySetting(sHTTPS, host, 100, &port);
+
+ if (retVal)
+ {
+ aHttpsProxy.Port = port;
+ }
+
+ // https proxy port
+ if( aHttpsProxy.Port > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( aHttpsProxy.Port ) ) );
+ }
+ 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 css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true, uno::makeAny( nProperties ) ) );
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
+ {
+ 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);
+
+ // fill proxy bypass list
+ if( aProxyBypassList.getLength() > 0 )
+ {
+ return css::uno::makeAny(
+ css::beans::Optional< css::uno::Any >(
+ true,
+ uno::makeAny( aProxyBypassList.replace( SPACE, SEMI_COLON ) ) ) );
+ }
+ return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ } else {
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL MacOSXBackend::getBackendName(void)
+{
+ return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.MacOSXBackend");
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL MacOSXBackend::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendName();
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getBackendServiceNames(void)
+{
+ uno::Sequence<rtl::OUString> aServiceNameList(1);
+ aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.MacOSXBackend"));
+
+ return aServiceNameList;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL MacOSXBackend::supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
+
+ for(sal_Int32 i = 0; i < svc.getLength(); ++i )
+ if(svc[i] == aServiceName)
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendServiceNames();
+}
diff --git a/shell/source/backends/macbe/macbackend.hxx b/shell/source/backends/macbe/macbackend.hxx
new file mode 100644
index 000000000000..de4f9eee1ff6
--- /dev/null
+++ b/shell/source/backends/macbe/macbackend.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _MACBACKEND_HXX_
+#define _MACBACKEND_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/string.hxx>
+
+// FIXME: stdio.h only for debugging...
+#include <stdio.h>
+
+namespace css = com::sun::star;
+namespace uno = css::uno;
+namespace lang = css::lang;
+
+class MacOSXBackend : public ::cppu::WeakImplHelper2 <css::beans::XPropertySet, lang::XServiceInfo >
+{
+
+public:
+
+ static MacOSXBackend* createInstance();
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException);
+
+ virtual uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames()
+ throw (uno::RuntimeException);
+
+ /**
+ Provides the implementation name.
+
+ @return implementation name
+ */
+ static rtl::OUString SAL_CALL getBackendName(void);
+
+ /**
+ Provides the supported services names
+
+ @return service names
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void);
+
+ // 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:
+
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ MacOSXBackend();
+
+ /** Destructor */
+ ~MacOSXBackend(void);
+};
+
+#endif // _MACBACKEND_HXX_
diff --git a/shell/source/backends/macbe/macbe.xml b/shell/source/backends/macbe/macbe.xml
new file mode 100644
index 000000000000..7cee5bb14de5
--- /dev/null
+++ b/shell/source/backends/macbe/macbe.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>macbe</module-name>
+ <component-description>
+ <author> Pavel Janík </author>
+ <name>com.sun.star.comp.configuration.backend.MacOSXBackend</name>
+ <description> The </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.comp.configuration.backend.MacOSXBackend</supported-service>
+ <service-dependency>...</service-dependency>
+ <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
+ <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
+ <type>com.sun.star.configuration.backend.XLayerHandler</type>
+ <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
+ <type>com.sun.star.lang.XMultiComponentFactory</type>
+ <type>com.sun.star.lang.XServiceInfo</type>
+ <type>com.sun.star.lang.XSingleComponentFactory</type>
+ <type>com.sun.star.lang.XTypeProvider</type>
+ <type>com.sun.star.uno.TypeClass</type>
+ <type>com.sun.star.uno.XAggregation</type>
+ <type>com.sun.star.uno.XComponentContext</type>
+ <type>com.sun.star.uno.XCurrentContext</type>
+ <type>com.sun.star.uno.XWeak</type>
+ <type>com.sun.star.registry.XRegistryKey</type>
+ </component-description>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
+ <runtime-module-dependency>cppu3</runtime-module-dependency>
+ <runtime-module-dependency>sal3</runtime-module-dependency>
+</module-description>
diff --git a/shell/source/backends/macbe/macbecdef.cxx b/shell/source/backends/macbe/macbecdef.cxx
new file mode 100644
index 000000000000..18cf2806c16b
--- /dev/null
+++ b/shell/source/backends/macbe/macbecdef.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#include "macbackend.hxx"
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace css = com::sun::star;
+namespace uno = css::uno;
+namespace lang = css::lang;
+
+//------------------------------------------------------------------------------
+
+static uno::Reference<uno::XInterface> SAL_CALL createMacOSXBackend(
+ const uno::Reference<uno::XComponentContext>&)
+{
+ return * MacOSXBackend::createInstance();
+}
+
+//------------------------------------------------------------------------------
+
+static const cppu::ImplementationEntry kImplementations_entries[] =
+{
+ {
+ createMacOSXBackend,
+ MacOSXBackend::getBackendName,
+ MacOSXBackend::getBackendServiceNames,
+ cppu::createSingleComponentFactory,
+ NULL,
+ 0
+ },
+ { NULL }
+};
+
+//------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **aEnvTypeName, uno_Environment ** /*aEnvironment*/) {
+
+ *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void *pRegistryKey) {
+ return cppu::component_writeInfoHelper(
+ pServiceManager, pRegistryKey, kImplementations_entries);
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory( const sal_Char *aImplementationName, void *aServiceManager, void *aRegistryKey)
+{
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries);
+}
+
+//------------------------------------------------------------------------------
+
diff --git a/shell/source/backends/macbe/makefile.mk b/shell/source/backends/macbe/makefile.mk
new file mode 100644
index 000000000000..c3a58ec9f5c6
--- /dev/null
+++ b/shell/source/backends/macbe/makefile.mk
@@ -0,0 +1,78 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=macbe
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+COMP1TYPELIST=$(TARGET)
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+DLLPRE =
+
+# --- Files ---
+
+.IF "$(OS)" != "MACOSX"
+
+dummy:
+ @echo "Nothing to build for OS $(OS)."
+
+.ELSE
+
+CFLAGSCXX+=$(OBJCXXFLAGS)
+
+SLOFILES= \
+ $(SLO)$/macbecdef.obj \
+ $(SLO)$/macbackend.obj
+
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ -framework Cocoa -framework SystemConfiguration
+
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
+.ENDIF # "$(OS)" != "MACOSX"
diff --git a/shell/source/backends/wininetbe/makefile.mk b/shell/source/backends/wininetbe/makefile.mk
new file mode 100644
index 000000000000..9f79fa706fbf
--- /dev/null
+++ b/shell/source/backends/wininetbe/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=wininetbe
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+COMP1TYPELIST=$(TARGET)
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+DLLPRE =
+
+# --- Files ---
+
+
+SLOFILES=\
+ $(SLO)$/wininetbecdef.obj \
+ $(SLO)$/wininetbackend.obj
+
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1VERSIONMAP=$(SOLARENV)/src/component.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx
new file mode 100644
index 000000000000..af6f1036496d
--- /dev/null
+++ b/shell/source/backends/wininetbe/wininetbackend.cxx
@@ -0,0 +1,403 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#include "rtl/ustrbuf.hxx"
+
+#include "wininetbackend.hxx"
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#include <wininet.h>
+#include <sal/alloca.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#define WININET_DLL_NAME "wininet.dll"
+#define EQUAL_SIGN '='
+#define COLON ':'
+#define SPACE ' '
+#define SEMI_COLON ';'
+
+namespace {
+
+struct Library {
+ HMODULE module;
+
+ Library(HMODULE theModule): module(theModule) {}
+
+ ~Library() { if (module) FreeLibrary(module); }
+};
+
+}
+
+typedef struct
+{
+ rtl::OUString Server;
+ rtl::OUString Port;
+} ProxyEntry;
+
+//------------------------------------------------------------------------
+// helper functions
+//------------------------------------------------------------------------
+
+namespace // private
+{
+ ProxyEntry ReadProxyEntry(const rtl::OUString& aProxy, sal_Int32& i)
+ {
+ ProxyEntry aProxyEntry;
+
+ aProxyEntry.Server = aProxy.getToken( 0, COLON, i );
+ if ( i > -1 )
+ aProxyEntry.Port = aProxy.getToken( 0, COLON, i );
+
+ return aProxyEntry;
+ }
+
+ ProxyEntry FindProxyEntry(const rtl::OUString& aProxyList, const rtl::OUString& aType)
+ {
+ sal_Int32 nIndex = 0;
+
+ do
+ {
+ // get the next token, e.g. ftp=server:port
+ rtl::OUString nextToken = aProxyList.getToken( 0, SPACE, nIndex );
+
+ // split the next token again into the parts separated
+ // through '=', e.g. ftp=server:port -> ftp and server:port
+ sal_Int32 i = 0;
+ if( nextToken.indexOf( EQUAL_SIGN ) > -1 )
+ {
+ if( aType.equals( nextToken.getToken( 0, EQUAL_SIGN, i ) ) )
+ return ReadProxyEntry(nextToken, i);
+ }
+ else if( aType.getLength() == 0)
+ return ReadProxyEntry(nextToken, i);
+
+ } while ( nIndex >= 0 );
+
+ return ProxyEntry();
+ }
+
+} // end private namespace
+
+//------------------------------------------------------------------------------
+
+WinInetBackend::WinInetBackend()
+{
+ Library hWinInetDll( LoadLibrary( WININET_DLL_NAME ) );
+ if( hWinInetDll.module )
+ {
+ typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD );
+
+ InternetQueryOption_Proc_T lpfnInternetQueryOption =
+ reinterpret_cast< InternetQueryOption_Proc_T >(
+ GetProcAddress( hWinInetDll.module, "InternetQueryOptionA" ) );
+ if (lpfnInternetQueryOption)
+ {
+ LPINTERNET_PROXY_INFO lpi = NULL;
+
+ // query for the neccessary space
+ DWORD dwLength = 0;
+ BOOL bRet = lpfnInternetQueryOption(
+ NULL,
+ INTERNET_OPTION_PROXY,
+ (LPVOID)lpi,
+ &dwLength );
+
+ // allocate sufficient space on the heap
+ // insufficient space on the heap results
+ // in a stack overflow exception, we assume
+ // this never happens, because of the relatively
+ // small amount of memory we need
+ // alloca is nice because it is fast and we don't
+ // have to free the allocated memory, it will be
+ // automatically done
+ lpi = reinterpret_cast< LPINTERNET_PROXY_INFO >(
+ alloca( dwLength ) );
+
+ bRet = lpfnInternetQueryOption(
+ NULL,
+ INTERNET_OPTION_PROXY,
+ (LPVOID)lpi,
+ &dwLength );
+
+ // if a proxy is disabled, InternetQueryOption returns
+ // an empty proxy list, so we don't have to check if
+ // proxy is enabled or not
+
+ rtl::OUString aProxyList = rtl::OUString::createFromAscii( lpi->lpszProxy );
+ rtl::OUString aProxyBypassList = rtl::OUString::createFromAscii( lpi->lpszProxyBypass );
+
+ // override default for ProxyType, which is "0" meaning "No proxies".
+ sal_Int32 nProperties = 1;
+
+ valueProxyType_.IsPresent = true;
+ valueProxyType_.Value <<= nProperties;
+
+ // fill proxy bypass list
+ if( aProxyBypassList.getLength() > 0 )
+ {
+ rtl::OUStringBuffer aReverseList;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ rtl::OUString aToken = aProxyBypassList.getToken( 0, SPACE, nIndex );
+ if ( aProxyList.indexOf( aToken ) == -1 )
+ {
+ if ( aReverseList.getLength() )
+ {
+ aReverseList.insert( 0, sal_Unicode( SEMI_COLON ) );
+ aReverseList.insert( 0, aToken );
+ }
+ else
+ aReverseList = aToken;
+ }
+ }
+ while ( nIndex >= 0 );
+
+ aProxyBypassList = aReverseList.makeStringAndClear();
+
+ valueNoProxy_.IsPresent = true;
+ valueNoProxy_.Value <<= aProxyBypassList.replace( SPACE, SEMI_COLON );
+ }
+
+ if( aProxyList.getLength() > 0 )
+ {
+ //-------------------------------------------------
+ // this implementation follows the algorithm
+ // of the internet explorer
+ // if there are type-dependent proxy settings
+ // and type independent proxy settings in the
+ // registry the internet explorer chooses the
+ // type independent proxy for all settings
+ // e.g. imagine the following registry entry
+ // ftp=server:port;http=server:port;server:port
+ // the last token server:port is type independent
+ // so the ie chooses this proxy server
+
+ // if there is no port specified for a type independent
+ // server the ie uses the port of an http server if
+ // there is one and it has a port
+ //-------------------------------------------------
+
+ ProxyEntry aTypeIndepProxy = FindProxyEntry( aProxyList, rtl::OUString());
+ ProxyEntry aHttpProxy = FindProxyEntry( aProxyList, rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "http" ) ) );
+ ProxyEntry aHttpsProxy = FindProxyEntry( aProxyList, rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "https" ) ) );
+
+ ProxyEntry aFtpProxy = FindProxyEntry( aProxyList, rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "ftp" ) ) );
+
+ if( aTypeIndepProxy.Server.getLength() )
+ {
+ aHttpProxy.Server = aTypeIndepProxy.Server;
+ aHttpsProxy.Server = aTypeIndepProxy.Server;
+ aFtpProxy.Server = aTypeIndepProxy.Server;
+
+ if( aTypeIndepProxy.Port.getLength() )
+ {
+ aHttpProxy.Port = aTypeIndepProxy.Port;
+ aHttpsProxy.Port = aTypeIndepProxy.Port;
+ aFtpProxy.Port = aTypeIndepProxy.Port;
+ }
+ else
+ {
+ aFtpProxy.Port = aHttpProxy.Port;
+ aHttpsProxy.Port = aHttpProxy.Port;
+ }
+ }
+
+ // http proxy name
+ if( aHttpProxy.Server.getLength() > 0 )
+ {
+ valueHttpProxyName_.IsPresent = true;
+ valueHttpProxyName_.Value <<= aHttpProxy.Server;
+ }
+
+ // http proxy port
+ if( aHttpProxy.Port.getLength() > 0 )
+ {
+ valueHttpProxyPort_.IsPresent = true;
+ valueHttpProxyPort_.Value <<= aHttpProxy.Port.toInt32();
+ }
+
+ // https proxy name
+ if( aHttpsProxy.Server.getLength() > 0 )
+ {
+ valueHttpsProxyName_.IsPresent = true;
+ valueHttpsProxyName_.Value <<= aHttpsProxy.Server;
+ }
+
+ // https proxy port
+ if( aHttpsProxy.Port.getLength() > 0 )
+ {
+ valueHttpsProxyPort_.IsPresent = true;
+ valueHttpsProxyPort_.Value <<= aHttpsProxy.Port.toInt32();
+ }
+
+ // ftp proxy name
+ if( aFtpProxy.Server.getLength() > 0 )
+ {
+ valueFtpProxyName_.IsPresent = true;
+ valueFtpProxyName_.Value <<= aFtpProxy.Server;
+ }
+
+ // ftp proxy port
+ if( aFtpProxy.Port.getLength() > 0 )
+ {
+ valueFtpProxyPort_.IsPresent = true;
+ valueFtpProxyPort_.Value <<= aFtpProxy.Port.toInt32();
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
+WinInetBackend::~WinInetBackend(void)
+{
+}
+
+//------------------------------------------------------------------------------
+
+WinInetBackend* WinInetBackend::createInstance()
+{
+ return new WinInetBackend;
+}
+
+// ---------------------------------------------------------------------------------------
+
+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)
+{
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("setPropertyValue not supported")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+}
+
+css::uno::Any WinInetBackend::getPropertyValue(
+ rtl::OUString const & PropertyName)
+ throw (
+ css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
+ css::uno::RuntimeException)
+{
+ if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyName")))
+ {
+ return css::uno::makeAny(valueFtpProxyName_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetFTPProxyPort")))
+ {
+ return css::uno::makeAny(valueFtpProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyName")))
+ {
+ return css::uno::makeAny(valueHttpProxyName_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPProxyPort")))
+ {
+ return css::uno::makeAny(valueHttpProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyName")))
+ {
+ return css::uno::makeAny(valueHttpsProxyName_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetHTTPSProxyPort")))
+ {
+ return css::uno::makeAny(valueHttpsProxyPort_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetNoProxy")))
+ {
+ return css::uno::makeAny(valueNoProxy_);
+ } else if (PropertyName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("ooInetProxyType")))
+ {
+ return css::uno::makeAny(valueProxyType_);
+ } else {
+ throw css::beans::UnknownPropertyException(
+ PropertyName, static_cast< cppu::OWeakObject * >(this));
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL WinInetBackend::getBackendName(void) {
+ return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.backend.WinInetBackend") ;
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL WinInetBackend::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendName() ;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void)
+{
+ uno::Sequence<rtl::OUString> aServiceNameList(1);
+ aServiceNameList[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.WinInetBackend")) ;
+
+ return aServiceNameList ;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL WinInetBackend::supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
+
+ for(sal_Int32 i = 0; i < svc.getLength(); ++i )
+ if(svc[i] == aServiceName)
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL WinInetBackend::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendServiceNames() ;
+}
diff --git a/shell/source/backends/wininetbe/wininetbackend.hxx b/shell/source/backends/wininetbe/wininetbackend.hxx
new file mode 100644
index 000000000000..5fe4d5625a9a
--- /dev/null
+++ b/shell/source/backends/wininetbe/wininetbackend.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 _FIXEDVALUEBACKEND_HXX_
+#define _FIXEDVALUEBACKEND_HXX_
+
+#include <com/sun/star/beans/Optional.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <rtl/string.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+
+class WinInetBackend : public ::cppu::WeakImplHelper2 <
+ css::beans::XPropertySet,
+ lang::XServiceInfo > {
+
+ public :
+
+ static WinInetBackend* createInstance();
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL
+ getImplementationName( )
+ throw (uno::RuntimeException) ;
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const rtl::OUString& aServiceName )
+ throw (uno::RuntimeException) ;
+
+ virtual uno::Sequence<rtl::OUString> SAL_CALL
+ getSupportedServiceNames( )
+ throw (uno::RuntimeException) ;
+
+ /**
+ Provides the implementation name.
+
+ @return implementation name
+ */
+ static rtl::OUString SAL_CALL getBackendName(void) ;
+ /**
+ Provides the supported services names
+
+ @return service names
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
+
+ // 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:
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ WinInetBackend();
+
+ /** Destructor */
+ ~WinInetBackend(void) ;
+
+ private:
+ 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_;
+} ;
+
+
+#endif // _FIXEDVALUEBACKEND_HXX_
diff --git a/shell/source/backends/wininetbe/wininetbe.xml b/shell/source/backends/wininetbe/wininetbe.xml
new file mode 100644
index 000000000000..1bf4bd2cd053
--- /dev/null
+++ b/shell/source/backends/wininetbe/wininetbe.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>wininetbe</module-name>
+ <component-description>
+ <author> Oliver Braun </author>
+ <name>com.sun.star.comp.configuration.backend.Win32Backend</name>
+ <description> The </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta"/>
+ <supported-service>com.sun.star.comp.configuration.backend.Win32Backend</supported-service>
+ <service-dependency>...</service-dependency>
+ <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
+ <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
+ <type>com.sun.star.configuration.backend.XLayerHandler</type>
+ <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
+ <type>com.sun.star.lang.XMultiComponentFactory</type>
+ <type>com.sun.star.lang.XServiceInfo</type>
+ <type>com.sun.star.lang.XSingleComponentFactory</type>
+ <type>com.sun.star.lang.XTypeProvider</type>
+ <type>com.sun.star.uno.TypeClass</type>
+ <type>com.sun.star.uno.XAggregation</type>
+ <type>com.sun.star.uno.XComponentContext</type>
+ <type>com.sun.star.uno.XCurrentContext</type>
+ <type>com.sun.star.uno.XWeak</type>
+ <type>com.sun.star.registry.XRegistryKey</type>
+ </component-description>
+ <project-build-dependency>cppuhelper</project-build-dependency>
+ <project-build-dependency>cppu</project-build-dependency>
+ <project-build-dependency>sal</project-build-dependency>
+ <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
+ <runtime-module-dependency>cppu3</runtime-module-dependency>
+ <runtime-module-dependency>sal3</runtime-module-dependency>
+</module-description>
diff --git a/shell/source/backends/wininetbe/wininetbecdef.cxx b/shell/source/backends/wininetbe/wininetbecdef.cxx
new file mode 100644
index 000000000000..862600009e30
--- /dev/null
+++ b/shell/source/backends/wininetbe/wininetbecdef.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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"
+
+#include <wininetbackend.hxx>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+
+//------------------------------------------------------------------------------
+
+static uno::Reference<uno::XInterface> SAL_CALL createWinInetBackend(
+ const uno::Reference<uno::XComponentContext>&){
+
+ return * WinInetBackend::createInstance();
+}
+
+//------------------------------------------------------------------------------
+
+static const cppu::ImplementationEntry kImplementations_entries[] =
+{
+ {
+ createWinInetBackend,
+ WinInetBackend::getBackendName,
+ WinInetBackend::getBackendServiceNames,
+ cppu::createSingleComponentFactory,
+ NULL,
+ 0
+ },
+ { NULL }
+} ;
+
+//------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **aEnvTypeName, uno_Environment ** /*aEnvironment*/) {
+
+ *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void *pRegistryKey) {
+ return cppu::component_writeInfoHelper(
+ pServiceManager, pRegistryKey, kImplementations_entries);
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory( const sal_Char *aImplementationName,
+ void *aServiceManager,
+ void *aRegistryKey) {
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries) ;
+}
+
+//------------------------------------------------------------------------------
+