summaryrefslogtreecommitdiff
path: root/shell/source/backends
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2007-04-16 10:53:18 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2007-04-16 10:53:18 +0000
commit4ebc8c08972f29b093505ad2961df1a0be83384c (patch)
tree67c4fa073387d3bbc4fab37a9133ec987892a01d /shell/source/backends
parent381bca16985315ffacbda95255a0b19e679d42c5 (diff)
INTEGRATION: CWS pj74 (1.1.2); FILE ADDED
2007/03/01 09:57:45 pjanik 1.1.2.1: #i74947#: Implement Mac OS X specific system proxy configuration backend..
Diffstat (limited to 'shell/source/backends')
-rw-r--r--shell/source/backends/macbe/macbackend.hxx140
-rw-r--r--shell/source/backends/macbe/macbe.xml36
-rw-r--r--shell/source/backends/macbe/macbecdef.cxx141
3 files changed, 317 insertions, 0 deletions
diff --git a/shell/source/backends/macbe/macbackend.hxx b/shell/source/backends/macbe/macbackend.hxx
new file mode 100644
index 000000000000..b17306c27807
--- /dev/null
+++ b/shell/source/backends/macbe/macbackend.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: macbackend.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: ihi $ $Date: 2007-04-16 11:52:45 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef _MACBACKEND_HXX_
+#define _MACBACKEND_HXX_
+
+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XSINGLELAYERSTRATUM_HPP_
+#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XBACKENDCHANGESNOTIFIER_HPP_
+#include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+#ifndef _RTL_STRING_HXX_
+#include <rtl/string.hxx>
+#endif
+
+// FIXME: stdio.h only for debugging...
+#include <stdio.h>
+
+namespace css = com::sun::star;
+namespace uno = css::uno;
+namespace lang = css::lang;
+namespace backend = css::configuration::backend;
+
+
+/**
+ Implements the SingleLayerStratum service.
+ */
+class MacOSXBackend : public ::cppu::WeakImplHelper2 <backend::XSingleLayerStratum, lang::XServiceInfo >
+{
+
+public:
+
+ static MacOSXBackend* createInstance(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // 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);
+
+ /**
+ Provides the supported component nodes
+
+ @return supported component nodes
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getSupportedComponents(void);
+
+ // XSingleLayerStratum
+ virtual uno::Reference<backend::XLayer> SAL_CALL getLayer(const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp)
+ throw (backend::BackendAccessException, lang::IllegalArgumentException);
+
+ virtual uno::Reference<backend::XUpdatableLayer> SAL_CALL getUpdatableLayer(const rtl::OUString& aLayerId)
+ throw (backend::BackendAccessException, lang::NoSupportException, lang::IllegalArgumentException);
+
+protected:
+
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ MacOSXBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException);
+
+ /** Destructor */
+ ~MacOSXBackend(void);
+
+private:
+
+ uno::Reference<uno::XComponentContext> m_xContext;
+ uno::Reference<backend::XLayer> m_xSystemLayer;
+
+};
+
+#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..85854250cfe3
--- /dev/null
+++ b/shell/source/backends/macbe/macbe.xml
@@ -0,0 +1,36 @@
+<?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>
+ <supported-service>com.sun.star.comp.configuration.backend.PlatformBackend</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..558ad8e7681c
--- /dev/null
+++ b/shell/source/backends/macbe/macbecdef.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: macbecdef.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: ihi $ $Date: 2007-04-16 11:53:18 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "macbackend.hxx"
+
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
+#include <cppuhelper/implementationentry.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
+
+namespace css = com::sun::star;
+namespace uno = css::uno;
+namespace lang = css::lang;
+namespace backend = css::configuration::backend;
+
+//------------------------------------------------------------------------------
+
+static uno::Reference<uno::XInterface> SAL_CALL createMacOSXBackend(
+ const uno::Reference<uno::XComponentContext>& xContext)
+{
+ return * MacOSXBackend::createInstance(xContext);
+}
+
+//------------------------------------------------------------------------------
+
+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) {
+
+ using namespace ::com::sun::star::registry;
+ if (pRegistryKey)
+ {
+ try
+ {
+ uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + MacOSXBackend::getBackendName()
+ );
+
+ // Register associated service names
+ uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") )
+ );
+
+ uno::Sequence<rtl::OUString> sServiceNames = MacOSXBackend::getBackendServiceNames();
+ for (sal_Int32 i = 0; i < sServiceNames.getLength(); ++ i)
+ xServicesKey->createKey(sServiceNames[i]);
+
+ // Register supported components
+ uno::Reference<XRegistryKey> xComponentKey = xImplKey->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/DATA/SupportedComponents") )
+ );
+
+ xComponentKey->setAsciiListValue( MacOSXBackend::getSupportedComponents() );
+
+ return sal_True;
+ }
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "InvalidRegistryException caught");
+ }
+ }
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory( const sal_Char *aImplementationName, void *aServiceManager, void *aRegistryKey)
+{
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries);
+}
+
+//------------------------------------------------------------------------------
+