summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
Diffstat (limited to 'stoc')
-rw-r--r--stoc/prj/build.lst2
-rw-r--r--stoc/prj/d.lst10
-rw-r--r--stoc/source/bootstrap/services.cxx6
-rw-r--r--stoc/source/corereflection/base.hxx3
-rw-r--r--stoc/source/corereflection/crefl.cxx30
-rw-r--r--stoc/source/corereflection/makefile.mk7
-rw-r--r--stoc/source/corereflection/reflection.component35
-rw-r--r--stoc/source/implementationregistration/implreg.cxx25
-rw-r--r--stoc/source/inspect/introspection.component34
-rw-r--r--stoc/source/inspect/introspection.cxx27
-rw-r--r--stoc/source/inspect/makefile.mk7
-rw-r--r--stoc/source/invocation/invocation.component34
-rw-r--r--stoc/source/invocation/invocation.cxx6
-rw-r--r--stoc/source/invocation/makefile.mk6
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx8
-rw-r--r--stoc/source/invocation_adapterfactory/invocadapt.component34
-rw-r--r--stoc/source/invocation_adapterfactory/makefile.mk8
-rw-r--r--stoc/source/javaloader/javaloader.component35
-rw-r--r--stoc/source/javaloader/javaloader.cxx6
-rw-r--r--stoc/source/javaloader/makefile.mk7
-rw-r--r--stoc/source/javavm/javavm.component35
-rw-r--r--stoc/source/javavm/javavm.cxx37
-rw-r--r--stoc/source/javavm/makefile.mk7
-rw-r--r--stoc/source/namingservice/makefile.mk7
-rw-r--r--stoc/source/namingservice/namingservice.component34
-rw-r--r--stoc/source/namingservice/namingservice.cxx6
-rw-r--r--stoc/source/proxy_factory/makefile.mk8
-rw-r--r--stoc/source/proxy_factory/proxyfac.component34
-rw-r--r--stoc/source/proxy_factory/proxyfac.cxx7
-rw-r--r--stoc/source/simpleregistry/makefile.mk3
-rwxr-xr-x[-rw-r--r--]stoc/source/simpleregistry/simpleregistry.cxx2284
-rwxr-xr-xstoc/source/simpleregistry/textualservices.cxx1216
-rw-r--r--stoc/source/simpleregistry/textualservices.hxx67
-rw-r--r--stoc/source/stocservices/stocservices.cxx6
-rw-r--r--stoc/test/uriproc/makefile.mk20
-rw-r--r--stoc/util/bootstrap.component62
-rw-r--r--stoc/util/makefile.mk16
-rw-r--r--stoc/util/stocservices.component51
38 files changed, 2937 insertions, 1293 deletions
diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst
index 1fb7d34eeb32..256f094742f5 100644
--- a/stoc/prj/build.lst
+++ b/stoc/prj/build.lst
@@ -1,4 +1,4 @@
-tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk NULL
+tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt NULL
tc stoc usr1 - all tc_mkout NULL
tc stoc\inc nmake - all tc_inc NULL
tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL
diff --git a/stoc/prj/d.lst b/stoc/prj/d.lst
index 1f01434bf58a..79b2d77348b4 100644
--- a/stoc/prj/d.lst
+++ b/stoc/prj/d.lst
@@ -4,6 +4,16 @@ mkdir: %_DEST%\inc%_EXT%\stoc
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
..\%__SRC%\bin\*.rdb %_DEST%\rdb%_EXT%\*
+..\%__SRC%\misc\bootstrap.component %_DEST%\xml%_EXT%\bootstrap.component
+..\%__SRC%\misc\introspection.component %_DEST%\xml%_EXT%\introspection.component
+..\%__SRC%\misc\invocadapt.component %_DEST%\xml%_EXT%\invocadapt.component
+..\%__SRC%\misc\invocation.component %_DEST%\xml%_EXT%\invocation.component
+..\%__SRC%\misc\javaloader.component %_DEST%\xml%_EXT%\javaloader.component
+..\%__SRC%\misc\javavm.component %_DEST%\xml%_EXT%\javavm.component
+..\%__SRC%\misc\namingservice.component %_DEST%\xml%_EXT%\namingservice.component
+..\%__SRC%\misc\proxyfac.component %_DEST%\xml%_EXT%\proxyfac.component
+..\%__SRC%\misc\reflection.component %_DEST%\xml%_EXT%\reflection.component
+..\%__SRC%\misc\stocservices.component %_DEST%\xml%_EXT%\stocservices.component
..\source\module-description.dtd %_DEST%\xml%_EXT%\module-description.dtd
..\source\corereflection\corefl.xml %_DEST%\xml%_EXT%\reflection.uno.xml
diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx
index c98ee46d8922..7d295f4de78c 100644
--- a/stoc/source/bootstrap/services.cxx
+++ b/stoc/source/bootstrap/services.cxx
@@ -132,12 +132,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx
index fd77a646f1e5..2ef60da60d0b 100644
--- a/stoc/source/corereflection/base.hxx
+++ b/stoc/source/corereflection/base.hxx
@@ -55,9 +55,6 @@
#include <com/sun/star/reflection/XIdlField2.hpp>
#include <com/sun/star/reflection/XIdlMethod.hpp>
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-
-
using namespace std;
using namespace osl;
using namespace rtl;
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index 5c201ad52421..99019e959dfa 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -32,7 +32,6 @@
#include <cppuhelper/implementationentry.hxx>
#endif
-#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/reflection/XTypeDescription.hpp>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -509,35 +508,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- if (component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ))
- {
- try
- {
- // register singleton
- registry::XRegistryKey * pKey =
- reinterpret_cast< registry::XRegistryKey * >( pRegistryKey );
- Reference< registry::XRegistryKey > xKey(
- pKey->createKey(
- OUSTR(IMPLNAME "/UNO/SINGLETONS/com.sun.star.reflection.theCoreReflection") ) );
- xKey->setStringValue( OUSTR("com.sun.star.reflection.CoreReflection") );
- return sal_True;
- }
- catch (Exception & exc)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_ENSURE( 0, cstr.getStr() );
-#else
- (void) exc; // unused
-#endif
- }
- }
- return sal_False;
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/corereflection/makefile.mk b/stoc/source/corereflection/makefile.mk
index b61eb13aa9ee..7156f6d63cc4 100644
--- a/stoc/source/corereflection/makefile.mk
+++ b/stoc/source/corereflection/makefile.mk
@@ -73,3 +73,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/reflection.component
+
+$(MISC)/reflection.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ reflection.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt reflection.component
diff --git a/stoc/source/corereflection/reflection.component b/stoc/source/corereflection/reflection.component
new file mode 100644
index 000000000000..00772a448367
--- /dev/null
+++ b/stoc/source/corereflection/reflection.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.CoreReflection">
+ <service name="com.sun.star.reflection.CoreReflection"/>
+ <singleton name="com.sun.star.reflection.theCoreReflection"/>
+ </implementation>
+</component>
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index df63bfbfaee1..2faf13fd159c 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -628,9 +628,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey,
} else
{
oldImpl = implEntries.getConstArray()[0];
-
+ rtl::OUString path(xOldKey->getKeyName());
xOldKey->closeKey();
- xRootKey->deleteKey(xOldKey->getKeyName());
+ xRootKey->deleteKey(path);
}
OUString oldTarget = searchLinkTargetForImpl(xRootKey, linkName, oldImpl);
@@ -644,8 +644,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey,
{
bClean = sal_True;
hasNoImplementations = sal_False;
+ rtl::OUString path(xOldKey->getKeyName());
xOldKey->closeKey();
- xRootKey->deleteKey(xOldKey->getKeyName());
+ xRootKey->deleteKey(path);
}
}
} else
@@ -808,21 +809,24 @@ static void deleteAllImplementations( const Reference < XSimpleRegistry >& xRe
if (hasLocationUrl)
{
hasLocationUrl = sal_False;
+ rtl::OUString path(xImplKey->getKeyName());
xImplKey->closeKey();
- xReg->getRootKey()->deleteKey(xImplKey->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
subKeys = xSource->openKeys();
if (subKeys.getLength() == 0)
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
} else
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
@@ -947,21 +951,24 @@ static void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xRe
if (hasNoImplementations)
{
hasNoImplementations = sal_False;
+ rtl::OUString path(xServiceKey->getKeyName());
xServiceKey->closeKey();
- xReg->getRootKey()->deleteKey(xServiceKey->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
subKeys = xSource->openKeys();
if (subKeys.getLength() == 0)
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
} else
{
+ rtl::OUString path(xSource->getKeyName());
xSource->closeKey();
- xReg->getRootKey()->deleteKey(xSource->getKeyName());
+ xReg->getRootKey()->deleteKey(path);
}
}
diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component
new file mode 100644
index 000000000000..349fb0c9dfbe
--- /dev/null
+++ b/stoc/source/inspect/introspection.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.Introspection">
+ <service name="com.sun.star.beans.Introspection"/>
+ </implementation>
+</component>
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 5a09c59c5605..051ff3e2ae3c 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -71,7 +71,6 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
@@ -3065,32 +3064,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey )
-{
- if (pRegistryKey)
- {
- try
- {
- Reference< XRegistryKey > xNewKey(
- reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
- OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) );
-
- const Sequence< OUString > & rSNL =
- stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static();
- const OUString * pArray = rSNL.getConstArray();
- for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
- xNewKey->createKey( pArray[nPos] );
-
- return sal_True;
- }
- catch (InvalidRegistryException &)
- {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
- return sal_False;
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * )
{
diff --git a/stoc/source/inspect/makefile.mk b/stoc/source/inspect/makefile.mk
index 80e87dbf7cab..60864eea2496 100644
--- a/stoc/source/inspect/makefile.mk
+++ b/stoc/source/inspect/makefile.mk
@@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/introspection.component
+
+$(MISC)/introspection.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt introspection.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt introspection.component
diff --git a/stoc/source/invocation/invocation.component b/stoc/source/invocation/invocation.component
new file mode 100644
index 000000000000..67178ef2e88d
--- /dev/null
+++ b/stoc/source/invocation/invocation.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.Invocation">
+ <service name="com.sun.star.script.Invocation"/>
+ </implementation>
+</component>
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 74bdc3fe1359..f66c3af742d7 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -1251,12 +1251,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/invocation/makefile.mk b/stoc/source/invocation/makefile.mk
index c170bf6b614e..72eeea37c659 100644
--- a/stoc/source/invocation/makefile.mk
+++ b/stoc/source/invocation/makefile.mk
@@ -62,4 +62,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/invocation.component
+$(MISC)/invocation.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ invocation.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt invocation.component
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index 2fda1819f891..70d2562657ad 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -1016,14 +1016,6 @@ void SAL_CALL component_getImplementationEnvironment(
}
//==============================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return ::cppu::component_writeInfoHelper(
- pServiceManager, pRegistryKey, g_entries );
-}
-
-//==============================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component
new file mode 100644
index 000000000000..64f7b2b3691a
--- /dev/null
+++ b/stoc/source/invocation_adapterfactory/invocadapt.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.InvocationAdapterFactory">
+ <service name="com.sun.star.script.InvocationAdapterFactory"/>
+ </implementation>
+</component>
diff --git a/stoc/source/invocation_adapterfactory/makefile.mk b/stoc/source/invocation_adapterfactory/makefile.mk
index 66568af039e7..4c3450ac8c8d 100644
--- a/stoc/source/invocation_adapterfactory/makefile.mk
+++ b/stoc/source/invocation_adapterfactory/makefile.mk
@@ -63,3 +63,11 @@ DEF1NAME= $(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/invocadapt.component
+
+$(MISC)/invocadapt.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ invocadapt.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt invocadapt.component
diff --git a/stoc/source/javaloader/javaloader.component b/stoc/source/javaloader/javaloader.component
new file mode 100644
index 000000000000..bdd3b82d5125
--- /dev/null
+++ b/stoc/source/javaloader/javaloader.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.JavaComponentLoader">
+ <service name="com.sun.star.loader.Java"/>
+ <service name="com.sun.star.loader.Java2"/>
+ </implementation>
+</component>
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 566612cb2f00..396ff48ec310 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -472,12 +472,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/javaloader/makefile.mk b/stoc/source/javaloader/makefile.mk
index 60eea6a23457..e53b90d5e6e7 100644
--- a/stoc/source/javaloader/makefile.mk
+++ b/stoc/source/javaloader/makefile.mk
@@ -70,3 +70,10 @@ all:
.INCLUDE : target.mk
+ALLTAR : $(MISC)/javaloader.component
+
+$(MISC)/javaloader.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ javaloader.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt javaloader.component
diff --git a/stoc/source/javavm/javavm.component b/stoc/source/javavm/javavm.component
new file mode 100644
index 000000000000..f78d8af3ac29
--- /dev/null
+++ b/stoc/source/javavm/javavm.component
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.JavaVirtualMachine">
+ <service name="com.sun.star.java.JavaVirtualMachine"/>
+ <singleton name="com.sun.star.java.theJavaVirtualMachine"/>
+ </implementation>
+</component>
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index ad72a64a811c..1ea792270861 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -226,15 +226,10 @@ rtl::OUString serviceGetImplementationName()
"com.sun.star.comp.stoc.JavaVirtualMachine"));
}
-rtl::OUString serviceGetServiceName()
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.java.JavaVirtualMachine"));
-}
-
css::uno::Sequence< rtl::OUString > serviceGetSupportedServiceNames()
{
- rtl::OUString aServiceName = serviceGetServiceName();
+ rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine"));
return css::uno::Sequence< rtl::OUString >(&aServiceName, 1);
}
@@ -619,34 +614,6 @@ component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,
*pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager,
- void * pRegistryKey)
-{
- if (cppu::component_writeInfoHelper(pServiceManager, pRegistryKey,
- aServiceImplementation))
- {
- try
- {
- css::uno::Reference< css::registry::XRegistryKey >(
- reinterpret_cast< css::registry::XRegistryKey * >(
- pRegistryKey)->
- createKey(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.stoc.JavaVirtualMachine"
- "/UNO/SINGLETONS/"
- "com.sun.star.java.theJavaVirtualMachine"))))->
- setStringValue(serviceGetServiceName());
- return true;
- }
- catch (css::uno::Exception &)
- {
- OSL_ENSURE(false, "com.sun.star.uno.Exception caught");
- }
- }
- return false;
-}
-
extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName,
void * pServiceManager,
void * pRegistryKey)
diff --git a/stoc/source/javavm/makefile.mk b/stoc/source/javavm/makefile.mk
index 96908d10d1a1..bcd36e69681e 100644
--- a/stoc/source/javavm/makefile.mk
+++ b/stoc/source/javavm/makefile.mk
@@ -85,3 +85,10 @@ all:
.INCLUDE : target.mk
+ALLTAR : $(MISC)/javavm.component
+
+$(MISC)/javavm.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ javavm.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt javavm.component
diff --git a/stoc/source/namingservice/makefile.mk b/stoc/source/namingservice/makefile.mk
index 424180e114a1..cc98cdfc3571 100644
--- a/stoc/source/namingservice/makefile.mk
+++ b/stoc/source/namingservice/makefile.mk
@@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/namingservice.component
+
+$(MISC)/namingservice.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt namingservice.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt namingservice.component
diff --git a/stoc/source/namingservice/namingservice.component b/stoc/source/namingservice/namingservice.component
new file mode 100644
index 000000000000..8450cdee6d7e
--- /dev/null
+++ b/stoc/source/namingservice/namingservice.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.NamingService">
+ <service name="com.sun.star.uno.NamingService"/>
+ </implementation>
+</component>
diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx
index 26ced6e8e973..a2ea1d361202 100644
--- a/stoc/source/namingservice/namingservice.cxx
+++ b/stoc/source/namingservice/namingservice.cxx
@@ -238,12 +238,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/proxy_factory/makefile.mk b/stoc/source/proxy_factory/makefile.mk
index b38dac146ae1..23146e678f5a 100644
--- a/stoc/source/proxy_factory/makefile.mk
+++ b/stoc/source/proxy_factory/makefile.mk
@@ -63,3 +63,11 @@ DEF1NAME=$(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/proxyfac.component
+
+$(MISC)/proxyfac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ proxyfac.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt proxyfac.component
diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component
new file mode 100644
index 000000000000..bfe2c9c4268a
--- /dev/null
+++ b/stoc/source/proxy_factory/proxyfac.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.reflection.ProxyFactory">
+ <service name="com.sun.star.reflection.ProxyFactory"/>
+ </implementation>
+</component>
diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx
index 76d5edfb536d..644f8ecb624c 100644
--- a/stoc/source/proxy_factory/proxyfac.cxx
+++ b/stoc/source/proxy_factory/proxyfac.cxx
@@ -526,13 +526,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return ::cppu::component_writeInfoHelper(
- pServiceManager, pRegistryKey, g_entries );
-}
-
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/source/simpleregistry/makefile.mk b/stoc/source/simpleregistry/makefile.mk
index 510e7b466d83..bc0ddf7cc71a 100644
--- a/stoc/source/simpleregistry/makefile.mk
+++ b/stoc/source/simpleregistry/makefile.mk
@@ -39,7 +39,8 @@ UNOUCROUT=$(OUT)$/inc$/bootstrap
# ------------------------------------------------------------------
SLOFILES= \
- $(SLO)$/simpleregistry.obj
+ $(SLO)/simpleregistry.obj \
+ $(SLO)/textualservices.obj
# --- Targets ------------------------------------------------------
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 4ae9875bdab1..9c6b71bc6c83 100644..100755
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -1,1306 +1,1320 @@
/*************************************************************************
- *
- * 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
+*
+* 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_stoc.hxx"
-#include <osl/diagnose.h>
-#include <osl/mutex.hxx>
-#include <rtl/alloc.h>
-#ifndef _RTL_USTRBUF_H_
-#include <rtl/ustrbuf.hxx>
-#endif
-#include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
-#include <cppuhelper/implementationentry.hxx>
-#endif
-#include <registry/registry.hxx>
-
-#include <com/sun/star/registry/XSimpleRegistry.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace com::sun::star::uno;
-using namespace com::sun::star::registry;
-using namespace com::sun::star::lang;
-using namespace cppu;
-using namespace osl;
-using namespace rtl;
-
-#define SERVICENAME "com.sun.star.registry.SimpleRegistry"
-#define IMPLNAME "com.sun.star.comp.stoc.SimpleRegistry"
+#include "sal/config.h"
+
+#include <cstdlib>
+#include <memory>
+#include <vector>
+
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/registry/InvalidRegistryException.hpp"
+#include "com/sun/star/registry/InvalidValueException.hpp"
+#include "com/sun/star/registry/MergeConflictException.hpp"
+#include "com/sun/star/registry/RegistryKeyType.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/registry/XSimpleRegistry.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/mutex.hxx"
+#include "registry/registry.hxx"
+#include "registry/regtype.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/string.hxx"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
+#include "rtl/unload.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+#include "bootstrapservices.hxx"
+
+#include "textualservices.hxx"
extern rtl_StandardModuleCount g_moduleCount;
-namespace stoc_bootstrap
-{
-Sequence< OUString > simreg_getSupportedServiceNames()
-{
- static Sequence < OUString > *pNames = 0;
- if( ! pNames )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( !pNames )
- {
- static Sequence< OUString > seqNames(1);
- seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
- pNames = &seqNames;
- }
- }
- return *pNames;
-}
-
-OUString simreg_getImplementationName()
-{
- static OUString *pImplName = 0;
- if( ! pImplName )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pImplName )
- {
- static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) );
- pImplName = &implName;
- }
- }
- return *pImplName;
-}
-}
+namespace {
-namespace stoc_simreg {
+namespace css = com::sun::star;
-//*************************************************************************
-// class RegistryKeyImpl the implenetation of interface XRegistryKey
-//*************************************************************************
-class RegistryKeyImpl;
-
-//*************************************************************************
-// SimpleRegistryImpl
-//*************************************************************************
-class SimpleRegistryImpl : public WeakImplHelper2< XSimpleRegistry, XServiceInfo >
+class SimpleRegistry:
+ public cppu::WeakImplHelper2<
+ css::registry::XSimpleRegistry, css::lang::XServiceInfo >
{
public:
- SimpleRegistryImpl( const Registry& rRegistry );
-
- ~SimpleRegistryImpl();
-
- // XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
- virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
-
- // XSimpleRegistry
- virtual OUString SAL_CALL getURL() throw(RuntimeException);
- virtual void SAL_CALL open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException);
- virtual void SAL_CALL close( ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL destroy( ) throw(InvalidRegistryException, RuntimeException);
- virtual Reference< XRegistryKey > SAL_CALL getRootKey( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL mergeKey( const OUString& aKeyName, const OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException);
-
- friend class RegistryKeyImpl;
-protected:
- Mutex m_mutex;
- OUString m_url;
- Registry m_registry;
-};
+ SimpleRegistry() { g_moduleCount.modCnt.acquire(&g_moduleCount.modCnt); }
+ ~SimpleRegistry() { g_moduleCount.modCnt.release(&g_moduleCount.modCnt); }
-class RegistryKeyImpl : public WeakImplHelper1< XRegistryKey >
-{
-public:
- RegistryKeyImpl( const RegistryKey& rKey, SimpleRegistryImpl* pRegistry );
-
- RegistryKeyImpl( const OUString& rKeyName, SimpleRegistryImpl* pRegistry );
-
- ~RegistryKeyImpl();
-
- // XRegistryKey
- virtual OUString SAL_CALL getKeyName() throw(RuntimeException);
- virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException);
- virtual RegistryKeyType SAL_CALL getKeyType( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual RegistryValueType SAL_CALL getValueType( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Int32 SAL_CALL getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setAsciiValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< OUString > SAL_CALL getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setStringValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< OUString > SAL_CALL getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException);
- virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(InvalidRegistryException, RuntimeException);
- virtual Reference< XRegistryKey > SAL_CALL openKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual Reference< XRegistryKey > SAL_CALL createKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL closeKey( ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL deleteKey( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< Reference< XRegistryKey > > SAL_CALL openKeys( ) throw(InvalidRegistryException, RuntimeException);
- virtual Sequence< OUString > SAL_CALL getKeyNames( ) throw(InvalidRegistryException, RuntimeException);
- virtual sal_Bool SAL_CALL createLink( const OUString& aLinkName, const OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException);
- virtual void SAL_CALL deleteLink( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getLinkTarget( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException);
- virtual OUString SAL_CALL getResolvedName( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException);
-
-protected:
- OUString m_name;
- RegistryKey m_key;
- SimpleRegistryImpl* m_pRegistry;
-};
+ osl::Mutex mutex_;
-//*************************************************************************
-RegistryKeyImpl::RegistryKeyImpl( const RegistryKey& key, SimpleRegistryImpl* pRegistry )
- : m_key(key)
- , m_pRegistry(pRegistry)
-{
- m_pRegistry->acquire();
- m_name = m_key.getName();
-}
+private:
+ virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
-//*************************************************************************
-RegistryKeyImpl::RegistryKeyImpl( const OUString& rKeyName,
- SimpleRegistryImpl* pRegistry )
- : m_pRegistry(pRegistry)
-{
- m_pRegistry->acquire();
+ virtual void SAL_CALL open(
+ rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
- RegistryKey rootKey;
- if (!pRegistry->m_registry.isValid() ||
- pRegistry->m_registry.openRootKey(rootKey))
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- if ( rootKey.openKey(rKeyName, m_key) )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- m_name = rKeyName;
- }
- }
-}
+ virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
-//*************************************************************************
-RegistryKeyImpl::~RegistryKeyImpl()
-{
- m_pRegistry->release();
-}
+ virtual void SAL_CALL close() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getKeyName() throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- return m_name;
-}
+ virtual void SAL_CALL destroy() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::isReadOnly( )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (m_key.isValid())
- {
- return(m_key.isReadOnly());
- } else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-}
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ getRootKey() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::isValid( ) throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- return m_key.isValid();
-}
+ virtual sal_Bool SAL_CALL isReadOnly() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
-//*************************************************************************
-RegistryKeyType SAL_CALL RegistryKeyImpl::getKeyType( const OUString& rKeyName )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- RegKeyType keyType;
- if ( !m_key.getKeyType(rKeyName, &keyType) )
- {
- switch (keyType)
- {
- case RG_KEYTYPE:
- return RegistryKeyType_KEY;
- case RG_LINKTYPE:
- return RegistryKeyType_LINK;
- }
- } else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- } else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
+ virtual void SAL_CALL mergeKey(
+ rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::MergeConflictException, css::uno::RuntimeException);
- return RegistryKeyType_KEY;
-}
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return stoc_bootstrap::simreg_getImplementationName(); }
-//*************************************************************************
-RegistryValueType SAL_CALL RegistryKeyImpl::getValueType( )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (!m_key.isValid())
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
- if (m_key.getValueInfo(OUString(), &type, &size))
- {
- return RegistryValueType_NOT_DEFINED;
- } else
- {
- switch (type)
- {
- case RG_VALUETYPE_LONG: return RegistryValueType_LONG;
- case RG_VALUETYPE_STRING: return RegistryValueType_ASCII;
- case RG_VALUETYPE_UNICODE: return RegistryValueType_STRING;
- case RG_VALUETYPE_BINARY: return RegistryValueType_BINARY;
- case RG_VALUETYPE_LONGLIST: return RegistryValueType_LONGLIST;
- case RG_VALUETYPE_STRINGLIST: return RegistryValueType_ASCIILIST;
- case RG_VALUETYPE_UNICODELIST: return RegistryValueType_STRINGLIST;
- default: return RegistryValueType_NOT_DEFINED;
- }
- }
- }
-
- return RegistryValueType_NOT_DEFINED;
-}
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return stoc_bootstrap::simreg_getSupportedServiceNames(); }
-//*************************************************************************
-sal_Int32 SAL_CALL RegistryKeyImpl::getLongValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (!m_key.isValid())
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
+ Registry registry_;
+ std::auto_ptr< stoc::simpleregistry::TextualServices > textual_;
+};
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_LONG)
- {
- sal_Int32 value;
- if ( !m_key.getValue(OUString(), (RegValue)&value) )
- {
- return value;
- }
- }
- }
+class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > {
+public:
+ Key(
+ rtl::Reference< SimpleRegistry > const & registry,
+ RegistryKey const & key):
+ registry_(registry), key_(key) {}
+
+private:
+ virtual rtl::OUString SAL_CALL getKeyName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnly() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException);
+
+ virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
+ rtl::OUString const & rKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::registry::RegistryValueType SAL_CALL getValueType() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongValue(sal_Int32 value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongListValue(
+ com::sun::star::uno::Sequence< sal_Int32 > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getStringValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setBinaryValue(
+ css::uno::Sequence< sal_Int8 > const & value)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ createKey(rtl::OUString const & aKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL closeKey() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ SAL_CALL openKeys() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getLinkTarget(
+ rtl::OUString const & rLinkName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getResolvedName(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ rtl::Reference< SimpleRegistry > registry_;
+ RegistryKey key_;
+};
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
+rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.getName();
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setLongValue( sal_Int32 value )
- throw(InvalidRegistryException, RuntimeException)
+sal_Bool Key::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- if (m_key.setValue(OUString(), RG_VALUETYPE_LONG, &value, sizeof(sal_Int32)))
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.isReadOnly();
}
-//*************************************************************************
-Sequence< sal_Int32 > SAL_CALL RegistryKeyImpl::getLongListValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_LONGLIST)
- {
- RegistryValueList<sal_Int32> tmpValue;
- if ( !m_key.getLongListValue(OUString(), tmpValue) )
- {
- Sequence<sal_Int32> seqValue(size);
-
- for (sal_uInt32 i=0; i < size; i++)
- {
- seqValue.getArray()[i] = tmpValue.getElement(i);
- }
-
- return seqValue;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
+sal_Bool Key::isValid() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.isValid();
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue )
- throw(InvalidRegistryException, RuntimeException)
+css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 length = seqValue.getLength();
- sal_Int32* tmpValue = new sal_Int32[length];
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- tmpValue[i] = seqValue.getConstArray()[i];
- }
-
- if ( m_key.setLongListValue(OUString(), tmpValue, length) )
- {
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
-
- delete[] tmpValue;
+ osl::MutexGuard guard(registry_->mutex_);
+ RegKeyType type;
+ RegError err = key_.getKeyType(rKeyName, &type);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyType:"
+ " underlying RegistryKey::getKeyType() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ switch (type) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo-fall-through to avoid warnings on MSC
+ case RG_KEYTYPE:
+ return css::registry::RegistryKeyType_KEY;
+ case RG_LINKTYPE:
+ return css::registry::RegistryKeyType_LINK;
}
}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getAsciiValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+css::registry::RegistryValueType Key::getValueType()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if (!m_key.isValid())
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if ( type == RG_VALUETYPE_STRING )
- {
- char* value = new char[size];
- if ( m_key.getValue(OUString(), (RegValue)value) )
- {
- delete [] value;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- } else
- {
- OUString ret(OStringToOUString(value, RTL_TEXTENCODING_UTF8));
- delete [] value;
- return ret;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_INVALID_VALUE:
+ type = RG_VALUETYPE_NOT_DEFINED;
+ break;
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getValueType:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ switch (type) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo-fall-through to avoid warnings on MSC
+ case RG_VALUETYPE_NOT_DEFINED:
+ return css::registry::RegistryValueType_NOT_DEFINED;
+ case RG_VALUETYPE_LONG:
+ return css::registry::RegistryValueType_LONG;
+ case RG_VALUETYPE_STRING:
+ return css::registry::RegistryValueType_ASCII;
+ case RG_VALUETYPE_UNICODE:
+ return css::registry::RegistryValueType_STRING;
+ case RG_VALUETYPE_BINARY:
+ return css::registry::RegistryValueType_BINARY;
+ case RG_VALUETYPE_LONGLIST:
+ return css::registry::RegistryValueType_LONGLIST;
+ case RG_VALUETYPE_STRINGLIST:
+ return css::registry::RegistryValueType_ASCIILIST;
+ case RG_VALUETYPE_UNICODELIST:
+ return css::registry::RegistryValueType_STRINGLIST;
}
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setAsciiValue( const OUString& value )
- throw(InvalidRegistryException, RuntimeException)
+sal_Int32 Key::getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- OString sValue = OUStringToOString(value, RTL_TEXTENCODING_UTF8);
- sal_uInt32 size = sValue.getLength()+1;
- if ( m_key.setValue(OUString(), RG_VALUETYPE_STRING,
- (RegValue)(sValue.getStr()), size) )
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ sal_Int32 value;
+ RegError err = key_.getValue(rtl::OUString(), &value);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongValue:"
+ " underlying RegistryKey::getValue() = REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
+ return value;
}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getAsciiListValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setLongValue(sal_Int32 value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_STRINGLIST)
- {
- RegistryValueList<char*> tmpValue;
- if ( !m_key.getStringListValue(OUString(), tmpValue) )
- {
- Sequence<OUString> seqValue(size);
-
- for (sal_uInt32 i=0; i < size; i++)
- {
- seqValue.getArray()[i] =
- OStringToOUString(tmpValue.getElement(i), RTL_TEXTENCODING_UTF8);
- }
-
- return seqValue;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_LONG, &value, sizeof (sal_Int32));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setLongValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 length = seqValue.getLength();
- OString* pSValue = new OString[length];
- char** tmpValue = new char*[length];
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- pSValue[i] = OUStringToOString(seqValue.getConstArray()[i], RTL_TEXTENCODING_UTF8);
- tmpValue[i] = (char*)pSValue[i].getStr();
- }
-
- if ( m_key.setStringListValue(OUString(), tmpValue, length) )
- {
- delete[] pSValue;
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
-
- delete[] pSValue;
- delete[] tmpValue;
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryValueList< sal_Int32 > list;
+ RegError err = key_.getLongListValue(rtl::OUString(), list);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_VALUE_NOT_EXISTS:
+ return css::uno::Sequence< sal_Int32 >();
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongListValue:"
+ " underlying RegistryKey::getLongListValue() ="
+ " REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongListValue:"
+ " underlying RegistryKey::getLongListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLongListValue:"
+ " underlying RegistryKey::getLongListValue() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ value[static_cast< sal_Int32 >(i)] = list.getElement(i);
}
+ return value;
}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getStringValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_UNICODE)
- {
- sal_Unicode* value = new sal_Unicode[size];
- if ( m_key.getValue(OUString(), (RegValue)value) )
- {
- delete [] value;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- } else
- {
- OUString ret(value);
- delete [] value;
- return ret;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ std::vector< sal_Int32 > list;
+ for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
+ list.push_back(seqValue[i]);
+ }
+ RegError err = key_.setLongListValue(
+ rtl::OUString(), list.empty() ? 0 : &list[0],
+ static_cast< sal_uInt32 >(list.size()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setLongListValue:"
+ " underlying RegistryKey::setLongListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setStringValue( const OUString& value )
- throw(InvalidRegistryException, RuntimeException)
+rtl::OUString Key::getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 size = (value.getLength() + 1) * sizeof(sal_Unicode);
- if ( m_key.setValue(OUString(), RG_VALUETYPE_UNICODE,
- (RegValue)(value.getStr()), size) )
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (type != RG_VALUETYPE_STRING) {
+ throw css::registry::InvalidValueException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey type = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
+ static_cast< OWeakObject * >(this));
+ }
+ // size contains terminating null (error in underlying registry.cxx):
+ if (size == 0) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey size 0 cannot happen due to"
+ " design error")),
+ static_cast< OWeakObject * >(this));
+ }
+ if (size > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey size too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ std::vector< char > list(size);
+ err = key_.getValue(rtl::OUString(), &list[0]);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
+ if (list[size - 1] != '\0') {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey value must be null-terminated due"
+ " to design error")),
+ static_cast< OWeakObject * >(this));
+ }
+ rtl::OUString value;
+ if (!rtl_convertStringToUString(
+ &value.pData, &list[0],
+ static_cast< sal_Int32 >(size - 1), RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getAsciiValue:"
+ " underlying RegistryKey not UTF-8")),
+ static_cast< OWeakObject * >(this));
+ }
+ return value;
}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getStringListValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setAsciiValue(rtl::OUString const & value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
- {
- if (type == RG_VALUETYPE_UNICODELIST)
- {
- RegistryValueList<sal_Unicode*> tmpValue;
- if ( !m_key.getUnicodeListValue(OUString(), tmpValue) )
- {
- Sequence<OUString> seqValue(size);
-
- for (sal_uInt32 i=0; i < size; i++)
- {
- seqValue.getArray()[i] = OUString(tmpValue.getElement(i));
- }
-
- return seqValue;
- }
- }
- }
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(registry_->mutex_);
+ rtl::OString utf8;
+ if (!value.convertToString(
+ &utf8, RTL_TEXTENCODING_UTF8,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setAsciiValue:"
+ " value not UTF-16")),
+ static_cast< OWeakObject * >(this));
+ }
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_STRING,
+ const_cast< char * >(utf8.getStr()), utf8.getLength() + 1);
+ // +1 for terminating null (error in underlying registry.cxx)
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setAsciiValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setStringListValue( const Sequence< OUString >& seqValue )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 length = seqValue.getLength();
- sal_Unicode** tmpValue = new sal_Unicode*[length];
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- tmpValue[i] = (sal_Unicode*)seqValue.getConstArray()[i].getStr();
- }
-
- if (m_key.setUnicodeListValue(OUString(), tmpValue, length))
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryValueList< char * > list;
+ RegError err = key_.getStringListValue(rtl::OUString(), list);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_VALUE_NOT_EXISTS:
+ return css::uno::Sequence< rtl::OUString >();
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying"
+ " RegistryKey::getStringListValue() = REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying"
+ " RegistryKey::getStringListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying"
+ " RegistryKey::getStringListValue() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ char * el = list.getElement(i);
+ sal_Int32 size = rtl_str_getLength(el);
+ if (!rtl_convertStringToUString(
+ &value[static_cast< sal_Int32 >(i)].pData, el, size,
+ RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
{
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying RegistryKey not"
+ " UTF-8")),
+ static_cast< OWeakObject * >(this));
}
-
- delete[] tmpValue;
}
+ return value;
}
-//*************************************************************************
-Sequence< sal_Int8 > SAL_CALL RegistryKeyImpl::getBinaryValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setAsciiListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
+ osl::MutexGuard guard(registry_->mutex_);
+ std::vector< rtl::OString > list;
+ for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
+ rtl::OString utf8;
+ if (!seqValue[i].convertToString(
+ &utf8, RTL_TEXTENCODING_UTF8,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{
- if (type == RG_VALUETYPE_BINARY)
- {
- sal_Int8* value = new sal_Int8[size];
- if (m_key.getValue(OUString(), (RegValue)value))
- {
- delete [] value;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- } else
- {
- Sequence<sal_Int8> seqBytes(value, size);
- delete [] value;
- return seqBytes;
- }
- }
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setAsciiListValue: value not UTF-16")),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ list.push_back(utf8);
+ }
+ std::vector< char * > list2;
+ for (std::vector< rtl::OString >::iterator i(list.begin()); i != list.end();
+ ++i)
+ {
+ list2.push_back(const_cast< char * >(i->getStr()));
+ }
+ RegError err = key_.setStringListValue(
+ rtl::OUString(), list2.empty() ? 0 : &list2[0],
+ static_cast< sal_uInt32 >(list2.size()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setAsciiListValue: underlying"
+ " RegistryKey::setStringListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
- throw(InvalidRegistryException, RuntimeException)
+rtl::OUString Key::getStringValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- sal_uInt32 size = value.getLength();
- if ( m_key.setValue(OUString(), RG_VALUETYPE_BINARY,
- (RegValue)(value.getConstArray()), size) )
- {
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (type != RG_VALUETYPE_UNICODE) {
+ throw css::registry::InvalidValueException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey type = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
+ static_cast< OWeakObject * >(this));
+ }
+ // size contains terminating null and is *2 (error in underlying
+ // registry.cxx):
+ if (size == 0 || (size & 1) == 1) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey size 0 or odd cannot happen due to"
+ " design error")),
+ static_cast< OWeakObject * >(this));
}
+ if (size > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey size too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ std::vector< sal_Unicode > list(size);
+ err = key_.getValue(rtl::OUString(), &list[0]);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (list[size/2 - 1] != 0) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getStringValue:"
+ " underlying RegistryKey value must be null-terminated due"
+ " to design error")),
+ static_cast< OWeakObject * >(this));
+ }
+ return rtl::OUString(&list[0], static_cast< sal_Int32 >(size/2 - 1));
}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::openKey( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+void Key::setStringValue(rtl::OUString const & value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- RegistryKey newKey;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError _ret = m_key.openKey(aKeyName, newKey);
- if ( _ret )
- {
- if ( _ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Reference<XRegistryKey>();
- } else
- {
- return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry));
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_UNICODE,
+ const_cast< sal_Unicode * >(value.getStr()),
+ (value.getLength() + 1) * sizeof (sal_Unicode));
+ // +1 for terminating null (error in underlying registry.cxx)
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setStringValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::createKey( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- RegistryKey newKey;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError _ret = m_key.createKey(aKeyName, newKey);
- if ( _ret )
- {
- if (_ret == REG_INVALID_KEY)
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Reference<XRegistryKey>();
- } else
- {
- return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry));
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryValueList< sal_Unicode * > list;
+ RegError err = key_.getUnicodeListValue(rtl::OUString(), list);
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_VALUE_NOT_EXISTS:
+ return css::uno::Sequence< rtl::OUString >();
+ case REG_INVALID_VALUE:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getStringListValue: underlying"
+ " RegistryKey::getUnicodeListValue() = REG_INVALID_VALUE")),
+ static_cast< OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getStringListValue: underlying"
+ " RegistryKey::getUnicodeListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getStringListValue: underlying"
+ " RegistryKey::getUnicodeListValue() too large")),
+ static_cast< OWeakObject * >(this));
}
+ css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ value[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ }
+ return value;
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::closeKey( )
- throw(InvalidRegistryException, RuntimeException)
+void Key::setStringListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- if ( !m_key.closeKey() )
- return;
+ osl::MutexGuard guard(registry_->mutex_);
+ std::vector< sal_Unicode * > list;
+ for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) {
+ list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr()));
+ }
+ RegError err = key_.setUnicodeListValue(
+ rtl::OUString(), list.empty() ? 0 : &list[0],
+ static_cast< sal_uInt32 >(list.size()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setStringListValue: underlying"
+ " RegistryKey::setUnicodeListValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::deleteKey( const OUString& rKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- if ( !m_key.deleteKey(rKeyName) )
- return;
+ osl::MutexGuard guard(registry_->mutex_);
+ RegValueType type;
+ sal_uInt32 size;
+ RegError err = key_.getValueInfo(rtl::OUString(), &type, &size);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
+ if (type != RG_VALUETYPE_BINARY) {
+ throw css::registry::InvalidValueException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey type = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(type))),
+ static_cast< OWeakObject * >(this));
+ }
+ if (size > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey size too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size));
+ err = key_.getValue(rtl::OUString(), value.getArray());
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getBinaryValue:"
+ " underlying RegistryKey::getValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return value;
}
-//*************************************************************************
-Sequence< Reference< XRegistryKey > > SAL_CALL RegistryKeyImpl::openKeys( )
- throw(InvalidRegistryException, RuntimeException)
+void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegistryKeyArray subKeys;
- RegError _ret = REG_NO_ERROR;
- if ( (_ret = m_key.openSubKeys(OUString(), subKeys)) )
- {
- if ( _ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Sequence< Reference<XRegistryKey> >();
- } else
- {
- sal_uInt32 length = subKeys.getLength();
- Sequence< Reference<XRegistryKey> > seqKeys(length);
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- seqKeys.getArray()[i] =
- (XRegistryKey*) new RegistryKeyImpl(subKeys.getElement(i), m_pRegistry);
- }
- return seqKeys;
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.setValue(
+ rtl::OUString(), RG_VALUETYPE_BINARY,
+ const_cast< sal_Int8 * >(value.getConstArray()),
+ static_cast< sal_uInt32 >(value.getLength()));
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key setBinaryValue:"
+ " underlying RegistryKey::setValue() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getKeyNames( )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
+ rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegistryKeyNames subKeys;
- RegError _ret = REG_NO_ERROR;
- if ( (_ret = m_key.getKeyNames(OUString(), subKeys)) )
- {
- if ( _ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
-
- return Sequence<OUString>();
- } else
- {
- sal_uInt32 length = subKeys.getLength();
- Sequence<OUString> seqKeys(length);
-
- for (sal_uInt32 i=0; i < length; i++)
- {
- seqKeys.getArray()[i] = subKeys.getElement(i);
- }
- return seqKeys;
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKey key;
+ RegError err = key_.openKey(aKeyName, key);
+ switch (err) {
+ case REG_NO_ERROR:
+ return new Key(registry_, key);
+ case REG_KEY_NOT_EXISTS:
+ return css::uno::Reference< css::registry::XRegistryKey >();
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key openKey:"
+ " underlying RegistryKey::openKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
+ rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError ret = m_key.createLink(aLinkName, aLinkTarget);
- if ( ret )
- {
- if ( ret == REG_DETECT_RECURSION ||
- ret == REG_INVALID_KEY )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- return sal_False;
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKey key;
+ RegError err = key_.createKey(aKeyName, key);
+ switch (err) {
+ case REG_NO_ERROR:
+ return new Key(registry_, key);
+ case REG_INVALID_KEYNAME:
+ return css::uno::Reference< css::registry::XRegistryKey >();
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key createKey:"
+ " underlying RegistryKey::createKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
- return sal_True;
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::deleteLink( const OUString& rLinkName )
- throw(InvalidRegistryException, RuntimeException)
+void Key::closeKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- if ( m_key.deleteLink(rLinkName) )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.closeKey();
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key closeKey:"
+ " underlying RegistryKey::closeKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getLinkTarget( const OUString& rLinkName )
- throw(InvalidRegistryException, RuntimeException)
+void Key::deleteKey(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- OUString linkTarget;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError ret = m_key.getLinkTarget(rLinkName, linkTarget);
- if ( ret )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.deleteKey(rKeyName);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key deleteKey:"
+ " underlying RegistryKey::deleteKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- return linkTarget;
}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getResolvedName( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+Key::openKeys()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- OUString resolvedName;
-
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( !m_key.isValid() )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- } else
- {
- RegError ret = m_key.getResolvedKeyName(
- aKeyName, sal_True, resolvedName);
- if ( ret )
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKeyArray list;
+ RegError err = key_.openSubKeys(rtl::OUString(), list);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key openKeys:"
+ " underlying RegistryKey::openSubKeys() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- return resolvedName;
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyNames:"
+ " underlying RegistryKey::getKeyNames() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ keys(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ keys[static_cast< sal_Int32 >(i)] = new Key(
+ registry_, list.getElement(i));
+ }
+ return keys;
}
-//*************************************************************************
-SimpleRegistryImpl::SimpleRegistryImpl( const Registry& rRegistry )
- : m_registry(rRegistry)
+css::uno::Sequence< rtl::OUString > Key::getKeyNames()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegistryKeyNames list;
+ RegError err = key_.getKeyNames(rtl::OUString(), list);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyNames:"
+ " underlying RegistryKey::getKeyNames() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ sal_uInt32 n = list.getLength();
+ if (n > SAL_MAX_INT32) {
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getKeyNames:"
+ " underlying RegistryKey::getKeyNames() too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > names(static_cast< sal_Int32 >(n));
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ names[static_cast< sal_Int32 >(i)] = list.getElement(i);
+ }
+ return names;
}
-//*************************************************************************
-SimpleRegistryImpl::~SimpleRegistryImpl()
+sal_Bool Key::createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.createLink(aLinkName, aLinkTarget);
+ switch (err) {
+ case REG_NO_ERROR:
+ return true;
+ case REG_INVALID_KEY:
+ case REG_DETECT_RECURSION:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key createLink:"
+ " underlying RegistryKey::createLink() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ default:
+ return false;
+ }
}
-//*************************************************************************
-OUString SAL_CALL SimpleRegistryImpl::getImplementationName( )
- throw(RuntimeException)
+void Key::deleteLink(rtl::OUString const & rLinkName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- return stoc_bootstrap::simreg_getImplementationName();
+ osl::MutexGuard guard(registry_->mutex_);
+ RegError err = key_.deleteLink(rLinkName);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key deleteLink:"
+ " underlying RegistryKey::deleteLink() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::supportsService( const OUString& ServiceName )
- throw(RuntimeException)
+rtl::OUString Key::getLinkTarget(rtl::OUString const & rLinkName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- Sequence< OUString > aSNL = getSupportedServiceNames();
- const OUString * pArray = aSNL.getArray();
- for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
- if( pArray[i] == ServiceName )
- return sal_True;
- return sal_False;
+ osl::MutexGuard guard(registry_->mutex_);
+ rtl::OUString target;
+ RegError err = key_.getLinkTarget(rLinkName, target);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getLinkTarget:"
+ " underlying RegistryKey::getLinkTarget() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return target;
}
-//*************************************************************************
-Sequence<OUString> SAL_CALL SimpleRegistryImpl::getSupportedServiceNames( )
- throw(RuntimeException)
+rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- return stoc_bootstrap::simreg_getSupportedServiceNames();
+ osl::MutexGuard guard(registry_->mutex_);
+ rtl::OUString resolved;
+ RegError err = key_.getResolvedKeyName(aKeyName, true, resolved);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key getResolvedName:"
+ " underlying RegistryKey::getResolvedName() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
+ }
+ return resolved;
}
-//*************************************************************************
-OUString SAL_CALL SimpleRegistryImpl::getURL() throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_mutex );
- return m_url;
+rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(mutex_);
+ return textual_.get() == 0 ? registry_.getName() : textual_->getUri();
}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate )
- throw(InvalidRegistryException, RuntimeException)
+void SimpleRegistry::open(
+ rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- m_registry.close();
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.open(")) +
+ rURL +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "): instance already open"))),
+ static_cast< OWeakObject * >(this));
}
-
- RegAccessMode accessMode = REG_READWRITE;
-
- if ( bReadOnly )
- accessMode = REG_READONLY;
-
- if ( !m_registry.open(rURL, accessMode) )
- {
- m_url = rURL;
- return;
+ RegError err = (rURL.getLength() == 0 && bCreate)
+ ? REG_REGISTRY_NOT_EXISTS
+ : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE);
+ if (err == REG_REGISTRY_NOT_EXISTS && bCreate) {
+ err = registry_.create(rURL);
}
-
- if ( bCreate )
- {
- if ( !m_registry.create(rURL) )
- {
- m_url = rURL;
- return;
+ switch (err) {
+ case REG_NO_ERROR:
+ break;
+ case REG_INVALID_REGISTRY:
+ if (bReadOnly && !bCreate) {
+ textual_.reset(new stoc::simpleregistry::TextualServices(rURL));
+ break;
}
+ // fall through
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.open(")) +
+ rURL +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "): underlying Registry::open/create() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- m_url = OUString();
-
- OUStringBuffer reason( 128 );
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("Couldn't ") );
- if( bCreate )
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("create") );
- }
- else
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("open") );
- }
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" registry ") );
- reason.append( rURL );
- if( bReadOnly )
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for reading") );
- }
- else
- {
- reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for writing" ) );
- }
- throw InvalidRegistryException( reason.makeStringAndClear() , Reference< XInterface >() );
}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::isValid( ) throw(RuntimeException)
-{
- Guard< Mutex > aGuard( m_mutex );
- return m_registry.isValid();
+sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(mutex_);
+ return textual_.get() != 0 || registry_.isValid();
}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::close( )
- throw(InvalidRegistryException, RuntimeException)
+void SimpleRegistry::close()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- if ( !m_registry.close() )
- {
- m_url = OUString();
- return;
- }
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ textual_.reset();
+ return;
+ }
+ RegError err = registry_.close();
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.close:"
+ " underlying Registry::close() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::destroy( )
- throw(InvalidRegistryException, RuntimeException)
+void SimpleRegistry::destroy()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- if ( !m_registry.destroy(OUString()) )
- {
- m_url = OUString();
- return;
- }
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ textual_.reset();
+ return;
+ }
+ RegError err = registry_.destroy(rtl::OUString());
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.destroy:"
+ " underlying Registry::destroy() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL SimpleRegistryImpl::getRootKey( )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- return ((XRegistryKey*)new RegistryKeyImpl(OUString( RTL_CONSTASCII_USTRINGPARAM("/") ), this));
- else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ return textual_->getRootKey();
+ }
+ RegistryKey root;
+ RegError err = registry_.openRootKey(root);
+ if (err != REG_NO_ERROR) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.getRootKey:"
+ " underlying Registry::getRootKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
+ return new Key(this, root);
}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::isReadOnly( )
- throw(InvalidRegistryException, RuntimeException)
+sal_Bool SimpleRegistry::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- return m_registry.isReadOnly();
- else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
+ osl::MutexGuard guard(mutex_);
+ return textual_.get() != 0 || registry_.isReadOnly();
}
-//*************************************************************************
-void SAL_CALL SimpleRegistryImpl::mergeKey( const OUString& aKeyName, const OUString& aUrl )
- throw(InvalidRegistryException, MergeConflictException, RuntimeException)
+void SimpleRegistry::mergeKey(
+ rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::MergeConflictException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_mutex );
- if ( m_registry.isValid() )
- {
- RegistryKey rootKey;
- if ( !m_registry.openRootKey(rootKey) )
- {
- RegError ret = m_registry.mergeKey(rootKey, aKeyName, aUrl, sal_False, sal_False);
- if (ret)
- {
- if ( ret == REG_MERGE_CONFLICT )
- return;
- if ( ret == REG_MERGE_ERROR )
- {
- throw MergeConflictException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("MergeConflictException") ),
- (OWeakObject *)this );
- }
- else
- {
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
- }
- }
-
- return;
- }
+ osl::MutexGuard guard(mutex_);
+ if (textual_.get() != 0) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.mergeKey: not"
+ " supported for textual representation")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ RegistryKey root;
+ RegError err = registry_.openRootKey(root);
+ if (err == REG_NO_ERROR) {
+ err = registry_.mergeKey(root, aKeyName, aUrl, false, false);
+ }
+ switch (err) {
+ case REG_NO_ERROR:
+ case REG_MERGE_CONFLICT:
+ break;
+ case REG_MERGE_ERROR:
+ throw css::registry::MergeConflictException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.mergeKey:"
+ " underlying Registry::mergeKey() = REG_MERGE_ERROR")),
+ static_cast< cppu::OWeakObject * >(this));
+ default:
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry.mergeKey:"
+ " underlying Registry::getRootKey/mergeKey() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
}
-namespace stoc_bootstrap
-{
-//*************************************************************************
-Reference<XInterface> SAL_CALL SimpleRegistry_CreateInstance( const Reference<XComponentContext>& )
-{
- Reference<XInterface> xRet;
-
- Registry reg;
+}
- XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_simreg::SimpleRegistryImpl(reg);
+namespace stoc_bootstrap {
- if (pRegistry)
- {
- xRet = Reference<XInterface>::query(pRegistry);
- }
+css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
+ css::uno::Reference< css::uno::XComponentContext > const &)
+{
+ return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
+}
- return xRet;
+css::uno::Sequence< rtl::OUString > simreg_getSupportedServiceNames() {
+ css::uno::Sequence< rtl::OUString > names(1);
+ names[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry"));
+ return names;
}
+
+rtl::OUString simreg_getImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry"));
}
+}
diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx
new file mode 100755
index 000000000000..932c639124d0
--- /dev/null
+++ b/stoc/source/simpleregistry/textualservices.cxx
@@ -0,0 +1,1216 @@
+/*************************************************************************
+*
+* 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_stoc.hxx"
+#include "sal/config.h"
+
+#include <cstddef>
+#include <cstdlib>
+#include <map>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/registry/InvalidRegistryException.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/implbase1.hxx"
+#include "osl/diagnose.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+#include "xmlreader/span.hxx"
+#include "xmlreader/xmlreader.hxx"
+
+#include "textualservices.hxx"
+
+namespace stoc { namespace simpleregistry {
+
+namespace {
+
+namespace css = com::sun::star;
+
+struct Implementation {
+ rtl::OUString uri;
+ rtl::OUString loader;
+ std::vector< rtl::OUString > services;
+ std::vector< rtl::OUString > singletons;
+};
+
+typedef std::map< rtl::OUString, Implementation > Implementations;
+
+typedef std::map< rtl::OUString, std::vector< rtl::OUString > >
+ ImplementationMap;
+
+}
+
+class Data: public salhelper::SimpleReferenceObject, private boost::noncopyable
+{
+public:
+ Implementations implementations;
+ ImplementationMap services;
+ ImplementationMap singletons;
+};
+
+namespace {
+
+class Parser: private boost::noncopyable {
+public:
+ Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data);
+
+private:
+ void handleComponent();
+
+ void handleImplementation();
+
+ void handleService();
+
+ void handleSingleton();
+
+ rtl::OUString getNameAttribute();
+
+ xmlreader::XmlReader reader_;
+ rtl::Reference< Data > data_;
+ rtl::OUString attrUri_;
+ rtl::OUString attrLoader_;
+ rtl::OUString attrImplementation_;
+};
+
+Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data):
+ reader_(uri), data_(data)
+{
+ OSL_ASSERT(data.is());
+ int ucNsId = reader_.registerNamespaceIri(
+ xmlreader::Span(
+ RTL_CONSTASCII_STRINGPARAM(
+ "http://openoffice.org/2010/uno-components")));
+ enum State {
+ STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL,
+ STATE_COMPONENT, STATE_IMPLEMENTATION, STATE_SERVICE, STATE_SINGLETON };
+ for (State state = STATE_BEGIN;;) {
+ xmlreader::Span name;
+ int nsId;
+ xmlreader::XmlReader::Result res = reader_.nextItem(
+ xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
+ switch (state) {
+ case STATE_BEGIN:
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("components")))
+ {
+ state = STATE_COMPONENTS;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in outer level"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_END:
+ if (res == xmlreader::XmlReader::RESULT_DONE) {
+ return;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in outer level"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_COMPONENTS:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_END;
+ break;
+ }
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("component")))
+ {
+ handleComponent();
+ state = STATE_COMPONENT_INITIAL;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <components>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_COMPONENT:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_COMPONENTS;
+ break;
+ }
+ // fall through
+ case STATE_COMPONENT_INITIAL:
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("implementation")))
+ {
+ handleImplementation();
+ state = STATE_IMPLEMENTATION;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <component>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_IMPLEMENTATION:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_COMPONENT;
+ break;
+ }
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("service")))
+ {
+ handleService();
+ state = STATE_SERVICE;
+ break;
+ }
+ if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("singleton")))
+ {
+ handleSingleton();
+ state = STATE_SINGLETON;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <implementation>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_SERVICE:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_IMPLEMENTATION;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <service>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case STATE_SINGLETON:
+ if (res == xmlreader::XmlReader::RESULT_END) {
+ state = STATE_IMPLEMENTATION;
+ break;
+ }
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": unexpected item in <service>"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+}
+
+void Parser::handleComponent() {
+ attrUri_ = rtl::OUString();
+ attrLoader_ = rtl::OUString();
+ xmlreader::Span name;
+ int nsId;
+ while (reader_.nextAttribute(&nsId, &name)) {
+ if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("uri")))
+ {
+ if (attrUri_.getLength() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has multiple \"uri\" attributes"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ attrUri_ = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrUri_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has empty \"uri\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("loader")))
+ {
+ if (attrLoader_.getLength() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has multiple \"loader\""
+ " attributes"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ attrLoader_ = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrLoader_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> has empty \"loader\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": expected <component> attribute \"uri\" or"
+ " \"loader\""))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ if (attrUri_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> is missing \"uri\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ if (attrLoader_.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": <component> is missing \"loader\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+void Parser::handleImplementation() {
+ attrImplementation_ = getNameAttribute();
+ if (data_->implementations.find(attrImplementation_) !=
+ data_->implementations.end())
+ {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": duplicate <implementation name=\"")) +
+ attrImplementation_ +
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\">"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ data_->implementations[attrImplementation_].uri = attrUri_;
+ data_->implementations[attrImplementation_].loader = attrLoader_;
+}
+
+void Parser::handleService() {
+ rtl::OUString name = getNameAttribute();
+ data_->implementations[attrImplementation_].services.push_back(name);
+ data_->services[name].push_back(attrImplementation_);
+}
+
+void Parser::handleSingleton() {
+ rtl::OUString name = getNameAttribute();
+ data_->implementations[attrImplementation_].singletons.push_back(name);
+ data_->singletons[name].push_back(attrImplementation_);
+}
+
+rtl::OUString Parser::getNameAttribute() {
+ rtl::OUString attrName;
+ xmlreader::Span name;
+ int nsId;
+ while (reader_.nextAttribute(&nsId, &name)) {
+ if (nsId == xmlreader::XmlReader::NAMESPACE_NONE &&
+ name.equals(RTL_CONSTASCII_STRINGPARAM("name")))
+ {
+ if (attrName.getLength() != 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": element has multiple \"name\" attributes"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ attrName = reader_.getAttributeValue(false).convertFromUtf8();
+ if (attrName.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": element has empty \"name\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": expected element attribute \"name\""))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ if (attrName.getLength() == 0) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ ": element is missing \"name\" attribute"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return attrName;
+}
+
+rtl::OUString pathToString(std::vector< rtl::OUString > const & path) {
+ rtl::OUStringBuffer buf;
+ for (std::vector< rtl::OUString >::const_iterator i(path.begin());
+ i != path.end(); ++i)
+ {
+ buf.append(sal_Unicode('/'));
+ buf.append(*i);
+ }
+ if (buf.getLength() == 0) {
+ buf.append(sal_Unicode('/'));
+ }
+ return buf.makeStringAndClear();
+}
+
+class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > {
+public:
+ Key(
+ rtl::Reference< Data > const & data,
+ std::vector< rtl::OUString > const & path):
+ data_(data), path_(path) { OSL_ASSERT(data.is());
+ }
+
+private:
+ /*
+ /
+ IMPLEMENTATIONS
+ <implementation>
+ UNO
+ LOCATION utf-8
+ ACTIVATOR utf-8
+ SERVICES
+ <service>
+ ...
+ SINGLETONS
+ <singleton> utf-16
+ ...
+ ...
+ SERVICES
+ <service> utf-8-list
+ ...
+ SINGLETONS
+ <singleton> utf-16
+ REGISTERED_BY utf-8-list
+ ...
+ */
+ enum State {
+ STATE_ROOT, STATE_IMPLEMENTATIONS, STATE_IMPLEMENTATION, STATE_UNO,
+ STATE_LOCATION, STATE_ACTIVATOR, STATE_IMPLEMENTATION_SERVICES,
+ STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETONS,
+ STATE_IMPLEMENTATION_SINGLETON, STATE_SERVICES, STATE_SERVICE,
+ STATE_SINGLETONS, STATE_SINGLETON, STATE_REGISTEREDBY };
+
+ virtual rtl::OUString SAL_CALL getKeyName()
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnly() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException);
+
+ virtual css::registry::RegistryKeyType SAL_CALL getKeyType(
+ rtl::OUString const & rKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::registry::RegistryValueType SAL_CALL getValueType() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongValue(sal_Int32 value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setLongListValue(
+ com::sun::star::uno::Sequence< sal_Int32 > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setAsciiListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getStringValue() throw(
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setStringListValue(
+ css::uno::Sequence< rtl::OUString > const & seqValue)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL setBinaryValue(
+ css::uno::Sequence< sal_Int8 > const & value)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ createKey(rtl::OUString const & aKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL closeKey() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ SAL_CALL openKeys() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getLinkTarget(
+ rtl::OUString const & rLinkName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getResolvedName(
+ rtl::OUString const & aKeyName)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ bool find(
+ rtl::OUString const & relative, std::vector< rtl::OUString > * path,
+ State * state, css::registry::RegistryValueType * type) const;
+
+ css::uno::Sequence< rtl::OUString > getChildren();
+
+ rtl::Reference< Data > data_;
+ std::vector< rtl::OUString > path_;
+};
+
+rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) {
+ return pathToString(path_);
+}
+
+sal_Bool Key::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ return true;
+}
+
+sal_Bool Key::isValid() throw(css::uno::RuntimeException) {
+ return true;
+}
+
+css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ if (!find(rtl::OUString(), 0, 0, 0)) {
+ throw css::registry::InvalidRegistryException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unknown key ")) +
+ rKeyName),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ return css::registry::RegistryKeyType_KEY;
+}
+
+css::registry::RegistryValueType Key::getValueType()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ css::registry::RegistryValueType type =
+ css::registry::RegistryValueType_NOT_DEFINED;
+ OSL_VERIFY(find(rtl::OUString(), 0, 0, &type));
+ return type;
+}
+
+sal_Int32 Key::getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getLongValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setLongValue(sal_Int32)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setLongValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getLongListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setLongListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getAsciiValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ switch (state) {
+ case STATE_LOCATION:
+ return data_->implementations[path_[1]].uri;
+ case STATE_ACTIVATOR:
+ return data_->implementations[path_[1]].loader;
+ default:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getAsciiValue: wrong type")),
+ static_cast< OWeakObject * >(this));
+ }
+}
+
+void Key::setAsciiValue(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setAsciiValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ std::vector< rtl::OUString > const * list;
+ switch (state) {
+ case STATE_SERVICE:
+ list = &data_->services[path_[1]];
+ break;
+ case STATE_REGISTEREDBY:
+ list = &data_->singletons[path_[1]];
+ break;
+ default:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getAsciiListValue: wrong type")),
+ static_cast< OWeakObject * >(this));
+ }
+ if (list->size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getAsciiListValue: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(list->size()));
+ sal_Int32 i = 0;
+ for (std::vector< rtl::OUString >::const_iterator j(list->begin());
+ j != list->end(); ++j)
+ {
+ seq[i++] = *j;
+ }
+ return seq;
+}
+
+void Key::setAsciiListValue(css::uno::Sequence< rtl::OUString > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setAsciiListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getStringValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ switch (state) {
+ case STATE_IMPLEMENTATION_SINGLETON:
+ case STATE_SINGLETON:
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getStringValue: does not associate singletons with"
+ " services")),
+ static_cast< OWeakObject * >(this));
+ default:
+ break;
+ }
+ // default case extracted from switch to avoid erroneous compiler warnings
+ // on Solaris:
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getStringValue: wrong type")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setStringValue(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setStringValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getStringListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setStringListValue(css::uno::Sequence< rtl::OUString > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setStringListValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< sal_Int8 > Key::getBinaryValue()
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getBinarValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " setBinaryValue not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
+ rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ std::vector< rtl::OUString > path;
+ if (!find(aKeyName, &path, 0, 0)) {
+ return css::uno::Reference< css::registry::XRegistryKey >();
+ }
+ return new Key(data_, path);
+}
+
+css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
+ rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " createKey not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::closeKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{}
+
+void Key::deleteKey(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " deleteKey not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+Key::openKeys()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > names(getChildren());
+ css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+ keys(names.getLength());
+ for (sal_Int32 i = 0; i < keys.getLength(); ++i) {
+ keys[i] = openKey(names[i]);
+ OSL_ASSERT(keys[i].is());
+ }
+ return keys;
+}
+
+css::uno::Sequence< rtl::OUString > Key::getKeyNames()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > names(getChildren());
+ rtl::OUString prefix(pathToString(path_));
+ prefix += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
+ for (sal_Int32 i = 0; i < names.getLength(); ++i) {
+ names[i] = prefix + names[i];
+ }
+ return names;
+}
+
+sal_Bool Key::createLink(rtl::OUString const &, rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " createLink not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+void Key::deleteLink(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " deleteLink not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getLinkTarget(rtl::OUString const &)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ throw css::registry::InvalidRegistryException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual services key"
+ " getLinkTarget not supported")),
+ static_cast< OWeakObject * >(this));
+}
+
+rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
+{
+ std::vector< rtl::OUString > path;
+ find(aKeyName, &path, 0, 0);
+ return pathToString(path);
+}
+
+bool Key::find(
+ rtl::OUString const & relative, std::vector< rtl::OUString > * path,
+ State * state, css::registry::RegistryValueType * type) const
+{
+ std::vector< rtl::OUString > p(path_);
+ sal_Int32 i = 0;
+ do {
+ rtl::OUString seg(relative.getToken(0, '/', i));
+ if (seg.getLength() != 0) {
+ p.push_back(seg);
+ }
+ } while (i >= 0);
+ if (path != 0) {
+ *path = p;
+ }
+ std::size_t const MAX_TRANSITIONS = 4;
+ struct StateInfo {
+ css::registry::RegistryValueType type;
+ std::size_t count;
+ struct { char const * segment; State state; }
+ transitions[MAX_TRANSITIONS];
+ };
+ static StateInfo const info[] = {
+ // STATE_ROOT:
+ { css::registry::RegistryValueType_NOT_DEFINED, 3,
+ { { "IMPLEMENTATIONS", STATE_IMPLEMENTATIONS },
+ { "SERVICES", STATE_SERVICES },
+ { "SINGLETONS", STATE_SINGLETONS } } },
+ // STATE_IMPLEMENTATIONS:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_IMPLEMENTATION } } },
+ // STATE_IMPLEMENTATION:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { "UNO", STATE_UNO } } },
+ // STATE_UNO:
+ { css::registry::RegistryValueType_NOT_DEFINED, 4,
+ { { "LOCATION", STATE_LOCATION },
+ { "ACTIVATOR", STATE_ACTIVATOR },
+ { "SERVICES", STATE_IMPLEMENTATION_SERVICES },
+ { "SINGLETONS", STATE_IMPLEMENTATION_SINGLETONS } } },
+ // STATE_LOCATION:
+ { css::registry::RegistryValueType_ASCII, 0, {} },
+ // STATE_ACTIVATOR:
+ { css::registry::RegistryValueType_ASCII, 0, {} },
+ // STATE_IMPLEMENTATION_SERVICES:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_IMPLEMENTATION_SERVICE } } },
+ // STATE_IMPLEMENTATION_SERVICE:
+ { css::registry::RegistryValueType_NOT_DEFINED, 0, {} },
+ // STATE_IMPLEMENTATION_SINGLETONS:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_IMPLEMENTATION_SINGLETON } } },
+ // STATE_IMPLEMENTATION_SINGLETON:
+ { css::registry::RegistryValueType_STRING, 0, {} },
+ // STATE_SERVICES:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_SERVICE } } },
+ // STATE_SERVICE:
+ { css::registry::RegistryValueType_ASCIILIST, 0, {} },
+ // STATE_SINGLETONS:
+ { css::registry::RegistryValueType_NOT_DEFINED, 1,
+ { { 0, STATE_SINGLETON } } },
+ // STATE_SINGLETON:
+ { css::registry::RegistryValueType_STRING, 1,
+ { { "REGISTERED_BY", STATE_REGISTEREDBY } } },
+ // STATE_REGISTEREDBY:
+ { css::registry::RegistryValueType_ASCIILIST, 0, {} } };
+ State s = STATE_ROOT;
+ for (std::vector< rtl::OUString >::iterator j(p.begin()); j != p.end(); ++j)
+ {
+ bool found = false;
+ for (std::size_t k = 0; k < info[s].count; ++k) {
+ if (info[s].transitions[k].segment == 0) {
+ switch (info[s].transitions[k].state) {
+ case STATE_IMPLEMENTATION:
+ found = data_->implementations.find(*j) !=
+ data_->implementations.end();
+ break;
+ case STATE_IMPLEMENTATION_SERVICE:
+ case STATE_IMPLEMENTATION_SINGLETON:
+ found = true; //TODO
+ break;
+ case STATE_SERVICE:
+ found = data_->services.find(*j) != data_->services.end();
+ break;
+ case STATE_SINGLETON:
+ found = data_->singletons.find(*j) !=
+ data_->singletons.end();
+ break;
+ default:
+ std::abort(); // this cannot happen
+ }
+ } else {
+ found = j->equalsAscii(info[s].transitions[k].segment);
+ }
+ if (found) {
+ s = info[s].transitions[k].state;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+ if (state != 0) {
+ *state = s;
+ }
+ if (type != 0) {
+ *type = info[s].type;
+ }
+ return true;
+}
+
+css::uno::Sequence< rtl::OUString > Key::getChildren() {
+ State state = STATE_ROOT;
+ OSL_VERIFY(find(rtl::OUString(), 0, &state, 0));
+ switch (state) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo-fall-through to avoid warnings on MSC
+ case STATE_ROOT:
+ {
+ css::uno::Sequence< rtl::OUString > seq(3);
+ seq[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("IMPLEMENTATIONS"));
+ seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES"));
+ seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS"));
+ return seq;
+ }
+ case STATE_IMPLEMENTATIONS:
+ {
+ if (data_->implementations.size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(data_->implementations.size()));
+ sal_Int32 i = 0;
+ for (Implementations::iterator j(data_->implementations.begin());
+ j != data_->implementations.end(); ++j)
+ {
+ seq[i++] = j->first;
+ }
+ return seq;
+ }
+ case STATE_UNO:
+ {
+ css::uno::Sequence< rtl::OUString > seq(4);
+ seq[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCATION"));
+ seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACTIVATOR"));
+ seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES"));
+ seq[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS"));
+ return seq;
+ }
+ case STATE_LOCATION:
+ case STATE_ACTIVATOR:
+ case STATE_IMPLEMENTATION_SERVICE:
+ case STATE_IMPLEMENTATION_SINGLETON:
+ case STATE_SERVICE:
+ case STATE_REGISTEREDBY:
+ return css::uno::Sequence< rtl::OUString >();
+ case STATE_IMPLEMENTATION_SERVICES:
+ {
+ if (data_->implementations[path_[1]].services.size() >
+ SAL_MAX_INT32)
+ {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(
+ data_->implementations[path_[1]].services.size()));
+ sal_Int32 i = 0;
+ for (std::vector< rtl::OUString >::iterator j(
+ data_->implementations[path_[1]].services.begin());
+ j != data_->implementations[path_[1]].services.end(); ++j)
+ {
+ seq[i++] = *j;
+ }
+ return seq;
+ }
+ case STATE_IMPLEMENTATION_SINGLETONS:
+ {
+ if (data_->implementations[path_[1]].singletons.size() >
+ SAL_MAX_INT32)
+ {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(
+ data_->implementations[path_[1]].singletons.size()));
+ sal_Int32 i = 0;
+ for (std::vector< rtl::OUString >::iterator j(
+ data_->implementations[path_[1]].singletons.begin());
+ j != data_->implementations[path_[1]].singletons.end(); ++j)
+ {
+ seq[i++] = *j;
+ }
+ return seq;
+ }
+ case STATE_SERVICES:
+ {
+ if (data_->services.size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(data_->services.size()));
+ sal_Int32 i = 0;
+ for (ImplementationMap::iterator j(data_->services.begin());
+ j != data_->services.end(); ++j)
+ {
+ seq[i++] = j->first;
+ }
+ return seq;
+ }
+ case STATE_SINGLETONS:
+ {
+ if (data_->singletons.size() > SAL_MAX_INT32) {
+ throw css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry textual"
+ " services key openKeys: too large")),
+ static_cast< OWeakObject * >(this));
+ }
+ css::uno::Sequence< rtl::OUString > seq(
+ static_cast< sal_Int32 >(data_->singletons.size()));
+ sal_Int32 i = 0;
+ for (ImplementationMap::iterator j(data_->singletons.begin());
+ j != data_->singletons.end(); ++j)
+ {
+ seq[i++] = j->first;
+ }
+ return seq;
+ }
+ case STATE_SINGLETON:
+ {
+ css::uno::Sequence< rtl::OUString > seq(1);
+ seq[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("REGISTERED_BY"));
+ return seq;
+ }
+ }
+}
+
+}
+
+TextualServices::TextualServices(rtl::OUString const & uri):
+ uri_(uri), data_(new Data)
+{
+ try {
+ Parser(uri, data_);
+ } catch (css::container::NoSuchElementException &) {
+ throw css::registry::InvalidRegistryException(
+ (uri +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(": no such file"))),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+TextualServices::~TextualServices() {}
+
+css::uno::Reference< css::registry::XRegistryKey > TextualServices::getRootKey()
+{
+ return new Key(data_, std::vector< rtl::OUString >());
+}
+
+} }
diff --git a/stoc/source/simpleregistry/textualservices.hxx b/stoc/source/simpleregistry/textualservices.hxx
new file mode 100644
index 000000000000..0261e260444e
--- /dev/null
+++ b/stoc/source/simpleregistry/textualservices.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+*
+* 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_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX
+#define INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX
+
+#include "sal/config.h"
+
+#include <memory>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+
+namespace com { namespace sun { namespace star { namespace registry {
+ class XRegistryKey;
+} } } }
+
+namespace stoc { namespace simpleregistry {
+
+class Data;
+
+class TextualServices: private boost::noncopyable {
+public:
+ explicit TextualServices(rtl::OUString const & uri);
+ // throws com::sun::star::registry::InvalidRegistryException
+
+ virtual ~TextualServices();
+
+ inline rtl::OUString getUri() { return uri_; }
+
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey >
+ getRootKey();
+
+private:
+ rtl::OUString uri_;
+ rtl::Reference< Data > data_;
+};
+
+} }
+
+#endif
diff --git a/stoc/source/stocservices/stocservices.cxx b/stoc/source/stocservices/stocservices.cxx
index 5a276293089a..6270d508eb37 100644
--- a/stoc/source/stocservices/stocservices.cxx
+++ b/stoc/source/stocservices/stocservices.cxx
@@ -102,12 +102,6 @@ void SAL_CALL component_getImplementationEnvironment(
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//==================================================================================================
-sal_Bool SAL_CALL component_writeInfo(
- void * pServiceManager, void * pRegistryKey )
-{
- return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries );
-}
-//==================================================================================================
void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
{
diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk
index cfdc33e7586b..05ffd5fdd210 100644
--- a/stoc/test/uriproc/makefile.mk
+++ b/stoc/test/uriproc/makefile.mk
@@ -35,6 +35,8 @@ TARGET := test_uriproc
ENABLE_EXCEPTIONS := TRUE
+my_components = stocservices
+
.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
@@ -62,14 +64,20 @@ ALLTAR: test
test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb
$(CPPUNITTESTER) $(SHL1TARGETN) \
- -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb \
- -env:OOO_TEST_PREFIX=$(my_file)$(PWD)/$(DLLDEST)/
+ -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \
+ -env:URE_INTERNAL_LIB_DIR=$(my_file)$(PWD)/$(DLLDEST)
+
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/$(TARGET)/services.input \
+ $(my_components:^"$(MISC)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
-$(MISC)/$(TARGET)/services.rdb:
+$(MISC)/$(TARGET)/services.input:
$(MKDIRHIER) $(@:d)
- $(RM) $@
- $(REGCOMP) -register -r $@ -wop=vnd.sun.star.expand:\$${{OOO_TEST_PREFIX}} \
- -c $(DLLDEST)/stocservices.uno$(DLLPOST)
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
.END
diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component
new file mode 100644
index 000000000000..ccc131b4a6db
--- /dev/null
+++ b/stoc/util/bootstrap.component
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.DLLComponentLoader">
+ <service name="com.sun.star.loader.SharedLibrary"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.ImplementationRegistration">
+ <service name="com.sun.star.registry.ImplementationRegistration"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.NestedRegistry">
+ <service name="com.sun.star.registry.NestedRegistry"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.ORegistryServiceManager">
+ <service name="com.sun.star.lang.RegistryServiceManager"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.OServiceManager">
+ <service name="com.sun.star.lang.ServiceManager"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.OServiceManagerWrapper"/>
+ <implementation name="com.sun.star.comp.stoc.RegistryTypeDescriptionProvider">
+ <service name="com.sun.star.reflection.TypeDescriptionProvider"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.SimpleRegistry">
+ <service name="com.sun.star.registry.SimpleRegistry"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.stoc.TypeDescriptionManager">
+ <service name="com.sun.star.reflection.TypeDescriptionManager"/>
+ </implementation>
+ <implementation name="com.sun.star.security.comp.stoc.AccessController">
+ <service name="com.sun.star.security.AccessController"/>
+ </implementation>
+ <implementation name="com.sun.star.security.comp.stoc.FilePolicy">
+ <service name="com.sun.star.security.Policy"/>
+ </implementation>
+</component>
diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk
index 4243d45511fe..32f229cc3d14 100644
--- a/stoc/util/makefile.mk
+++ b/stoc/util/makefile.mk
@@ -57,7 +57,8 @@ SHL1STDLIBS= \
$(SALHELPERLIB) \
$(CPPUHELPERLIB) \
$(SALLIB) \
- $(REGLIB)
+ $(REGLIB) \
+ $(XMLREADERLIB)
SHL1DEPN=
SHL1IMPLIB= i$(TARGET)
@@ -94,3 +95,16 @@ DEF2NAME= $(SHL2TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/bootstrap.component $(MISC)/stocservices.component
+
+$(MISC)/bootstrap.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ bootstrap.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt bootstrap.component
+
+$(MISC)/stocservices.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt stocservices.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL2TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt stocservices.component
diff --git a/stoc/util/stocservices.component b/stoc/util/stocservices.component
new file mode 100644
index 000000000000..fb3528728347
--- /dev/null
+++ b/stoc/util/stocservices.component
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* 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.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.stoc.TypeConverter">
+ <service name="com.sun.star.script.Converter"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.uri.ExternalUriReferenceTranslator">
+ <service name="com.sun.star.uri.ExternalUriReferenceTranslator"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.uri.UriReferenceFactory">
+ <service name="com.sun.star.uri.UriReferenceFactory"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.uri.UriSchemeParser_vndDOTsunDOTstarDOTexpand">
+ <service name="com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTexpand"/>
+ </implementation>
+ <implementation
+ name="com.sun.star.comp.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript">
+ <service name="com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.uri.VndSunStarPkgUrlReferenceFactory">
+ <service name="com.sun.star.uri.VndSunStarPkgUrlReferenceFactory"/>
+ </implementation>
+</component>