summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-05-04 16:29:02 +0200
committersb <sb@openoffice.org>2010-05-04 16:29:02 +0200
commit74155ef0d4806b2cad2e550ce337e7f6a02adf38 (patch)
tree29326853cb88a712356429afabe5aa72a53a1c6a /configmgr
parent0a877b39fdd26f6fcd5706912569b83daf3fb67d (diff)
sb122: #i110491# turned configmgr API from C++ to UNO
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/inc/configmgr/detail/configmgrdllapi.hxx41
-rw-r--r--configmgr/prj/d.lst11
-rw-r--r--configmgr/source/makefile.mk4
-rw-r--r--configmgr/source/services.cxx17
-rw-r--r--configmgr/source/update.cxx143
-rw-r--r--configmgr/source/update.hxx (renamed from configmgr/inc/configmgr/update.hxx)39
6 files changed, 176 insertions, 79 deletions
diff --git a/configmgr/inc/configmgr/detail/configmgrdllapi.hxx b/configmgr/inc/configmgr/detail/configmgrdllapi.hxx
deleted file mode 100644
index 6eb2ea7bc9d9..000000000000
--- a/configmgr/inc/configmgr/detail/configmgrdllapi.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************************************
-*
-* 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_CONFIGMGR_DETAIL_CONFIGMGRDLLAPI_HXX
-#define INCLUDED_CONFIGMGR_DETAIL_CONFIGMGRDLLAPI_HXX
-
-#include "sal/config.h"
-
-#include "sal/types.h"
-
-#if defined OOO_DLLIMPLEMENTATION_CONFIGMGR
-#define OOO_DLLPUBLIC_CONFIGMGR SAL_DLLPUBLIC_EXPORT
-#else
-#define OOO_DLLPUBLIC_CONFIGMGR SAL_DLLPUBLIC_IMPORT
-#endif
-
-#endif
diff --git a/configmgr/prj/d.lst b/configmgr/prj/d.lst
index a9d91980b213..17ccdbe86a08 100644
--- a/configmgr/prj/d.lst
+++ b/configmgr/prj/d.lst
@@ -1,8 +1,3 @@
-mkdir: %_DEST%\inc%_EXT%\configmgr
-mkdir: %_DEST%\inc%_EXT%\configmgr\detail
-..\%__SRC%\bin\configmgr.dll %_DEST%\bin%_EXT%\configmgr.dll
-..\%__SRC%\lib\iconfigmgr.lib %_DEST%\lib%_EXT%\iconfigmgr.lib
-..\%__SRC%\lib\libconfigmgr.dylib %_DEST%\lib%_EXT%\libconfigmgr.dylib
-..\%__SRC%\lib\libconfigmgr.so %_DEST%\lib%_EXT%\libconfigmgr.so
-..\inc\configmgr\detail\configmgrdllapi.hxx %_DEST%\inc%_EXT%\configmgr\detail\configmgrdllapi.hxx
-..\inc\configmgr\update.hxx %_DEST%\inc%_EXT%\configmgr\update.hxx
+..\%__SRC%\bin\configmgr.uno.dll %_DEST%\bin%_EXT%\configmgr.uno.dll
+..\%__SRC%\lib\configmgr.uno.dylib %_DEST%\lib%_EXT%\configmgr.uno.dylib
+..\%__SRC%\lib\configmgr.uno.so %_DEST%\lib%_EXT%\configmgr.uno.so
diff --git a/configmgr/source/makefile.mk b/configmgr/source/makefile.mk
index 317e08bdf49c..777fed3323d8 100644
--- a/configmgr/source/makefile.mk
+++ b/configmgr/source/makefile.mk
@@ -34,7 +34,7 @@ VISIBILITY_HIDDEN = TRUE
.INCLUDE: settings.mk
-CDEFS += -DOOO_DLLIMPLEMENTATION_CONFIGMGR
+DLLPRE =
SLOFILES = \
$(SLO)/access.obj \
@@ -77,7 +77,7 @@ SHL1STDLIBS = \
$(CPPULIB) \
$(SALHELPERLIB) \
$(SALLIB)
-SHL1TARGET = configmgr
+SHL1TARGET = configmgr.uno
SHL1USE_EXPORTS = name
DEF1NAME = $(SHL1TARGET)
diff --git a/configmgr/source/services.cxx b/configmgr/source/services.cxx
index 3a009b3cee15..f8c3289664ef 100644
--- a/configmgr/source/services.cxx
+++ b/configmgr/source/services.cxx
@@ -44,6 +44,7 @@
#include "configurationprovider.hxx"
#include "configurationregistry.hxx"
#include "defaultprovider.hxx"
+#include "update.hxx"
namespace {
@@ -67,6 +68,9 @@ static cppu::ImplementationEntry const services[] = {
{ &dummy, &configmgr::configuration_registry::getImplementationName,
&configmgr::configuration_registry::getSupportedServiceNames,
&configmgr::configuration_registry::createFactory, 0, 0 },
+ { &dummy, &configmgr::update::getImplementationName,
+ &configmgr::update::getSupportedServiceNames,
+ &configmgr::update::createFactory, 0, 0 },
{ 0, 0, 0, 0, 0, 0 }
};
@@ -107,6 +111,19 @@ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.DefaultProvider")));
+ css::uno::Reference< css::registry::XRegistryKey >(
+ (css::uno::Reference< css::registry::XRegistryKey >(
+ static_cast< css::registry::XRegistryKey * >(pRegistryKey))->
+ createKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/com.sun.star.comp.configuration.Update/UNO/"
+ "SINGLETONS/com.sun.star.configuration.Update")))),
+ css::uno::UNO_SET_THROW)->
+ setStringValue(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.Update_Service")));
} catch (css::uno::Exception & e) {
(void) e;
OSL_TRACE(
diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx
index 57f45068d954..4c1d59d5d054 100644
--- a/configmgr/source/update.cxx
+++ b/configmgr/source/update.cxx
@@ -30,27 +30,84 @@
#include <set>
-#include "configmgr/update.hxx"
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/configuration/XUpdate.hpp"
+#include "com/sun/star/lang/XSingleComponentFactory.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/XInterface.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/weak.hxx"
#include "osl/mutex.hxx"
#include "rtl/ref.hxx"
+#include "rtl/unload.h"
+#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
+#include "sal/types.h"
#include "broadcaster.hxx"
#include "components.hxx"
#include "lock.hxx"
#include "modifications.hxx"
#include "rootaccess.hxx"
+#include "update.hxx"
-namespace configmgr {
+namespace configmgr { namespace update {
-namespace update {
+namespace {
-void insertExtensionXcsFile(bool shared, rtl::OUString const & fileUri) {
+namespace css = com::sun::star;
+
+std::set< rtl::OUString > seqToSet(
+ css::uno::Sequence< rtl::OUString > const & sequence)
+{
+ return std::set< rtl::OUString >(
+ sequence.getConstArray(),
+ sequence.getConstArray() + sequence.getLength());
+}
+
+class Service:
+ public cppu::WeakImplHelper1< css::configuration::XUpdate >,
+ private boost::noncopyable
+{
+public:
+ Service() {}
+
+private:
+ virtual ~Service() {}
+
+ virtual void SAL_CALL insertExtensionXcsFile(
+ sal_Bool shared, rtl::OUString const & fileUri)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL insertExtensionXcuFile(
+ sal_Bool shared, rtl::OUString const & fileUri)
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL insertModificationXcuFile(
+ rtl::OUString const & fileUri,
+ css::uno::Sequence< rtl::OUString > const & includedPaths,
+ css::uno::Sequence< rtl::OUString > const & excludedPaths)
+ throw (css::uno::RuntimeException);
+};
+
+void Service::insertExtensionXcsFile(
+ sal_Bool shared, rtl::OUString const & fileUri)
+ throw (css::uno::RuntimeException)
+{
osl::MutexGuard g(lock);
Components::getSingleton().insertExtensionXcsFile(shared, fileUri);
}
-void insertExtensionXcuFile(bool shared, rtl::OUString const & fileUri) {
+void Service::insertExtensionXcuFile(
+ sal_Bool shared, rtl::OUString const & fileUri)
+ throw (css::uno::RuntimeException)
+{
Broadcaster bc;
{
osl::MutexGuard g(lock);
@@ -63,23 +120,91 @@ void insertExtensionXcuFile(bool shared, rtl::OUString const & fileUri) {
bc.send();
}
-void insertModificationXcuFile(
+void Service::insertModificationXcuFile(
rtl::OUString const & fileUri,
- std::set< rtl::OUString > const & includedPaths,
- std::set< rtl::OUString > const & excludedPaths)
+ css::uno::Sequence< rtl::OUString > const & includedPaths,
+ css::uno::Sequence< rtl::OUString > const & excludedPaths)
+ throw (css::uno::RuntimeException)
{
Broadcaster bc;
{
osl::MutexGuard g(lock);
Modifications mods;
Components::getSingleton().insertModificationXcuFile(
- fileUri, includedPaths, excludedPaths, &mods);
+ fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods);
Components::getSingleton().initGlobalBroadcaster(
mods, rtl::Reference< RootAccess >(), &bc);
}
bc.send();
}
+class Factory:
+ public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
+ private boost::noncopyable
+{
+public:
+ Factory() {}
+
+private:
+ virtual ~Factory() {}
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
+ createInstanceWithContext(
+ css::uno::Reference< css::uno::XComponentContext > const & Context)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
+ createInstanceWithArgumentsAndContext(
+ css::uno::Sequence< css::uno::Any > const & Arguments,
+ css::uno::Reference< css::uno::XComponentContext > const & Context)
+ throw (css::uno::Exception, css::uno::RuntimeException);
+};
+
+css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
+ css::uno::Reference< css::uno::XComponentContext > const & Context)
+ throw (css::uno::Exception, css::uno::RuntimeException)
+{
+ return createInstanceWithArgumentsAndContext(
+ css::uno::Sequence< css::uno::Any >(), Context);
+}
+
+css::uno::Reference< css::uno::XInterface >
+Factory::createInstanceWithArgumentsAndContext(
+ css::uno::Sequence< css::uno::Any > const & Arguments,
+ css::uno::Reference< css::uno::XComponentContext > const &)
+ throw (css::uno::Exception, css::uno::RuntimeException)
+{
+ if (Arguments.getLength() != 0) {
+ throw css::uno::Exception(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.Update must be"
+ " instantiated without arguments")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ return static_cast< cppu::OWeakObject * >(new Service);
}
}
+
+rtl::OUString getImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.Update"));
+}
+
+css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
+ rtl::OUString name(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.Update_Service"));
+ return css::uno::Sequence< rtl::OUString >(&name, 1);
+}
+
+css::uno::Reference< css::lang::XSingleComponentFactory > createFactory(
+ cppu::ComponentFactoryFunc, rtl::OUString const &,
+ css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
+ SAL_THROW(())
+{
+ return new Factory;
+}
+
+} }
diff --git a/configmgr/inc/configmgr/update.hxx b/configmgr/source/update.hxx
index 3a152959342b..faa5c86b15fa 100644
--- a/configmgr/inc/configmgr/update.hxx
+++ b/configmgr/source/update.hxx
@@ -25,34 +25,35 @@
*
************************************************************************/
-#ifndef INCLUDED_CONFIGMGR_UPDATE_HXX
-#define INCLUDED_CONFIGMGR_UPDATE_HXX
+#ifndef INCLUDED_CONFIGMGR_SOURCE_UPDATE_HXX
+#define INCLUDED_CONFIGMGR_SOURCE_UPDATE_HXX
#include "sal/config.h"
-#include <set>
-
-#include "configmgr/detail/configmgrdllapi.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "cppuhelper/factory.hxx"
+#include "rtl/unload.h"
+#include "sal/types.h"
+namespace com { namespace sun { namespace star { namespace lang {
+ class XSingleComponentFactory;
+} } } }
namespace rtl { class OUString; }
-namespace configmgr {
-
-namespace update {
-
-OOO_DLLPUBLIC_CONFIGMGR void insertExtensionXcsFile(
- bool shared, rtl::OUString const & fileUri);
+namespace configmgr { namespace update {
-OOO_DLLPUBLIC_CONFIGMGR void insertExtensionXcuFile(
- bool shared, rtl::OUString const & fileUri);
+rtl::OUString SAL_CALL getImplementationName();
-OOO_DLLPUBLIC_CONFIGMGR void insertModificationXcuFile(
- rtl::OUString const & fileUri,
- std::set< rtl::OUString > const & includedPaths,
- std::set< rtl::OUString > const & excludedPaths);
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+getSupportedServiceNames();
-}
+com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
+SAL_CALL createFactory(
+ cppu::ComponentFactoryFunc, rtl::OUString const &,
+ com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
+ SAL_THROW(());
-}
+} }
#endif