summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2011-01-04 12:01:53 +0100
committerJoachim Lingner <jl@openoffice.org>2011-01-04 12:01:53 +0100
commitf26e87c46923d499324ce231ce74dfa9ac32544b (patch)
treec3742e02c02c1c576483ae1eb52f841d0e031717
parent271291457f1ef8e70dfe0d99bb5d5ba7d5b49984 (diff)
parentd6e1cfbbba8c44663a7bf0f87c5bb03cb256d6d3 (diff)
jl160 merge with DEV300m96
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx49
-rw-r--r--bridges/source/jni_uno/makefile.mk1
-rw-r--r--bridges/source/remote/context/context.cxx45
-rw-r--r--bridges/source/remote/urp/urp_job.hxx1
-rw-r--r--cppu/inc/uno/lbnames.h45
-rw-r--r--cppu/source/threadpool/current.cxx4
-rw-r--r--cppu/source/threadpool/jobqueue.cxx7
-rw-r--r--cppu/source/threadpool/jobqueue.hxx6
-rw-r--r--cppu/source/threadpool/thread.cxx32
-rw-r--r--cppu/source/threadpool/thread.hxx5
-rw-r--r--cppu/source/threadpool/threadpool.cxx58
-rw-r--r--cppu/source/threadpool/threadpool.hxx15
-rw-r--r--cppu/source/typelib/static_types.cxx48
-rw-r--r--cppu/source/typelib/typelib.cxx11
-rw-r--r--cppu/source/uno/lbenv.cxx15
-rw-r--r--cppu/util/target.pmk9
-rw-r--r--cppuhelper/inc/cppuhelper/factory.hxx3
-rw-r--r--cppuhelper/inc/cppuhelper/implementationentry.hxx6
-rw-r--r--cppuhelper/inc/cppuhelper/interfacecontainer.h23
-rw-r--r--cppuhelper/inc/cppuhelper/propshlp.hxx35
-rw-r--r--cppuhelper/inc/cppuhelper/shlib.hxx4
-rw-r--r--cppuhelper/prj/build.lst2
-rw-r--r--cppuhelper/qa/propertysetmixin/JavaSupplier.java5
-rw-r--r--cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx7
-rw-r--r--cppuhelper/qa/propertysetmixin/makefile.mk59
-rw-r--r--cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component34
-rw-r--r--cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component34
-rw-r--r--cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx40
-rw-r--r--cppuhelper/source/bootstrap.cxx10
-rwxr-xr-xcppuhelper/source/cc5_solaris_sparc.map6
-rw-r--r--cppuhelper/source/factory.cxx8
-rw-r--r--cppuhelper/source/gcc3.map6
-rw-r--r--cppuhelper/source/interfacecontainer.cxx108
-rw-r--r--cppuhelper/source/msvc_win32_intel.map6
-rw-r--r--cppuhelper/source/propshlp.cxx109
-rw-r--r--cppuhelper/source/servicefactory.cxx73
-rw-r--r--cpputools/prj/build.lst1
-rw-r--r--cpputools/prj/d.lst2
-rwxr-xr-xcpputools/source/regcomplazy/regcomplazy.cxx282
-rw-r--r--io/prj/build.lst2
-rw-r--r--io/prj/d.lst5
-rw-r--r--io/source/TextInputStream/TextInputStream.cxx6
-rw-r--r--io/source/TextInputStream/makefile.mk8
-rw-r--r--io/source/TextInputStream/textinstream.component34
-rw-r--r--io/source/TextOutputStream/TextOutputStream.cxx6
-rw-r--r--io/source/TextOutputStream/makefile.mk8
-rw-r--r--io/source/TextOutputStream/textoutstream.component34
-rw-r--r--io/source/acceptor/acceptor.component34
-rw-r--r--io/source/acceptor/acceptor.cxx6
-rw-r--r--io/source/acceptor/makefile.mk8
-rw-r--r--io/source/connector/connector.component34
-rw-r--r--io/source/connector/connector.cxx6
-rw-r--r--io/source/connector/makefile.mk8
-rw-r--r--io/source/stm/factreg.cxx6
-rw-r--r--io/source/stm/makefile.mk7
-rw-r--r--io/source/stm/streams.component55
-rw-r--r--javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java17
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/Factory.java38
-rw-r--r--javaunohelper/prj/build.lst2
-rw-r--r--javaunohelper/prj/d.lst1
-rw-r--r--javaunohelper/util/juh.component34
-rw-r--r--javaunohelper/util/makefile.mk5
-rw-r--r--jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java12
-rw-r--r--jurt/com/sun/star/comp/connections/Acceptor.java15
-rw-r--r--jurt/com/sun/star/comp/connections/Connector.java15
-rw-r--r--jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java14
-rw-r--r--jurt/com/sun/star/comp/connections/PipedConnection.java13
-rw-r--r--jurt/com/sun/star/comp/urlresolver/UrlResolver.java14
-rw-r--r--jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java15
-rw-r--r--jurt/com/sun/star/lib/connections/pipe/pipeConnector.java15
-rw-r--r--jurt/com/sun/star/lib/connections/socket/socketAcceptor.java15
-rw-r--r--jurt/com/sun/star/lib/connections/socket/socketConnector.java15
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java13
-rw-r--r--jurt/prj/d.lst1
-rw-r--r--jurt/source/pipe/makefile.mk1
-rw-r--r--jvmaccess/util/cc5_solaris_sparc.map4
-rw-r--r--jvmaccess/util/gcc3.map4
-rw-r--r--jvmaccess/util/msvc_win32_intel.map4
-rw-r--r--jvmfwk/inc/jvmfwk/framework.h1
-rw-r--r--jvmfwk/inc/jvmfwk/vendorplugin.h19
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx5
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx62
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map5
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx4
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx8
-rw-r--r--jvmfwk/source/elements.cxx10
-rw-r--r--jvmfwk/source/framework.cxx48
-rw-r--r--jvmfwk/source/framework.hxx4
-rw-r--r--offapi/com/sun/star/awt/XDialog2.idl2
-rwxr-xr-x[-rw-r--r--]offapi/com/sun/star/deployment/XPackage.idl8
-rw-r--r--offapi/com/sun/star/document/MediaDescriptor.idl31
-rw-r--r--offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl65
-rw-r--r--offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl109
-rw-r--r--offapi/com/sun/star/embed/XStorage2.idl165
-rw-r--r--offapi/com/sun/star/embed/makefile.mk3
-rw-r--r--offapi/com/sun/star/formula/FormulaProperties.idl8
-rw-r--r--offapi/com/sun/star/inspection/LineDescriptor.idl4
-rw-r--r--offapi/com/sun/star/script/ModuleInfo.idl42
-rw-r--r--offapi/com/sun/star/script/ModuleType.idl42
-rwxr-xr-xoffapi/com/sun/star/script/NativeObjectWrapper.idl42
-rw-r--r--offapi/com/sun/star/script/makefile.mk3
-rw-r--r--offapi/com/sun/star/task/PDFExportException.idl52
-rw-r--r--[-rwxr-xr-x]offapi/com/sun/star/task/makefile.mk1
-rw-r--r--offapi/com/sun/star/text/DocumentSettings.idl12
-rw-r--r--offapi/com/sun/star/text/PrintPreviewSettings.idl2
-rw-r--r--offapi/com/sun/star/text/TextMarkupType.idl25
-rw-r--r--offapi/com/sun/star/ui/UIElementType.idl10
-rw-r--r--offapi/com/sun/star/util/OfficeInstallationDirectories.idl6
-rw-r--r--offapi/com/sun/star/util/XOfficeInstallationDirectories.idl7
-rw-r--r--offuh/prj/build.lst2
-rw-r--r--offuh/prj/d.lst41
-rw-r--r--offuh/source/makefile.mk12
-rw-r--r--pyuno/prj/build.lst2
-rw-r--r--pyuno/prj/d.lst3
-rw-r--r--pyuno/source/loader/makefile.mk34
-rw-r--r--pyuno/source/loader/pythonloader.component34
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx6
-rw-r--r--pyuno/zipcore/python.sh2
-rw-r--r--remotebridges/prj/build.lst2
-rw-r--r--remotebridges/prj/d.lst3
-rw-r--r--remotebridges/source/bridge/makefile.mk8
-rw-r--r--remotebridges/source/bridge/remote_bridge.cxx6
-rw-r--r--remotebridges/source/bridge/remotebridge.component36
-rw-r--r--remotebridges/source/dynamicloader/dynamicloader.cxx28
-rw-r--r--remotebridges/source/factory/bridgefac.component34
-rw-r--r--remotebridges/source/factory/bridgefactory.cxx6
-rw-r--r--remotebridges/source/factory/makefile.mk7
-rw-r--r--remotebridges/source/unourl_resolver/makefile.mk8
-rw-r--r--remotebridges/source/unourl_resolver/unourl_resolver.cxx6
-rw-r--r--remotebridges/source/unourl_resolver/uuresolver.component34
-rw-r--r--sal/inc/osl/diagnose.h10
-rw-r--r--sal/inc/rtl/malformeduriexception.hxx4
-rw-r--r--sal/inc/rtl/math.h8
-rw-r--r--sal/osl/unx/file_misc.cxx57
-rw-r--r--sal/osl/unx/nlsupport.c4
-rw-r--r--sal/prj/build.lst2
-rw-r--r--sal/qa/OStringBuffer/makefile.mk2
-rw-r--r--sal/qa/OStringBuffer/rtl_OStringBuffer.cxx30
-rw-r--r--sal/qa/OStringBuffer/rtl_String_Const.h6
-rw-r--r--sal/qa/osl/pipe/makefile.mk2
-rw-r--r--sal/qa/osl/pipe/osl_Pipe.cxx87
-rw-r--r--sal/qa/osl/process/makefile.mk2
-rw-r--r--sal/qa/osl/profile/makefile.mk1
-rwxr-xr-xsal/qa/rtl/alloc/makefile.mk2
-rwxr-xr-xsal/qa/rtl/crc32/makefile.mk2
-rw-r--r--sal/qa/rtl/digest/makefile.mk2
-rw-r--r--sal/qa/rtl/doublelock/makefile.mk2
-rw-r--r--sal/qa/rtl/locale/makefile.mk2
-rw-r--r--sal/qa/rtl/math/export.exp1
-rw-r--r--sal/qa/rtl/math/makefile.mk84
-rw-r--r--sal/qa/rtl/math/rtl_math.cxx626
-rw-r--r--sal/qa/rtl/math/rtl_old_testint64.cxx122
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx76
-rw-r--r--sal/qa/rtl/math/test_rtl_math.cxx674
-rw-r--r--sal/qa/rtl/random/makefile.mk2
-rw-r--r--sal/qa/rtl_strings/makefile.mk1
-rw-r--r--sal/rtl/source/math.cxx2
-rw-r--r--sal/systools/win32/kill/kill.cxx2
-rw-r--r--sal/textenc/convertiscii.tab2
-rw-r--r--sal/textenc/tencinfo.c5
-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.cxx117
-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/registry_tdprovider/tdprovider.cxx33
-rw-r--r--stoc/source/simpleregistry/makefile.mk3
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx2380
-rw-r--r--stoc/source/simpleregistry/textualservices.cxx1228
-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
-rw-r--r--udkapi/com/sun/star/script/XDirectInvocation.idl82
-rw-r--r--udkapi/com/sun/star/script/makefile.mk1
-rw-r--r--ure/prj/build.lst2
-rw-r--r--ure/prj/d.lst16
-rw-r--r--ure/source/README2
-rw-r--r--ure/source/makefile.mk76
-rw-r--r--ure/source/startup.sh2
-rw-r--r--xmlreader/inc/makefile.mk40
-rw-r--r--xmlreader/inc/pch/precompiled_xmlreader.cxx28
-rw-r--r--xmlreader/inc/pch/precompiled_xmlreader.hxx32
-rw-r--r--xmlreader/inc/xmlreader/README34
-rw-r--r--xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx41
-rw-r--r--xmlreader/inc/xmlreader/pad.hxx59
-rw-r--r--xmlreader/inc/xmlreader/span.hxx69
-rw-r--r--xmlreader/inc/xmlreader/xmlreader.hxx199
-rw-r--r--xmlreader/prj/build.lst3
-rw-r--r--xmlreader/prj/d.lst10
-rw-r--r--[-rwxr-xr-x]xmlreader/source/makefile.mk (renamed from cpputools/source/regcomplazy/makefile.mk)45
-rw-r--r--xmlreader/source/pad.cxx85
-rw-r--r--xmlreader/source/span.cxx66
-rw-r--r--xmlreader/source/xmlreader.cxx1054
220 files changed, 6915 insertions, 4183 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index 37fab3d8b..d2c8f3312 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -28,10 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_bridges.hxx"
+#include <exception>
+#include <typeinfo>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <rtl/alloc.h>
+
+#include "rtl/alloc.h"
+#include "rtl/ustrbuf.hxx"
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -237,6 +241,18 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
//==================================================================================================
+namespace {
+
+void appendCString(OUStringBuffer & buffer, char const * text) {
+ if (text != 0) {
+ buffer.append(
+ OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1));
+ // use 8859-1 to avoid conversion failure
+ }
+}
+
+}
+
static void cpp_call(
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
bridges::cpp_uno::shared::VtableSlot aVtableSlot,
@@ -369,12 +385,31 @@ static void cpp_call(
try
{
- callVirtualMethod(
- pAdjustedThisPtr, aVtableSlot.index,
- pCppReturn, pReturnTypeRef, bSimpleReturn,
- pStackStart, ( pStack - pStackStart ),
- pGPR, nGPR,
- pFPR, nFPR );
+ try {
+ callVirtualMethod(
+ pAdjustedThisPtr, aVtableSlot.index,
+ pCppReturn, pReturnTypeRef, bSimpleReturn,
+ pStackStart, ( pStack - pStackStart ),
+ pGPR, nGPR,
+ pFPR, nFPR );
+ } catch (Exception &) {
+ throw;
+ } catch (std::exception & e) {
+ OUStringBuffer buf;
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("C++ code threw "));
+ appendCString(buf, typeid(e).name());
+ buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(": "));
+ appendCString(buf, e.what());
+ throw RuntimeException(
+ buf.makeStringAndClear(), Reference< XInterface >());
+ } catch (...) {
+ throw RuntimeException(
+ OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "C++ code threw unknown exception")),
+ Reference< XInterface >());
+ }
+
// NO exception occured...
*ppUnoExc = 0;
diff --git a/bridges/source/jni_uno/makefile.mk b/bridges/source/jni_uno/makefile.mk
index da0942cda..1474a86cd 100644
--- a/bridges/source/jni_uno/makefile.mk
+++ b/bridges/source/jni_uno/makefile.mk
@@ -67,6 +67,7 @@ SHL1STDLIBS= \
SHL1VERSIONMAP=$(TARGET).map
+SHL1CREATEJNILIB=TRUE
SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
diff --git a/bridges/source/remote/context/context.cxx b/bridges/source/remote/context/context.cxx
index 4c9e1b066..58b9dc1f7 100644
--- a/bridges/source/remote/context/context.cxx
+++ b/bridges/source/remote/context/context.cxx
@@ -38,6 +38,7 @@
#include <osl/mutex.hxx>
#include "rtl/ustring.hxx"
+#include "rtl/instance.hxx"
#include <bridges/remote/context.h>
#include <bridges/remote/remote.h>
@@ -109,17 +110,9 @@ ContextMap;
static MyCounter thisCounter( "DEBUG : Context" );
#endif
-class ContextAdmin;
-
-ContextAdmin *g_pTheContext = 0;
-
-
-
class ContextAdmin
{
public:
- static ContextAdmin *getInstance();
-
// listener administration
void addContextListener( remote_contextListenerFunc listener , void *pObject );
void removeContextListener( remote_contextListenerFunc listener , void *pObject );
@@ -138,7 +131,7 @@ public:
void revokeContext( uno_Context *pRemoteContext );
- uno_Context *get( rtl_uString *pHost );
+ uno_Context *getContext( rtl_uString *pHost );
rtl_uString ** getConnectionList(
sal_Int32 *pnStringCount, MemAlloc memAlloc );
@@ -152,19 +145,6 @@ private:
List m_lstListener;
};
-ContextAdmin *ContextAdmin::getInstance()
-{
- if( ! g_pTheContext ) {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( ! g_pTheContext ) {
- //TODO This memory is leaked; see #i63473# for when this should be
- // changed again:
- g_pTheContext = new ContextAdmin;
- }
- }
- return g_pTheContext;
-}
-
void ContextAdmin::addContextListener( remote_contextListenerFunc listener , void *pObject )
{
::osl::MutexGuard guard( m_mutex );
@@ -209,7 +189,7 @@ uno_Context *ContextAdmin::createAndRegisterContext( remote_Connection *pConnect
{
::osl::MutexGuard guard( m_mutex );
- uno_Context *pContext = get( pIdStr );
+ uno_Context *pContext = getContext( pIdStr );
if( pContext )
{
pContext->release( pContext );
@@ -245,7 +225,7 @@ void ContextAdmin::revokeContext( uno_Context *pRemoteContext )
}
-uno_Context *ContextAdmin::get( rtl_uString *pHost )
+uno_Context *ContextAdmin::getContext( rtl_uString *pHost )
{
::osl::MutexGuard guard( m_mutex );
@@ -267,6 +247,10 @@ rtl_uString ** ContextAdmin::getConnectionList(
::osl::MutexGuard guard( m_mutex );
*pnStringCount = m_mapContext.size();
+
+ if (*pnStringCount == 0)
+ return NULL;
+
rtl_uString **ppReturn = ( rtl_uString ** )
memAlloc( sizeof( rtl_uString * ) * m_mapContext.size() );
memset( ppReturn , 0 , sizeof( rtl_uString * ) * m_mapContext.size() );
@@ -283,6 +267,7 @@ rtl_uString ** ContextAdmin::getConnectionList(
}
+struct theContextAdmin : public rtl::Static<ContextAdmin, theContextAdmin> {};
/*****************************
* remote_ContextImpl implementation
@@ -379,7 +364,7 @@ void remote_ContextImpl::thisDispose( remote_Context *pRemoteC )
if( ! pImpl->m_bDisposed )
{
pImpl->m_bDisposed = sal_True;
- ContextAdmin::getInstance()->revokeContext( (uno_Context * ) pRemoteC );
+ theContextAdmin::get().revokeContext( (uno_Context * ) pRemoteC );
if( pImpl->m_pInstanceProvider )
{
@@ -456,7 +441,7 @@ using namespace remote_context;
extern "C" remote_Context * SAL_CALL
remote_getContext( rtl_uString *pIdString )
{
- return (remote_Context *) ContextAdmin::getInstance()->get( pIdString );
+ return (remote_Context *) theContextAdmin::get().getContext(pIdString);
}
@@ -469,7 +454,7 @@ remote_createContext( remote_Connection *pConnection,
remote_InstanceProvider *pProvider )
{
remote_ContextImpl *p = (remote_ContextImpl * )
- ContextAdmin::getInstance()->createAndRegisterContext(
+ theContextAdmin::get().createAndRegisterContext(
pConnection ,
pIdStr ,
pDescription,
@@ -483,17 +468,17 @@ remote_createContext( remote_Connection *pConnection,
extern "C" void SAL_CALL
remote_addContextListener( remote_contextListenerFunc listener, void *pObject )
{
- ContextAdmin::getInstance()->addContextListener( listener , pObject );
+ theContextAdmin::get().addContextListener( listener , pObject );
}
extern "C" void SAL_CALL
remote_removeContextListener( remote_contextListenerFunc listener , void *pObject )
{
- ContextAdmin::getInstance()->removeContextListener( listener , pObject );
+ theContextAdmin::get().removeContextListener( listener , pObject );
}
extern "C" rtl_uString ** SAL_CALL
remote_getContextList( sal_Int32 *pnStringCount, MemAlloc memAlloc )
{
- return ContextAdmin::getInstance()->getConnectionList( pnStringCount , memAlloc );
+ return theContextAdmin::get().getConnectionList( pnStringCount , memAlloc );
}
diff --git a/bridges/source/remote/urp/urp_job.hxx b/bridges/source/remote/urp/urp_job.hxx
index 8f6f95936..f1829f7ff 100644
--- a/bridges/source/remote/urp/urp_job.hxx
+++ b/bridges/source/remote/urp/urp_job.hxx
@@ -303,6 +303,7 @@ inline ClientJob::ClientJob(
uno_Any **ppException )
: Job(
pEnvRemote, pContext, pBridgeImpl, ::bridges_remote::RTC_HOLDENVWEAK )
+ , m_bExceptionOccured( false )
, m_ppArgs( ppArgs )
, m_pReturn( pReturn )
, m_pInterfaceType( pInterfaceType ) // weak
diff --git a/cppu/inc/uno/lbnames.h b/cppu/inc/uno/lbnames.h
index 285c43b40..7da2e25ea 100644
--- a/cppu/inc/uno/lbnames.h
+++ b/cppu/inc/uno/lbnames.h
@@ -29,49 +29,6 @@
#ifdef __cplusplus
-/* environment type names for supported compilers */
-#if defined (_MSC_VER)
-#if (_MSC_VER < 1000)
-#error "ms visual c++ version must be at least 4.2"
-#elif (_MSC_VER < 1100) // MSVC 4.x
-#pragma warning( disable: 4290 )
-#define TMP_CPPU_ENV msci
-#elif (_MSC_VER < 1600) // MSVC 5-9
-#define TMP_CPPU_ENV msci
-#else
-#error "ms visual c++ version must be between 4.2 and 9.x"
-#endif /* (_MSC_VER < 1000) */
-/* sunpro cc */
-#elif defined (__SUNPRO_CC)
-#if ((__SUNPRO_CC >= 0x5000 && __SUNPRO_CC < 0x6000) || (__SUNPRO_CC >= 0x500 && __SUNPRO_CC < 0x600))
-#define TMP_CPPU_ENV sunpro5
-#elif
-#error "sunpro cc version must be 5.x"
-provoking error here, because PP ignores #error
-#endif /* defined (__SUNPRO_CC) */
-/* g++ 2.x, 3.0 */
-#elif defined (__GNUC__)
-#if (__GNUC__ == 2 && __GNUC_MINOR__ == 91)
-#define TMP_CPPU_ENV gcc2
-#elif (__GNUC__ == 2 && __GNUC_MINOR__ == 95)
-#define TMP_CPPU_ENV gcc2
-#elif (__GNUC__ == 2)
-#error "Tested gcc 2 versions are 2.91 and 2.95. Patch uno/lbnames.h to try your gcc 2 version."
-#elif (__GNUC__ == 3 && __GNUC_MINOR__ <= 4)
-#define __CPPU_ENV gcc3
-#elif (__GNUC__ == 4 && __GNUC_MINOR__ <= 4)
-#define __CPPU_ENV gcc3
-#elif (__GNUC__ == 3)
-#error "Tested gcc 3 version is <= 3.4. Patch uno/lbnames.h to try your gcc 3 version."
-#else
-#error "Supported gcc majors are 2 , 3 and 4 <= 4.4. Unsupported gcc major version."
-#endif /* defined (__GNUC__) */
-#endif /* defined (_MSC_VER) */
-
-#if (! defined (CPPU_ENV) && defined (TMP_CPPU_ENV))
-#define CPPU_ENV TMP_CPPU_ENV
-#endif
-
#ifdef CPPU_ENV
#define CPPU_STRINGIFY_EX( x ) #x
@@ -87,8 +44,6 @@ provoking error here, because PP ignores #error
#endif /* CPPU_ENV */
-#undef TMP_CPPU_ENV
-
#endif /* __cplusplus */
/** Environment type name for binary C UNO. */
diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx
index 07323c2fd..805b5759a 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -106,11 +106,9 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
1, aParameters, 1, pExceptions );
typelib_typedescription_register( (typelib_TypeDescription**)&pMethod );
typelib_typedescription_release( (typelib_TypeDescription*)pMethod );
-#if ! defined CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++reinterpret_cast< typelib_TypeDescription * >( pTD )->
nStaticRefCount;
-#endif
s_type_XCurrentContext = pTD;
}
}
diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx
index 18693bef1..338a94cf2 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -42,6 +42,7 @@ namespace cppu_threadpool {
m_cndWait( osl_createCondition() )
{
osl_resetCondition( m_cndWait );
+ m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
}
JobQueue::~JobQueue()
@@ -68,7 +69,7 @@ namespace cppu_threadpool {
{
// synchronize with the dispose calls
MutexGuard guard( m_mutex );
- if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) )
+ if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) )
{
return 0;
}
@@ -97,6 +98,10 @@ namespace cppu_threadpool {
if( 0 == m_lstCallstack.front() )
{
// disposed !
+ if( m_lstJob.empty() )
+ {
+ osl_resetCondition( m_cndWait );
+ }
break;
}
diff --git a/cppu/source/threadpool/jobqueue.hxx b/cppu/source/threadpool/jobqueue.hxx
index 7a50b8a0e..31ea0690e 100644
--- a/cppu/source/threadpool/jobqueue.hxx
+++ b/cppu/source/threadpool/jobqueue.hxx
@@ -34,6 +34,8 @@
#include <osl/conditn.h>
#include <osl/mutex.hxx>
+#include <boost/shared_ptr.hpp>
+
namespace cppu_threadpool
{
extern "C" typedef void (SAL_CALL RequestFun)(void *);
@@ -48,6 +50,9 @@ namespace cppu_threadpool
typedef ::std::list < sal_Int64 > CallStackList;
+ class DisposedCallerAdmin;
+ typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
+
class JobQueue
{
public:
@@ -73,6 +78,7 @@ namespace cppu_threadpool
sal_Int32 m_nToDo;
sal_Bool m_bSuspended;
oslCondition m_cndWait;
+ DisposedCallerAdminHolder m_DisposedCallerAdmin;
};
}
diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx
index 565020850..f8e12a0aa 100644
--- a/cppu/source/threadpool/thread.cxx
+++ b/cppu/source/threadpool/thread.cxx
@@ -31,6 +31,8 @@
#include <osl/diagnose.h>
#include <uno/threadpool.h>
+#include <rtl/instance.hxx>
+
#include "thread.hxx"
#include "jobqueue.hxx"
#include "threadpool.hxx"
@@ -98,20 +100,17 @@ namespace cppu_threadpool {
} while( pCurrent );
}
- ThreadAdmin* ThreadAdmin::getInstance()
+ struct theThreadAdmin : public rtl::StaticWithInit< ThreadAdminHolder, theThreadAdmin >
{
- static ThreadAdmin *pThreadAdmin = 0;
- if( ! pThreadAdmin )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pThreadAdmin )
- {
- static ThreadAdmin admin;
- pThreadAdmin = &admin;
- }
+ ThreadAdminHolder operator () () {
+ ThreadAdminHolder aRet(new ThreadAdmin());
+ return aRet;
}
- return pThreadAdmin;
+ };
+ ThreadAdminHolder& ThreadAdmin::getInstance()
+ {
+ return theThreadAdmin::get();
}
// ----------------------------------------------------------------------------------
@@ -119,12 +118,13 @@ namespace cppu_threadpool {
const ByteSequence &aThreadId,
sal_Bool bAsynchron )
: m_thread( 0 )
+ , m_aThreadAdmin( ThreadAdmin::getInstance() )
, m_pQueue( pQueue )
, m_aThreadId( aThreadId )
, m_bAsynchron( bAsynchron )
, m_bDeleteSelf( sal_True )
{
- ThreadAdmin::getInstance()->add( this );
+ m_aThreadAdmin->add( this );
}
@@ -166,7 +166,7 @@ namespace cppu_threadpool {
void ORequestThread::onTerminated()
{
- ThreadAdmin::getInstance()->remove( this );
+ m_aThreadAdmin->remove( this );
if( m_bDeleteSelf )
{
delete this;
@@ -175,6 +175,8 @@ namespace cppu_threadpool {
void ORequestThread::run()
{
+ ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance();
+
while ( m_pQueue )
{
if( ! m_bAsynchron )
@@ -197,7 +199,7 @@ namespace cppu_threadpool {
if( m_pQueue->isEmpty() )
{
- ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron );
+ theThreadPool->revokeQueue( m_aThreadId , m_bAsynchron );
// Note : revokeQueue might have failed because m_pQueue.isEmpty()
// may be false (race).
}
@@ -211,7 +213,7 @@ namespace cppu_threadpool {
uno_releaseIdFromCurrentThread();
}
- cppu_threadpool::ThreadPool::getInstance()->waitInPool( this );
+ theThreadPool->waitInPool( this );
}
}
}
diff --git a/cppu/source/threadpool/thread.hxx b/cppu/source/threadpool/thread.hxx
index 642820e9e..becf50286 100644
--- a/cppu/source/threadpool/thread.hxx
+++ b/cppu/source/threadpool/thread.hxx
@@ -37,6 +37,8 @@
namespace cppu_threadpool {
class JobQueue;
+ class ThreadAdmin;
+ typedef boost::shared_ptr<ThreadAdmin> ThreadAdminHolder;
//-----------------------------------------
// private thread class for the threadpool
@@ -61,6 +63,7 @@ namespace cppu_threadpool {
private:
oslThread m_thread;
+ ThreadAdminHolder m_aThreadAdmin;
JobQueue *m_pQueue;
::rtl::ByteSequence m_aThreadId;
sal_Bool m_bAsynchron;
@@ -71,7 +74,7 @@ namespace cppu_threadpool {
{
public:
~ThreadAdmin ();
- static ThreadAdmin *getInstance();
+ static ThreadAdminHolder &getInstance();
void add( ORequestThread * );
void remove( ORequestThread * );
void join();
diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx
index f09c8fbd3..1d68a5482 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -33,6 +33,7 @@
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <osl/thread.h>
+#include <rtl/instance.hxx>
#include <uno/threadpool.h>
@@ -44,19 +45,17 @@ using namespace ::osl;
namespace cppu_threadpool
{
- DisposedCallerAdmin *DisposedCallerAdmin::getInstance()
+ struct theDisposedCallerAdmin :
+ public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin >
{
- static DisposedCallerAdmin *pDisposedCallerAdmin = 0;
- if( ! pDisposedCallerAdmin )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pDisposedCallerAdmin )
- {
- static DisposedCallerAdmin admin;
- pDisposedCallerAdmin = &admin;
- }
+ DisposedCallerAdminHolder operator () () {
+ return DisposedCallerAdminHolder(new DisposedCallerAdmin());
}
- return pDisposedCallerAdmin;
+ };
+
+ DisposedCallerAdminHolder DisposedCallerAdmin::getInstance()
+ {
+ return theDisposedCallerAdmin::get();
}
DisposedCallerAdmin::~DisposedCallerAdmin()
@@ -107,6 +106,21 @@ namespace cppu_threadpool
//-------------------------------------------------------------------------------
+
+ struct theThreadPool :
+ public rtl::StaticWithInit< ThreadPoolHolder, theThreadPool >
+ {
+ ThreadPoolHolder operator () () {
+ ThreadPoolHolder aRet(new ThreadPool());
+ return aRet;
+ }
+ };
+
+ ThreadPool::ThreadPool()
+ {
+ m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance();
+ }
+
ThreadPool::~ThreadPool()
{
#if OSL_DEBUG_LEVEL > 1
@@ -116,19 +130,9 @@ namespace cppu_threadpool
}
#endif
}
- ThreadPool *ThreadPool::getInstance()
+ ThreadPoolHolder ThreadPool::getInstance()
{
- static ThreadPool *pThreadPool = 0;
- if( ! pThreadPool )
- {
- MutexGuard guard( Mutex::getGlobalMutex() );
- if( ! pThreadPool )
- {
- static ThreadPool pool;
- pThreadPool = &pool;
- }
- }
- return pThreadPool;
+ return theThreadPool::get();
}
@@ -136,7 +140,7 @@ namespace cppu_threadpool
{
if( nDisposeId )
{
- DisposedCallerAdmin::getInstance()->dispose( nDisposeId );
+ m_DisposedCallerAdmin->dispose( nDisposeId );
MutexGuard guard( m_mutex );
for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ;
@@ -171,7 +175,7 @@ namespace cppu_threadpool
void ThreadPool::stopDisposing( sal_Int64 nDisposeId )
{
- DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId );
+ m_DisposedCallerAdmin->stopDisposing( nDisposeId );
}
/******************
@@ -400,7 +404,7 @@ struct uno_ThreadPool_Hash
-typedef ::std::hash_set< uno_ThreadPool, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
+typedef ::std::hash_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet;
static ThreadpoolHashSet *g_pThreadpoolHashSet;
@@ -420,7 +424,7 @@ uno_threadpool_create() SAL_THROW_EXTERN_C()
// Just ensure that the handle is unique in the process (via heap)
uno_ThreadPool h = new struct _uno_ThreadPool;
- g_pThreadpoolHashSet->insert( h );
+ g_pThreadpoolHashSet->insert( ThreadpoolHashSet::value_type(h, ThreadPool::getInstance()) );
return h;
}
diff --git a/cppu/source/threadpool/threadpool.hxx b/cppu/source/threadpool/threadpool.hxx
index 1ff1748fe..b9df49f43 100644
--- a/cppu/source/threadpool/threadpool.hxx
+++ b/cppu/source/threadpool/threadpool.hxx
@@ -30,6 +30,8 @@
#include <rtl/byteseq.hxx>
+#include <boost/shared_ptr.hpp>
+
#include "jobqueue.hxx"
@@ -75,13 +77,16 @@ namespace cppu_threadpool {
};
typedef ::std::list < struct ::cppu_threadpool::WaitingThread * > WaitingThreadList;
+
+ class DisposedCallerAdmin;
+ typedef boost::shared_ptr<DisposedCallerAdmin> DisposedCallerAdminHolder;
class DisposedCallerAdmin
{
public:
~DisposedCallerAdmin();
- static DisposedCallerAdmin *getInstance();
+ static DisposedCallerAdminHolder getInstance();
void dispose( sal_Int64 nDisposeId );
void stopDisposing( sal_Int64 nDisposeId );
@@ -92,11 +97,15 @@ namespace cppu_threadpool {
DisposedCallerList m_lst;
};
+ class ThreadPool;
+ typedef boost::shared_ptr<ThreadPool> ThreadPoolHolder;
+
class ThreadPool
{
public:
+ ThreadPool();
~ThreadPool();
- static ThreadPool *getInstance();
+ static ThreadPoolHolder getInstance();
void dispose( sal_Int64 nDisposeId );
void stopDisposing( sal_Int64 nDisposeId );
@@ -124,6 +133,8 @@ namespace cppu_threadpool {
::osl::Mutex m_mutexWaitingThreadList;
WaitingThreadList m_lstThreads;
+
+ DisposedCallerAdminHolder m_DisposedCallerAdmin;
};
} // end namespace cppu_threadpool
diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx
index 202c55bf7..a95264379 100644
--- a/cppu/source/typelib/static_types.cxx
+++ b/cppu/source/typelib/static_types.cxx
@@ -168,10 +168,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("type") );
::typelib_typedescriptionreference_new(
&s_aTypes[typelib_TypeClass_TYPE], typelib_TypeClass_TYPE, sTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_TYPE]->nStaticRefCount;
-#endif
}
// any
if (! s_aTypes[typelib_TypeClass_ANY])
@@ -179,10 +177,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("any") );
::typelib_typedescriptionreference_new(
&s_aTypes[typelib_TypeClass_ANY], typelib_TypeClass_ANY, sTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_ANY]->nStaticRefCount;
-#endif
}
// string
if (! s_aTypes[typelib_TypeClass_STRING])
@@ -190,10 +186,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("string") );
::typelib_typedescriptionreference_new(
&s_aTypes[typelib_TypeClass_STRING], typelib_TypeClass_STRING, sTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_STRING]->nStaticRefCount;
-#endif
}
// XInterface
if (! s_aTypes[typelib_TypeClass_INTERFACE])
@@ -220,10 +214,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
::typelib_typedescription_register( (typelib_TypeDescription **)&pTD );
::typelib_typedescriptionreference_acquire(
s_aTypes[typelib_TypeClass_INTERFACE] = ((typelib_TypeDescription *)pTD)->pWeakRef );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_INTERFACE]->nStaticRefCount;
-#endif
::typelib_typedescription_release( (typelib_TypeDescription*)pTD );
::typelib_typedescriptionreference_release( pMembers[0] );
@@ -252,10 +244,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
typelib_typedescription_register( &pTD1 );
typelib_typedescriptionreference_acquire(
s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[typelib_TypeClass_EXCEPTION]->nStaticRefCount;
-#endif
// RuntimeException
OUString sTypeName2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException") );
::typelib_typedescription_new(
@@ -302,10 +292,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass(
{
OUString aTypeName( OUString::createFromAscii( s_aTypeNames[eTypeClass] ) );
::typelib_typedescriptionreference_new( &s_aTypes[eTypeClass], eTypeClass, aTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++s_aTypes[eTypeClass]->nStaticRefCount;
-#endif
}
}
}
@@ -327,10 +315,8 @@ void SAL_CALL typelib_static_type_init(
OUString aTypeName( OUString::createFromAscii( pTypeName ) );
::typelib_typedescriptionreference_new( ppRef, eTypeClass, aTypeName.pData );
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -364,10 +350,8 @@ void SAL_CALL typelib_static_sequence_type_init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -450,10 +434,8 @@ void init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -551,10 +533,8 @@ void SAL_CALL typelib_static_mi_interface_type_init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
@@ -593,10 +573,8 @@ void SAL_CALL typelib_static_enum_type_init(
*ppRef = (typelib_TypeDescriptionReference *)pReg;
OSL_ASSERT( *ppRef == pReg->pWeakRef );
}
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++(*(sal_Int32 *)&(*ppRef)->pReserved);
-#endif
}
}
}
@@ -660,10 +638,8 @@ void SAL_CALL typelib_static_array_type_init(
OSL_ASSERT( *ppRef == pReg->pWeakRef );
} else
delete [] pDimensions;
-#ifndef CPPU_LEAK_STATIC_DATA
- // another static ref
+ // another static ref:
++((*ppRef)->nStaticRefCount);
-#endif
}
}
}
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 01c3311ea..1745dd69b 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -264,17 +264,9 @@ inline void TypeDescriptor_Init_Impl::callChain(
}
}
-// never called
-#if defined(CPPU_LEAK_STATIC_DATA) && defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
-static void dumb_sunpro5_must_have_dtor_stl_hashmap_code_if_compiled_with_minus_g() SAL_THROW( () )
-{
- delete (WeakMap_Impl *)0xbeef1e;
-}
-#endif
//__________________________________________________________________________________________________
TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
{
-#ifndef CPPU_LEAK_STATIC_DATA
if( pCache )
{
TypeDescriptionList_Impl::const_iterator aIt = pCache->begin();
@@ -303,7 +295,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
for( i = 0; i < nSize; i++ )
{
typelib_TypeDescriptionReference * pTDR = ppTDR[i];
- sal_Int32 nStaticCounts = pTDR->nStaticRefCount;
OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount );
pTDR->nRefCount -= pTDR->nStaticRefCount;
@@ -355,9 +346,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
#endif
delete pCallbacks;
pCallbacks = 0;
-#endif // CPPU_LEAK_STATIC_DATA
- // todo: maybe into leak block
if( pMutex )
{
delete pMutex;
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index e3b1cdf1e..e05847191 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -139,6 +139,7 @@ struct EnvironmentsData
::osl::Mutex mutex;
OUString2EnvironmentMap aName2EnvMap;
+ EnvironmentsData() : isDisposing(false) {}
~EnvironmentsData();
inline void getEnvironment(
@@ -147,6 +148,8 @@ struct EnvironmentsData
inline void getRegisteredEnvironments(
uno_Environment *** pppEnvs, sal_Int32 * pnLen,
uno_memAlloc memAlloc, const OUString & rEnvDcp );
+
+ bool isDisposing;
};
namespace
@@ -595,9 +598,14 @@ static void SAL_CALL defenv_harden(
*ppHardEnv = 0;
}
+ EnvironmentsData & rData = theEnvironmentsData::get();
+
+ if (rData.isDisposing)
+ return;
+
uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv;
{
- ::osl::MutexGuard guard( theEnvironmentsData::get().mutex );
+ ::osl::MutexGuard guard( rData.mutex );
if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead
{
that->nRef = 0;
@@ -914,6 +922,7 @@ static void SAL_CALL unoenv_releaseInterface(
EnvironmentsData::~EnvironmentsData()
{
::osl::MutexGuard guard( mutex );
+ isDisposing = true;
for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() );
iPos != aName2EnvMap.end(); ++iPos )
@@ -928,11 +937,7 @@ EnvironmentsData::~EnvironmentsData()
#if OSL_DEBUG_LEVEL > 1
::uno_dumpEnvironment( 0, pHard, 0 );
#endif
-#if defined CPPU_LEAK_STATIC_DATA
- pHard->environmentDisposing = 0; // set to null => wont be called
-#else
(*pHard->dispose)( pHard ); // send explicit dispose
-#endif
(*pHard->release)( pHard );
}
}
diff --git a/cppu/util/target.pmk b/cppu/util/target.pmk
index 4e456b206..3befcb154 100644
--- a/cppu/util/target.pmk
+++ b/cppu/util/target.pmk
@@ -51,12 +51,3 @@ CFLAGS += -Ob0
.ENDIF
.ENDIF
-
-# other stuff
-
-.IF "$(cppu_no_leak)" == ""
-.IF "$(bndchk)" == ""
-CFLAGS += -DCPPU_LEAK_STATIC_DATA
-.ENDIF
-.ENDIF
-
diff --git a/cppuhelper/inc/cppuhelper/factory.hxx b/cppuhelper/inc/cppuhelper/factory.hxx
index 4320acb98..1dd04173c 100644
--- a/cppuhelper/inc/cppuhelper/factory.hxx
+++ b/cppuhelper/inc/cppuhelper/factory.hxx
@@ -87,6 +87,9 @@ typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)(
typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void);
/** Function pointer declaration.
+
+ @obsolete component_writeInfo should no longer be used in new components
+
Function writes component registry info, at least writing the supported service names.
@param pServiceManager
diff --git a/cppuhelper/inc/cppuhelper/implementationentry.hxx b/cppuhelper/inc/cppuhelper/implementationentry.hxx
index f74493210..e52e658d8 100644
--- a/cppuhelper/inc/cppuhelper/implementationentry.hxx
+++ b/cppuhelper/inc/cppuhelper/implementationentry.hxx
@@ -72,6 +72,8 @@ struct ImplementationEntry
/** Helper function for implementation of the component_writeInfo()-function.
+ @obsolete component_writeInfo should no longer be used in new components
+
@param pServiceManager The first parameter passed to component_writeInfo()-function
(This is an instance of the service manager, that creates the factory).
@param pRegistryKey The second parameter passed to the component_writeInfo()-function.
@@ -90,9 +92,9 @@ sal_Bool component_writeInfoHelper(
@param pImplName The implementation-name to be instantiated ( This is the
first parameter passed to the component_getFactory
- @param pServiceManager The first parameter passed to component_writeInfo()-function
+ @param pServiceManager The second parameter passed to component_getFactory()-function
(This is a of the service manager, that creates the factory).
- @param pRegistryKey The second parameter passed to the component_writeInfo()-function.
+ @param pRegistryKey The third parameter passed to the component_getFactory()-function.
This is a reference to the registry key, where the implementation
data has been written to.
@param entries Each element of the entries-array must contains a function pointer
diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.h b/cppuhelper/inc/cppuhelper/interfacecontainer.h
index bb8ea3d0e..5e7d1ff4a 100644
--- a/cppuhelper/inc/cppuhelper/interfacecontainer.h
+++ b/cppuhelper/inc/cppuhelper/interfacecontainer.h
@@ -44,6 +44,17 @@
namespace cppu
{
+namespace detail {
+
+ union element_alias
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsSequence;
+ ::com::sun::star::uno::XInterface * pAsInterface;
+ element_alias() : pAsInterface(0) {}
+ };
+
+}
+
//===================================================================
class OInterfaceContainerHelper;
/**
@@ -95,7 +106,9 @@ public:
private:
OInterfaceContainerHelper & rCont;
sal_Bool bIsList;
- void * pData;
+
+ detail::element_alias aData;
+
sal_Int32 nRemain;
OInterfaceIteratorHelper( const OInterfaceIteratorHelper & ) SAL_THROW( () );
@@ -222,14 +235,14 @@ public:
private:
friend class OInterfaceIteratorHelper;
/**
- bIsList == TRUE -> pData of type Sequence< XInterfaceSequence >,
- otherwise pData == of type (XEventListener *)
+ bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >,
+ otherwise aData.pAsInterface == of type (XEventListener *)
*/
- void * pData;
+ detail::element_alias aData;
::osl::Mutex & rMutex;
/** TRUE -> used by an iterator. */
sal_Bool bInUse;
- /** TRUE -> pData is of type Sequence< XInterfaceSequence >. */
+ /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */
sal_Bool bIsList;
OInterfaceContainerHelper( const OInterfaceContainerHelper & ) SAL_THROW( () );
diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx
index 61c8a2269..ea9a13877 100644
--- a/cppuhelper/inc/cppuhelper/propshlp.hxx
+++ b/cppuhelper/inc/cppuhelper/propshlp.hxx
@@ -595,6 +595,29 @@ protected:
::com::sun::star::uno::Any& rValue,
sal_Int32 nHandle ) const = 0;
+ /** sets an dependent property's value
+
+ <p>Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue|
+ from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners
+ while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast|
+ recursively) is not an option, too, since it would miss firing the property change event.</p>
+
+ <p>So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|.
+ It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast|
+ for the given handle and value), and add the property change event to the list of events to be notified
+ when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.</p>
+
+ <p><strong>Note</strong>: The method will <em>not</em> invoke veto listeners for the property.</p>
+
+ <p><strong>Note</strong>: It's the caller's responsibility to ensure that our mutex is locked. This is
+ canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other
+ contexts, you might need to take own measures.</p>
+ */
+ void setDependentFastPropertyValue(
+ sal_Int32 i_handle,
+ const ::com::sun::star::uno::Any& i_value
+ );
+
/** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */
OBroadcastHelper &rBHelper;
/**
@@ -610,12 +633,22 @@ protected:
/** reserved for future use. finally, the future has arrived...
*/
- const std::auto_ptr<const Impl> m_pReserved;
+ const std::auto_ptr<Impl> m_pReserved;
private:
OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW( () );
OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW( () );
+ /** notifies the given changes in property's values, <em>plus</em> all property changes collected during recent
+ |setDependentFastPropertyValue| calls.
+ */
+ void impl_fireAll(
+ sal_Int32* i_handles,
+ const ::com::sun::star::uno::Any * i_newValues,
+ const ::com::sun::star::uno::Any * i_oldValues,
+ sal_Int32 i_count
+ );
+
public:
// Suppress warning about virtual functions but non-virtual destructor:
#if defined __GNUC__
diff --git a/cppuhelper/inc/cppuhelper/shlib.hxx b/cppuhelper/inc/cppuhelper/shlib.hxx
index 044b30758..42299fa08 100644
--- a/cppuhelper/inc/cppuhelper/shlib.hxx
+++ b/cppuhelper/inc/cppuhelper/shlib.hxx
@@ -64,7 +64,9 @@ SAL_CALL loadSharedLibComponentFactory(
(e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific
directory. The resulting path of the library will be checked against environment variable
CPLD_ACCESSPATH if set.
-
+
+ @obsolete component_writeInfo should no longer be used in new components
+
@param rLibName name of the library
@param rPath optional path
@param xMgr service manager to be provided to the component
diff --git a/cppuhelper/prj/build.lst b/cppuhelper/prj/build.lst
index de66b2d61..ff837f90d 100644
--- a/cppuhelper/prj/build.lst
+++ b/cppuhelper/prj/build.lst
@@ -1,4 +1,4 @@
-ch cppuhelper : BOOST:boost codemaker cppu offuh NULL
+ch cppuhelper : BOOST:boost LIBXSLT:libxslt codemaker cppu offuh NULL
ch cppuhelper usr1 - all ch_mkout NULL
ch cppuhelper\inc nmake - all ch_include NULL
ch cppuhelper\source nmake - all ch_source ch_unotypes ch_include NULL
diff --git a/cppuhelper/qa/propertysetmixin/JavaSupplier.java b/cppuhelper/qa/propertysetmixin/JavaSupplier.java
index 513f207ab..834e448c6 100644
--- a/cppuhelper/qa/propertysetmixin/JavaSupplier.java
+++ b/cppuhelper/qa/propertysetmixin/JavaSupplier.java
@@ -75,11 +75,6 @@ public final class JavaSupplier extends WeakBase implements XSupplier {
: null;
}
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- implementationName, serviceName, regKey);
- }
-
private static final String implementationName
= JavaSupplier.class.getName();
private static final String serviceName
diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
index 67571e82c..c6eccecb4 100644
--- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
+++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx
@@ -427,10 +427,3 @@ extern "C" void SAL_CALL component_getImplementationEnvironment(
{
*envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
-
-extern "C" sal_Bool SAL_CALL component_writeInfo(
- void * serviceManager, void * registryKey)
-{
- return cppu::component_writeInfoHelper(
- serviceManager, registryKey, entries);
-}
diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk
index edd4795fc..04aa2479c 100644
--- a/cppuhelper/qa/propertysetmixin/makefile.mk
+++ b/cppuhelper/qa/propertysetmixin/makefile.mk
@@ -37,6 +37,8 @@ PACKAGE = test/cppuhelper/propertysetmixin/comp
ENABLE_EXCEPTIONS := TRUE
+my_components = $(TARGET).cpp $(TARGET).java
+
.INCLUDE: settings.mk
.IF "$(OS)" == "WNT"
@@ -75,51 +77,62 @@ JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar
ALLTAR: test
$(MISC)/$(TARGET)/types.urd: types.idl
- - $(MKDIR) $(@:d)
+ $(MKDIRHIER) $(@:d)
$(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $<
$(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd
- $(RM) $@
$(REGMERGE) $@ /UCR $<
-$(MISC)/$(TARGET)/uno.rdb: $(MISC)/$(TARGET)/types.rdb $(SHL2TARGETN) \
- $(MISC)/$(TARGET)/$(TARGET).uno.jar $(MISC)/$(TARGET)/bootstrap.rdb
- - $(MKDIR) $(@:d)
- $(COPY) $(SOLARBINDIR)/types.rdb $@
- $(REGMERGE) $@ / $(MISC)/$(TARGET)/types.rdb
- $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \
- -c reflection.uno -c stocservices.uno -c $(SHL2TARGETN)
- $(REGCOMP) -register -br $(MISC)/$(TARGET)/bootstrap.rdb -r $@ \
- -c $(my_file)$(PWD)/$(MISC)/$(TARGET)/$(TARGET).uno.jar \
- -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR)
-
-$(MISC)/$(TARGET)/bootstrap.rdb:
- - $(MKDIR) $(@:d)
- $(COPY) $(SOLARBINDIR)/types.rdb $@
- $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \
- -c stocservices.uno
-
$(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb
$(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \
- -X$(SOLARBINDIR)/types.rdb $<
+ -X$(SOLARBINDIR)/udkapi.rdb $<
$(TOUCH) $@
$(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag
$(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb
- $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/types.rdb $<
+ $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/udkapi.rdb $<
$(TOUCH) $@
$(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag
+$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/$(TARGET)/services.input \
+ $(my_components:^"$(MISC)/$(TARGET)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input
+
+$(MISC)/$(TARGET)/services.input:
+ $(MKDIRHIER) $(@:d)
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
+
+$(MISC)/$(TARGET)/$(TARGET).cpp.component .ERRREMOVE: \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL2TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component
+
+$(MISC)/$(TARGET)/$(TARGET).java.component .ERRREMOVE: \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_INBUILD_JAVA)$(TARGET).uno.jar' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component
+
$(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \
$(MISC)/$(TARGET)/javamaker.flag manifest
jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin
-test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/uno.rdb
+test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/$(TARGET).uno.jar \
+ $(MISC)/$(TARGET)/types.rdb $(MISC)/$(TARGET)/services.rdb
$(CPPUNITTESTER) $(SHL1TARGETN) \
- -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \
+ '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb' \
+ '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\
-env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \
- -env:arg-reg=$(MISC)/$(TARGET)/uno.rdb -env:arg-path=$(SOLARSHAREDBIN)
+ -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \
+ -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(PWD)/$(DLLDEST) \
+ -env:OOO_INBUILD_JAR_DIR=$(my_file)$(PWD)/$(MISC)/$(TARGET)
.END
diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component
new file mode 100644
index 000000000..a654e0758
--- /dev/null
+++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.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="test.cppuhelper.propertysetmixin.comp.CppSupplier">
+ <service name="test.cppuhelper.propertysetmixin.CppSupplier"/>
+ </implementation>
+</component>
diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component
new file mode 100644
index 000000000..9711563b7
--- /dev/null
+++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.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.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="test.cppuhelper.propertysetmixin.comp.JavaSupplier">
+ <service name="test.cppuhelper.propertysetmixin.JavaSupplier"/>
+ </implementation>
+</component>
diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx
index 82256c634..9a25e9885 100644
--- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx
+++ b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx
@@ -52,21 +52,19 @@
#include "com/sun/star/beans/XPropertySetInfo.hpp"
#include "com/sun/star/beans/XVetoableChangeListener.hpp"
#include "com/sun/star/lang/XComponent.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/Type.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/bootstrap.hxx"
#include "cppuhelper/implbase1.hxx"
-#include "cppuhelper/servicefactory.hxx"
#include "cppunit/TestAssert.h"
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
#include "osl/mutex.hxx"
-#include "rtl/bootstrap.hxx"
#include "rtl/ref.hxx"
#include "rtl/string.h"
#include "rtl/textenc.h"
@@ -98,14 +96,6 @@ std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) {
out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]";
}
-rtl::OUString getArgument(rtl::OUString const & name) {
- rtl::OUString val;
- CPPUNIT_ASSERT(
- rtl::Bootstrap::get(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name, val));
- return val;
-}
-
class BoundListener:
public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >
{
@@ -178,7 +168,7 @@ class Test: public CppUnit::TestFixture {
public:
virtual void setUp();
- void finish();
+ virtual void tearDown();
void testCppEmpty1() { testEmpty1(getCppSupplier()); }
@@ -199,7 +189,6 @@ public:
CPPUNIT_TEST(testJavaEmpty1);
CPPUNIT_TEST(testJavaEmpty2);
CPPUNIT_TEST(testJavaFull);
- CPPUNIT_TEST(finish);
CPPUNIT_TEST_SUITE_END();
private:
@@ -221,30 +210,15 @@ private:
css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier >
const & supplier) const;
- static css::uno::Reference< css::uno::XComponentContext > m_context;
+ css::uno::Reference< css::uno::XComponentContext > m_context;
};
void Test::setUp() {
- // For whatever reason, on W32 it does not work to create/destroy a fresh
- // component context for each test in Test::setUp/tearDown; therefore, a
- // single component context is used for all tests and destroyed in the last
- // pseudo-test "finish":
- if (!m_context.is()) {
- css::uno::Reference< css::lang::XMultiComponentFactory > factory(
- cppu::createRegistryServiceFactory(
- getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reg"))),
- sal_False,
- getArgument(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))),
- css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::beans::XPropertySet >(
- factory, css::uno::UNO_QUERY_THROW)->getPropertyValue(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")))
- >>= m_context;
- }
+ m_context = cppu::defaultBootstrap_InitialComponentContext();
+ CPPUNIT_ASSERT(m_context.is());
}
-void Test::finish() {
+void Test::tearDown() {
css::uno::Reference< css::lang::XComponent >(
m_context, css::uno::UNO_QUERY_THROW)->dispose();
}
@@ -671,8 +645,6 @@ void Test::testFull(
} catch (css::beans::UnknownPropertyException &) {}
}
-css::uno::Reference< css::uno::XComponentContext > Test::m_context;
-
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 0dcb24b5a..b8af92fed 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -380,9 +380,15 @@ SAL_CALL defaultBootstrap_InitialComponentContext(
Bootstrap const & bootstrap )
SAL_THROW( (Exception) )
{
- OUString bootstrapPath( get_this_libpath() );
- OUString iniDir;
+ OUString bootstrapPath;
+ if (!bootstrap.getFrom(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")),
+ bootstrapPath))
+ {
+ bootstrapPath = get_this_libpath();
+ }
+ OUString iniDir;
osl_getProcessWorkingDir(&iniDir.pData);
Reference<lang::XMultiComponentFactory> smgr_XMultiComponentFactory(
diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map
index 090f8a1cc..6d4c9e6ce 100755
--- a/cppuhelper/source/cc5_solaris_sparc.map
+++ b/cppuhelper/source/cc5_solaris_sparc.map
@@ -387,3 +387,9 @@ UDK_3.7 { # OOo 3.3
__1cDcomDsunEstarDunoTWeakReferenceHelperFclear6M_v_;
__1cEcppubHcreateOneInstanceComponentFactory6FpFrknDcomDsunEstarDunoJReference4n0ERXComponentContext____n0EJReference4n0EKXInterface___rknDrtlIOUString_rkn0EISequence4n0K___pnQ_rtl_ModuleCount__n0EJReference4n0DElangXXSingleComponentFactory____;
} UDK_3.6;
+
+UDK_3.8 { # OOo 3.4
+ global:
+ __1cEcppuSOPropertySetHelperbDsetDependentFastPropertyValue6MlrknDcomDsunEstarDunoDAny__v_;
+} UDK_3.7;
+
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index df3069db7..18d9b57ad 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -232,9 +232,17 @@ Reference< XInterface > OSingleFactoryHelper::createInstanceWithArgumentsAndCont
else
{
if ( rArguments.getLength() )
+ {
+ // dispose the here created UNO object before throwing out exception
+ // to avoid risk of memory leaks #i113722#
+ Reference<XComponent> xComp( xRet, UNO_QUERY );
+ if (xComp.is())
+ xComp->dispose();
+
throw lang::IllegalArgumentException(
OUString( RTL_CONSTASCII_USTRINGPARAM("cannot pass arguments to component => no XInitialization implemented!") ),
Reference< XInterface >(), 0 );
+ }
}
return xRet;
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 88e58df65..0aee99691 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -382,3 +382,9 @@ UDK_3.6 { # OOo 3.3
_ZN4cppu33createOneInstanceComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
} UDK_3.5;
+
+UDK_3.7 { # OOo 3.4
+ global:
+ _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueE?RKN3com3sun4star3uno3AnyE;
+} UDK_3.6;
+
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
index b1f45c687..b04b34b45 100644
--- a/cppuhelper/source/interfacecontainer.cxx
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -99,15 +99,15 @@ OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper &
// worst case, two iterators at the same time
rCont.copyAndResetInUse();
bIsList = rCont_.bIsList;
- pData = rCont_.pData;
+ aData = rCont_.aData;
if( bIsList )
{
rCont.bInUse = sal_True;
- nRemain = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ nRemain = aData.pAsSequence->getLength();
}
- else if( pData )
+ else if( aData.pAsInterface )
{
- ((XInterface *)pData)->acquire();
+ aData.pAsInterface->acquire();
nRemain = 1;
}
else
@@ -120,7 +120,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () )
{
MutexGuard aGuard( rCont.rMutex );
// bResetInUse protect the iterator against recursion
- bShared = pData == rCont.pData && rCont.bIsList;
+ bShared = aData.pAsSequence == rCont.aData.pAsSequence && rCont.bIsList;
if( bShared )
{
OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper must be in use" );
@@ -132,10 +132,10 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () )
{
if( bIsList )
// Sequence owned by the iterator
- delete (Sequence< Reference< XInterface > >*)pData;
- else if( pData )
+ delete aData.pAsSequence;
+ else if( aData.pAsInterface )
// Interface is acquired by the iterator
- ((XInterface*)pData)->release();
+ aData.pAsInterface->release();
}
}
@@ -146,9 +146,9 @@ XInterface * OInterfaceIteratorHelper::next() SAL_THROW( () )
nRemain--;
if( bIsList )
// typecase to const,so the getArray method is faster
- return ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get();
- else if( pData )
- return (XInterface*)pData;
+ return aData.pAsSequence->getConstArray()[nRemain].get();
+ else if( aData.pAsInterface )
+ return aData.pAsInterface;
}
// exception
return 0;
@@ -159,15 +159,14 @@ void OInterfaceIteratorHelper::remove() SAL_THROW( () )
if( bIsList )
{
OSL_ASSERT( nRemain >= 0 &&
- nRemain < ((const Sequence< Reference< XInterface > >*)pData)->getLength() );
- XInterface * p =
- ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get();
+ nRemain < aData.pAsSequence->getLength() );
+ XInterface * p = aData.pAsSequence->getConstArray()[nRemain].get();
rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) );
}
else
{
OSL_ASSERT( 0 == nRemain );
- rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&pData));
+ rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&aData.pAsInterface));
}
}
@@ -177,8 +176,7 @@ void OInterfaceIteratorHelper::remove() SAL_THROW( () )
OInterfaceContainerHelper::OInterfaceContainerHelper( Mutex & rMutex_ ) SAL_THROW( () )
- : pData( 0 )
- , rMutex( rMutex_ )
+ : rMutex( rMutex_ )
, bInUse( sal_False )
, bIsList( sal_False )
{
@@ -188,17 +186,17 @@ OInterfaceContainerHelper::~OInterfaceContainerHelper() SAL_THROW( () )
{
OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper but is in use" );
if( bIsList )
- delete (Sequence< Reference< XInterface > >*)pData;
- else if( pData )
- ((XInterface*)pData)->release();
+ delete aData.pAsSequence;
+ else if( aData.pAsInterface )
+ aData.pAsInterface->release();
}
sal_Int32 OInterfaceContainerHelper::getLength() const SAL_THROW( () )
{
MutexGuard aGuard( rMutex );
if( bIsList )
- return ((Sequence< Reference< XInterface > >*)pData)->getLength();
- else if( pData )
+ return aData.pAsSequence->getLength();
+ else if( aData.pAsInterface )
return 1;
return 0;
}
@@ -207,10 +205,10 @@ Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const
{
MutexGuard aGuard( rMutex );
if( bIsList )
- return *(Sequence< Reference< XInterface > >*)pData;
- else if( pData )
+ return *aData.pAsSequence;
+ else if( aData.pAsInterface )
{
- Reference<XInterface> x( (XInterface *)pData );
+ Reference<XInterface> x( aData.pAsInterface );
return Sequence< Reference< XInterface > >( &x, 1 );
}
return Sequence< Reference< XInterface > >();
@@ -224,9 +222,9 @@ void OInterfaceContainerHelper::copyAndResetInUse() SAL_THROW( () )
// this should be the worst case. If a iterator is active
// and a new Listener is added.
if( bIsList )
- pData = new Sequence< Reference< XInterface > >( *(Sequence< Reference< XInterface > >*)pData );
- else if( pData )
- ((XInterface*)pData)->acquire();
+ aData.pAsSequence = new Sequence< Reference< XInterface > >( *aData.pAsSequence );
+ else if( aData.pAsInterface )
+ aData.pAsInterface->acquire();
bInUse = sal_False;
}
@@ -241,25 +239,25 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> &
if( bIsList )
{
- sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength();
- realloc( *(Sequence< Reference< XInterface > >*)pData, nLen +1 );
- ((Sequence< Reference< XInterface > >*)pData)->getArray()[ nLen ] = rListener;
+ sal_Int32 nLen = aData.pAsSequence->getLength();
+ realloc( *aData.pAsSequence, nLen +1 );
+ aData.pAsSequence->getArray()[ nLen ] = rListener;
return nLen +1;
}
- else if( pData )
+ else if( aData.pAsInterface )
{
Sequence< Reference< XInterface > > * pSeq = new Sequence< Reference< XInterface > >( 2 );
Reference<XInterface> * pArray = pSeq->getArray();
- pArray[0] = (XInterface *)pData;
+ pArray[0] = aData.pAsInterface;
pArray[1] = rListener;
- ((XInterface *)pData)->release();
- pData = pSeq;
+ aData.pAsInterface->release();
+ aData.pAsSequence = pSeq;
bIsList = sal_True;
return 2;
}
else
{
- pData = rListener.get();
+ aData.pAsInterface = rListener.get();
if( rListener.is() )
rListener->acquire();
return 1;
@@ -275,8 +273,8 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
if( bIsList )
{
- const Reference<XInterface> * pL = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray();
- sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ const Reference<XInterface> * pL = aData.pAsSequence->getConstArray();
+ sal_Int32 nLen = aData.pAsSequence->getLength();
sal_Int32 i;
for( i = 0; i < nLen; i++ )
{
@@ -284,7 +282,7 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
// more faster.
if( pL[i].get() == rListener.get() )
{
- sequenceRemoveElementAt( *(Sequence< Reference< XInterface > >*)pData, i );
+ sequenceRemoveElementAt( *aData.pAsSequence, i );
break;
}
}
@@ -296,30 +294,30 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface
{
if( pL[i] == rListener )
{
- sequenceRemoveElementAt(*(Sequence< Reference< XInterface > >*)pData, i );
+ sequenceRemoveElementAt(*aData.pAsSequence, i );
break;
}
}
}
- if( ((Sequence< Reference< XInterface > >*)pData)->getLength() == 1 )
+ if( aData.pAsSequence->getLength() == 1 )
{
- XInterface * p = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[0].get();
+ XInterface * p = aData.pAsSequence->getConstArray()[0].get();
p->acquire();
- delete (Sequence< Reference< XInterface > >*)pData;
- pData = p;
+ delete aData.pAsSequence;
+ aData.pAsInterface = p;
bIsList = sal_False;
return 1;
}
else
- return ((Sequence< Reference< XInterface > >*)pData)->getLength();
+ return aData.pAsSequence->getLength();
}
- else if( pData && Reference<XInterface>( (XInterface*)pData ) == rListener )
+ else if( aData.pAsInterface && Reference<XInterface>( aData.pAsInterface ) == rListener )
{
- ((XInterface *)pData)->release();
- pData = 0;
+ aData.pAsInterface->release();
+ aData.pAsInterface = 0;
}
- return pData ? 1 : 0;
+ return aData.pAsInterface ? 1 : 0;
}
void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_THROW( () )
@@ -328,10 +326,10 @@ void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_
OInterfaceIteratorHelper aIt( *this );
// Container freigeben, falls im disposing neue Einträge kommen
OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" );
- if( !bIsList && pData )
- ((XInterface *)pData)->release();
+ if( !bIsList && aData.pAsInterface )
+ aData.pAsInterface->release();
// set the member to null, the iterator delete the values
- pData = NULL;
+ aData.pAsInterface = NULL;
bIsList = sal_False;
bInUse = sal_False;
aGuard.clear();
@@ -358,10 +356,10 @@ void OInterfaceContainerHelper::clear() SAL_THROW( () )
OInterfaceIteratorHelper aIt( *this );
// Container freigeben, falls im disposing neue Einträge kommen
OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" );
- if( !bIsList && pData )
- ((XInterface *)pData)->release();
+ if( !bIsList && aData.pAsInterface )
+ aData.pAsInterface->release();
// set the member to null, the iterator delete the values
- pData = 0;
+ aData.pAsInterface = 0;
bIsList = sal_False;
bInUse = sal_False;
// release mutex before aIt destructor call
diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map
index 6d5a491ab..7069276e2 100644
--- a/cppuhelper/source/msvc_win32_intel.map
+++ b/cppuhelper/source/msvc_win32_intel.map
@@ -278,3 +278,9 @@ UDK_3.6 { # OOo 3.3
?clear@WeakReferenceHelper@uno@star@sun@com@@QAAXXZ;
?createOneInstanceComponentFactory@cppu@@YA?AV?$Reference@VXSingleComponentFactory@lang@star@sun@com@@@uno@star@sun@com@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@3456@@ZABVOUString@rtl@@ABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z;
} UDK_3.5;
+
+UDK_3.7 { # OOo 3.4
+ global:
+ ?setDependentFastPropertyValue@OPropertySetHelper@cppu@@IAEXJABVAny@uno@star@sun@com@@@Z;
+} UDK_3.6;
+
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index eb71723e1..b0a41bb40 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -32,6 +32,7 @@
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/exc_hlp.hxx"
#include "com/sun/star/beans/PropertyAttribute.hpp"
#include "com/sun/star/lang/DisposedException.hpp"
@@ -144,15 +145,20 @@ sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const OUString & Proper
class OPropertySetHelper::Impl {
public:
- Impl ( bool i_bIgnoreRuntimeExceptionsWhileFiring,
- IEventNotificationHook *i_pFireEvents)
- : m_bIgnoreRuntimeExceptionsWhileFiring(
- i_bIgnoreRuntimeExceptionsWhileFiring ),
- m_pFireEvents( i_pFireEvents )
- { }
+ Impl( bool i_bIgnoreRuntimeExceptionsWhileFiring,
+ IEventNotificationHook *i_pFireEvents
+ )
+ :m_bIgnoreRuntimeExceptionsWhileFiring( i_bIgnoreRuntimeExceptionsWhileFiring )
+ ,m_pFireEvents( i_pFireEvents )
+ {
+ }
bool m_bIgnoreRuntimeExceptionsWhileFiring;
class IEventNotificationHook * const m_pFireEvents;
+
+ ::std::vector< sal_Int32 > m_handles;
+ ::std::vector< Any > m_newValues;
+ ::std::vector< Any > m_oldValues;
};
@@ -432,6 +438,57 @@ void OPropertySetHelper::removeVetoableChangeListener(
}
}
+void OPropertySetHelper::setDependentFastPropertyValue( sal_Int32 i_handle, const ::com::sun::star::uno::Any& i_value )
+{
+ //OSL_PRECOND( rBHelper.rMutex.isAcquired(), "OPropertySetHelper::setDependentFastPropertyValue: to be called with a locked mutex only!" );
+ // there is no such thing as Mutex.isAcquired, sadly ...
+
+ sal_Int16 nAttributes(0);
+ IPropertyArrayHelper& rInfo = getInfoHelper();
+ if ( !rInfo.fillPropertyMembersByHandle( NULL, &nAttributes, i_handle ) )
+ // unknown property
+ throw UnknownPropertyException();
+
+ // no need to check for READONLY-ness of the property. The method is intended to be called internally, which
+ // implies it might be invoked for properties which are read-only to the instance's clients, but well allowed
+ // to change their value.
+
+ Any aConverted, aOld;
+ sal_Bool bChanged = convertFastPropertyValue( aConverted, aOld, i_handle, i_value );
+ if ( !bChanged )
+ return;
+
+ // don't fire vetoable events. This method is called with our mutex locked, so calling into listeners would not be
+ // a good idea. The caler is responsible for not invoking this for constrained properties.
+ OSL_ENSURE( ( nAttributes & PropertyAttribute::CONSTRAINED ) == 0,
+ "OPropertySetHelper::setDependentFastPropertyValue: not to be used for constrained properties!" );
+ (void)nAttributes;
+
+ // actually set the new value
+ try
+ {
+ setFastPropertyValue_NoBroadcast( i_handle, aConverted );
+ }
+ catch (const UnknownPropertyException& ) { throw; /* allowed to leave */ }
+ catch (const PropertyVetoException& ) { throw; /* allowed to leave */ }
+ catch (const IllegalArgumentException& ) { throw; /* allowed to leave */ }
+ catch (const WrappedTargetException& ) { throw; /* allowed to leave */ }
+ catch (const RuntimeException& ) { throw; /* allowed to leave */ }
+ catch (const Exception& )
+ {
+ // not allowed to leave this meathod
+ WrappedTargetException aWrapped;
+ aWrapped.TargetException <<= ::cppu::getCaughtException();
+ aWrapped.Context = static_cast< XPropertySet* >( this );
+ throw aWrapped;
+ }
+
+ // remember the handle/values, for the events to be fired later
+ m_pReserved->m_handles.push_back( i_handle );
+ m_pReserved->m_newValues.push_back( aConverted ); // TODO: setFastPropertyValue notifies the unconverted value here ...?
+ m_pReserved->m_oldValues.push_back( aOld );
+}
+
// XFastPropertySet
void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue )
throw(::com::sun::star::beans::UnknownPropertyException,
@@ -498,7 +555,7 @@ void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rVa
// release guard to fire events
}
// file a change event, if the value changed
- fire( &nHandle, &rValue, &aOldVal, 1, sal_False );
+ impl_fireAll( &nHandle, &rValue, &aOldVal, 1 );
}
}
@@ -521,6 +578,42 @@ Any OPropertySetHelper::getFastPropertyValue( sal_Int32 nHandle )
}
//--------------------------------------------------------------------------
+void OPropertySetHelper::impl_fireAll( sal_Int32* i_handles, const Any* i_newValues, const Any* i_oldValues, sal_Int32 i_count )
+{
+ ClearableMutexGuard aGuard( rBHelper.rMutex );
+ if ( m_pReserved->m_handles.empty() )
+ {
+ aGuard.clear();
+ fire( i_handles, i_newValues, i_oldValues, i_count, sal_False );
+ return;
+ }
+
+ const size_t additionalEvents = m_pReserved->m_handles.size();
+ OSL_ENSURE( additionalEvents == m_pReserved->m_newValues.size()
+ && additionalEvents == m_pReserved->m_oldValues.size(),
+ "OPropertySetHelper::impl_fireAll: inconsistency!" );
+
+ ::std::vector< sal_Int32 > allHandles( additionalEvents + i_count );
+ ::std::copy( m_pReserved->m_handles.begin(), m_pReserved->m_handles.end(), allHandles.begin() );
+ ::std::copy( i_handles, i_handles + i_count, allHandles.begin() + additionalEvents );
+
+ ::std::vector< Any > allNewValues( additionalEvents + i_count );
+ ::std::copy( m_pReserved->m_newValues.begin(), m_pReserved->m_newValues.end(), allNewValues.begin() );
+ ::std::copy( i_newValues, i_newValues + i_count, allNewValues.begin() + additionalEvents );
+
+ ::std::vector< Any > allOldValues( additionalEvents + i_count );
+ ::std::copy( m_pReserved->m_oldValues.begin(), m_pReserved->m_oldValues.end(), allOldValues.begin() );
+ ::std::copy( i_oldValues, i_oldValues + i_count, allOldValues.begin() + additionalEvents );
+
+ m_pReserved->m_handles.clear();
+ m_pReserved->m_newValues.clear();
+ m_pReserved->m_oldValues.clear();
+
+ aGuard.clear();
+ fire( &allHandles[0], &allNewValues[0], &allOldValues[0], additionalEvents + i_count, sal_False );
+}
+
+//--------------------------------------------------------------------------
void OPropertySetHelper::fire
(
sal_Int32 * pnHandles,
@@ -803,7 +896,7 @@ void OPropertySetHelper::setFastPropertyValues(
}
// fire change events
- fire( pHandles, pConvertedValues, pOldValues, n, sal_False );
+ impl_fireAll( pHandles, pConvertedValues, pOldValues, n );
}
catch( ... )
{
diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx
index d1ae7f1a9..3dcea15c7 100644
--- a/cppuhelper/source/servicefactory.cxx
+++ b/cppuhelper/source/servicefactory.cxx
@@ -28,13 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppuhelper.hxx"
-#if OSL_DEBUG_LEVEL > 0
-#include <stdio.h>
-#endif
#include <vector>
#include "rtl/string.hxx"
-#include "rtl/ustrbuf.hxx"
#include "rtl/bootstrap.hxx"
#include "osl/diagnose.h"
#include "osl/file.h"
@@ -46,6 +42,7 @@
#include "cppuhelper/servicefactory.hxx"
#include "cppuhelper/bootstrap.hxx"
+#include "com/sun/star/uno/DeploymentException.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/lang/XInitialization.hpp"
#include "com/sun/star/lang/XSingleServiceFactory.hpp"
@@ -64,6 +61,7 @@ using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+namespace css = com::sun::star;
namespace cppu
{
@@ -417,39 +415,42 @@ Reference< XComponentContext > bootstrapInitialContext(
keys.getConstArray();
for ( sal_Int32 nPos = keys.getLength(); nPos--; )
{
- Reference< registry::XRegistryKey > const & xKey2 =
- pKeys[ nPos ];
- try
- {
- OUStringBuffer buf( 32 );
- buf.appendAscii(
- RTL_CONSTASCII_STRINGPARAM("/singletons/") );
- buf.append(
- xKey2->getKeyName().copy(
- sizeof("/SINGLETONS") /* -\0 +'/' */ ) );
- entry.name = buf.makeStringAndClear();
- entry.value <<= xKey2->getStringValue();
- context_values.push_back( entry );
- }
- catch (Exception & rExc)
- {
-#if OSL_DEBUG_LEVEL > 0
- OString aStr(
- OUStringToOString(
- xKey2->getKeyName().copy( 11 ),
- RTL_TEXTENCODING_ASCII_US ) );
- OString aStr2(
- OUStringToOString(
- rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
- fprintf(
- stderr,
- "### failed reading singleton [%s]"
- " service name from registry: %s\n",
- aStr.getStr(), aStr2.getStr() );
-#else
- (void) rExc; // avoid warning about unused variable
-#endif
+ css::uno::Sequence< rtl::OUString > impls(
+ css::uno::Reference< css::registry::XRegistryKey >(
+ pKeys[nPos]->openKey(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "REGISTERED_BY"))),
+ css::uno::UNO_SET_THROW)->getAsciiListValue());
+ switch (impls.getLength()) {
+ case 0:
+ throw css::uno::DeploymentException(
+ (pKeys[nPos]->getKeyName() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/REGISTERED_BY is empty"))),
+ css::uno::Reference< css::uno::XInterface >());
+ case 1:
+ break;
+ default:
+ OSL_TRACE(
+ ("arbitrarily chosing \"%s\" among multiple"
+ " implementations for \"%s\""),
+ rtl::OUStringToOString(
+ impls[0], RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(
+ pKeys[nPos]->getKeyName(),
+ RTL_TEXTENCODING_UTF8).getStr());
+ break;
}
+ context_values.push_back(
+ ContextEntry_Init(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("/singletons/")) +
+ pKeys[nPos]->getKeyName().copy(
+ RTL_CONSTASCII_LENGTH("/SINGLETONS/"))),
+ css::uno::makeAny(impls[0]),
+ true));
}
}
}
diff --git a/cpputools/prj/build.lst b/cpputools/prj/build.lst
index 7cd9053c5..ca820871b 100644
--- a/cpputools/prj/build.lst
+++ b/cpputools/prj/build.lst
@@ -2,7 +2,6 @@ pt cpputools : cppuhelper offuh LIBXML2:libxml2 NULL
pt cpputools usr1 - all pt_mkout NULL
pt cpputools\prj get - all pt_prj NULL
pt cpputools\source\registercomponent nmake - all pt_regcomp NULL
-pt cpputools\source\regcomplazy nmake - all pt_regcomplazy NULL
pt cpputools\source\regsingleton nmake - all pt_regsingleton NULL
pt cpputools\source\unoexe nmake - all pt_unoexe NULL
pt cpputools\source\sp2bv nmake - all pt_sp2bv NULL
diff --git a/cpputools/prj/d.lst b/cpputools/prj/d.lst
index fa029cc4d..14de5e78a 100644
--- a/cpputools/prj/d.lst
+++ b/cpputools/prj/d.lst
@@ -1,8 +1,6 @@
..\%__SRC%\bin\regcomp.exe %_DEST%\bin%_EXT%\regcomp.exe
..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp
..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp.bin
-..\%__SRC%\bin\regcomplazy.exe %_DEST%\bin%_EXT%\regcomplazy.exe
-..\%__SRC%\bin\regcomplazy %_DEST%\bin%_EXT%\regcomplazy
..\%__SRC%\bin\uno.exe %_DEST%\bin%_EXT%\uno.exe
..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno
..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno.bin
diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx
deleted file mode 100755
index 00907602f..000000000
--- a/cpputools/source/regcomplazy/regcomplazy.cxx
+++ /dev/null
@@ -1,282 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <stdio.h>
-
-#include "sal/main.h"
-#include <osl/diagnose.h>
-#include <osl/thread.h>
-#include <osl/file.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <vector>
-
-#include <registry/registry.hxx>
-
-
-#define OUSTR(x) ::rtl::OUString::createFromAscii( x )
-#define OSToOUS(x) ::rtl::OStringToOUString(x, osl_getThreadTextEncoding())
-#define OUSToOS(x) ::rtl::OUStringToOString(x, osl_getThreadTextEncoding())
-using namespace ::rtl;
-
-typedef ::std::vector< ::rtl::OString > OSVector;
-
-struct CompDescriptor {
- OString sImplementationName;
- OString sComponentName;
- OString sLoaderName;
- OSVector vSupportedServices;
-};
-
-typedef ::std::vector< CompDescriptor > CDescrVector;
-
-static void print_options() SAL_THROW( () )
-{
- printf(
- "\nusage: regcomplazy [-v]registry_file cmp_descr_file ...\n\n"
- "Register a cmponent using a comp description file.\n"
- "Option -v prints verbose output on stdout.\n" );
-}
-
-static bool checkImplValue(RegistryValueList<sal_Char*>* pValueList, OString sImplName) {
- for (sal_uInt32 i=0; i < pValueList->getLength(); i++) {
- if (sImplName.equals(pValueList->getElement(i)))
- return true;
- }
-
- return false;
-}
-
-//==================================================================================================
-SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
-{
- if (argc < 3)
- {
- print_options();
- return 1;
- }
-
- bool bVerbose = false;
- int nPos = 1;
- if ('-' == argv[ nPos ][ 0 ] && 'v' == argv[ nPos ][ 1 ])
- {
- if ('\0' != argv[ nPos ][ 2 ])
- {
- print_options();
- return 1;
- }
- bVerbose = true;
- ++nPos;
- }
-
- OUString sys_path( OUSTR( argv[ nPos ] ) );
- OUString reg_url;
- oslFileError rc = osl_getFileURLFromSystemPath( sys_path.pData, &reg_url.pData );
- if (osl_File_E_None != rc)
- {
- if (bVerbose)
- fprintf( stderr, "\nERROR: cannot make file url out of %s\n", argv[nPos]);
- return 1;
- }
-
- FILE* fDescr = fopen(argv[ ++nPos ], "r");
- OStringBuffer sBuffer(512);
-
- if ( fDescr) {
- size_t totalSize = 0;
- size_t readSize = 0;
- char pBuffer[513];
-
- while ( !feof(fDescr) )
- {
- if ( (readSize = fread(pBuffer, 1, 512, fDescr)) > 0
- && !ferror(fDescr) ) {
- totalSize += readSize;
- if (totalSize >= 512)
- sBuffer.ensureCapacity(totalSize * 2);
-
- sBuffer.append(pBuffer, readSize);
- }
- }
- fclose(fDescr);
- fDescr = 0; // just to be sure noone tries to use the file ever after
- }
-
- OString sDescr = sBuffer.makeStringAndClear();
- sal_Int32 nTokenIndex = 0;
-
- CDescrVector vDescr;
- CompDescriptor descr;
- bool bFirst = true;
-
- do {
- OString sTmp = sDescr.getToken(0, '\x0A', nTokenIndex);
- OString sToken(sTmp);
- if (sTmp.pData->buffer[sTmp.getLength()-1] == '\x0D')
- sToken = sTmp.copy(0, sTmp.getLength()-1);
- if ( sToken.indexOf("[ComponentDescriptor]") >= 0) {
- if (bFirst)
- bFirst = false;
- else
- vDescr.push_back(descr);
-
- descr = CompDescriptor();
- }
- else if ( sToken.indexOf("ImplementationName=") >= 0) {
- descr.sImplementationName = sToken.copy(19);
- }
- else if ( sToken.indexOf("ComponentName=") >= 0) {
- descr.sComponentName = sToken.copy(14);
- }
- else if ( sToken.indexOf("LoaderName=") >= 0) {
- descr.sLoaderName = sToken.copy(11);
- }
- else if ( (sToken.indexOf("[SupportedServices]") < 0) &&
- (sToken.getLength() > 0) &&
- (sToken.pData->buffer[0] != '[') ) {
- descr.vSupportedServices.push_back(sToken);
- }
- } while (nTokenIndex >= 0 );
- // insert the last descriptor
- vDescr.push_back(descr);
-
- Registry *pReg = new Registry;
-
- RegistryKey rootKey, key, subKey, serviceKey;
-
- if (pReg->open(reg_url, REG_READWRITE))
- {
- if (pReg->create(reg_url))
- {
- if (bVerbose)
- fprintf(stderr, "ERROR: open registry \"%s\" failed\n", argv[1]);
- return 1;
- }
- }
- if (pReg->openRootKey(rootKey)) {
- if (bVerbose)
- fprintf(stderr, "ERROR: open root key failed\n");
- return 1;
- }
-
- CDescrVector::const_iterator comp_iter = vDescr.begin();
- do {
- OString sImplName = (*comp_iter).sImplementationName;
- OUStringBuffer sbImpl;
- sbImpl.appendAscii("/IMPLEMENTATIONS/");
- sbImpl.append(OSToOUS(sImplName));
- OUString sImplKeyName = sbImpl.makeStringAndClear();
-
- if (rootKey.openKey(sImplKeyName, key) == REG_NO_ERROR) {
- if (bVerbose) {
- fprintf(stderr, "WARNING: implementation entry for \"%s\" already exists, existing entries are overwritten\n", sImplName.getStr());
- }
- } else {
- if (rootKey.createKey(sImplKeyName, key)) {
- if (bVerbose) {
- fprintf(stderr, "ERROR: can't create new implementation entry \"%s\".\n", sImplName.getStr());
- }
- return 1;
- }
- }
-
- OString sLoaderName = (*comp_iter).sLoaderName;
- OUString usKeyName(OUSTR("UNO/ACTIVATOR"));
- key.createKey(usKeyName, subKey);
- subKey.setValue(OUString(), RG_VALUETYPE_STRING,
- (sal_Char*)sLoaderName.getStr(), sLoaderName.getLength()+1);
-
- OString sCompName = (*comp_iter).sComponentName;
- usKeyName = OUSTR("UNO/LOCATION");
- key.createKey(usKeyName, subKey);
- subKey.setValue(OUString(), RG_VALUETYPE_STRING,
- (sal_Char*)sCompName.getStr(), sCompName.getLength()+1);
-
- usKeyName = OUSTR("UNO/SERVICES");
- key.createKey(usKeyName, subKey);
-
- rootKey.createKey(OUSTR("/SERVICES"), serviceKey);
-
- OSVector::const_iterator serv_iter = ((*comp_iter).vSupportedServices).begin();
- OUString usServiceKeyName;
- do {
- usServiceKeyName = OSToOUS(*serv_iter);
- // write service key in impl section
- subKey.createKey(usServiceKeyName, key);
-
- if (serviceKey.openKey(usServiceKeyName, key) == REG_NO_ERROR) {
- RegistryValueList<sal_Char*> valueList;
- serviceKey.getStringListValue(usServiceKeyName, valueList);
- if ( checkImplValue(&valueList, sImplName) ) {
- serv_iter++;
- continue;
- }
-
- sal_uInt32 nServices = valueList.getLength()+1;
- sal_Char** pImplList = (sal_Char**)rtl_allocateZeroMemory(
- nServices * sizeof(sal_Char*));
- pImplList[0] = (sal_Char*)rtl_allocateZeroMemory(
- sImplName.getLength()+1 * sizeof(sal_Char));
- rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(),
- sImplName.getLength()+1);
- for (sal_uInt32 i=0; i < valueList.getLength(); i++) {
- pImplList[i+1]=valueList.getElement(i);
- }
- key.setStringListValue(OUString(), pImplList, nServices);
-
- // free memory
- rtl_freeMemory(pImplList[0]);
- rtl_freeMemory(pImplList);
-
- } else {
- serviceKey.createKey(usServiceKeyName, key);
-
- sal_Char* pImplList[1];
- pImplList[0] = (sal_Char*)rtl_allocateZeroMemory(
- sImplName.getLength()+1 * sizeof(sal_Char));
- rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(),
- sImplName.getLength()+1);
- key.setStringListValue(OUString(), pImplList, 1);
-
- // free memory
- rtl_freeMemory(pImplList[0]);
- }
- serv_iter++;
- } while (serv_iter != (*comp_iter).vSupportedServices.end());
-
- comp_iter++;
- } while (comp_iter != vDescr.end());
-
- key.closeKey();
- subKey.closeKey();
- serviceKey.closeKey();
- rootKey.closeKey();
- pReg->close();
-
- return 0;
-}
diff --git a/io/prj/build.lst b/io/prj/build.lst
index 2fa4900f5..f2be62d2a 100644
--- a/io/prj/build.lst
+++ b/io/prj/build.lst
@@ -1,4 +1,4 @@
-io io : rdbmaker NULL
+io io : LIBXSLT:libxslt rdbmaker NULL
io io usr1 - all io_mkout NULL
io io\inc nmake - all io_inc NULL
io io\source\acceptor nmake - all io_acceptor io_connector io_inc NULL
diff --git a/io/prj/d.lst b/io/prj/d.lst
index 9d19e5f8e..eaadf64db 100644
--- a/io/prj/d.lst
+++ b/io/prj/d.lst
@@ -5,3 +5,8 @@
..\source\stm\stm.xml %_DEST%\xml%_EXT%\streams.uno.xml
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*
+..\%__SRC%\misc\acceptor.component %_DEST%\xml%_EXT%\acceptor.component
+..\%__SRC%\misc\connector.component %_DEST%\xml%_EXT%\connector.component
+..\%__SRC%\misc\streams.component %_DEST%\xml%_EXT%\streams.component
+..\%__SRC%\misc\textinstream.component %_DEST%\xml%_EXT%\textinstream.component
+..\%__SRC%\misc\textoutstream.component %_DEST%\xml%_EXT%\textoutstream.component
diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx
index 3fa833139..c7ea60d7d 100644
--- a/io/source/TextInputStream/TextInputStream.cxx
+++ b/io/source/TextInputStream/TextInputStream.cxx
@@ -521,12 +521,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/io/source/TextInputStream/makefile.mk b/io/source/TextInputStream/makefile.mk
index 3c0cd5c57..ea476c57c 100644
--- a/io/source/TextInputStream/makefile.mk
+++ b/io/source/TextInputStream/makefile.mk
@@ -59,3 +59,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/textinstream.component
+
+$(MISC)/textinstream.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt textinstream.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt textinstream.component
diff --git a/io/source/TextInputStream/textinstream.component b/io/source/TextInputStream/textinstream.component
new file mode 100644
index 000000000..6ac7d2a98
--- /dev/null
+++ b/io/source/TextInputStream/textinstream.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.io.TextInputStream">
+ <service name="com.sun.star.io.TextInputStream"/>
+ </implementation>
+</component>
diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx
index b0a70f55c..3232d43cc 100644
--- a/io/source/TextOutputStream/TextOutputStream.cxx
+++ b/io/source/TextOutputStream/TextOutputStream.cxx
@@ -319,12 +319,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/io/source/TextOutputStream/makefile.mk b/io/source/TextOutputStream/makefile.mk
index ad78178f8..2c9d4eb2e 100644
--- a/io/source/TextOutputStream/makefile.mk
+++ b/io/source/TextOutputStream/makefile.mk
@@ -60,3 +60,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/textoutstream.component
+
+$(MISC)/textoutstream.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt textoutstream.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt textoutstream.component
diff --git a/io/source/TextOutputStream/textoutstream.component b/io/source/TextOutputStream/textoutstream.component
new file mode 100644
index 000000000..afbc50ab8
--- /dev/null
+++ b/io/source/TextOutputStream/textoutstream.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.io.TextOutputStream">
+ <service name="com.sun.star.io.TextOutputStream"/>
+ </implementation>
+</component>
diff --git a/io/source/acceptor/acceptor.component b/io/source/acceptor/acceptor.component
new file mode 100644
index 000000000..81e0399b2
--- /dev/null
+++ b/io/source/acceptor/acceptor.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.io.Acceptor">
+ <service name="com.sun.star.connection.Acceptor"/>
+ </implementation>
+</component>
diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx
index 9cc2d0ebd..a21b05ddb 100644
--- a/io/source/acceptor/acceptor.cxx
+++ b/io/source/acceptor/acceptor.cxx
@@ -366,12 +366,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/io/source/acceptor/makefile.mk b/io/source/acceptor/makefile.mk
index 3da3fbe18..bbc7ac6d3 100644
--- a/io/source/acceptor/makefile.mk
+++ b/io/source/acceptor/makefile.mk
@@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/acceptor.component
+
+$(MISC)/acceptor.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ acceptor.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt acceptor.component
diff --git a/io/source/connector/connector.component b/io/source/connector/connector.component
new file mode 100644
index 000000000..95fa72aa5
--- /dev/null
+++ b/io/source/connector/connector.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.io.Connector">
+ <service name="com.sun.star.connection.Connector"/>
+ </implementation>
+</component>
diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx
index a9a69a351..49b6c860b 100644
--- a/io/source/connector/connector.cxx
+++ b/io/source/connector/connector.cxx
@@ -278,12 +278,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/io/source/connector/makefile.mk b/io/source/connector/makefile.mk
index 7f12b850f..e3a67abe6 100644
--- a/io/source/connector/makefile.mk
+++ b/io/source/connector/makefile.mk
@@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET)
.ENDIF # L10N_framework
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/connector.component
+
+$(MISC)/connector.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ connector.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt connector.component
diff --git a/io/source/stm/factreg.cxx b/io/source/stm/factreg.cxx
index 50a2f673b..24c858efa 100644
--- a/io/source/stm/factreg.cxx
+++ b/io/source/stm/factreg.cxx
@@ -110,12 +110,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/io/source/stm/makefile.mk b/io/source/stm/makefile.mk
index a6a163eca..52dd0c492 100644
--- a/io/source/stm/makefile.mk
+++ b/io/source/stm/makefile.mk
@@ -75,3 +75,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/streams.component
+
+$(MISC)/streams.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ streams.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt streams.component
diff --git a/io/source/stm/streams.component b/io/source/stm/streams.component
new file mode 100644
index 000000000..76890d360
--- /dev/null
+++ b/io/source/stm/streams.component
@@ -0,0 +1,55 @@
+<?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.io.Pump">
+ <service name="com.sun.star.io.Pump"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.DataInputStream">
+ <service name="com.sun.star.io.DataInputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.DataOutputStream">
+ <service name="com.sun.star.io.DataOutputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.MarkableInputStream">
+ <service name="com.sun.star.io.MarkableInputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.MarkableOutputStream">
+ <service name="com.sun.star.io.MarkableOutputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.ObjectInputStream">
+ <service name="com.sun.star.io.ObjectInputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.ObjectOutputStream">
+ <service name="com.sun.star.io.ObjectOutputStream"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.io.stm.Pipe">
+ <service name="com.sun.star.io.Pipe"/>
+ </implementation>
+</component>
diff --git a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java
index 411779faf..7df6497a1 100644
--- a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java
+++ b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java
@@ -28,7 +28,6 @@ package com.sun.star.comp;
import com.sun.star.lib.uno.helper.Factory;
import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.registry.XRegistryKey;
import com.sun.star.comp.juhtest.SmoketestCommandEnvironment;
@@ -62,20 +61,4 @@ public class JavaUNOHelperServices {
return xFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return Factory.writeRegistryServiceInfo(SmoketestCommandEnvironment.class.getName(),
- SmoketestCommandEnvironment.getServiceNames(),
- regKey);
- }
}
-
-
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
index 0d3759f74..aa67282ca 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/Factory.java
@@ -46,11 +46,35 @@ public class Factory
implements XSingleComponentFactory, XServiceInfo
{
private static final boolean DEBUG = false;
-
+
/** Creates an object factory supporting interfaces
com.sun.star.lang.XSingleComponentFactory and
com.sun.star.lang.XServiceInfo
-
+
+ @param impl_class
+ implementation class
+ @param impl_name
+ implementation name
+ @param supported_services
+ services implemented
+ @return
+ object factory
+
+ @since UDK 3.2.13
+ */
+ public static XSingleComponentFactory createComponentFactory(
+ Class impl_class, String impl_name, String supported_services [] )
+ throws com.sun.star.uno.RuntimeException
+ {
+ return new Factory( impl_class, impl_name, supported_services );
+ }
+
+ /** Creates an object factory supporting interfaces
+ com.sun.star.lang.XSingleComponentFactory and
+ com.sun.star.lang.XServiceInfo
+
+ The implementation name is the name of the implementation class.
+
@param impl_class
implementation class
@param supported_services
@@ -62,7 +86,8 @@ public class Factory
Class impl_class, String supported_services [] )
throws com.sun.star.uno.RuntimeException
{
- return new Factory( impl_class, supported_services );
+ return createComponentFactory(
+ impl_class, impl_class.getName(), supported_services );
}
/** Writes component's implementation info to given registry key.
@@ -106,11 +131,10 @@ public class Factory
private java.lang.reflect.Method m_method;
private java.lang.reflect.Constructor m_ctor;
- // ctor
- private Factory( Class impl_class, String supported_services [] )
- throws com.sun.star.uno.RuntimeException
+ private Factory(
+ Class impl_class, String impl_name, String supported_services [] )
{
- m_impl_name = impl_class.getName();
+ m_impl_name = impl_name;
m_supported_services = supported_services;
m_impl_class = impl_class;
m_method = null;
diff --git a/javaunohelper/prj/build.lst b/javaunohelper/prj/build.lst
index c18dd3eb9..d97a6450d 100644
--- a/javaunohelper/prj/build.lst
+++ b/javaunohelper/prj/build.lst
@@ -1,4 +1,4 @@
-jh javaunohelper : bridges cppuhelper jurt ridljar unoil NULL
+jh javaunohelper : LIBXSLT:libxslt bridges cppuhelper jurt ridljar unoil NULL
jh javaunohelper usr1 - all jh_mkout NULL
jh javaunohelper\inc nmake - all jh_inc NULL
jh javaunohelper\com\sun\star\comp\helper nmake - all jh_helper jh_inc NULL
diff --git a/javaunohelper/prj/d.lst b/javaunohelper/prj/d.lst
index 1fbd9c223..d58290843 100644
--- a/javaunohelper/prj/d.lst
+++ b/javaunohelper/prj/d.lst
@@ -2,5 +2,6 @@
..\%__SRC%\bin\juh*.dll %_DEST%\bin%_EXT%\juh*.dll
..\%__SRC%\lib\libjuh*.so %_DEST%\lib%_EXT%\libjuh*.so
..\%__SRC%\lib\libjuh*.dylib %_DEST%\lib%_EXT%\libjuh*.dylib
+..\%__SRC%\misc\juh.component %_DEST%\xml%_EXT%\juh.component
..\%__SRC%\bin\juh_src.zip %COMMON_DEST%\bin%_EXT%\juh_src.zip
diff --git a/javaunohelper/util/juh.component b/javaunohelper/util/juh.component
new file mode 100644
index 000000000..790a2a2b1
--- /dev/null
+++ b/javaunohelper/util/juh.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.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.juhtest.SmoketestCommandEnvironment">
+ <service name="com.sun.star.deployment.test.SmoketestCommandEnvironment"/>
+ </implementation>
+</component>
diff --git a/javaunohelper/util/makefile.mk b/javaunohelper/util/makefile.mk
index 22b3a72be..796280eb3 100644
--- a/javaunohelper/util/makefile.mk
+++ b/javaunohelper/util/makefile.mk
@@ -50,4 +50,9 @@ ZIP1LIST=com -x "*makefile.mk"
.INCLUDE : target.mk
+ALLTAR : $(MISC)/juh.component
+$(MISC)/juh.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ juh.component
+ $(XSLTPROC) --nonet --stringparam uri '$(COMPONENTPREFIX_URE_JAVA)juh.jar' \
+ -o $@ $(SOLARENV)/bin/createcomponent.xslt juh.component
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
index 89174467a..23516fef0 100644
--- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
+++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
@@ -92,18 +92,6 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey);
- }
/**
* Creates a remote bridge and memorizes it under <code>sName</code>.
diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java
index 2539bb528..1b0cf9c6e 100644
--- a/jurt/com/sun/star/comp/connections/Acceptor.java
+++ b/jurt/com/sun/star/comp/connections/Acceptor.java
@@ -84,21 +84,6 @@ public final class Acceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(),
- __serviceName, regKey);
- }
-
- /**
* Constructs a new <code>Acceptor</code> that uses the given service
* factory to create a specific <code>XAcceptor</code>.
*
diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java
index 6f0f351e2..3e0c38aed 100644
--- a/jurt/com/sun/star/comp/connections/Connector.java
+++ b/jurt/com/sun/star/comp/connections/Connector.java
@@ -84,21 +84,6 @@ public class Connector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(),
- __serviceName, regKey);
- }
-
- /**
* Constructs a new <code>Connector</code> that uses the given service
* factory to create a specific <code>XConnector</code>.
*
diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
index d3e188f3f..ce64cb95d 100644
--- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
+++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java
@@ -84,20 +84,6 @@ public class ConstantInstanceProvider implements XInstanceProvider {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey);
- }
-
-
protected XMultiServiceFactory _serviceManager;
protected String _serviceName;
diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java
index ee772124e..719e24b15 100644
--- a/jurt/com/sun/star/comp/connections/PipedConnection.java
+++ b/jurt/com/sun/star/comp/connections/PipedConnection.java
@@ -84,19 +84,6 @@ public class PipedConnection implements XConnection {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey);
- }
-
/**
* The amount of time in milliseconds, to wait to
diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
index a73b24098..7b8dce558 100644
--- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
+++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java
@@ -154,18 +154,4 @@ public class UrlResolver {
return xSingleServiceFactory;
}
-
- /**
- * Writes the service information into the given registry key.
- * This method is called by the <code>JavaLoader</code>
- * <p>
- * @return returns true if the operation succeeded
- * @param regKey the registryKey
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey);
- }
-
}
-
diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
index f9e2a43bc..63a3fb3a6 100644
--- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java
@@ -84,21 +84,6 @@ public final class pipeAcceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- pipeAcceptor.class.getName(), __serviceName, regKey);
- }
-
- /**
* Accepts a connection request via the described pipe.
*
* <p>This call blocks until a connection has been established.</p>
diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
index 7128a5b3f..2f631a788 100644
--- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
+++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java
@@ -84,21 +84,6 @@ public final class pipeConnector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- pipeConnector.class.getName(), __serviceName, regKey);
- }
-
- /**
* Connects via the described pipe to a waiting server.
*
* <p>The connection description has the following format:
diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
index 930eeecf4..1f64d16c8 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java
@@ -89,21 +89,6 @@ public final class socketAcceptor implements XAcceptor {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- socketAcceptor.class.getName(), __serviceName, regKey);
- }
-
- /**
* Accepts a connection request via the described socket.
*
* <p>This call blocks until a connection has been established.</p>
diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
index 287274356..11ffcb174 100644
--- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java
+++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java
@@ -89,21 +89,6 @@ public final class socketConnector implements XConnector {
}
/**
- * Writes the service information into the given registry key.
- *
- * <p>This method is called by the <code>JavaLoader</code>.</p>
- *
- * @param regKey the registry key.
- * @return <code>true</code> if the operation succeeded.
- *
- * @see com.sun.star.comp.loader.JavaLoader
- */
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(
- socketConnector.class.getName(), __serviceName, regKey);
- }
-
- /**
* Connects via the described socket to a waiting server.
*
* <p>The connection description has the following format:
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java
index 631bda3a1..fd7fefdad 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java
@@ -148,11 +148,22 @@ final class ProxyFactory {
private Object request(String operation, Object[] args) throws Throwable
{
- return requestHandler.sendRequest(oid, type, operation, args);
+ Object res = requestHandler.sendRequest(oid, type, operation, args);
+ // Avoid early finalization of this object, while an invoke ->
+ // request call is still ongoing; as finalize also calls request,
+ // this should fulfil the condition from The Java Language
+ // Specification, 3rd ed., that "if an object's finalizer can result
+ // in synchronization on that object, then that object must be alive
+ // and considered reachable whenever a lock is held on it:"
+ synchronized (this) {
+ ++dummy;
+ }
+ return res;
}
private final String oid;
private final Type type;
+ private int dummy = 0;
}
private static final Method METHOD_EQUALS;
diff --git a/jurt/prj/d.lst b/jurt/prj/d.lst
index 848435f61..74f5b60d7 100644
--- a/jurt/prj/d.lst
+++ b/jurt/prj/d.lst
@@ -3,5 +3,6 @@
..\%__SRC%\bin\jpipx.dll %_DEST%\bin%_EXT%\jpipx.dll
..\%__SRC%\lib\libjpipe*.so %_DEST%\lib%_EXT%\libjpipe*.so
..\%__SRC%\lib\libjpipe*.dylib %_DEST%\lib%_EXT%\libjpipe*.dylib
+..\%__SRC%\lib\libjpipe*.jnilib %_DEST%\lib%_EXT%\libjpipe*.jnilib
..\%__SRC%\bin\jurt_src.zip %COMMON_DEST%\bin%_EXT%\jurt_src.zip
diff --git a/jurt/source/pipe/makefile.mk b/jurt/source/pipe/makefile.mk
index 5be6f1ebf..4a6dc59c8 100644
--- a/jurt/source/pipe/makefile.mk
+++ b/jurt/source/pipe/makefile.mk
@@ -41,6 +41,7 @@ SHL1TARGET = jpipe
.END
SHL1CODETYPE = C
+SHL1CREATEJNILIB=TRUE
SHL1IMPLIB = i$(SHL1TARGET)
SHL1OBJS = $(SLO)/com_sun_star_lib_connections_pipe_PipeConnection.obj
SHL1RPATH = URELIB
diff --git a/jvmaccess/util/cc5_solaris_sparc.map b/jvmaccess/util/cc5_solaris_sparc.map
index 307229033..09d7ba756 100644
--- a/jvmaccess/util/cc5_solaris_sparc.map
+++ b/jvmaccess/util/cc5_solaris_sparc.map
@@ -25,7 +25,7 @@
#
#*************************************************************************
-UDK_3_0_0 {
+UDK_3.1 {
global:
# jvmaccess/virtualmachine.hxx:
__1cJjvmaccessOVirtualMachineLAttachGuardRCreationException2t6M_v_; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
@@ -52,7 +52,7 @@ UDK_3.2 {
__1cJjvmaccesscQ__RTTI__1CpnJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException *
__1cJjvmaccesscR__RTTI__1CpknJjvmaccessOVirtualMachineLAttachGuardRCreationException__; # RTTI for jvmaccess::VirtualMachine::AttachGuard::CreationException const *
__1cJjvmaccessOVirtualMachine2t5B6MpnHJavaVM__ibpnHJNIEnv___v_; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *) #Nvariant 1
-} UDK_3_0_0;
+} UDK_3.1;
UDK_3.3 {
global:
diff --git a/jvmaccess/util/gcc3.map b/jvmaccess/util/gcc3.map
index 2a888d9c2..6702986aa 100644
--- a/jvmaccess/util/gcc3.map
+++ b/jvmaccess/util/gcc3.map
@@ -25,7 +25,7 @@
#
#*************************************************************************
-UDK_3_0_0 {
+UDK_3.1 {
global:
# jvmaccess/virtualmachine.hxx:
_ZN9jvmaccess14VirtualMachine11AttachGuard17CreationExceptionC1Ev; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
@@ -59,7 +59,7 @@ UDK_3.2 {
# We put the '*' at the beginning because its unlikely that these symbols will ever be a postfix of another symbol.
_*ZN9jvmaccess14VirtualMachineC1EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
_*ZN9jvmaccess14VirtualMachineC2EP10_Jv_JavaVMibP10_Jv_JNIEnv; # jvmaccess::VirtualMachine::VirtualMachine(JavaVM *, int, bool, JNIEnv *)
-} UDK_3_0_0;
+} UDK_3.1;
UDK_3.3 {
global:
diff --git a/jvmaccess/util/msvc_win32_intel.map b/jvmaccess/util/msvc_win32_intel.map
index 4620b1caa..fd148b189 100644
--- a/jvmaccess/util/msvc_win32_intel.map
+++ b/jvmaccess/util/msvc_win32_intel.map
@@ -1,4 +1,4 @@
-UDK_3_0_0 {
+UDK_3.1 {
global:
# jvmaccess/virtualmachine.hxx:
??0CreationException@AttachGuard@VirtualMachine@jvmaccess@@QAE@XZ; # jvmaccess::VirtualMachine::AttachGuard::CreationException::CreationException()
@@ -15,7 +15,7 @@ UDK_3_0_0 {
UDK_3.2 {
global:
-} UDK_3_0_0;
+} UDK_3.1;
UDK_3.3 {
global:
diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h
index 00c2b0fe5..30e5bdc0f 100644
--- a/jvmfwk/inc/jvmfwk/framework.h
+++ b/jvmfwk/inc/jvmfwk/framework.h
@@ -830,6 +830,7 @@ javaFrameworkError SAL_CALL jfw_getJRELocations(
JFW_E_NONE the function ran successfully.</br>
JFW_E_ERROR an error occurred during execution.</br>
JFW_E_INVALID_ARG pInfo contains invalid data</br>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
*/
javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
diff --git a/jvmfwk/inc/jvmfwk/vendorplugin.h b/jvmfwk/inc/jvmfwk/vendorplugin.h
index 3df1a98b9..7844ee433 100644
--- a/jvmfwk/inc/jvmfwk/vendorplugin.h
+++ b/jvmfwk/inc/jvmfwk/vendorplugin.h
@@ -238,6 +238,25 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
+/** checks if the installation of the jre still exists.
+
+ This function checks if the JRE described by pInfo still
+ exists. The check must be very quick because it is called by javaldx
+ (Linux, Solaris) at start up.
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param pp_exist
+ [out] the parameter is set to either sal_True or sal_False. The value is
+ only valid if the function returns JFW_E_NONE.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG pInfo contains invalid data</br>
+ */
+javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+
#ifdef __cplusplus
}
#endif
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
index 352c13c3c..c21fbff6d 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx
@@ -73,7 +73,7 @@ char const* const* OtherInfo::getRuntimePaths(int * size)
"/bin/hotspot/jvm.dll"
#elif UNX
#ifdef MACOSX
- "/../../../JavaVM"
+ "/../../../../../Frameworks/JavaVM.framework/JavaVM" //as of 1.6.0_22
#else
"/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", // for Blackdown PPC
"/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so", // for Blackdown AMD64
@@ -95,8 +95,7 @@ char const* const* OtherInfo::getLibraryPaths(int* size)
#ifdef UNX
static char const * ar[] = {
#ifdef MACOSX
- "/../Libraries",
- "/lib"
+ //mac version does not have a ld library path anymore
#else
"/bin",
"/jre/bin",
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index 1165e5080..23a380c89 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -470,10 +470,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
{
JFW_ENSURE(0, OUSTR("[Java framework]sunjavaplugin" SAL_DLLEXTENSION
" could not load Java runtime library: \n")
- + sRuntimeLib + OUSTR("."));
+ + sRuntimeLib + OUSTR("\n"));
JFW_TRACE0(OUSTR("[Java framework]sunjavaplugin" SAL_DLLEXTENSION
" could not load Java runtime library: \n")
- + sRuntimeLib + OUSTR("."));
+ + sRuntimeLib + OUSTR("\n"));
return JFW_PLUGIN_E_VM_CREATION_FAILED;
}
@@ -614,5 +614,63 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
return errcode;
}
+extern "C"
+javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
+{
+ javaPluginError ret = JFW_PLUGIN_E_NONE;
+ if (!pInfo || !exist)
+ return JFW_PLUGIN_E_INVALID_ARG;
+ ::rtl::OUString sLocation(pInfo->sLocation);
+
+ if (sLocation.getLength() == 0)
+ return JFW_PLUGIN_E_INVALID_ARG;
+ ::osl::DirectoryItem item;
+ ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item);
+ if (::osl::File::E_None == rc_item)
+ {
+ *exist = sal_True;
+ }
+ else if (::osl::File::E_NOENT == rc_item)
+ {
+ *exist = sal_False;
+ }
+ else
+ {
+ ret = JFW_PLUGIN_E_ERROR;
+ }
+#ifdef MACOSX
+ //We can have the situation that the JavaVM runtime library is not
+ //contained within JAVA_HOME. Then the check for JAVA_HOME would return
+ //true although the runtime library may not be loadable.
+ if (ret == JFW_PLUGIN_E_NONE && *exist == sal_True)
+ {
+ rtl::OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
+ JFW_TRACE2(OUSTR("[Java framework] Checking existence of Java runtime library.\n"));
+
+ ::osl::DirectoryItem itemRt;
+ ::osl::File::RC rc_itemRt = ::osl::DirectoryItem::get(sRuntimeLib, itemRt);
+ if (::osl::File::E_None == rc_itemRt)
+ {
+ *exist = sal_True;
+ JFW_TRACE2(OUSTR("[Java framework] Java runtime library exist: ")
+ + sRuntimeLib + OUSTR("\n"));
+
+ }
+ else if (::osl::File::E_NOENT == rc_itemRt)
+ {
+ *exist = sal_False;
+ JFW_TRACE2(OUSTR("[Java framework] Java runtime library does not exist: ")
+ + sRuntimeLib + OUSTR("\n"));
+ }
+ else
+ {
+ ret = JFW_PLUGIN_E_ERROR;
+ JFW_TRACE2(OUSTR("[Java framework] Error while looking for Java runtime library: ")
+ + sRuntimeLib + OUSTR(" \n"));
+ }
+ }
+#endif
+ return ret;
+}
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map
index db75c9611..c08817d69 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map
@@ -6,3 +6,8 @@ UDK_3_0_0 {
local:
*;
};
+
+UDK_3.1 { # OOo 3.3
+ global:
+ jfw_plugin_existJRE;
+} UDK_3_0_0;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
index 215e1f04d..41900777e 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
@@ -418,9 +418,9 @@ SelfTest::SelfTest()
break;
}
if (bRet)
- JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.");
+ JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.\n");
else
- OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed");
+ OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed.\n");
}
#endif
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 4ae83e579..b0c94c4de 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -450,12 +450,12 @@ bool getJavaProps(const OUString & exePath,
rs = stdoutReader.readLine( & aLine);
if (rs != FileHandleReader::RESULT_OK)
break;
- JFW_TRACE2(OString("[Java framework] line:\" ")
- + aLine + OString(" \".\n"));
+// JFW_TRACE2(OString("[Java framework] line:\" ")
+// + aLine + OString(" \".\n"));
OUString sLine;
if (!decodeOutput(aLine, &sLine))
continue;
- JFW_TRACE2(OString("[Java framework] line:\" ")
+ JFW_TRACE2(OString("[Java framework]:\" ")
+ OString( CHAR_POINTER(sLine)) + OString(" \".\n"));
sLine = sLine.trim();
if (sLine.getLength() == 0)
@@ -509,7 +509,7 @@ bool decodeOutput(const rtl::OString& s, rtl::OUString* out)
} while (nIndex >= 0);
*out = buff.makeStringAndClear();
- JFW_TRACE2(*out);
+// JFW_TRACE2(*out);
return true;
}
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index e597a6d93..fb70fb5b9 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -974,6 +974,16 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo)
pDoc, cur->children, 1);
rtl::OUString sRequire = xmlRequire;
nRequirements = sRequire.toInt64(16);
+#ifdef MACOSX
+ //javaldx is not used anymore in the mac build. In case the Java
+ //corresponding to the saved settings does not exist anymore the
+ //javavm services will look for an existing Java after creation of
+ //the JVM failed. See stoc/source/javavm/javavm.cxx. Only if
+ //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the
+ //jvm of the new selected JRE will be started. Old settings (before
+ //OOo 3.3) still contain the flag which can be safely ignored.
+ nRequirements &= ~JFW_REQUIRE_NEEDRESTART;
+#endif
}
else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0)
{
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index ee8378e78..1f9bb76db 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -1114,29 +1114,39 @@ javaFrameworkError SAL_CALL jfw_getJRELocations(
javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
{
- javaFrameworkError ret = JFW_E_NONE;
- if (!pInfo || !exist)
- return JFW_E_INVALID_ARG;
- ::rtl::OUString sLocation(pInfo->sLocation);
-
- if (sLocation.getLength() == 0)
- return JFW_E_INVALID_ARG;
+ //get the function jfw_plugin_existJRE
+ jfw::VendorSettings aVendorSettings;
+ jfw::CJavaInfo aInfo;
+ aInfo = (const ::JavaInfo*) pInfo; //makes a copy of pInfo
+ rtl::OUString sLibPath = aVendorSettings.getPluginLibrary(aInfo.getVendor());
+ osl::Module modulePlugin(sLibPath);
+ if ( ! modulePlugin)
+ return JFW_E_NO_PLUGIN;
+ rtl::OUString sFunctionName(
+ RTL_CONSTASCII_USTRINGPARAM("jfw_plugin_existJRE"));
+ jfw_plugin_existJRE_ptr pFunc =
+ (jfw_plugin_existJRE_ptr)
+ osl_getFunctionSymbol(modulePlugin, sFunctionName.pData);
+ if (pFunc == NULL)
+ return JFW_E_ERROR;
+
+ javaPluginError plerr = (*pFunc)(pInfo, exist);
- ::osl::DirectoryItem item;
- ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item);
- if (::osl::File::E_None == rc_item)
- {
- *exist = sal_True;
- }
- else if (::osl::File::E_NOENT == rc_item)
- {
- *exist = sal_False;
- }
- else
+ javaFrameworkError ret = JFW_E_NONE;
+ switch (plerr)
{
+ case JFW_PLUGIN_E_NONE:
+ ret = JFW_E_NONE;
+ break;
+ case JFW_PLUGIN_E_INVALID_ARG:
+ ret = JFW_E_INVALID_ARG;
+ break;
+ case JFW_PLUGIN_E_ERROR:
+ ret = JFW_E_ERROR;
+ break;
+ default:
ret = JFW_E_ERROR;
}
-
return ret;
}
diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx
index 740c52391..91a3aa257 100644
--- a/jvmfwk/source/framework.hxx
+++ b/jvmfwk/source/framework.hxx
@@ -64,6 +64,10 @@ typedef javaPluginError (*jfw_plugin_startJavaVirtualMachine_ptr)(
JavaVM ** ppVM,
JNIEnv ** ppEnv);
+typedef javaPluginError (*jfw_plugin_existJRE_ptr)(
+ const JavaInfo *info,
+ sal_Bool *exist);
+
namespace jfw
{
diff --git a/offapi/com/sun/star/awt/XDialog2.idl b/offapi/com/sun/star/awt/XDialog2.idl
index 83d4ca85b..6237a7f3b 100644
--- a/offapi/com/sun/star/awt/XDialog2.idl
+++ b/offapi/com/sun/star/awt/XDialog2.idl
@@ -25,7 +25,7 @@ interface XDialog2: com::sun::star::awt::XDialog
/** sets the help id so that the standard help button action will
show the appropriate help page.
*/
- void setHelpId ( [in] long Id );
+ void setHelpId ( [in] string Id );
};
//=============================================================================
diff --git a/offapi/com/sun/star/deployment/XPackage.idl b/offapi/com/sun/star/deployment/XPackage.idl
index 920b27426..f93c8de99 100644..100755
--- a/offapi/com/sun/star/deployment/XPackage.idl
+++ b/offapi/com/sun/star/deployment/XPackage.idl
@@ -262,6 +262,14 @@ interface XPackage
string getDescription()
raises (ExtensionRemovedException);
+ /** returns a string containing the license text.
+
+ @return
+ license
+ */
+ string getLicenseText()
+ raises (ExtensionRemovedException);
+
/** returns a sequence of update information URLs.
The sequence may be empty in case no update information is available.
diff --git a/offapi/com/sun/star/document/MediaDescriptor.idl b/offapi/com/sun/star/document/MediaDescriptor.idl
index 1daed7b0d..7a5808de5 100644
--- a/offapi/com/sun/star/document/MediaDescriptor.idl
+++ b/offapi/com/sun/star/document/MediaDescriptor.idl
@@ -39,6 +39,10 @@
#include <com/sun/star/awt/Rectangle.idl>
#endif
+#ifndef __com_sun_star_beans_NamedValue_idl__
+#include <com/sun/star/beans/NamedValue.idl>
+#endif
+
#ifndef __com_sun_star_util_URL_idl__
#include <com/sun/star/util/URL.idl>
#endif
@@ -144,7 +148,7 @@ published service MediaDescriptor
<p>
For extensibility, it is recommended to use values of type
- sequence<com.sun.star.beans.PropertyValue> with this property.
+ sequence<com.sun.star.beans.NamedValue> with this property.
</p>
*/
[optional,property] any ComponentData;
@@ -164,6 +168,23 @@ published service MediaDescriptor
[optional,property] string DocumentTitle;
//-------------------------------------------------------------------------
+ /** encryption information for encryption/decryption of documents
+
+ <p>
+ It contains the necessary information for encryption/decryption of
+ a component (if necessary).
+ If neither password nor encryption data is specified, loading of
+ a password protected document will fail, storing will be done without
+ encryption. If both are provided, the encryption data is used
+ ( if the filter supports it ).
+ </p>
+ <p>
+ The encryption data is generated based on the password.
+ </p>
+ */
+ [optional,property] sequence< ::com::sun::star::beans::NamedValue > EncryptionData;
+
+ //-------------------------------------------------------------------------
/** same as <member>MediaDescriptor::URL</member>
<p>
@@ -365,9 +386,11 @@ published service MediaDescriptor
/** pasword for loading storing documents
<p>
- It caontains a password for loading or storing a component (if necessary).
- If no password is specified, loading of a password protected document
- will fail, storing will be done without encryption.
+ It contains a password for loading or storing a component (if necessary).
+ If neither password nor encryption data is specified, loading of
+ a password protected document will fail, storing will be done without
+ encryption. If both are provided, the encryption data is used
+ ( if the filter supports it ).
</p>
*/
[optional,property] string Password;
diff --git a/offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl b/offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl
new file mode 100644
index 000000000..3c5fcf7f0
--- /dev/null
+++ b/offapi/com/sun/star/embed/XEncryptionProtectedSource2.idl
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * 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 __com_sun_star_embed_XEncryptionProtectedSource2_idl__
+#define __com_sun_star_embed_XEncryptionProtectedSource2_idl__
+
+#ifndef __com_sun_star_embed_XEncryptionProtectedSource_idl__
+#include <com/sun/star/embed/XEncryptionProtectedSource.idl>
+#endif
+
+#ifndef __com_sun_star_beans_NamedValue_idl__
+#include <com/sun/star/beans/NamedValue.idl>
+#endif
+
+//============================================================================
+
+module com { module sun { module star { module embed {
+
+//============================================================================
+/** This interface allows to set a password for an object.
+ */
+published interface XEncryptionProtectedSource2: XEncryptionProtectedSource
+{
+ // -----------------------------------------------------------------------
+ /** sets an encryption data for the object.
+
+ @param aEncryptionData
+ the new encryption data
+
+ @throws ::com::sun::star::io::IOException
+ in case the data could not be set
+ */
+ void setEncryptionData( [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData )
+ raises( ::com::sun::star::io::IOException );
+};
+
+//============================================================================
+
+}; }; }; };
+
+#endif
+
diff --git a/offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl b/offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl
new file mode 100644
index 000000000..1fa9f3906
--- /dev/null
+++ b/offapi/com/sun/star/embed/XHierarchicalStorageAccess2.idl
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * 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 __com_sun_star_embed_XHierarchicalStorageAccess2_idl__
+#define __com_sun_star_embed_XHierarchicalStorageAccess2_idl__
+
+#ifndef __com_sun_star_embed_XHierarchicalStorageAccess_idl__
+#include <com/sun/star/embed/XHierarchicalStorageAccess.idl>
+#endif
+
+#ifndef __com_sun_star_beans_NamedValue_idl__
+#include <com/sun/star/beans/NamedValue.idl>
+#endif
+
+//============================================================================
+
+ module com { module sun { module star { module embed {
+
+//============================================================================
+/** This interface extends XHierarchicalStorageAccess interface.
+ */
+interface XHierarchicalStorageAccess2 : XHierarchicalStorageAccess
+{
+ // -----------------------------------------------------------------------
+ /** allows to get access to a child encrypted stream with encryption data
+ using hierarchical path.
+
+ <p>
+ If storage does not allow any encryption this method will always throw
+ <type scope="com::sun::star::packages">NoEncryptionException</type>.
+ </p>
+
+ <p>
+ In case the stream is open in readonly mode the
+ <method scope="com::sun::star::io">XStream::getOutputStream</method>
+ method will return an empty reference.
+ </p>
+
+ @param sStreamPath
+ the path to the substream that should be open
+
+ @param nOpenMode
+ a mode the stream should be open in,
+ can be a combination of <type>ElementModes</type> values
+
+ @param aEncryptionData
+ this parameter allowes to specify an encryption data for the
+ stream, the data must be correct, otherwise an
+ exception will be thrown
+
+ @throws ::com::sun::star::embed::InvalidStorageException
+ this storage is in invalid state for any reason
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ one of provided arguments is illegal
+
+ @throws ::com::sun::star::packages::NoEncryptionException
+ the stream is not encrypted
+
+ @throws ::com::sun::star::packages::WrongPasswordException
+ the provided password is wrong
+
+ @throws ::com::sun::star::io::IOException
+ in case of io errors during stream opening
+
+ @throws ::com::sun::star::embed::StorageWrappedTargetException
+ wraps other exceptions
+ */
+ XExtendedStorageStream openEncryptedStreamByHierarchicalName(
+ [in] string sStreamName,
+ [in] long nOpenMode,
+ [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData )
+ raises( ::com::sun::star::embed::InvalidStorageException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::packages::NoEncryptionException,
+ ::com::sun::star::packages::WrongPasswordException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::embed::StorageWrappedTargetException );
+};
+
+//============================================================================
+
+}; }; }; };
+
+#endif
+
diff --git a/offapi/com/sun/star/embed/XStorage2.idl b/offapi/com/sun/star/embed/XStorage2.idl
new file mode 100644
index 000000000..3a9ccce34
--- /dev/null
+++ b/offapi/com/sun/star/embed/XStorage2.idl
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * 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 __com_sun_star_embed_XStorage2_idl__
+#define __com_sun_star_embed_XStorage2_idl__
+
+#ifndef __com_sun_star_embed_XStorage_idl__
+#include <com/sun/star/embed/XStorage.idl>
+#endif
+
+#ifndef __com_sun_star_beans_NamedValue_idl__
+#include <com/sun/star/beans/NamedValue.idl>
+#endif
+
+
+//============================================================================
+
+ module com { module sun { module star { module embed {
+
+//============================================================================
+/** This interface extends the base XStorage interface.
+ */
+interface XStorage2 : XStorage
+{
+ // -----------------------------------------------------------------------
+ /** allows to get access to a child encrypted stream with EncryptionData.
+
+ <p>
+ If storage does not allow any encryption this method will always throw
+ <type scope="com::sun::star::packages">NoEncryptionException</type>.
+ </p>
+
+ <p>
+ In case the stream is open in readonly mode the
+ <method scope="com::sun::star::io">XStream::getOutputStream</method>
+ method will return an empty reference.
+ </p>
+
+ @param sStreamName
+ the name of the substream that should be open
+
+ @param nOpenMode
+ a mode the stream should be open in,
+ can be a combination of <type>ElementModes</type> values
+
+ @param aEncryptionData
+ this parameter allowes to specify an encryption data to decrypt the
+ stream, the encryption data must be correct, otherwise an
+ exception will be thrown
+
+ @throws ::com::sun::star::embed::InvalidStorageException
+ this storage is in invalid state for any reason
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ one of provided arguments is illegal
+
+ @throws ::com::sun::star::packages::NoEncryptionException
+ the stream is not encrypted
+
+ @throws ::com::sun::star::packages::WrongPasswordException
+ the provided encryption data is wrong
+
+ @throws ::com::sun::star::io::IOException
+ in case of io errors during stream opening
+
+ @throws ::com::sun::star::embed::StorageWrappedTargetException
+ wraps other exceptions
+ */
+ ::com::sun::star::io::XStream openEncryptedStream(
+ [in] string sStreamName,
+ [in] long nOpenMode,
+ [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData )
+ raises( ::com::sun::star::embed::InvalidStorageException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::packages::NoEncryptionException,
+ ::com::sun::star::packages::WrongPasswordException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::embed::StorageWrappedTargetException );
+
+ // -----------------------------------------------------------------------
+ /** allows to get readonly copy of a child encrypted stream with encryption
+ data.
+
+ <p>
+ If storage does not allow any encryption this method will always throw
+ <type scope="com::sun::star::packages">NoEncryptionException</type>.
+ </p>
+
+ <p>
+ The stream is open in readonly mode so the
+ <method scope="com::sun::star::io">XStream::getOutputStream</method>
+ method will return an empty reference.
+ </p>
+
+ <p>
+ This method allows to specify encryption data for the child stream
+ explicitly.
+ </p>
+
+ @param sStreamName
+ the name of the substream that should be copied
+
+ @param aEncryptionData
+ this parameter allowes to specify an encryption data for the
+ stream, the encryption data must be correct, otherwise an
+ exception will be thrown
+
+ @throws ::com::sun::star::embed::InvalidStorageException
+ this storage is in invalid state for any reason
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ one of provided arguments is illegal
+
+ @throws ::com::sun::star::packages::NoEncryptionException
+ the stream is not encrypted
+
+ @throws ::com::sun::star::packages::WrongPasswordException
+ the provided encryption data is wrong
+
+ @throws ::com::sun::star::io::IOException
+ in case of io errors during stream opening
+
+ @throws ::com::sun::star::embed::StorageWrappedTargetException
+ wraps other exceptions
+ */
+ ::com::sun::star::io::XStream cloneEncryptedStream(
+ [in] string sStreamName,
+ [in] sequence< ::com::sun::star::beans::NamedValue > aEncryptionData )
+ raises( ::com::sun::star::embed::InvalidStorageException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::packages::NoEncryptionException,
+ ::com::sun::star::packages::WrongPasswordException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::embed::StorageWrappedTargetException );
+};
+
+//============================================================================
+
+}; }; }; };
+
+#endif
+
diff --git a/offapi/com/sun/star/embed/makefile.mk b/offapi/com/sun/star/embed/makefile.mk
index 349017452..8ee156af4 100644
--- a/offapi/com/sun/star/embed/makefile.mk
+++ b/offapi/com/sun/star/embed/makefile.mk
@@ -77,6 +77,7 @@ IDLFILES=\
XLinkCreator.idl\
XLinkFactory.idl\
XEncryptionProtectedSource.idl\
+ XEncryptionProtectedSource2.idl\
XInplaceClient.idl\
XInsertObjectDialog.idl\
XWindowSupplier.idl\
@@ -89,9 +90,11 @@ IDLFILES=\
XTransferableSupplier.idl\
XComponentSupplier.idl\
XStorage.idl\
+ XStorage2.idl\
XStorageRawAccess.idl\
XExtendedStorageStream.idl\
XHierarchicalStorageAccess.idl\
+ XHierarchicalStorageAccess2.idl\
XHatchWindowController.idl\
XHatchWindowFactory.idl\
XHatchWindow.idl\
diff --git a/offapi/com/sun/star/formula/FormulaProperties.idl b/offapi/com/sun/star/formula/FormulaProperties.idl
index 6f7b82794..3c03a88ee 100644
--- a/offapi/com/sun/star/formula/FormulaProperties.idl
+++ b/offapi/com/sun/star/formula/FormulaProperties.idl
@@ -338,6 +338,14 @@ published service FormulaProperties
/** contains the metric value of the right margin of the formula.
*/
[property] short RightMargin;
+
+ //-------------------------------------------------------------------------
+
+ /** contains the baselines offset in respect to the top of the formula rectangle
+
+ @since OOo 3.4
+ */
+ [property, optional] short BaseLine;
};
//=============================================================================
diff --git a/offapi/com/sun/star/inspection/LineDescriptor.idl b/offapi/com/sun/star/inspection/LineDescriptor.idl
index fc300d041..7787ea77a 100644
--- a/offapi/com/sun/star/inspection/LineDescriptor.idl
+++ b/offapi/com/sun/star/inspection/LineDescriptor.idl
@@ -94,7 +94,7 @@ struct LineDescriptor
<p>If a primary button exists for a property's UI representation (<member>HasPrimaryButton</member>),
it gets the ID specified herein.</p>
*/
- long PrimaryButtonId;
+ string PrimaryButtonId;
/** describes the URL of an image to display on the primary button, if any.
@@ -139,7 +139,7 @@ struct LineDescriptor
@see PrimaryButtonId
*/
- long SecondaryButtonId;
+ string SecondaryButtonId;
/** describes the URL of an image to display on the secondary button, if any.
diff --git a/offapi/com/sun/star/script/ModuleInfo.idl b/offapi/com/sun/star/script/ModuleInfo.idl
index 0a35328ba..307627b1c 100644
--- a/offapi/com/sun/star/script/ModuleInfo.idl
+++ b/offapi/com/sun/star/script/ModuleInfo.idl
@@ -1,35 +1,27 @@
/*************************************************************************
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
- * $RCSfile: ModuleInfo.idl,v $
+ * OpenOffice.org - a multi-platform office productivity suite
*
- * $Revision: 1.2 $
+ * This file is part of OpenOffice.org.
*
- * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
+ * 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.
*
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
+ * 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).
*
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * 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.
*
************************************************************************/
diff --git a/offapi/com/sun/star/script/ModuleType.idl b/offapi/com/sun/star/script/ModuleType.idl
index 32c90d9d8..b10d0bca0 100644
--- a/offapi/com/sun/star/script/ModuleType.idl
+++ b/offapi/com/sun/star/script/ModuleType.idl
@@ -1,35 +1,27 @@
/*************************************************************************
*
- * OpenOffice.org - a multi-platform office productivity suite
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
- * $RCSfile: ModuleType.idl,v $
+ * OpenOffice.org - a multi-platform office productivity suite
*
- * $Revision: 1.2 $
+ * This file is part of OpenOffice.org.
*
- * last change: $Author: rt $ $Date: 2006/05/05 10:14:46 $
+ * 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.
*
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
+ * 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).
*
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * 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.
*
************************************************************************/
diff --git a/offapi/com/sun/star/script/NativeObjectWrapper.idl b/offapi/com/sun/star/script/NativeObjectWrapper.idl
new file mode 100755
index 000000000..7048e312a
--- /dev/null
+++ b/offapi/com/sun/star/script/NativeObjectWrapper.idl
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * 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 __com_sun_star_script_NativeObjectWrapper_idl__
+#define __com_sun_star_script_NativeObjectWrapper_idl__
+
+//=============================================================================
+module com { module sun { module star { module script {
+struct NativeObjectWrapper
+{
+ any ObjectId;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/script/makefile.mk b/offapi/com/sun/star/script/makefile.mk
index da8e9110d..9c0a38fa4 100644
--- a/offapi/com/sun/star/script/makefile.mk
+++ b/offapi/com/sun/star/script/makefile.mk
@@ -50,7 +50,8 @@ IDLFILES=\
XStorageBasedLibraryContainer.idl\
ModuleSizeExceededRequest.idl\
ModuleInfo.idl\
- ModuleType.idl
+ ModuleType.idl\
+ NativeObjectWrapper.idl
# ------------------------------------------------------------------
diff --git a/offapi/com/sun/star/task/PDFExportException.idl b/offapi/com/sun/star/task/PDFExportException.idl
new file mode 100644
index 000000000..de8b4561a
--- /dev/null
+++ b/offapi/com/sun/star/task/PDFExportException.idl
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * 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 __com_sun_star_task_PDFExportException_idl__
+#define __com_sun_star_task_PDFExportException_idl__
+
+#ifndef __com_sun_star_uno_Exception_idl__
+#include <com/sun/star/uno/Exception.idl>
+#endif
+
+ module com { module sun { module star { module task {
+
+
+/** is an exception that provides information on an error during PDF export.
+ */
+published exception PDFExportException: com::sun::star::uno::Exception
+{
+ /** contains a number of errors that occured during PDFExport
+ */
+ sequence< long > ErrorCodes;
+};
+
+//=============================================================================
+
+}; }; }; };
+
+/*===========================================================================
+===========================================================================*/
+#endif
diff --git a/offapi/com/sun/star/task/makefile.mk b/offapi/com/sun/star/task/makefile.mk
index 16b0be56e..cd9db6b5a 100755..100644
--- a/offapi/com/sun/star/task/makefile.mk
+++ b/offapi/com/sun/star/task/makefile.mk
@@ -59,6 +59,7 @@ IDLFILES=\
PasswordContainerInteractionHandler.idl\
PasswordRequest.idl\
PasswordRequestMode.idl\
+ PDFExportException.idl\
OfficeRestartManager.idl\
UnsupportedOverwriteRequest.idl\
UrlRecord.idl\
diff --git a/offapi/com/sun/star/text/DocumentSettings.idl b/offapi/com/sun/star/text/DocumentSettings.idl
index a33b372fe..99921e6e2 100644
--- a/offapi/com/sun/star/text/DocumentSettings.idl
+++ b/offapi/com/sun/star/text/DocumentSettings.idl
@@ -195,10 +195,20 @@ published service DocumentSettings
*/
[optional, property] boolean ConsiderTextWrapOnObjPos;
+ // ------------------------------------------------------------
+ /** specifies if Math objects should automatically vertically aligned to
+ match the baseline of the surrounding text.
+
+ <p>If activated formula object that are anchored 'As Character' will be
+ vertically aligned to have their baseline match with the one from the text.</p>
+
+ @since OOo 3.4
+ */
+ [optional, property] boolean MathBaselineAlignment;
};
//=============================================================================
}; }; }; };
-#endif
+#endif \ No newline at end of file
diff --git a/offapi/com/sun/star/text/PrintPreviewSettings.idl b/offapi/com/sun/star/text/PrintPreviewSettings.idl
index bec086e30..bd6c61d2f 100644
--- a/offapi/com/sun/star/text/PrintPreviewSettings.idl
+++ b/offapi/com/sun/star/text/PrintPreviewSettings.idl
@@ -39,6 +39,8 @@
//=============================================================================
/** These properties describe the printing of the content of a text document.
+ *
+ * @deprecated since OOo 3.3
*/
published service PrintPreviewSettings
{
diff --git a/offapi/com/sun/star/text/TextMarkupType.idl b/offapi/com/sun/star/text/TextMarkupType.idl
index 5137d47d2..fe631b5c8 100644
--- a/offapi/com/sun/star/text/TextMarkupType.idl
+++ b/offapi/com/sun/star/text/TextMarkupType.idl
@@ -44,27 +44,32 @@ module com { module sun { module star { module text {
constants TextMarkupType
{
- /// Markup originates from spell checking.
+ /** Markup originates from spell checking.
+ */
const long SPELLCHECK = 1;
- /// Markup originates from proofreading
- /// @since OOo 3.0.1
+ /** Markup originates from proofreading
+ @since OOo 3.0.1
+ */
const long PROOFREADING = 2;
- /// Markup originates from smart tag checking.
+ /** Markup originates from smart tag checking.
+ */
const long SMARTTAG = 3;
- /// Markup originates from proofreading
- /// An inivisible markup used to identify sentence boundaries.
- /// @since OOo 3.0.1
+ /** Markup originates from proofreading
+ An inivisible markup type used in proofreading API calls.
+ @since OOo 3.0.1
+ */
const long SENTENCE = 4;
- /// Markups originates from change tracking.
- /// @since OOo 3.3
+ /** Markups originates from change tracking.
+ @since OOo 3.3
+ */
const long TRACK_CHANGE_INSERTION = 5;
const long TRACK_CHANGE_DELETION = 6;
const long TRACK_CHANGE_FORMATCHANGE = 7;
};
}; }; }; };
-#endif
+#endif \ No newline at end of file
diff --git a/offapi/com/sun/star/ui/UIElementType.idl b/offapi/com/sun/star/ui/UIElementType.idl
index f57a17ee7..ea78e5938 100644
--- a/offapi/com/sun/star/ui/UIElementType.idl
+++ b/offapi/com/sun/star/ui/UIElementType.idl
@@ -2,10 +2,13 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
+ * $RCSfile: UIElementType.idl,v $
+ * $Revision: 1.4 $
+ *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -78,6 +81,11 @@ constants UIElementType
const short TOOLPANEL = 7;
//-------------------------------------------------------------------------
+ /** specifies a window that can be docked.
+ */
+ const short DOCKINGWINDOW = 7;
+
+ //-------------------------------------------------------------------------
/** specifies the number of constants.
*/
const short COUNT = 8;
diff --git a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl
index 23d2d013d..2a79d6aff 100644
--- a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl
+++ b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
@@ -52,7 +52,7 @@ module com { module sun { module star { module util {
@since OOo 2.0.0
*/
-service OfficeInstallationDirectories
+published service OfficeInstallationDirectories
{
/** provides access to the current office installation directories (office
base installation and user data).
@@ -67,7 +67,7 @@ service OfficeInstallationDirectories
@see OfficeInstallationDirectories
*/
-singleton theOfficeInstallationDirectories
+published singleton theOfficeInstallationDirectories
{
service com::sun::star::util::OfficeInstallationDirectories;
};
diff --git a/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl b/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl
index 8da92550e..d79d0cffc 100644
--- a/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl
+++ b/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* 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
@@ -47,7 +47,7 @@ module com { module sun { module star { module util {
@since OOo 2.0.0
*/
-interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface
+published interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface
{
//------------------------------------------------------------------------
/** returns the absolute URL containing the directory of the current office
@@ -61,7 +61,8 @@ interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface
//------------------------------------------------------------------------
/** returns the absolute URL containing the directory where the current
- office installation expects its user data (e.g. "file:///home/kso".)
+ office installation expects its user data (e.g.
+ "file:///home/kso/.openoffice.org".)
@returns
the absolute URL containing the directory of the current office
diff --git a/offuh/prj/build.lst b/offuh/prj/build.lst
index f8f8ca45b..e98f3565b 100644
--- a/offuh/prj/build.lst
+++ b/offuh/prj/build.lst
@@ -1,4 +1,4 @@
-ou offuh :: offapi codemaker NULL
+ou offuh :: offapi oovbaapi codemaker NULL
ou offuh usr1 - all ou_mkout NULL
ou offuh\prj get - all ou_prj NULL
ou offuh\source nmake - all ou_source NULL
diff --git a/offuh/prj/d.lst b/offuh/prj/d.lst
index a88257dc6..486c08f1c 100644
--- a/offuh/prj/d.lst
+++ b/offuh/prj/d.lst
@@ -134,6 +134,21 @@ mkdir: %_DEST%\inc%_EXT%\offuh\com\sun\star\xml\wrapper
#i20156 - end
mkdir: %_DEST%\inc%_EXT%\offuh\com\sun\star\rdf
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\access
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\adodb
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\dao
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\excel
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\msforms
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\office
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\powerpoint
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\stdole
+mkdir: %_DEST%\inc%_EXT%\offuh\ooo\vba\word
+mkdir: %_DEST%\inc%_EXT%\offuh\msforms
+
+
+
..\%__SRC%\inc\offuh\com\sun\star\auth\*.hdl %_DEST%\inc%_EXT%\offuh\com\sun\star\auth\*.hdl
..\%__SRC%\inc\offuh\com\sun\star\auth\*.hpp %_DEST%\inc%_EXT%\offuh\com\sun\star\auth\*.hpp
..\%__SRC%\inc\offuh\com\sun\star\accessibility\*.hpp %_DEST%\inc%_EXT%\offuh\com\sun\star\accessibility\*.hpp
@@ -377,3 +392,29 @@ mkdir: %_DEST%\inc%_EXT%\offuh\com\sun\star\rdf
..\%__SRC%\inc\offuh\com\sun\star\rdf\*.hpp %_DEST%\inc%_EXT%\offuh\com\sun\star\rdf\*.hpp
..\%__SRC%\inc\offuh\com\sun\star\rdf\*.hdl %_DEST%\inc%_EXT%\offuh\com\sun\star\rdf\*.hdl
+
+..\%__SRC%\inc\offuh\ooo\vba\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\access\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\access\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\access\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\access\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\adodb\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\adodb\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\adodb\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\adodb\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\dao\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\dao\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\dao\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\dao\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\excel\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\excel\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\excel\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\excel\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\msforms\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\msforms\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\msforms\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\msforms\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\office\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\office\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\office\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\office\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\powerpoint\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\powerpoint\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\powerpoint\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\powerpoint\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\stdole\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\stdole\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\stdole\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\stdole\*.hdl
+..\%__SRC%\inc\offuh\ooo\vba\word\*.hpp %_DEST%\inc%_EXT%\offuh\ooo\vba\word\*.hpp
+..\%__SRC%\inc\offuh\ooo\vba\word\*.hdl %_DEST%\inc%_EXT%\offuh\ooo\vba\word\*.hdl
+..\%__SRC%\inc\offuh\msforms\*.hpp %_DEST%\inc%_EXT%\offuh\msforms\*.hpp
+..\%__SRC%\inc\offuh\msforms\*.hdl %_DEST%\inc%_EXT%\offuh\msforms\*.hdl
+
diff --git a/offuh/source/makefile.mk b/offuh/source/makefile.mk
index e773d7ff3..230dc750a 100644
--- a/offuh/source/makefile.mk
+++ b/offuh/source/makefile.mk
@@ -33,12 +33,16 @@ TARGET= offuh
.INCLUDE : settings.mk
-# ------------------------------------------------------------------
+# --- Targets ------------------------------------------------------
+.INCLUDE : target.mk
+
+ALLTAR : $(MISC)$/oovbaapi.don $(MISC)$/$(TARGET).don
$(MISC)$/$(TARGET).don : $(UNOUCRRDB)
@@-$(RM) $@
$(CPPUMAKER) -Gc $(CPPUMAKERFLAGS) -B$(UNOUCRBASE) -O$(UNOUCROUT) $(UNOUCRRDB) && echo > $@
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
+$(MISC)$/oovbaapi.don : $(SOLARBINDIR)$/oovbaapi.rdb
+ @@-$(RM) $@
+ $(CPPUMAKER) -Gc $(CPPUMAKERFLAGS) -B$(UNOUCRBASE) -O$(UNOUCROUT) $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
+ echo $@
diff --git a/pyuno/prj/build.lst b/pyuno/prj/build.lst
index 924491620..5a3b2c179 100644
--- a/pyuno/prj/build.lst
+++ b/pyuno/prj/build.lst
@@ -1,4 +1,4 @@
-bgpu pyuno : stoc cpputools cppuhelper bridges tools PYTHON:python NULL
+bgpu pyuno : stoc cpputools cppuhelper bridges tools PYTHON:python LIBXSLT:libxslt NULL
pu pyuno usr1 - all br_mkout NULL
pu pyuno\zipcore nmake - all pu_zipcore NULL
pu pyuno\source\module nmake - all pu_module NULL
diff --git a/pyuno/prj/d.lst b/pyuno/prj/d.lst
index 5fe7400a8..1dd212ea9 100644
--- a/pyuno/prj/d.lst
+++ b/pyuno/prj/d.lst
@@ -9,12 +9,11 @@ mkdir: %_DEST%\lib%_EXT%\pyuno
..\%__SRC%\lib\unohelper.py %_DEST%\lib%_EXT%\pyuno\unohelper.py
..\%__SRC%\lib\pythonloader.py %_DEST%\lib%_EXT%\pyuno\pythonloader.py
..\%__SRC%\lib\uno.py %_DEST%\lib%_EXT%\pyuno\uno.py
-..\%__SRC%\lib\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb
+..\%__SRC%\misc\pythonloader.component %_DEST%\xml\pythonloader.component
..\%__SRC%\bin\unohelper.py %_DEST%\bin%_EXT%\pyuno\unohelper.py
..\%__SRC%\bin\pythonloader.py %_DEST%\bin%_EXT%\pyuno\pythonloader.py
..\%__SRC%\bin\uno.py %_DEST%\bin%_EXT%\pyuno\uno.py
-..\%__SRC%\bin\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb
..\%__SRC%\bin\pyuno.pyd %_DEST%\bin%_EXT%\pyuno.pyd
..\%__SRC%\bin\pyuno.dll %_DEST%\bin%_EXT%\pyuno.dll
..\%__SRC%\bin\pythonl*.dll %_DEST%\bin%_EXT%\pythonl*.dll
diff --git a/pyuno/source/loader/makefile.mk b/pyuno/source/loader/makefile.mk
index 6f8648ce5..65ec8116f 100644
--- a/pyuno/source/loader/makefile.mk
+++ b/pyuno/source/loader/makefile.mk
@@ -73,40 +73,22 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
SLOFILES= $(SLO)$/pyuno_loader.obj
-#COMPONENTS= \
-# tcv \
-# inv \
-# corefl \
-# insp \
-# invadp \
-# proxyfac \
-# pythonloader.uno \
-
-
-COMPONENTS= \
- stocservices.uno \
- invocation.uno \
- introspection.uno \
- invocadapt.uno \
- proxyfac.uno \
- reflection.uno \
- .$/pythonloader.uno
-
# --- Targets ------------------------------------------------------
ALL : ALLTAR \
- $(DLLDEST)$/pythonloader.py \
- $(DLLDEST)$/pyuno_services.rdb
+ $(DLLDEST)$/pythonloader.py
.ENDIF # L10N_framework
.INCLUDE : target.mk
.IF "$(L10N_framework)"==""
$(DLLDEST)$/%.py: %.py
cp $? $@
-
-$(DLLDEST)$/pyuno_services.rdb : makefile.mk $(DLLDEST)$/$(DLLPRE)$(TARGET)$(DLLPOST)
- -rm -f $@ $(DLLDEST)$/pyuno_services.tmp $(DLLDEST)$/pyuno_services.rdb
- cd $(DLLDEST) && $(REGCOMP) -register -r pyuno_services.tmp -wop $(foreach,i,$(COMPONENTS) -c $(i))
- cd $(DLLDEST) && mv pyuno_services.tmp pyuno_services.rdb
.ENDIF # L10N_framework
+ALLTAR : $(MISC)/pythonloader.component
+
+$(MISC)/pythonloader.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt pythonloader.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ 'vnd.sun.star.expand:$$OOO_BASE_DIR/program/$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt pythonloader.component
diff --git a/pyuno/source/loader/pythonloader.component b/pyuno/source/loader/pythonloader.component
new file mode 100644
index 000000000..583b6ed38
--- /dev/null
+++ b/pyuno/source/loader/pythonloader.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="org.openoffice.comp.pyuno.Loader">
+ <service name="com.sun.star.loader.Python"/>
+ </implementation>
+</component>
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index cddb42f63..f94b4ea51 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -229,12 +229,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/pyuno/zipcore/python.sh b/pyuno/zipcore/python.sh
index f471b1dfd..b53e369fe 100644
--- a/pyuno/zipcore/python.sh
+++ b/pyuno/zipcore/python.sh
@@ -44,7 +44,7 @@ PATH=$sd_prog${PATH+:$PATH}
export PATH
# Set LD_LIBRARY_PATH so that "import pyuno" finds libpyuno.so:
-LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}
+LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
# Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable:
diff --git a/remotebridges/prj/build.lst b/remotebridges/prj/build.lst
index 30a376462..a1f16dbd6 100644
--- a/remotebridges/prj/build.lst
+++ b/remotebridges/prj/build.lst
@@ -1,4 +1,4 @@
-rb remotebridges : bridges rdbmaker NULL
+rb remotebridges : LIBXSLT:libxslt bridges rdbmaker NULL
rb remotebridges usr1 - all rb_mkout NULL
rb remotebridges\source\bridge nmake - all rb_iiop NULL
rb remotebridges\source\factory nmake - all rb_factory NULL
diff --git a/remotebridges/prj/d.lst b/remotebridges/prj/d.lst
index 04b8bf4f7..b304680e2 100644
--- a/remotebridges/prj/d.lst
+++ b/remotebridges/prj/d.lst
@@ -15,3 +15,6 @@
..\%__SRC%\lib\dynamicloader.uno.so %_DEST%\lib%_EXT%\dynamicloader.uno.so
..\%__SRC%\lib\uuresolver.uno.so %_DEST%\lib%_EXT%\uuresolver.uno.so
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*
+..\%__SRC%\misc\bridgefac.component %_DEST%\xml%_EXT%\bridgefac.component
+..\%__SRC%\misc\remotebridge.component %_DEST%\xml%_EXT%\remotebridge.component
+..\%__SRC%\misc\uuresolver.component %_DEST%\xml%_EXT%\uuresolver.component
diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk
index 1b712bef1..2a5ea130d 100644
--- a/remotebridges/source/bridge/makefile.mk
+++ b/remotebridges/source/bridge/makefile.mk
@@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/remotebridge.component
+
+$(MISC)/remotebridge.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt remotebridge.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt remotebridge.component
diff --git a/remotebridges/source/bridge/remote_bridge.cxx b/remotebridges/source/bridge/remote_bridge.cxx
index 40f233625..67272df80 100644
--- a/remotebridges/source/bridge/remote_bridge.cxx
+++ b/remotebridges/source/bridge/remote_bridge.cxx
@@ -457,12 +457,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/remotebridges/source/bridge/remotebridge.component b/remotebridges/source/bridge/remotebridge.component
new file mode 100644
index 000000000..bbc6bede1
--- /dev/null
+++ b/remotebridges/source/bridge/remotebridge.component
@@ -0,0 +1,36 @@
+<?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.remotebridges.Bridge.various">
+ <service name="com.sun.star.bridge.Bridge"/>
+ <service name="com.sun.star.bridge.IiopBridge"/>
+ <service name="com.sun.star.bridge.UrpBridge"/>
+ </implementation>
+</component>
diff --git a/remotebridges/source/dynamicloader/dynamicloader.cxx b/remotebridges/source/dynamicloader/dynamicloader.cxx
index ec87b5212..08001cb0b 100644
--- a/remotebridges/source/dynamicloader/dynamicloader.cxx
+++ b/remotebridges/source/dynamicloader/dynamicloader.cxx
@@ -381,34 +381,6 @@ extern "C" {
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
- sal_Bool SAL_CALL component_writeInfo(XMultiServiceFactory *, XRegistryKey * pRegistryKey) {
- sal_Bool bRes = sal_False;
-
- if (pRegistryKey) {
- try {
- OUString x = OUString::createFromAscii("/");
- x += ::dynamic_loader::DynamicLoader::implname;
- x += OUString::createFromAscii("/UNO/SERVICES");
-
-
- Reference<XRegistryKey> xNewKey(pRegistryKey->createKey(x));
-
- const Sequence<OUString> rSNL = ::dynamic_loader::DynamicLoader::getSupportedServiceNames_Static();
- const OUString * pArray = rSNL.getConstArray();
- for (sal_Int32 nPos = rSNL.getLength(); nPos--;)
- xNewKey->createKey(pArray[nPos]);
-
-
- bRes = sal_True;
- }
- catch (InvalidRegistryException &) {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
-
- return bRes;
- }
-
void * SAL_CALL component_getFactory(const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, XRegistryKey *) {
void * pRet = 0;
diff --git a/remotebridges/source/factory/bridgefac.component b/remotebridges/source/factory/bridgefac.component
new file mode 100644
index 000000000..e20bc3425
--- /dev/null
+++ b/remotebridges/source/factory/bridgefac.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.remotebridges.BridgeFactory">
+ <service name="com.sun.star.bridge.BridgeFactory"/>
+ </implementation>
+</component>
diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx
index e9e183525..fbe39339c 100644
--- a/remotebridges/source/factory/bridgefactory.cxx
+++ b/remotebridges/source/factory/bridgefactory.cxx
@@ -481,12 +481,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/remotebridges/source/factory/makefile.mk b/remotebridges/source/factory/makefile.mk
index 7cd3875bc..b47207077 100644
--- a/remotebridges/source/factory/makefile.mk
+++ b/remotebridges/source/factory/makefile.mk
@@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET)
.INCLUDE : target.mk
+ALLTAR : $(MISC)/bridgefac.component
+
+$(MISC)/bridgefac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ bridgefac.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt bridgefac.component
diff --git a/remotebridges/source/unourl_resolver/makefile.mk b/remotebridges/source/unourl_resolver/makefile.mk
index a3e4af7f0..edf5aa72c 100644
--- a/remotebridges/source/unourl_resolver/makefile.mk
+++ b/remotebridges/source/unourl_resolver/makefile.mk
@@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/uuresolver.component
+
+$(MISC)/uuresolver.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ uuresolver.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt uuresolver.component
diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
index f7d8b92ec..bdddf783d 100644
--- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx
+++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx
@@ -239,12 +239,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/remotebridges/source/unourl_resolver/uuresolver.component b/remotebridges/source/unourl_resolver/uuresolver.component
new file mode 100644
index 000000000..f9dcd71d8
--- /dev/null
+++ b/remotebridges/source/unourl_resolver/uuresolver.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.bridge.UnoUrlResolver">
+ <service name="com.sun.star.bridge.UnoUrlResolver"/>
+ </implementation>
+</component>
diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
index 3d9fbc6e1..9f8b519a8 100644
--- a/sal/inc/osl/diagnose.h
+++ b/sal/inc/osl/diagnose.h
@@ -78,15 +78,7 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf
#define OSL_THIS_FILE __FILE__
/* the macro OSL_THIS_FUNC is intended to be an office internal macro for now */
-#ifdef __func__
-#define OSL_THIS_FUNC __func__
-#elifdef __PRETTY_FUNCTION__
-#define OSL_THIS_FUNC __PRETTY_FUNCTION__
-#elifdef __FUNCTION__
-#define OSL_THIS_FUNC __FUNCTION__
-#else
-#define OSL_THIS_FUNC " "
-#endif
+#define OSL_THIS_FUNC "<unknown>"
/* the macro OSL_TO_STRING is intended to be an office internal macro for now */
#define OSL_TO_STRING( x ) #x
diff --git a/sal/inc/rtl/malformeduriexception.hxx b/sal/inc/rtl/malformeduriexception.hxx
index 4a5bfbe85..5d824c3bf 100644
--- a/sal/inc/rtl/malformeduriexception.hxx
+++ b/sal/inc/rtl/malformeduriexception.hxx
@@ -53,8 +53,8 @@ public:
inline SAL_EXCEPTION_DLLPRIVATE ~MalformedUriException() {}
inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException operator =(
- MalformedUriException const & other)
- { m_aMessage = other.m_aMessage; return *this; }
+ MalformedUriException const & rOther)
+ { m_aMessage = rOther.m_aMessage; return *this; }
/** Get the message.
diff --git a/sal/inc/rtl/math.h b/sal/inc/rtl/math.h
index 46efef7b1..9841d83ca 100644
--- a/sal/inc/rtl/math.h
+++ b/sal/inc/rtl/math.h
@@ -319,7 +319,9 @@ void SAL_CALL rtl_math_doubleToUString(rtl_uString ** pResult,
@param pParsedEnd
If non-null, returns one past the position of the last character parsed
away. Thus if [pBegin..pEnd) only contains the numerical string to be
- parsed, *pParsedEnd == pEnd on return.
+ parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is
+ found, *pParsedEnd == pBegin on return, even if there was leading
+ whitespace.
*/
double SAL_CALL rtl_math_stringToDouble(
sal_Char const * pBegin, sal_Char const * pEnd, sal_Char cDecSeparator,
@@ -357,7 +359,9 @@ double SAL_CALL rtl_math_stringToDouble(
@param pParsedEnd
If non-null, returns one past the position of the last character parsed
away. Thus if [pBegin..pEnd) only contains the numerical string to be
- parsed, *pParsedEnd == pEnd on return.
+ parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is
+ found, *pParsedEnd == pBegin on return, even if there was leading
+ whitespace.
*/
double SAL_CALL rtl_math_uStringToDouble(
sal_Unicode const * pBegin, sal_Unicode const * pEnd,
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index 95141420e..708b01d3c 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -1022,66 +1022,31 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD
return nRet;
}
- /* HACK: because memory mapping fails on various
- platforms if the size of the source file is 0 byte */
- if (0 == nSourceSize)
- {
- close(SourceFileFD);
- close(DestFileFD);
- return 0;
- }
-
- // read and lseek are used to check the possibility to access the data
- // not a nice solution, but it allows to avoid a crash in case it is an opened samba file
- // generally, reading of one byte should not affect the performance
- char nCh;
- if ( 1 != read( SourceFileFD, &nCh, 1 )
- || -1 == lseek( SourceFileFD, 0, SEEK_SET ) )
- {
- nRet = errno;
- close( SourceFileFD );
- close( DestFileFD );
- return nRet;
- }
-
size_t nWritten = 0;
size_t nRemains = nSourceSize;
- /* mmap file -- open dest file -- write -- fsync it at the end */
- void* pSourceFile = mmap( 0, nSourceSize, PROT_READ, MAP_SHARED, SourceFileFD, 0 );
- if ( pSourceFile != MAP_FAILED )
- {
- nWritten = write( DestFileFD, pSourceFile, nSourceSize );
- nRemains -= nWritten;
- munmap( (char*)pSourceFile, nSourceSize );
- }
-
if ( nRemains )
{
/* mmap has problems, try the direct streaming */
- char pBuffer[32000];
+ char pBuffer[0x8000];
size_t nRead = 0;
nRemains = nSourceSize;
- if ( -1 != lseek( SourceFileFD, 0, SEEK_SET )
- && -1 != lseek( DestFileFD, 0, SEEK_SET ) )
+ do
{
- do
- {
- nRead = 0;
- nWritten = 0;
+ nRead = 0;
+ nWritten = 0;
- size_t nToRead = std::min( (size_t)32000, nRemains );
- nRead = read( SourceFileFD, pBuffer, nToRead );
- if ( (size_t)-1 != nRead )
- nWritten = write( DestFileFD, pBuffer, nRead );
+ size_t nToRead = std::min( (size_t)0x8000, nRemains );
+ nRead = read( SourceFileFD, pBuffer, nToRead );
+ if ( (size_t)-1 != nRead )
+ nWritten = write( DestFileFD, pBuffer, nRead );
- if ( (size_t)-1 != nWritten )
- nRemains -= nWritten;
- }
- while( nRemains && (size_t)-1 != nRead && nRead == nWritten );
+ if ( (size_t)-1 != nWritten )
+ nRemains -= nWritten;
}
+ while( nRemains && (size_t)-1 != nRead && nRead == nWritten );
}
if ( nRemains )
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index 3cce0e6b0..90b3ed3cf 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -844,9 +844,9 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale )
if ( NULL == locale )
{
- locale = (char *)malloc( 20 );
+ locale = (char *)malloc( 128 );
if ( locale )
- macosx_getLocale( locale, 20 );
+ macosx_getLocale( locale, 128 );
else
fprintf( stderr, "nlsupport.c: locale allocation returned NULL!\n" );
}
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index 638252ad4..06e395844 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -18,4 +18,6 @@ sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL
sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL
sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL
sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL
+sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL
sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL
+sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL
diff --git a/sal/qa/OStringBuffer/makefile.mk b/sal/qa/OStringBuffer/makefile.mk
index d46168dc4..e0c1a81d6 100644
--- a/sal/qa/OStringBuffer/makefile.mk
+++ b/sal/qa/OStringBuffer/makefile.mk
@@ -33,8 +33,6 @@ PRJ=..$/..
PRJNAME=sal
TARGET=qa_ostringbuffer
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index 2b091f440..bdbd41bc2 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -14789,11 +14789,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[0] );
OString expVal( kTestStr116 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14873,11 +14869,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[1] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -14956,11 +14948,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[2] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -15039,11 +15027,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[3] );
OString expVal( kTestStr118 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
@@ -15122,11 +15106,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix,
{
::rtl::OStringBuffer aStrBuf( *arrOUS[4] );
OString expVal( kTestStr120 );
-#if defined(UNX) || defined(OS2)
- sal_Int64 input = 9223372036854775807LL;
-#else
- sal_Int64 input = 9223372036854775807;
-#endif
+ sal_Int64 input = SAL_CONST_INT64(9223372036854775807);
aStrBuf.append( input );
CPPUNIT_ASSERT_MESSAGE
diff --git a/sal/qa/OStringBuffer/rtl_String_Const.h b/sal/qa/OStringBuffer/rtl_String_Const.h
index dc905ac60..0c058273c 100644
--- a/sal/qa/OStringBuffer/rtl_String_Const.h
+++ b/sal/qa/OStringBuffer/rtl_String_Const.h
@@ -357,11 +357,7 @@ static const sal_Int16 kSInt16Max = SHRT_MAX;
static const sal_Int32 kUInt16Max = USHRT_MAX;
static const sal_Int32 kSInt32Max = INT_MAX;
static const sal_Int64 kUInt32Max = UINT_MAX;
-#if defined(UNX) || defined(OS2)
-static const sal_Int64 kSInt64Max = 9223372036854775807LL;
-#else
-static const sal_Int64 kSInt64Max = 9223372036854775807;
-#endif
+static const sal_Int64 kSInt64Max = SAL_CONST_INT64(9223372036854775807);
//------------------------------------------------------------------------
diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk
index 6350cdba0..85452eac8 100644
--- a/sal/qa/osl/pipe/makefile.mk
+++ b/sal/qa/osl/pipe/makefile.mk
@@ -51,7 +51,7 @@ SHL1OBJS= \
$(SLO)$/osl_Pipe.obj
SHL1TARGET= osl_Pipe
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB)
+SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTLIB)
SHL1IMPLIB= i$(SHL1TARGET)
# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index 5a6e9afc5..8dfe261d9 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -36,6 +36,7 @@
#include "cppunit/TestFixture.h"
#include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h"
+#include "test/uniquepipename.hxx"
#include <sal/types.h>
#include <rtl/ustring.hxx>
@@ -186,8 +187,8 @@ namespace osl_Pipe
void ctors_name_option( )
{
/// create a named pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
- ::osl::Pipe aAssignPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ ::osl::Pipe aAssignPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aPipe.is( ) && aAssignPipe.is( );
@@ -199,7 +200,7 @@ namespace osl_Pipe
{
/// create a security pipe.
const ::osl::Security rSecurity;
- ::osl::Pipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity );
+ ::osl::Pipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity );
bRes = aSecurityPipe.is( );
@@ -210,7 +211,7 @@ namespace osl_Pipe
void ctors_copy( )
{
/// create a pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// create a pipe using copy constructor.
::osl::Pipe aCopyPipe( aPipe );
@@ -233,7 +234,7 @@ namespace osl_Pipe
void ctors_no_acquire( )
{
/// create a pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// constructs a pipe reference without acquiring the handle.
::osl::Pipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE );
@@ -249,7 +250,7 @@ namespace osl_Pipe
void ctors_acquire( )
{
/// create a base pipe.
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
/// constructs two pipes without acquiring the handle on the base pipe.
::osl::Pipe aAcquirePipe( aPipe.getHandle( ) );
::osl::Pipe aAcquirePipe1( NULL );
@@ -287,14 +288,14 @@ namespace osl_Pipe
void is_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), a normal pipe creation.", sal_True == aPipe.is( ) );
}
void is_003( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), an invalid case.", sal_False == aPipe.is( ) );
@@ -337,8 +338,8 @@ namespace osl_Pipe
{
const Security rSec;
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
- bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
+ bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.",
@@ -349,8 +350,8 @@ namespace osl_Pipe
{
const Security rSec;
::osl::Pipe aPipe, aPipe1;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec );
- bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN, rSec );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec );
+ bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN, rSec );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.",
@@ -360,8 +361,8 @@ namespace osl_Pipe
void create_named_001( )
{
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
- bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.",
@@ -371,8 +372,8 @@ namespace osl_Pipe
void create_named_002( )
{
::osl::Pipe aPipe, aPipe1;
- bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE );
- bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.",
@@ -382,7 +383,7 @@ namespace osl_Pipe
void create_named_003( )
{
::osl::Pipe aPipe;
- bRes = aPipe.create( aTestPipeName );
+ bRes = aPipe.create( test::uniquePipeName(aTestPipeName) );
aPipe.clear( );
CPPUNIT_ASSERT_MESSAGE( "#test comment#: test default option is open.",
@@ -410,7 +411,7 @@ namespace osl_Pipe
void clear_001( )
{
::osl::Pipe aPipe;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe.clear( );
bRes = aPipe.is( );
@@ -436,7 +437,7 @@ namespace osl_Pipe
void assign_ref( )
{
::osl::Pipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -450,7 +451,7 @@ namespace osl_Pipe
void assign_handle( )
{
::osl::Pipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe.getHandle( );
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -500,7 +501,7 @@ namespace osl_Pipe
void isEqual_001( )
{
::osl::Pipe aPipe;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
bRes = aPipe == aPipe;
aPipe.close( );
@@ -511,10 +512,10 @@ namespace osl_Pipe
void isEqual_002( )
{
::osl::Pipe aPipe, aPipe1, aPipe2;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
- aPipe2.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe2.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
bRes = aPipe == aPipe1;
bRes1 = aPipe == aPipe2;
@@ -543,7 +544,7 @@ namespace osl_Pipe
void close_001( )
{
- ::osl::Pipe aPipe( aTestPipe1, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE );
aPipe.close( );
bRes = aPipe.is( );
@@ -556,7 +557,7 @@ namespace osl_Pipe
void close_002( )
{
- ::osl::StreamPipe aPipe( aTestPipe1, osl_Pipe_CREATE );
+ ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE );
aPipe.close( );
int nRet = aPipe.send( m_pTestString1.getStr(), 3 );
@@ -624,7 +625,7 @@ namespace osl_Pipe
void getError_001( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
oslPipeError nError = aPipe.getError( );
printPipeError( aPipe );
aPipe.clear( );
@@ -635,8 +636,8 @@ namespace osl_Pipe
void getError_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
- ::osl::Pipe aPipe1( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
+ ::osl::Pipe aPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
oslPipeError nError = aPipe.getError( );
printPipeError( aPipe );
aPipe.clear( );
@@ -663,7 +664,7 @@ namespace osl_Pipe
void getHandle_001( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aPipe == aPipe.getHandle( );
aPipe.clear( );
@@ -673,7 +674,7 @@ namespace osl_Pipe
void getHandle_002( )
{
- ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::Pipe aPipe1( aPipe.getHandle( ) );
bRes = aPipe == aPipe1;
aPipe.clear( );
@@ -726,7 +727,7 @@ namespace osl_StreamPipe
void ctors_none( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
::osl::StreamPipe aStreamPipe1;
bRes = aStreamPipe1.is( );
@@ -744,7 +745,7 @@ namespace osl_StreamPipe
void ctors_handle( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create a pipe with last handle.
::osl::StreamPipe aStreamPipe1( aStreamPipe.getHandle( ) );
bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1;
@@ -758,7 +759,7 @@ namespace osl_StreamPipe
void ctors_copy( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
::osl::StreamPipe aStreamPipe1( aStreamPipe );
bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1;
@@ -772,9 +773,9 @@ namespace osl_StreamPipe
void ctors_name_option( )
{
// create a pipe.
- ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// create an unattached pipe.
- ::osl::StreamPipe aStreamPipe1( aTestPipeName, osl_Pipe_OPEN );
+ ::osl::StreamPipe aStreamPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN );
bRes = aStreamPipe1.is( ) && aStreamPipe.is( );
aStreamPipe.clear( );
aStreamPipe1.clear( );
@@ -787,7 +788,7 @@ namespace osl_StreamPipe
{
/// create a security pipe.
const ::osl::Security rSecurity;
- ::osl::StreamPipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity );
+ ::osl::StreamPipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity );
bRes = aSecurityPipe.is( );
aSecurityPipe.clear( );
@@ -809,7 +810,7 @@ namespace osl_StreamPipe
void ctors_no_acquire( )
{
// create a pipe.
- ::osl::StreamPipe aPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
// constructs a pipe reference without acquiring the handle.
::osl::StreamPipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE );
@@ -846,7 +847,7 @@ namespace osl_StreamPipe
void assign_ref( )
{
::osl::StreamPipe aPipe, aPipe1;
- aPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
aPipe1 = aPipe;
bRes = aPipe1.is( );
bRes1 = aPipe == aPipe1;
@@ -859,7 +860,7 @@ namespace osl_StreamPipe
void assign_handle( )
{
- ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( aTestPipeName, osl_Pipe_CREATE );
+ ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::StreamPipe * pAssignPipe = new ::osl::StreamPipe;
*pAssignPipe = pPipe->getHandle( );
@@ -914,7 +915,7 @@ namespace osl_StreamPipe
sal_Int32 nChars = 0;
printf("open pipe\n");
- ::osl::StreamPipe aSenderPipe( aTestPipeName, osl_Pipe_OPEN ); // aTestPipeName is a string = "TestPipe"
+ ::osl::StreamPipe aSenderPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); // test::uniquePipeName(aTestPipeName) is a string = "TestPipe"
if ( aSenderPipe.is() == sal_False )
{
printf("pipe open failed! \n");
@@ -947,13 +948,13 @@ namespace osl_StreamPipe
{
public:
sal_Char buf[256];
- //::osl::StreamPipe aListenPipe; //( aTestPipeName, osl_Pipe_CREATE );
+ //::osl::StreamPipe aListenPipe; //( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
::osl::Pipe aListenPipe;
::osl::StreamPipe aConnectionPipe;
Pipe_DataSource_Thread( )
{
printf("create pipe\n");
- aListenPipe.create( aTestPipeName, osl_Pipe_CREATE );
+ aListenPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
}
~Pipe_DataSource_Thread( )
{
@@ -964,7 +965,7 @@ namespace osl_StreamPipe
{
//create pipe.
sal_Int32 nChars;
- //::osl::StreamPipe aListenPipe( aTestPipeName, osl_Pipe_CREATE );
+ //::osl::StreamPipe aListenPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE );
printf("listen\n");
if ( aListenPipe.is() == sal_False )
{
diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk
index 6bbee03b6..e113ac86e 100644
--- a/sal/qa/osl/process/makefile.mk
+++ b/sal/qa/osl/process/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_osl_process
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/osl/profile/makefile.mk b/sal/qa/osl/profile/makefile.mk
index a95db211c..67ad60057 100644
--- a/sal/qa/osl/profile/makefile.mk
+++ b/sal/qa/osl/profile/makefile.mk
@@ -33,7 +33,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_osl_profile
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/alloc/makefile.mk b/sal/qa/rtl/alloc/makefile.mk
index 37ae3718b..db4f01eb4 100755
--- a/sal/qa/rtl/alloc/makefile.mk
+++ b/sal/qa/rtl/alloc/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_alloc
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/crc32/makefile.mk b/sal/qa/rtl/crc32/makefile.mk
index 6bd3bd89d..704c149d4 100755
--- a/sal/qa/rtl/crc32/makefile.mk
+++ b/sal/qa/rtl/crc32/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_crc32
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/digest/makefile.mk b/sal/qa/rtl/digest/makefile.mk
index 415183b7e..7798004ed 100644
--- a/sal/qa/rtl/digest/makefile.mk
+++ b/sal/qa/rtl/digest/makefile.mk
@@ -29,8 +29,6 @@ INCPRE+= $(PRJ)$/qa$/inc
PRJNAME=sal
TARGET=rtl_digest
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/doublelock/makefile.mk b/sal/qa/rtl/doublelock/makefile.mk
index b13ccf420..45259fd3c 100644
--- a/sal/qa/rtl/doublelock/makefile.mk
+++ b/sal/qa/rtl/doublelock/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_doublelock
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/locale/makefile.mk b/sal/qa/rtl/locale/makefile.mk
index 329769b5d..d6c9c6b67 100644
--- a/sal/qa/rtl/locale/makefile.mk
+++ b/sal/qa/rtl/locale/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_locale
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl/math/export.exp b/sal/qa/rtl/math/export.exp
deleted file mode 100644
index a13529da5..000000000
--- a/sal/qa/rtl/math/export.exp
+++ /dev/null
@@ -1 +0,0 @@
-registerAllTestFunction
diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk
index 3b35e52ab..59f2ecc49 100644
--- a/sal/qa/rtl/math/makefile.mk
+++ b/sal/qa/rtl/math/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -23,75 +23,33 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
-PRJ=..$/..$/..
-INCPRE+= $(PRJ)$/qa$/inc
+#***********************************************************************/
-PRJNAME=sal
-TARGET=rtl_math
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
-ENABLE_EXCEPTIONS=TRUE
+PRJ = ../../..
+PRJNAME = sal
+TARGET = qa_rtl_profile
-# --- Settings -----------------------------------------------------
+ENABLE_EXCEPTIONS = TRUE
-.INCLUDE : settings.mk
-
-CFLAGS+= $(LFS_CFLAGS)
-CXXFLAGS+= $(LFS_CFLAGS)
+.INCLUDE: settings.mk
CFLAGSCXX += $(CPPUNIT_CFLAGS)
-#----------------------------------- OStringBuffer -----------------------------------
-
-SHL1OBJS= \
- $(SLO)$/test_rtl_math.obj
-
-SHL1TARGET= rtl_math
-SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL1IMPLIB= i$(SHL1TARGET)
-# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME =$(SHL1TARGET)
-# DEF1EXPORTFILE= export.exp
-SHL1VERSIONMAP = $(PRJ)$/qa$/export.map
-
-# --- BEGIN --------------------------------------------------------
-SHL2OBJS= \
- $(SLO)$/rtl_math.obj
-SHL2TARGET= rtl_math2
-SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-
-SHL2IMPLIB= i$(SHL2TARGET)
-DEF2NAME= $(SHL2TARGET)
-SHL2VERSIONMAP = $(PRJ)$/qa$/export.map
-
-
-
-# # --- BEGIN --------------------------------------------------------
-# LLA: this is an old test, which seems not to work
-# sal_setInt64()
-# sal_getInt64()
-# does not exist.
-#
-# SHL3OBJS= \
-# $(SLO)$/rtl_old_testint64.obj
-# SHL3TARGET= rtl_old_testint64
-# SHL3STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB)
-#
-# SHL3IMPLIB= i$(SHL3TARGET)
-# DEF3NAME= $(SHL3TARGET)
-# SHL3VERSIONMAP = $(PRJ)$/qa$/export.map
-#
-
-#------------------------------- All object files -------------------------------
-# do this here, so we get right dependencies
-# SLOFILES=$(SHL1OBJS)
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLO)/test-rtl-math.obj
+SHL1RPATH = NONE
+SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
+SHL1TARGET = test-rtl-math
+SHL1VERSIONMAP = $(PRJ)/qa/export.map
+DEF1NAME = $(SHL1TARGET)
-# --- Targets ------------------------------------------------------
+SLOFILES = $(SHL1OBJS)
-.INCLUDE : target.mk
-.INCLUDE : _cppunit.mk
+.INCLUDE: target.mk
+.INCLUDE: _cppunit.mk
+.END
diff --git a/sal/qa/rtl/math/rtl_math.cxx b/sal/qa/rtl/math/rtl_math.cxx
deleted file mode 100644
index 7d04684c9..000000000
--- a/sal/qa/rtl/math/rtl_math.cxx
+++ /dev/null
@@ -1,626 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-#ifdef WIN32
-// LLA: take a look into Microsofts math.h implementation, why this define is need
-#define _USE_MATH_DEFINES
-#endif
-
-#include <math.h>
-#include <testshl/simpleheader.hxx>
-#include <rtl/math.h>
-#include <rtl/string.hxx>
-
-#include "valueequal.hxx"
-
-namespace rtl_math
-{
-
-class test : public CppUnit::TestFixture
-{
-public:
- // initialise your test code values here.
- void setUp()
- {
- }
-
- void tearDown()
- {
- }
-
-
- void equalCheck(double _nResult, double _nExpect) /* throws Exception */
- {
- bool bEqualResult = is_double_equal(_nResult, _nExpect);
-
- rtl::OString sError = "rtl_math_round expected result is wrong should:(";
- sError += rtl::OString::valueOf(_nExpect);
- sError += ") but is:(";
- sError += rtl::OString::valueOf(_nResult);
- sError += ")";
-
- CPPUNIT_ASSERT_MESSAGE(sError.getStr(), bEqualResult == true);
- }
-
- // insert your test code here.
- void round_000()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nValue = M_PI;
- double nResult = 0.0;
-
- nResult = rtl_math_round(nValue, 0, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.0));
-
- nResult = rtl_math_round(nValue, 2, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.14));
-
- nResult = rtl_math_round(nValue, 3, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.142));
-
- nResult = rtl_math_round(nValue, 10, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(3.1415926536));
- }
-
- // insert your test code here.
- void round_001_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(0.2));
- }
-
- void round_001_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Corrected);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_002_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(0.1));
- }
-
- void round_002_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Down);
- equalCheck(nResult, double(-0.1));
- }
-// -----------------------------------------------------------------------------
- void round_003_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(0.2));
- }
-
- void round_003_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Up);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_004_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(0.1));
- }
-
- void round_004_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Floor);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_005_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(0.2));
- }
-
- void round_005_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Ceiling);
- equalCheck(nResult, double(-0.1));
- }
-// -----------------------------------------------------------------------------
- void round_006_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(0.2));
- }
-
- void round_006_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfDown);
- equalCheck(nResult, double(-0.2));
- }
-// -----------------------------------------------------------------------------
- void round_007_positiv()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.1));
-
- nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
-
- nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(0.2));
- }
-
- void round_007_negativ()
- {
- // this is demonstration code
- // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
-
- double nResult = 0.0;
-
- nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.1));
-
- nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
-
- nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfUp);
- equalCheck(nResult, double(-0.2));
- }
-
- // Change the following lines only, if you add, remove or rename
- // member functions of the current class,
- // because these macros are need by auto register mechanism.
-
- CPPUNIT_TEST_SUITE(test);
- CPPUNIT_TEST(round_000);
-
- CPPUNIT_TEST(round_001_positiv);
- CPPUNIT_TEST(round_001_negativ);
-
- CPPUNIT_TEST(round_002_positiv);
- CPPUNIT_TEST(round_002_negativ);
-
- CPPUNIT_TEST(round_003_positiv);
- CPPUNIT_TEST(round_003_negativ);
-
- CPPUNIT_TEST(round_004_positiv);
- CPPUNIT_TEST(round_004_negativ);
-
- CPPUNIT_TEST(round_005_positiv);
- CPPUNIT_TEST(round_005_negativ);
-
- CPPUNIT_TEST(round_006_positiv);
- CPPUNIT_TEST(round_006_negativ);
-
- CPPUNIT_TEST(round_007_positiv);
- CPPUNIT_TEST(round_007_negativ);
-
- CPPUNIT_TEST_SUITE_END();
-}; // class test
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_math::test, "rtl_math");
-} // namespace rtl_math
-
-
-// -----------------------------------------------------------------------------
-
-// this macro creates an empty function, which will called by the RegisterAllFunctions()
-// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
-
diff --git a/sal/qa/rtl/math/rtl_old_testint64.cxx b/sal/qa/rtl/math/rtl_old_testint64.cxx
deleted file mode 100644
index bb9f7b554..000000000
--- a/sal/qa/rtl/math/rtl_old_testint64.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-// LLA:
-// this file is converted to use with testshl2
-// original was placed in sal/test/textenc.cxx
-
-// fndef _OSL_DIAGNOSE_H_
-// nclude <osl/diagnose.h>
-// #endif
-
-#include <sal/types.h>
-
-#define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c))
-
-// #if OSL_DEBUG_LEVEL > 0
-// #define TEST_ENSURE(c, m) OSL_ENSURE(c, m)
-// #else
-// #define TEST_ENSURE(c, m) OSL_VERIFY(c)
-// #endif
-
-#include <testshl/simpleheader.hxx>
-
-// -----------------------------------------------------------------------------
-namespace rtl_math
-{
- class int64 : public CppUnit::TestFixture
- {
- public:
- void test_int64();
-
- CPPUNIT_TEST_SUITE( int64 );
- CPPUNIT_TEST( test_int64 );
- CPPUNIT_TEST_SUITE_END( );
- };
-
-void int64::test_int64()
-{
-#ifndef SAL_INT64_IS_STRUCT
-#ifdef UNX
- sal_Int64 i1 = -3223372036854775807LL;
- sal_uInt64 u1 = 5223372036854775807ULL;
-#else
- sal_Int64 i1 = -3223372036854775807;
- sal_uInt64 u1 = 5223372036854775807;
-#endif
- sal_Int64 i2 = 0;
- sal_uInt64 u2 = 0;
-#else
- sal_Int64 i1;
- sal_setInt64(&i1, 3965190145L, -750499787L);
-
- sal_Int64 i2 = { 0, 0 };
-
- sal_uInt64 u1;
- sal_setUInt64(&u1, 1651507199UL, 1216161073UL);
-
- sal_uInt64 u2 = {0, 0 };
-
-#endif
- sal_uInt32 low = 0;
- sal_Int32 high = 0;
-
- sal_getInt64(i1, &low, &high);
- sal_setInt64(&i2, low, high);
-
- sal_uInt32 ulow = 0;
- sal_uInt32 uhigh = 0;
-
- sal_getUInt64(u1, &ulow, &uhigh);
- sal_setUInt64(&u2, ulow, uhigh);
-
-#ifndef SAL_INT64_IS_STRUCT
- TEST_ENSURE( i1 == i2, "test_int64 error 1");
-
- TEST_ENSURE( u1 == u2, "test_int64 error 2");
-#else
- TEST_ENSURE( (i1.Part1 == i2.Part1) && (i1.Part2 == i2.Part2),
- "test_int64 error 1");
-
- TEST_ENSURE( (u1.Part1 == u2.Part1) && (u1.Part2 == u2.Part2),
- "test_int64 error 2");
-#endif
- return;
-}
-
-} // namespace rtl_math
-
-// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_math::int64, "rtl_math" );
-
-// -----------------------------------------------------------------------------
-NOADDITIONAL;
-
-
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
new file mode 100644
index 000000000..8e9875444
--- /dev/null
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+*
+* 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_sal.hxx"
+#include "sal/config.h"
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+#include "rtl/math.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+
+namespace {
+
+class Test: public CppUnit::TestFixture {
+public:
+ void test_stringToDouble_good() {
+ rtl_math_ConversionStatus status;
+ sal_Int32 end;
+ double res = rtl::math::stringToDouble(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" +1.E01foo")),
+ sal_Unicode('.'), sal_Unicode(','), &status, &end);
+ CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH(" +1.E01")), end);
+ CPPUNIT_ASSERT_EQUAL(10.0, res);
+ }
+
+ void test_stringToDouble_bad() {
+ rtl_math_ConversionStatus status;
+ sal_Int32 end;
+ double res = rtl::math::stringToDouble(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" +Efoo")),
+ sal_Unicode('.'), sal_Unicode(','), &status, &end);
+ CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), end);
+ CPPUNIT_ASSERT_EQUAL(0.0, res);
+ }
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test_stringToDouble_good);
+ CPPUNIT_TEST(test_stringToDouble_bad);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sal/qa/rtl/math/test_rtl_math.cxx b/sal/qa/rtl/math/test_rtl_math.cxx
deleted file mode 100644
index 41af2a010..000000000
--- a/sal/qa/rtl/math/test_rtl_math.cxx
+++ /dev/null
@@ -1,674 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sal.hxx"
-
-#include "rtl/math.h"
-#include "rtl/math.hxx"
-#include "rtl/strbuf.hxx"
-#include "rtl/string.h"
-#include "rtl/string.hxx"
-#include "rtl/textenc.h"
-// #include "rtl/tres.h"
-#include <testshl/tresstatewrapper.hxx>
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-
-#include <stdlib.h>
-
-namespace {
-
-struct FloatTraits
-{
- typedef float Number;
-
- static inline char const * getPrefix() { return "float"; }
-};
-
-struct DoubleTraits
-{
- typedef double Number;
-
- static inline char const * getPrefix() { return "double"; }
-};
-
-struct StringTraits
-{
- typedef rtl::OString String;
-
- static inline char const * getPrefix() { return "OString"; }
-
- static inline rtl::OString createFromAscii(char const * pString)
- { return rtl::OString(pString); }
-
- static inline void appendBuffer(rtl::OStringBuffer & rBuffer,
- rtl::OString const & rString)
- { rBuffer.append(rString); }
-
- static inline rtl::OString doubleToString(double fValue,
- rtl_math_StringFormat eFormat,
- sal_Int32 nDecPlaces,
- sal_Char cDecSeparator,
- bool bEraseTrailingDecZeros)
- {
- return rtl::math::doubleToString(fValue, eFormat, nDecPlaces,
- cDecSeparator, bEraseTrailingDecZeros);
- }
-};
-
-struct UStringTraits
-{
- typedef rtl::OUString String;
-
- static inline char const * getPrefix() { return "OUString"; }
-
- static inline rtl::OUString createFromAscii(char const * pString)
- { return rtl::OUString::createFromAscii(pString); }
-
- static inline void appendBuffer(rtl::OStringBuffer & rBuffer,
- rtl::OUString const & rString)
- { rBuffer.append(rtl::OUStringToOString(rString, RTL_TEXTENCODING_UTF8)); }
-
- static inline rtl::OUString doubleToString(double fValue,
- rtl_math_StringFormat eFormat,
- sal_Int32 nDecPlaces,
- sal_Unicode cDecSeparator,
- bool bEraseTrailingDecZeros)
- {
- return rtl::math::doubleToUString(fValue, eFormat, nDecPlaces,
- cDecSeparator,
- bEraseTrailingDecZeros);
- }
-};
-
-struct TestNumberToString
-{
- double fValue;
- rtl_math_StringFormat eFormat;
- sal_Int32 nDecPlaces;
- char cDecSeparator;
- bool bEraseTrailingDecZeros;
- char const * pResult;
-};
-
-template< typename StringT, typename NumberT >
-bool testNumberToString(hTestResult pTestResult,
- TestNumberToString const & rTest)
-{
- typename NumberT::Number fValue = static_cast< typename NumberT::Number >(rTest.fValue);
- if (fValue != rTest.fValue)
- return true;
-
- // LLA: t_print("size: %d ", sizeof(fValue));
- typename StringT::String aResult1;
-
- aResult1 = StringT::doubleToString(fValue, rTest.eFormat, rTest.nDecPlaces,
- rTest.cDecSeparator,
- rTest.bEraseTrailingDecZeros);
-
- typename StringT::String aResult2(StringT::createFromAscii(rTest.pResult));
-
- // LLA: rtl::OStringBuffer aBuf;
- // LLA: StringT::appendBuffer(aBuf, aResult1);
- // LLA: t_print("aResult1: %s ", aBuf.getStr());
- // LLA:
- // LLA: rtl::OStringBuffer aBuf2;
- // LLA: StringT::appendBuffer(aBuf2, aResult2);
- // LLA: t_print("aResult2: %s\n", aBuf2.getStr());
-
- bool bSuccess = aResult1 == aResult2;
-
- rtl::OStringBuffer aBuffer;
- aBuffer.append(StringT::getPrefix());
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("/"));
- aBuffer.append(NumberT::getPrefix());
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" doubleToString("));
- aBuffer.append(fValue);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.eFormat));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.nDecPlaces);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.cDecSeparator);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): "));
- StringT::appendBuffer(aBuffer, aResult1);
- if (!bSuccess)
- {
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != "));
- StringT::appendBuffer(aBuffer, aResult2);
- }
- // call to the real test checker
- // pTestResult->pFuncs->state_(pTestResult, bSuccess, "test_rtl_math",
- // aBuffer.getStr(), false);
- c_rtl_tres_state(pTestResult, bSuccess, aBuffer.getStr(), "testNumberToString");
- return bSuccess;
-}
-
-template< typename StringT, typename NumberT >
-bool testNumberToString(hTestResult pTestResult,
- TestNumberToString const * pTests, size_t nCount)
-{
- bool bSuccess = true;
- for (size_t i = 0; i < nCount; ++i)
- bSuccess &= testNumberToString< StringT, NumberT >(pTestResult,
- pTests[i]);
- return bSuccess;
-}
-
-struct TestStringToNumberToString
-{
- char const * pValue;
- rtl_math_StringFormat eFormat;
- sal_Int32 nDecPlaces;
- char cDecSeparator;
- bool bEraseTrailingDecZeros;
- char const * pResult;
-};
-
-template< typename StringT >
-bool testStringToNumberToString(hTestResult pTestResult,
- TestStringToNumberToString const & rTest)
-{
- double d = rtl::math::stringToDouble(StringT::createFromAscii(rTest.pValue),
- rTest.cDecSeparator, 0, 0, 0);
- typename StringT::String aResult1(
- StringT::doubleToString(d, rTest.eFormat, rTest.nDecPlaces,
- rTest.cDecSeparator,
- rTest.bEraseTrailingDecZeros));
- typename StringT::String aResult2(StringT::createFromAscii(rTest.pResult));
- bool bSuccess = aResult1 == aResult2;
- rtl::OStringBuffer aBuffer;
- aBuffer.append(StringT::getPrefix());
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(
- " doubleToString(stringToDouble("));
- aBuffer.append(rTest.pValue);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.cDecSeparator);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("), "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.eFormat));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.nDecPlaces);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(rTest.cDecSeparator);
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", "));
- aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros));
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): "));
- StringT::appendBuffer(aBuffer, aResult1);
- if (!bSuccess)
- {
- aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != "));
- StringT::appendBuffer(aBuffer, aResult2);
- }
- // call to the real test checker
- // pTestResult->pFuncs->state_(pTestResult, bSuccess, "test_rtl_math",
- // aBuffer.getStr(), false);
- c_rtl_tres_state(pTestResult, bSuccess, aBuffer.getStr(), "testStringToNumberToString");
-
- return bSuccess;
-}
-
-template< typename StringT >
-bool testStringToNumberToString(hTestResult pTestResult,
- TestStringToNumberToString const * pTests,
- size_t nCount)
-{
- bool bSuccess = true;
- for (size_t i = 0; i < nCount; ++i)
- bSuccess &= testStringToNumberToString< StringT >(pTestResult,
- pTests[i]);
- return bSuccess;
-}
-
-}
-
-extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult)
-{
- bool bReturn = true;
-
- {
- static TestNumberToString const aTest[]
- = { // 1, 1+2^-1, ..., 1+2^-52
- // Too few decimal digits are printed, so that various different
- // double values lead to the same output:
- { 1, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { 1.5, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.5" },
- { 1.25, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.25" },
- { 1.125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.125" },
- { 1.0625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0625" },
- { 1.03125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.03125" },
- { 1.015625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.015625" },
- { 1.0078125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0078125" },
- { 1.00390625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00390625" },
- { 1.001953125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.001953125" },
- { 1.0009765625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0009765625" },
- { 1.00048828125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00048828125" },
- { 1.000244140625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.000244140625" },
- { 1.0001220703125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.0001220703125" },
- { 1.00006103515625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00006103515625" },
- { 1.000030517578125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00003051757813" },
- { 1.0000152587890625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00001525878906" },
- { 1.00000762939453125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000762939453" },
- { 1.000003814697265625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000381469727" },
- { 1.0000019073486328125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000190734863" },
- { 1.00000095367431640625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000095367432" },
- { 1.000000476837158203125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000047683716" },
- { 1.0000002384185791015625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000023841858" },
- { 1.00000011920928955078125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000011920929" },
- { 1.000000059604644775390625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000005960464" },
- { 1.0000000298023223876953125, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000002980232" },
- { 1.00000001490116119384765625, rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1.00000001490116" },
- { 1.000000007450580596923828125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000745058" },
- { 1.0000000037252902984619140625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000372529" },
- { 1.00000000186264514923095703125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000186265" },
- { 1.000000000931322574615478515625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000093132" },
- { 1.0000000004656612873077392578125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000046566" },
- { 1.00000000023283064365386962890625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000023283" },
- { 1.000000000116415321826934814453125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000011642" },
- { 1.0000000000582076609134674072265625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000005821" },
- { 1.00000000002910383045673370361328125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.0000000000291" },
- { 1.000000000014551915228366851806640625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000001455" },
- { 1.0000000000072759576141834259033203125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000728" },
- { 1.00000000000363797880709171295166015625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000364" },
- { 1.000000000001818989403545856475830078125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000182" },
- { 1.0000000000009094947017729282379150390625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000091" },
- { 1.00000000000045474735088646411895751953125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000045" },
- { 1.000000000000227373675443232059478759765625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000023" },
- { 1.0000000000001136868377216160297393798828125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000011" },
- { 1.00000000000005684341886080801486968994140625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000006" },
- { 1.000000000000028421709430404007434844970703125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000003" },
- { 1.0000000000000142108547152020037174224853515625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000001" },
- { 1.00000000000000710542735760100185871124267578125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1.00000000000001" },
- { 1.000000000000003552713678800500929355621337890625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.0000000000000017763568394002504646778106689453125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.00000000000000088817841970012523233890533447265625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.000000000000000444089209850062616169452667236328125,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
- { 1.0000000000000002220446049250313080847263336181640625,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- '.', true, "1" },
-
- // 1, 1+2^-1, ..., 1+2^-52
- // Too few decimal digits are printed, so that various different
- // double values lead to the same output:
- { 1, rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.5, rtl_math_StringFormat_F, 53, '.', false,
- "1.50000000000000000000000000000000000000000000000000000" },
- { 1.25, rtl_math_StringFormat_F, 53, '.', false,
- "1.25000000000000000000000000000000000000000000000000000" },
- { 1.125, rtl_math_StringFormat_F, 53, '.', false,
- "1.12500000000000000000000000000000000000000000000000000" },
- { 1.0625, rtl_math_StringFormat_F, 53, '.', false,
- "1.06250000000000000000000000000000000000000000000000000" },
- { 1.03125, rtl_math_StringFormat_F, 53, '.', false,
- "1.03125000000000000000000000000000000000000000000000000" },
- { 1.015625, rtl_math_StringFormat_F, 53, '.', false,
- "1.01562500000000000000000000000000000000000000000000000" },
- { 1.0078125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00781250000000000000000000000000000000000000000000000" },
- { 1.00390625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00390625000000000000000000000000000000000000000000000" },
- { 1.001953125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00195312500000000000000000000000000000000000000000000" },
- { 1.0009765625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00097656250000000000000000000000000000000000000000000" },
- { 1.00048828125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00048828125000000000000000000000000000000000000000000" },
- { 1.000244140625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00024414062500000000000000000000000000000000000000000" },
- { 1.0001220703125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00012207031250000000000000000000000000000000000000000" },
- { 1.00006103515625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00006103515625000000000000000000000000000000000000000" },
- { 1.000030517578125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00003051757813000000000000000000000000000000000000000" },
- { 1.0000152587890625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00001525878906000000000000000000000000000000000000000" },
- { 1.00000762939453125, rtl_math_StringFormat_F, 53, '.', false,
- "1.00000762939453000000000000000000000000000000000000000" },
- { 1.000003814697265625, rtl_math_StringFormat_F, 53, '.', false,
- "1.00000381469727000000000000000000000000000000000000000" },
- { 1.0000019073486328125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000190734863000000000000000000000000000000000000000" },
- { 1.00000095367431640625, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000095367432000000000000000000000000000000000000000" },
- { 1.000000476837158203125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000047683716000000000000000000000000000000000000000" },
- { 1.0000002384185791015625, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000023841858000000000000000000000000000000000000000" },
- { 1.00000011920928955078125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000011920929000000000000000000000000000000000000000" },
- { 1.000000059604644775390625, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000005960464000000000000000000000000000000000000000" },
- { 1.0000000298023223876953125, rtl_math_StringFormat_F, 53, '.',
- false,
- "1.00000002980232000000000000000000000000000000000000000" },
- { 1.00000001490116119384765625, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000001490116000000000000000000000000000000000000000" },
- { 1.000000007450580596923828125, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000745058000000000000000000000000000000000000000" },
- { 1.0000000037252902984619140625, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000372529000000000000000000000000000000000000000" },
- { 1.00000000186264514923095703125, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000186265000000000000000000000000000000000000000" },
- { 1.000000000931322574615478515625, rtl_math_StringFormat_F, 53,
- '.', false,
- "1.00000000093132000000000000000000000000000000000000000" },
- { 1.0000000004656612873077392578125, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000046566000000000000000000000000000000000000000" },
- { 1.00000000023283064365386962890625, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000023283000000000000000000000000000000000000000" },
- { 1.000000000116415321826934814453125, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000011642000000000000000000000000000000000000000" },
- { 1.0000000000582076609134674072265625, rtl_math_StringFormat_F,
- 53, '.', false,
- "1.00000000005821000000000000000000000000000000000000000" },
- { 1.00000000002910383045673370361328125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000002910000000000000000000000000000000000000000" },
- { 1.000000000014551915228366851806640625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000001455000000000000000000000000000000000000000" },
- { 1.0000000000072759576141834259033203125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000728000000000000000000000000000000000000000" },
- { 1.00000000000363797880709171295166015625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000364000000000000000000000000000000000000000" },
- { 1.000000000001818989403545856475830078125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000182000000000000000000000000000000000000000" },
- { 1.0000000000009094947017729282379150390625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000091000000000000000000000000000000000000000" },
- { 1.00000000000045474735088646411895751953125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000045000000000000000000000000000000000000000" },
- { 1.000000000000227373675443232059478759765625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000023000000000000000000000000000000000000000" },
- { 1.0000000000001136868377216160297393798828125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000011000000000000000000000000000000000000000" },
- { 1.00000000000005684341886080801486968994140625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000006000000000000000000000000000000000000000" },
- { 1.000000000000028421709430404007434844970703125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000003000000000000000000000000000000000000000" },
- { 1.0000000000000142108547152020037174224853515625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000001000000000000000000000000000000000000000" },
- { 1.00000000000000710542735760100185871124267578125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000001000000000000000000000000000000000000000" },
- { 1.000000000000003552713678800500929355621337890625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.0000000000000017763568394002504646778106689453125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.00000000000000088817841970012523233890533447265625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.000000000000000444089209850062616169452667236328125,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" },
- { 1.0000000000000002220446049250313080847263336181640625,
- rtl_math_StringFormat_F, 53, '.', false,
- "1.00000000000000000000000000000000000000000000000000000" } };
- size_t const nCount = sizeof aTest / sizeof aTest[0];
-
-//LLA: the float tests are wrong here, due to the fact that
-// we calculate with too less digits after the point
-
-// bReturn &= testNumberToString< StringTraits, FloatTraits >(
-// pTestResult, aTest, nCount);
- bReturn &= testNumberToString< StringTraits, DoubleTraits >(
- pTestResult, aTest, nCount);
-// bReturn &= testNumberToString< UStringTraits, FloatTraits >(
-// pTestResult, aTest, nCount);
- bReturn &= testNumberToString< UStringTraits, DoubleTraits >(
- pTestResult, aTest, nCount);
- }
-
- {
- static TestStringToNumberToString const aTest[]
- = { { "1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { " 1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { " 1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { "\t1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { "\t 1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
- { " \t1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "1" },
-
- { "-1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { " -1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { " -1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { "\t-1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { "\t -1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
- { " \t-1", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', true, "-1" },
-
- { "1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { " 1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { " 1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { "\t1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { "\t 1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
- { " \t1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" },
-
- { "-1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { " -1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { " -1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { "\t-1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { "\t -1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
- { " \t-1.#INF", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" },
-
- { "1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { " 1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { " 1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { "\t1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { "\t 1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
- { " \t1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" },
-
- { "-1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { " -1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { " -1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { "\t-1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { "\t -1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
- { " \t-1.#NAN", rtl_math_StringFormat_Automatic,
- rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" },
-
- { "3.14E-2000", rtl_math_StringFormat_E, 4, '.', false,
- "0.0000E+000" },
- { "3.14E-200", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E-200" },
- { "3.14E-20", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E-020" },
- { "3.14E-2", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E-002" },
- { "3.14E2", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E+002" },
- { "3.14E20", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E+020" },
- { "3.14E200", rtl_math_StringFormat_E, 4, '.', false,
- "3.1400E+200" },
- { "3.14E2000", rtl_math_StringFormat_E, 4, '.', false,
- "1.#INF" },
- };
- size_t const nCount = sizeof aTest / sizeof aTest[0];
- bReturn &= testStringToNumberToString< StringTraits >(
- pTestResult, aTest, nCount);
- bReturn &= testStringToNumberToString< UStringTraits >(
- pTestResult, aTest, nCount);
- }
-
- return bReturn;
-}
-
-// -----------------------------------------------------------------------------
-extern "C" void /* sal_Bool */ SAL_CALL test_rtl_math2( hTestResult hRtlTestResult )
-{
- c_rtl_tres_state_start(hRtlTestResult, "rtl_math" );
-
- test_rtl_math( hRtlTestResult );
-
- c_rtl_tres_state_end(hRtlTestResult, "rtl_math" );
-}
-// -----------------------------------------------------------------------------
-void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc)
-{
- if (_pFunc)
- {
- (_pFunc)(&test_rtl_math2, "");
- }
-}
diff --git a/sal/qa/rtl/random/makefile.mk b/sal/qa/rtl/random/makefile.mk
index cd57ec9bc..ef8616a90 100644
--- a/sal/qa/rtl/random/makefile.mk
+++ b/sal/qa/rtl/random/makefile.mk
@@ -28,8 +28,6 @@ PRJ=..$/..$/..
PRJNAME=sal
TARGET=qa_rtl_random
-# this is removed at the moment because we need some enhancements
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/qa/rtl_strings/makefile.mk b/sal/qa/rtl_strings/makefile.mk
index 387f0675a..708a41a87 100644
--- a/sal/qa/rtl_strings/makefile.mk
+++ b/sal/qa/rtl_strings/makefile.mk
@@ -28,7 +28,6 @@ PRJ=..$/..
PRJNAME=sal
TARGET=qa_rtl_strings
-# TESTDIR=TRUE
ENABLE_EXCEPTIONS=TRUE
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx
index d983c5726..34b940a30 100644
--- a/sal/rtl/source/math.cxx
+++ b/sal/rtl/source/math.cxx
@@ -923,7 +923,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
if (pStatus != 0)
*pStatus = eStatus;
if (pParsedEnd != 0)
- *pParsedEnd = p;
+ *pParsedEnd = p == p0 ? pBegin : p;
return fVal;
}
diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx
index 0273f300b..b67518753 100644
--- a/sal/systools/win32/kill/kill.cxx
+++ b/sal/systools/win32/kill/kill.cxx
@@ -272,7 +272,7 @@ static void ParseCommandArgs( LPDWORD lpProcesses, LPDWORD lpdwNumProcesses, int
{
for ( int n = 0; n < NumSupportedSignals; n++ )
{
- _tprintf( _T("%s "), SupportedSignals[n] );
+ _tprintf( _T("%s "), SupportedSignals[n].lpSignalName );
}
_tprintf( _T("\n") );
ExitProcess( 0 );
diff --git a/sal/textenc/convertiscii.tab b/sal/textenc/convertiscii.tab
index 713309df3..891ee8369 100644
--- a/sal/textenc/convertiscii.tab
+++ b/sal/textenc/convertiscii.tab
@@ -108,5 +108,5 @@ static ImplTextEncodingData const aImplIsciiDevanagariTextEncodingData
1,
1,
NULL,
- NULL,
+ "x-iscii-de",
RTL_TEXTENCODING_INFO_ASCII };
diff --git a/sal/textenc/tencinfo.c b/sal/textenc/tencinfo.c
index 4e8bf7c06..e05f08f86 100644
--- a/sal/textenc/tencinfo.c
+++ b/sal/textenc/tencinfo.c
@@ -910,6 +910,9 @@ rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromMimeCharset( const sal_Char* pM
{ "csptcp154", RTL_TEXTENCODING_PT154 },
{ "pt154", RTL_TEXTENCODING_PT154 },
{ "cp154", RTL_TEXTENCODING_PT154 },
+ { "xisciide", RTL_TEXTENCODING_ISCII_DEVANAGARI },
+ /* This is no official MIME character set name, but is in use by
+ various windows APIs. */
{ NULL, RTL_TEXTENCODING_DONTKNOW }
};
@@ -1072,6 +1075,7 @@ rtl_getTextEncodingFromWindowsCodePage(sal_uInt32 nCodePage)
case 51932: return RTL_TEXTENCODING_EUC_JP;
case 51936: return RTL_TEXTENCODING_EUC_CN;
case 51949: return RTL_TEXTENCODING_EUC_KR;
+ case 57002: return RTL_TEXTENCODING_ISCII_DEVANAGARI;
case 65000: return RTL_TEXTENCODING_UTF7;
case 65001: return RTL_TEXTENCODING_UTF8;
default: return RTL_TEXTENCODING_DONTKNOW;
@@ -1147,6 +1151,7 @@ rtl_getWindowsCodePageFromTextEncoding(rtl_TextEncoding nEncoding)
case RTL_TEXTENCODING_EUC_JP: return 51932;
case RTL_TEXTENCODING_EUC_CN: return 51936;
case RTL_TEXTENCODING_EUC_KR: return 51949;
+ case RTL_TEXTENCODING_ISCII_DEVANAGARI: return 57002;
case RTL_TEXTENCODING_UTF7: return 65000;
case RTL_TEXTENCODING_UTF8: return 65001;
default: return 0;
diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst
index 1fb7d34ee..256f09474 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 1f01434bf..79b2d7734 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 2fb68a0cc..d5ce619c6 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 ba35d4f80..faf3e56bc 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 c706e233a..dac197e6f 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 b61eb13aa..7156f6d63 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 000000000..00772a448
--- /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 d803bd44c..f874c1d46 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 >& xReg,
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 >& xReg,
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);
}
}
@@ -1146,36 +1153,24 @@ static void prepareRegistry(
{
// update entries in SERVICES section
Sequence< Reference < XRegistryKey > > serviceKeys = xKey->openKeys();
- OUString implName;
+ const Reference < XRegistryKey > * pServiceKeys = serviceKeys.getConstArray();
- if (serviceKeys.getLength())
- {
- const Reference < XRegistryKey > * pServiceKeys = serviceKeys.getConstArray();
+ OUString implName = OUString(xImplKey->getKeyName().getStr() + 1);
+ sal_Int32 firstDot = implName.indexOf('/');
- implName = OUString(xImplKey->getKeyName().getStr() + 1);
- sal_Int32 firstDot = implName.indexOf('/');
-
- if (firstDot >= 0)
- implName = implName.copy(firstDot + 1);
-
- sal_Int32 offset = xKey->getKeyName().getLength() + 1;
-
- for (sal_Int32 j = 0; j < serviceKeys.getLength(); j++)
- {
- OUString serviceName = pServiceKeys[j]->getKeyName().copy(offset);
+ if (firstDot >= 0)
+ implName = implName.copy(firstDot + 1);
- createUniqueSubEntry(
- xDest->getRootKey()->createKey(
- pool.slash_SERVICES + serviceName ),
- implName);
- }
+ sal_Int32 offset = xKey->getKeyName().getLength() + 1;
- }
- else
+ for (sal_Int32 j = 0; j < serviceKeys.getLength(); j++)
{
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "prepareRegistry(): no service names given by component" ) ),
- Reference< XInterface > () );
+ OUString serviceName = pServiceKeys[j]->getKeyName().copy(offset);
+
+ createUniqueSubEntry(
+ xDest->getRootKey()->createKey(
+ pool.slash_SERVICES + serviceName ),
+ implName);
}
xKey = xImplKey->openKey( pool.slash_UNO );
@@ -1198,42 +1193,42 @@ static void prepareRegistry(
}
}
}
+ }
- // update LOCATION entry
- xKey = xImplKey->createKey( pool.slash_UNO_slash_LOCATION );
+ // update LOCATION entry
+ xKey = xImplKey->createKey( pool.slash_UNO_slash_LOCATION );
- if (xKey.is())
- {
- xKey->setAsciiValue(locationUrl);
- }
+ if (xKey.is())
+ {
+ xKey->setAsciiValue(locationUrl);
+ }
- // update ACTIVATOR entry
- xKey = xImplKey->createKey( pool.slash_UNO_slash_ACTIVATOR );
+ // update ACTIVATOR entry
+ xKey = xImplKey->createKey( pool.slash_UNO_slash_ACTIVATOR );
- if (xKey.is())
- {
- xKey->setAsciiValue(implementationLoaderUrl);
- }
+ if (xKey.is())
+ {
+ xKey->setAsciiValue(implementationLoaderUrl);
+ }
- xKey = xImplKey->openKey( pool.slash_UNO_slash_SERVICES );
+ xKey = xImplKey->openKey( pool.slash_UNO_slash_SERVICES );
+
+ if (xKey.is() && (xKey->getValueType() == RegistryValueType_ASCIILIST))
+ {
+ // update link entries in REGISTRY_LINKS section
+ Sequence<OUString> linkNames = xKey->getAsciiListValue();
- if (xKey.is() && (xKey->getValueType() == RegistryValueType_ASCIILIST))
+ if (linkNames.getLength())
{
- // update link entries in REGISTRY_LINKS section
- Sequence<OUString> linkNames = xKey->getAsciiListValue();
-
- if (linkNames.getLength())
- {
- const OUString* pLinkNames = linkNames.getConstArray();
+ const OUString* pLinkNames = linkNames.getConstArray();
- for (sal_Int32 j = 0; j < linkNames.getLength(); j++)
- {
- prepareLink(xDest, xImplKey, pLinkNames[j]);
- }
- }
- }
+ for (sal_Int32 j = 0; j < linkNames.getLength(); j++)
+ {
+ prepareLink(xDest, xImplKey, pLinkNames[j]);
+ }
+ }
}
-
+
insert_singletons( xDest, xImplKey, xContext );
}
}
diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component
new file mode 100644
index 000000000..349fb0c9d
--- /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 b8ae012d2..0b9857abe 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 80e87dbf7..60864eea2 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 000000000..67178ef2e
--- /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 b321d97cd..c5813efac 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 c170bf6b6..72eeea37c 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 e42aae68d..4c2bc37b5 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 000000000..64f7b2b36
--- /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 66568af03..4c3450ac8 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 000000000..bdd3b82d5
--- /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 069c9b1ea..ee4f5c8b4 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 60eea6a23..e53b90d5e 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 000000000..f78d8af3a
--- /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 f2c018418..ba1c3cf17 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 96908d10d..bcd36e696 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 424180e11..cc98cdfc3 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 000000000..8450cdee6
--- /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 761fccf64..e5aae9a74 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 b38dac146..23146e678 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 000000000..bfe2c9c42
--- /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 4b69487f3..8547900b1 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/registry_tdprovider/tdprovider.cxx b/stoc/source/registry_tdprovider/tdprovider.cxx
index c6e841390..0a3e16753 100644
--- a/stoc/source/registry_tdprovider/tdprovider.cxx
+++ b/stoc/source/registry_tdprovider/tdprovider.cxx
@@ -172,6 +172,8 @@ public:
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
// XHierarchicalNameAccess
+ Any getByHierarchicalNameImpl( const OUString & rName );
+
virtual Any SAL_CALL getByHierarchicalName( const OUString & rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException);
@@ -223,14 +225,7 @@ Any ProviderImpl::TypeDescriptionManagerWrapper::getByHierarchicalName(
sal_Bool ProviderImpl::TypeDescriptionManagerWrapper::hasByHierarchicalName(
OUString const & name ) throw (RuntimeException)
{
- try
- {
- return getByHierarchicalName( name ).hasValue();
- }
- catch (container::NoSuchElementException &)
- {
- return false;
- }
+ return m_xTDMgr->hasByHierarchicalName( name ) || m_xThisProvider->hasByHierarchicalName( name );
}
//______________________________________________________________________________
@@ -344,8 +339,7 @@ Sequence< OUString > ProviderImpl::getSupportedServiceNames()
// XHierarchicalNameAccess
//__________________________________________________________________________________________________
-Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName )
- throw(::com::sun::star::uno::RuntimeException, com::sun::star::container::NoSuchElementException)
+Any ProviderImpl::getByHierarchicalNameImpl( const OUString & rName )
{
Any aRet;
@@ -432,7 +426,17 @@ Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName )
// Don't stop iteration in this case.
}
+ catch ( NoSuchElementException const & )
+ {
+ }
}
+ return aRet;
+}
+
+Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName )
+ throw(::com::sun::star::uno::RuntimeException, com::sun::star::container::NoSuchElementException)
+{
+ Any aRet( getByHierarchicalNameImpl( rName ) );
if ( !aRet.hasValue() )
throw NoSuchElementException(
@@ -445,14 +449,7 @@ Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName )
sal_Bool ProviderImpl::hasByHierarchicalName( const OUString & rName )
throw(::com::sun::star::uno::RuntimeException)
{
- try
- {
- return getByHierarchicalName( rName ).hasValue();
- }
- catch (NoSuchElementException &)
- {
- }
- return sal_False;
+ return getByHierarchicalNameImpl( rName ).hasValue();
}
// XTypeDescriptionEnumerationAccess
diff --git a/stoc/source/simpleregistry/makefile.mk b/stoc/source/simpleregistry/makefile.mk
index 510e7b466..bc0ddf7cc 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 03faa9a2c..9c6b71bc6 100644
--- 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;
-}
+namespace {
-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 stoc_simreg {
-
-//*************************************************************************
-// class RegistryKeyImpl the implenetation of interface XRegistryKey
-//*************************************************************************
-class RegistryKeyImpl;
-
-//*************************************************************************
-// SimpleRegistryImpl
-//*************************************************************************
-class SimpleRegistryImpl : public WeakImplHelper2< XSimpleRegistry, XServiceInfo >
+namespace css = com::sun::star;
+
+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 >
-{
+ osl::Mutex mutex_;
+
+private:
+ virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL open(
+ rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL close() throw (
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL destroy() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL
+ getRootKey() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isReadOnly() throw(
+ css::registry::InvalidRegistryException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL mergeKey(
+ rtl::OUString const & aKeyName, rtl::OUString const & aUrl)
+ throw (
+ css::registry::InvalidRegistryException,
+ css::registry::MergeConflictException, css::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException)
+ { return stoc_bootstrap::simreg_getImplementationName(); }
+
+ virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+ { return ServiceName == getSupportedServiceNames()[0]; }
+
+ virtual css::uno::Sequence< rtl::OUString > SAL_CALL
+ getSupportedServiceNames() throw (css::uno::RuntimeException)
+ { return stoc_bootstrap::simreg_getSupportedServiceNames(); }
+
+ Registry registry_;
+ std::auto_ptr< stoc::simpleregistry::TextualServices > textual_;
+};
+
+class Key: public cppu::WeakImplHelper1< css::registry::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;
-};
-
-//*************************************************************************
-RegistryKeyImpl::RegistryKeyImpl( const RegistryKey& key, SimpleRegistryImpl* pRegistry )
- : m_key(key)
- , m_pRegistry(pRegistry)
-{
- m_pRegistry->acquire();
- m_name = m_key.getName();
+ 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_;
+};
+
+rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.getName();
}
-//*************************************************************************
-RegistryKeyImpl::RegistryKeyImpl( const OUString& rKeyName,
- SimpleRegistryImpl* pRegistry )
- : m_pRegistry(pRegistry)
+sal_Bool Key::isReadOnly()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- m_pRegistry->acquire();
-
- 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;
- }
- }
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.isReadOnly();
}
-//*************************************************************************
-RegistryKeyImpl::~RegistryKeyImpl()
-{
- m_pRegistry->release();
+sal_Bool Key::isValid() throw (css::uno::RuntimeException) {
+ osl::MutexGuard guard(registry_->mutex_);
+ return key_.isValid();
}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getKeyName() throw(RuntimeException)
+css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- return m_name;
-}
+ 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;
+ }
+}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::isReadOnly( )
- throw(InvalidRegistryException, RuntimeException)
+css::registry::RegistryValueType Key::getValueType()
+ throw (css::registry::InvalidRegistryException, css::uno::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 );
+ 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;
}
-}
+}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::isValid( ) throw(RuntimeException)
+sal_Int32 Key::getLongValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- return m_key.isValid();
-}
+ 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;
+}
-//*************************************************************************
-RegistryKeyType SAL_CALL RegistryKeyImpl::getKeyType( const OUString& rKeyName )
- throw(InvalidRegistryException, 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() )
- {
- 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 );
+ 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));
}
-
- return RegistryKeyType_KEY;
-}
+}
-//*************************************************************************
-RegistryValueType SAL_CALL RegistryKeyImpl::getValueType( )
- 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
- {
- RegValueType type;
- sal_uInt32 size;
-
- 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;
- }
- }
+ 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));
}
-
- return RegistryValueType_NOT_DEFINED;
-}
+ 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;
+}
-//*************************************************************************
-sal_Int32 SAL_CALL RegistryKeyImpl::getLongValue( )
- 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_LONG)
- {
- sal_Int32 value;
- if ( !m_key.getValue(OUString(), (RegValue)&value) )
- {
- return value;
- }
- }
- }
-
- 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::setLongValue( sal_Int32 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
- {
- 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_);
+ 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< sal_Int32 > SAL_CALL RegistryKeyImpl::getLongListValue( )
- 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_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 );
+ 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::setLongListValue( const Sequence< sal_Int32 >& seqValue )
- throw(InvalidRegistryException, 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;
- }
-}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getAsciiValue( )
- throw(InvalidRegistryException, InvalidValueException, 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
- {
- RegValueType type;
- sal_uInt32 size;
-
- if ( !m_key.getValueInfo(OUString(), &type, &size) )
+ 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)))
{
- 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 css::registry::InvalidValueException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " getAsciiListValue: underlying RegistryKey not"
+ " UTF-8")),
+ static_cast< OWeakObject * >(this));
}
-
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
}
-}
+ return value;
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setAsciiValue( const OUString& value )
- throw(InvalidRegistryException, 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
- {
- 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) )
+ 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)))
{
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.registry.SimpleRegistry key"
+ " setAsciiListValue: value not UTF-16")),
+ static_cast< OWeakObject * >(this));
}
+ list.push_back(utf8);
}
-}
-
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getAsciiListValue( )
- 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
+ std::vector< char * > list2;
+ for (std::vector< rtl::OString >::iterator i(list.begin()); i != list.end();
+ ++i)
{
- 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 );
+ 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::setAsciiListValue( const Sequence< OUString >& seqValue )
- throw(InvalidRegistryException, 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;
+rtl::OUString Key::getStringValue() throw (
+ css::registry::InvalidRegistryException,
+ css::registry::InvalidValueException, css::uno::RuntimeException)
+{
+ 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));
+}
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getStringValue( )
- throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+void Key::setStringValue(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_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_);
+ 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));
}
-}
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setStringValue( const OUString& value )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getStringListValue() 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_);
+ 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;
+}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getStringListValue( )
- throw(InvalidRegistryException, InvalidValueException, 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() )
- {
- 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_);
+ 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));
}
}
-
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setStringListValue( const Sequence< OUString >& seqValue )
- throw(InvalidRegistryException, 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))
- {
- delete[] tmpValue;
- throw InvalidValueException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ),
- (OWeakObject *)this );
- }
-
- delete[] tmpValue;
- }
-}
-//*************************************************************************
-Sequence< sal_Int8 > SAL_CALL RegistryKeyImpl::getBinaryValue( )
- throw(InvalidRegistryException, InvalidValueException, 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() )
- {
- 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_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 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 getBinaryValue:"
+ " underlying RegistryKey::getValueInfo() = ")) +
+ rtl::OUString::valueOf(static_cast< sal_Int32 >(err))),
+ static_cast< 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;
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value )
- 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
- {
- 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_);
+ 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));
+ }
+}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::openKey( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > Key::openKey(
+ rtl::OUString const & aKeyName)
+ 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_);
+ 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));
+ }
+}
-//*************************************************************************
-Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::createKey( const OUString& aKeyName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Reference< css::registry::XRegistryKey > Key::createKey(
+ rtl::OUString const & aKeyName)
+ 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.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_);
+ 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));
+ }
+}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::closeKey( )
- throw(InvalidRegistryException, RuntimeException)
-{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- if ( !m_key.closeKey() )
- return;
- }
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
-
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::deleteKey( const OUString& rKeyName )
- throw(InvalidRegistryException, RuntimeException)
+void Key::closeKey()
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- Guard< Mutex > aGuard( m_pRegistry->m_mutex );
- if ( m_key.isValid() )
- {
- if ( !m_key.deleteKey(rKeyName) )
- return;
- }
-
- throw InvalidRegistryException(
- OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ),
- (OWeakObject *)this );
-}
-
-//*************************************************************************
-Sequence< Reference< XRegistryKey > > SAL_CALL RegistryKeyImpl::openKeys( )
- throw(InvalidRegistryException, 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_.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));
+ }
+}
-//*************************************************************************
-Sequence< OUString > SAL_CALL RegistryKeyImpl::getKeyNames( )
- throw(InvalidRegistryException, RuntimeException)
+void Key::deleteKey(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
- {
- 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_);
+ 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));
+ }
+}
-//*************************************************************************
-sal_Bool SAL_CALL RegistryKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > >
+Key::openKeys()
+ 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_);
+ 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));
+ }
+ 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));
}
- return sal_True;
+ 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;
}
-//*************************************************************************
-void SAL_CALL RegistryKeyImpl::deleteLink( const OUString& rLinkName )
- throw(InvalidRegistryException, RuntimeException)
+css::uno::Sequence< rtl::OUString > Key::getKeyNames()
+ 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_);
+ 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;
}
-
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getLinkTarget( const OUString& rLinkName )
- throw(InvalidRegistryException, 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 );
- }
- }
- return linkTarget;
-}
-
-//*************************************************************************
-OUString SAL_CALL RegistryKeyImpl::getResolvedName( const OUString& aKeyName )
- throw(InvalidRegistryException, 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 );
- }
- }
-
- return resolvedName;
-}
-
-//*************************************************************************
-SimpleRegistryImpl::SimpleRegistryImpl( const Registry& rRegistry )
- : m_registry(rRegistry)
+sal_Bool Key::createLink(
+ rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- g_moduleCount.modCnt.acquire( &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;
+ }
+}
-//*************************************************************************
-SimpleRegistryImpl::~SimpleRegistryImpl()
+void Key::deleteLink(rtl::OUString const & rLinkName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+ 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));
+ }
}
-//*************************************************************************
-OUString SAL_CALL SimpleRegistryImpl::getImplementationName( )
- throw(RuntimeException)
+rtl::OUString Key::getLinkTarget(rtl::OUString const & rLinkName)
+ throw (css::registry::InvalidRegistryException, css::uno::RuntimeException)
{
- return stoc_bootstrap::simreg_getImplementationName();
-}
+ 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;
+}
-//*************************************************************************
-sal_Bool SAL_CALL SimpleRegistryImpl::supportsService( const OUString& ServiceName )
- throw(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;
-}
-
-//*************************************************************************
-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;
+namespace stoc_bootstrap {
- Registry reg;
-
- XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_simreg::SimpleRegistryImpl(reg);
+css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
+ css::uno::Reference< css::uno::XComponentContext > const &)
+{
+ return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
+}
- if (pRegistry)
- {
- xRet = Reference<XInterface>::query(pRegistry);
- }
-
- 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 100644
index 000000000..5a50a5aa6
--- /dev/null
+++ b/stoc/source/simpleregistry/textualservices.cxx
@@ -0,0 +1,1228 @@
+/*************************************************************************
+*
+* 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/malformeduriexception.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "rtl/uri.hxx"
+#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 >());
+ }
+ try {
+ attrUri_ = rtl::Uri::convertRelToAbs(reader_.getUrl(), attrUri_);
+ } catch (rtl::MalformedUriException & e) {
+ throw css::registry::InvalidRegistryException(
+ (reader_.getUrl() +
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(": bad \"uri\" attribute: ")) +
+ e.getMessage()),
+ 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 000000000..0261e2604
--- /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 7b8cfdb90..73787a5f3 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 cfdc33e75..05ffd5fdd 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 000000000..ccc131b4a
--- /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 4243d4551..32f229cc3 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 000000000..fb3528728
--- /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>
diff --git a/udkapi/com/sun/star/script/XDirectInvocation.idl b/udkapi/com/sun/star/script/XDirectInvocation.idl
new file mode 100644
index 000000000..3396bb05e
--- /dev/null
+++ b/udkapi/com/sun/star/script/XDirectInvocation.idl
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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 __com_sun_star_script_XDirectInvocation_idl__
+#define __com_sun_star_script_XDirectInvocation_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+#endif
+
+#ifndef __com_sun_star_script_CannotConvertException_idl__
+#include <com/sun/star/script/CannotConvertException.idl>
+#endif
+
+#ifndef __com_sun_star_reflection_InvocationTargetException_idl__
+#include <com/sun/star/reflection/InvocationTargetException.idl>
+#endif
+
+#ifndef __com_sun_star_beans_UnknownPropertyException_idl__
+#include <com/sun/star/beans/UnknownPropertyException.idl>
+#endif
+
+
+//=============================================================================
+
+ module com { module sun { module star { module script {
+
+//=============================================================================
+/** provides access to an object's methods and properties.
+ */
+published interface XDirectInvocation: com::sun::star::uno::XInterface
+{
+ //-------------------------------------------------------------------------
+ /** provides access to methods and properties exposed by an object.
+
+ @param aParams all parameters, out parameters are not supported
+ */
+ any directInvoke( [in] string aName,
+ [in] sequence<any> aParams )
+ raises( com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::script::CannotConvertException,
+ com::sun::star::reflection::InvocationTargetException );
+
+ //-------------------------------------------------------------------------
+ /** returns <TRUE/> if the method or property with the specified name exists, else <FALSE/>.
+ */
+ boolean hasMember( [in] string aName );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
+
diff --git a/udkapi/com/sun/star/script/makefile.mk b/udkapi/com/sun/star/script/makefile.mk
index 32aa58fef..c457b4a78 100644
--- a/udkapi/com/sun/star/script/makefile.mk
+++ b/udkapi/com/sun/star/script/makefile.mk
@@ -60,6 +60,7 @@ IDLFILES=\
XAllListener.idl\
XAllListenerAdapterService.idl\
XDebugging.idl\
+ XDirectInvocation.idl\
XEngine.idl\
XEngineListener.idl\
XEventAttacher.idl\
diff --git a/ure/prj/build.lst b/ure/prj/build.lst
index 07fbfc484..1f9b694ed 100644
--- a/ure/prj/build.lst
+++ b/ure/prj/build.lst
@@ -1,2 +1,2 @@
-ur ure : cli_ure solenv NULL
+ur ure : LIBXSLT:libxslt cli_ure io javaunohelper remotebridges solenv stoc NULL
ur ure\source nmake - all ur_source NULL
diff --git a/ure/prj/d.lst b/ure/prj/d.lst
index 23524c981..22cfb161c 100644
--- a/ure/prj/d.lst
+++ b/ure/prj/d.lst
@@ -1,9 +1,11 @@
mkdir: %_DEST%\bin%_EXT%\ure
-..\%__SRC%\bin\ure\README %_DEST%\bin%_EXT%\ure\README
-..\%__SRC%\bin\ure\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html
-..\%__SRC%\bin\ure\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini
-..\%__SRC%\bin\ure\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc
-..\%__SRC%\bin\ure\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh
-..\%__SRC%\bin\ure\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini
-..\%__SRC%\bin\ure\unorc %_DEST%\bin%_EXT%\ure\unorc
+mkdir: %_DEST%\xml%_EXT%\ure
..\%__SRC%\bin\uretest.zip %COMMON_DEST%\bin%_EXT%\uretest.zip
+..\%__SRC%\misc\services.rdb %_DEST%\xml%_EXT%\ure\services.rdb
+..\source\README %_DEST%\bin%_EXT%\ure\README
+..\source\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html
+..\source\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini
+..\source\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc
+..\source\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh
+..\source\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini
+..\source\unorc %_DEST%\bin%_EXT%\ure\unorc
diff --git a/ure/source/README b/ure/source/README
index 6e5162d8f..3bbdaa43d 100644
--- a/ure/source/README
+++ b/ure/source/README
@@ -65,6 +65,7 @@ Linux x86, Solaris x86, and Solaris SPARC:
/opt/openoffice.org/ure/lib/libreg.so.3 [private]
/opt/openoffice.org/ure/lib/librmcxt.so.3 [private]
/opt/openoffice.org/ure/lib/libstore.so.3 [private]
+/opt/openoffice.org/ure/lib/libxmlreader.so [private]
/opt/openoffice.org/ure/lib/libjvmaccessgcc3.so.3 [private; Linux x86 only]
/opt/openoffice.org/ure/lib/libjvmaccessC52.so.3 [private; Solaris only]
/opt/openoffice.org/ure/lib/libjvmfwk.so.3 [private]
@@ -128,6 +129,7 @@ Program Files\URE\bin\uno.ini [private]
Program Files\URE\bin\reg3.dll [private]
Program Files\URE\bin\rmcxt3.dll [private]
Program Files\URE\bin\store3.dll [private]
+Program Files\URE\bin\xmlreader.dll [private]
Program Files\URE\bin\jvmaccess3MSC.dll [private]
Program Files\URE\bin\jvmfwk3.dll [private]
Program Files\URE\bin\sunjavaplugin.dll [private]
diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk
index a1728b277..cd6fab210 100644
--- a/ure/source/makefile.mk
+++ b/ure/source/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -25,52 +25,46 @@
#
#*************************************************************************
-PRJ := ..
-PRJNAME := ure
-TARGET := $(PRJNAME)
-
-.INCLUDE: settings.mk
-
-.IF "$(OS)" == "WNT" || "$(OS)" == "OS2"
-MY_RC = .ini
-.ELSE
-MY_RC = rc
-.ENDIF
+PRJ = ..
+PRJNAME = ure
+TARGET = source
ZIP1TARGET = uretest
ZIP1FLAGS = -r
ZIP1LIST = uretest
-.INCLUDE: target.mk
-
-ALLTAR: \
- $(BIN)$/ure$/README \
- $(BIN)$/ure$/THIRDPARTYLICENSEREADME.html \
- $(BIN)$/ure$/jvmfwk3$(MY_RC) \
- $(BIN)$/ure$/uno$(MY_RC)
+my_components = \
+ acceptor \
+ bootstrap \
+ bridgefac \
+ connector \
+ introspection \
+ invocadapt \
+ invocation \
+ javaloader \
+ javavm \
+ juh \
+ namingservice \
+ proxyfac \
+ reflection \
+ remotebridge \
+ stocservices \
+ streams \
+ textinstream \
+ textoutstream \
+ uuresolver
-$(BIN)$/ure$/README: README
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-$(BIN)$/ure$/THIRDPARTYLICENSEREADME.html: THIRDPARTYLICENSEREADME.html
- - $(MKDIR) $(@:d)
- $(COPY) $< $@
-
-$(BIN)$/ure$/jvmfwk3$(MY_RC): jvmfwk3$(MY_RC)
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-$(BIN)$/ure$/uno$(MY_RC): uno$(MY_RC)
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
-
-.IF "$(OS)" != "WNT"
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
-ALLTAR: $(BIN)$/ure$/startup.sh
+ALLTAR : $(MISC)/services.rdb
-$(BIN)$/ure$/startup.sh: startup.sh
- -$(MKDIR) $(@:d)
- $(COPY) $< $@
+$(MISC)/services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \
+ $(MISC)/services.input $(my_components:^"$(SOLARXMLDIR)/":+".component")
+ $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \
+ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/services.input
-.ENDIF
+$(MISC)/services.input :
+ echo \
+ '<list>$(my_components:^"<filename>":+".component</filename>")</list>' \
+ > $@
diff --git a/ure/source/startup.sh b/ure/source/startup.sh
index 70748f262..7f973c5bf 100644
--- a/ure/source/startup.sh
+++ b/ure/source/startup.sh
@@ -39,7 +39,7 @@ epath=`dirname "$0"`
if [ -x "${epath}/javaldx" ] ; then
jpath=`"${epath}/javaldx" $my_envargs`
if [ -n "${jpath}" ]; then
- LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}
+ LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH
fi
fi
diff --git a/xmlreader/inc/makefile.mk b/xmlreader/inc/makefile.mk
new file mode 100644
index 000000000..9f8443470
--- /dev/null
+++ b/xmlreader/inc/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+PRJ = ..
+PRJNAME = xmlreader
+TARGET = inc
+
+ENABLE_EXCEPTIONS = TRUE
+VISIBILITY_HIDDEN = TRUE
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+
+.IF "$(ENABLE_PCH)" != ""
+ALLTAR: $(SLO)/precompiled.pch $(SLO)/precompiled_ex.pch
+.ENDIF
diff --git a/xmlreader/inc/pch/precompiled_xmlreader.cxx b/xmlreader/inc/pch/precompiled_xmlreader.cxx
new file mode 100644
index 000000000..e5d584855
--- /dev/null
+++ b/xmlreader/inc/pch/precompiled_xmlreader.cxx
@@ -0,0 +1,28 @@
+/*************************************************************************
+*
+* 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_xmlreader.hxx"
diff --git a/xmlreader/inc/pch/precompiled_xmlreader.hxx b/xmlreader/inc/pch/precompiled_xmlreader.hxx
new file mode 100644
index 000000000..7561fe89f
--- /dev/null
+++ b/xmlreader/inc/pch/precompiled_xmlreader.hxx
@@ -0,0 +1,32 @@
+/*************************************************************************
+*
+* 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.
+*
+************************************************************************/
+
+#if defined PRECOMPILED_HEADERS
+
+#include "sal/config.h"
+
+#endif
diff --git a/xmlreader/inc/xmlreader/README b/xmlreader/inc/xmlreader/README
new file mode 100644
index 000000000..cf238a695
--- /dev/null
+++ b/xmlreader/inc/xmlreader/README
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# 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.
+#
+#***********************************************************************/
+
+<http://qa.openoffice.org/issues/show_bug.cgi?id=115203>: "Issue 113189
+extracted xmlreader from configmgr, to make the former available within URE.
+The xmlreader library is for now considered a private part of URE (cf.
+ure/source/README), for simplicity uses OOO_DLLPUBLIC_XMLREADER-based symbol
+visibility (and thus no symbol versioning), but is of course used from outside
+URE in configmgr. This works as long as its ABI does not change. If it ever
+changes, symbol versioning will have to be added (in some form or other)."
diff --git a/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx b/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx
new file mode 100644
index 000000000..238661a24
--- /dev/null
+++ b/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+*
+* 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_XMLREADER_DETAIL_XMLREADERDLLAPI_HXX
+#define INCLUDED_XMLREADER_DETAIL_XMLREADERDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_XMLREADER
+#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
diff --git a/xmlreader/inc/xmlreader/pad.hxx b/xmlreader/inc/xmlreader/pad.hxx
new file mode 100644
index 000000000..d01574147
--- /dev/null
+++ b/xmlreader/inc/xmlreader/pad.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+*
+* 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_XMLREADER_PAD_HXX
+#define INCLUDED_XMLREADER_PAD_HXX
+
+#include "sal/config.h"
+
+#include "rtl/strbuf.hxx"
+#include "sal/types.h"
+#include "xmlreader/detail/xmlreaderdllapi.hxx"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+class OOO_DLLPUBLIC_XMLREADER Pad {
+public:
+ void add(char const * begin, sal_Int32 length);
+
+ void addEphemeral(char const * begin, sal_Int32 length);
+
+ void clear();
+
+ Span get() const;
+
+private:
+ SAL_DLLPRIVATE void flushSpan();
+
+ Span span_;
+ rtl::OStringBuffer buffer_;
+};
+
+}
+
+#endif
diff --git a/xmlreader/inc/xmlreader/span.hxx b/xmlreader/inc/xmlreader/span.hxx
new file mode 100644
index 000000000..4ec8b574f
--- /dev/null
+++ b/xmlreader/inc/xmlreader/span.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+*
+* 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_XMLREADER_SPAN_HXX
+#define INCLUDED_XMLREADER_SPAN_HXX
+
+#include "sal/config.h"
+
+#include "rtl/string.h"
+#include "sal/types.h"
+#include "xmlreader/detail/xmlreaderdllapi.hxx"
+
+namespace rtl { class OUString; }
+
+namespace xmlreader {
+
+struct OOO_DLLPUBLIC_XMLREADER Span {
+ char const * begin;
+ sal_Int32 length;
+
+ inline Span(): begin(0), length(0) {}
+ // init length to avoid compiler warnings
+
+ inline Span(char const * theBegin, sal_Int32 theLength):
+ begin(theBegin), length(theLength) {}
+
+ inline void clear() throw() { begin = 0; }
+
+ inline bool is() const { return begin != 0; }
+
+ inline bool equals(Span const & text) const {
+ return rtl_str_compare_WithLength(
+ begin, length, text.begin, text.length) == 0;
+ }
+
+ inline bool equals(char const * textBegin, sal_Int32 textLength) const {
+ return equals(Span(textBegin, textLength));
+ }
+
+ rtl::OUString convertFromUtf8() const;
+};
+
+}
+
+#endif
diff --git a/xmlreader/inc/xmlreader/xmlreader.hxx b/xmlreader/inc/xmlreader/xmlreader.hxx
new file mode 100644
index 000000000..242af58c7
--- /dev/null
+++ b/xmlreader/inc/xmlreader/xmlreader.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+*
+* 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_XMLREADER_XMLREADER_HXX
+#define INCLUDED_XMLREADER_XMLREADER_HXX
+
+#include "sal/config.h"
+
+#include <stack>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "osl/file.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "xmlreader/detail/xmlreaderdllapi.hxx"
+#include "xmlreader/pad.hxx"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+class OOO_DLLPUBLIC_XMLREADER XmlReader: private boost::noncopyable {
+public:
+ explicit XmlReader(rtl::OUString const & fileUrl)
+ SAL_THROW((
+ com::sun::star::container::NoSuchElementException,
+ com::sun::star::uno::RuntimeException));
+
+ ~XmlReader();
+
+ enum { NAMESPACE_NONE = -2, NAMESPACE_UNKNOWN = -1, NAMESPACE_XML = 0 };
+
+ enum Text { TEXT_NONE, TEXT_RAW, TEXT_NORMALIZED };
+
+ enum Result { RESULT_BEGIN, RESULT_END, RESULT_TEXT, RESULT_DONE };
+
+ int registerNamespaceIri(Span const & iri);
+
+ // RESULT_BEGIN: data = localName, ns = ns
+ // RESULT_END: data, ns unused
+ // RESULT_TEXT: data = text, ns unused
+ Result nextItem(Text reportText, Span * data, int * nsId);
+
+ bool nextAttribute(int * nsId, Span * localName);
+
+ // the span returned by getAttributeValue is only valid until the next call
+ // to nextItem or getAttributeValue
+ Span getAttributeValue(bool fullyNormalize);
+
+ int getNamespaceId(Span const & prefix) const;
+
+ rtl::OUString getUrl() const;
+
+private:
+ typedef std::vector< Span > NamespaceIris;
+
+ // If NamespaceData (and similarly ElementData and AttributeData) is made
+ // SAL_DLLPRIVATE, at least gcc 4.2.3 erroneously warns about
+ // "'xmlreader::XmlReader' declared with greater visibility than the type of
+ // its field 'xmlreader::XmlReader::namespaces_'" (and similarly for
+ // elements_ and attributes_):
+
+ struct NamespaceData {
+ Span prefix;
+ int nsId;
+
+ NamespaceData() {}
+
+ NamespaceData(Span const & thePrefix, int theNsId):
+ prefix(thePrefix), nsId(theNsId) {}
+ };
+
+ typedef std::vector< NamespaceData > NamespaceList;
+
+ struct ElementData {
+ Span name;
+ NamespaceList::size_type inheritedNamespaces;
+ int defaultNamespaceId;
+
+ ElementData(
+ Span const & theName,
+ NamespaceList::size_type theInheritedNamespaces,
+ int theDefaultNamespaceId):
+ name(theName), inheritedNamespaces(theInheritedNamespaces),
+ defaultNamespaceId(theDefaultNamespaceId)
+ {}
+ };
+
+ typedef std::stack< ElementData > ElementStack;
+
+ struct AttributeData {
+ char const * nameBegin;
+ char const * nameEnd;
+ char const * nameColon;
+ char const * valueBegin;
+ char const * valueEnd;
+
+ AttributeData(
+ char const * theNameBegin, char const * theNameEnd,
+ char const * theNameColon, char const * theValueBegin,
+ char const * theValueEnd):
+ nameBegin(theNameBegin), nameEnd(theNameEnd),
+ nameColon(theNameColon), valueBegin(theValueBegin),
+ valueEnd(theValueEnd)
+ {}
+ };
+
+ typedef std::vector< AttributeData > Attributes;
+
+ enum State {
+ STATE_CONTENT, STATE_START_TAG, STATE_END_TAG, STATE_EMPTY_ELEMENT_TAG,
+ STATE_DONE };
+
+ SAL_DLLPRIVATE inline char read() { return pos_ == end_ ? '\0' : *pos_++; }
+
+ SAL_DLLPRIVATE inline char peek() { return pos_ == end_ ? '\0' : *pos_; }
+
+ SAL_DLLPRIVATE void normalizeLineEnds(Span const & text);
+
+ SAL_DLLPRIVATE void skipSpace();
+
+ SAL_DLLPRIVATE bool skipComment();
+
+ SAL_DLLPRIVATE void skipProcessingInstruction();
+
+ SAL_DLLPRIVATE void skipDocumentTypeDeclaration();
+
+ SAL_DLLPRIVATE Span scanCdataSection();
+
+ SAL_DLLPRIVATE bool scanName(char const ** nameColon);
+
+ SAL_DLLPRIVATE int scanNamespaceIri(
+ char const * begin, char const * end);
+
+ SAL_DLLPRIVATE char const * handleReference(
+ char const * position, char const * end);
+
+ SAL_DLLPRIVATE Span handleAttributeValue(
+ char const * begin, char const * end, bool fullyNormalize);
+
+ SAL_DLLPRIVATE Result handleStartTag(int * nsId, Span * localName);
+
+ SAL_DLLPRIVATE Result handleEndTag();
+
+ SAL_DLLPRIVATE void handleElementEnd();
+
+ SAL_DLLPRIVATE Result handleSkippedText(Span * data, int * nsId);
+
+ SAL_DLLPRIVATE Result handleRawText(Span * text);
+
+ SAL_DLLPRIVATE Result handleNormalizedText(Span * text);
+
+ SAL_DLLPRIVATE int toNamespaceId(NamespaceIris::size_type pos);
+
+ rtl::OUString fileUrl_;
+ oslFileHandle fileHandle_;
+ sal_uInt64 fileSize_;
+ void * fileAddress_;
+ NamespaceIris namespaceIris_;
+ NamespaceList namespaces_;
+ ElementStack elements_;
+ char const * pos_;
+ char const * end_;
+ State state_;
+ Attributes attributes_;
+ Attributes::iterator currentAttribute_;
+ bool firstAttribute_;
+ Pad pad_;
+};
+
+}
+
+#endif
diff --git a/xmlreader/prj/build.lst b/xmlreader/prj/build.lst
new file mode 100644
index 000000000..5408a5255
--- /dev/null
+++ b/xmlreader/prj/build.lst
@@ -0,0 +1,3 @@
+xr xmlreader : BOOST:boost cppu offuh sal stlport NULL
+xr xmlreader\inc nmake - all xr_inc NULL
+xr xmlreader\source nmake - all xr_source xr_inc NULL
diff --git a/xmlreader/prj/d.lst b/xmlreader/prj/d.lst
new file mode 100644
index 000000000..fcb99bd30
--- /dev/null
+++ b/xmlreader/prj/d.lst
@@ -0,0 +1,10 @@
+mkdir: %_DEST%\inc%_EXT%\xmlreader
+mkdir: %_DEST%\inc%_EXT%\xmlreader\detail
+..\%__SRC%\bin\xmlreader.dll %_DEST%\bin%_EXT%\xmlreader.dll
+..\%__SRC%\lib\ixmlreader.lib %_DEST%\lib%_EXT%\ixmlreader.lib
+..\%__SRC%\lib\libxmlreader.dylib %_DEST%\lib%_EXT%\libxmlreader.dylib
+..\%__SRC%\lib\libxmlreader.so %_DEST%\lib%_EXT%\libxmlreader.so
+..\inc\xmlreader\detail\xmlreaderdllapi.hxx %_DEST%\inc%_EXT%\xmlreader\detail\xmlreaderdllapi.hxx
+..\inc\xmlreader\pad.hxx %_DEST%\inc%_EXT%\xmlreader\pad.hxx
+..\inc\xmlreader\span.hxx %_DEST%\inc%_EXT%\xmlreader\span.hxx
+..\inc\xmlreader\xmlreader.hxx %_DEST%\inc%_EXT%\xmlreader\xmlreader.hxx
diff --git a/cpputools/source/regcomplazy/makefile.mk b/xmlreader/source/makefile.mk
index 0a4fe8477..cb71e21a1 100755..100644
--- a/cpputools/source/regcomplazy/makefile.mk
+++ b/xmlreader/source/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -23,32 +23,31 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
-PRJ=..$/..
-
-PRJNAME=cpputools
-TARGET=regcomplazy
-TARGETTYPE=CUI
-LIBTARGET=NO
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
+#***********************************************************************/
-.INCLUDE : settings.mk
+PRJ = ..
+PRJNAME = xmlreader
+TARGET = xmlreader
-# --- Files --------------------------------------------------------
+ENABLE_EXCEPTIONS = TRUE
+VISIBILITY_HIDDEN = TRUE
-DEPOBJFILES= \
- $(OBJ)$/regcomplazy.obj
+.INCLUDE: settings.mk
-APP1TARGET=$(TARGET)
-APP1OBJS=$(DEPOBJFILES)
+CDEFS += -DOOO_DLLIMPLEMENTATION_XMLREADER
-APP1STDLIBS= \
- $(SALLIB) \
- $(SALHELPERLIB) \
- $(REGLIB)
+SLOFILES = \
+ $(SLO)/pad.obj \
+ $(SLO)/span.obj \
+ $(SLO)/xmlreader.obj
-.INCLUDE : target.mk
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = URELIB
+SHL1STDLIBS = \
+ $(SALLIB)
+SHL1TARGET = xmlreader
+SHL1USE_EXPORTS = name
+DEF1NAME = $(SHL1TARGET)
+.INCLUDE: target.mk
diff --git a/xmlreader/source/pad.cxx b/xmlreader/source/pad.cxx
new file mode 100644
index 000000000..b1673c4a4
--- /dev/null
+++ b/xmlreader/source/pad.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+*
+* 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_xmlreader.hxx"
+#include "sal/config.h"
+
+#include "osl/diagnose.h"
+#include "rtl/string.h"
+#include "sal/types.h"
+#include "xmlreader/pad.hxx"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+void Pad::add(char const * begin, sal_Int32 length) {
+ OSL_ASSERT(
+ begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ if (length != 0) {
+ flushSpan();
+ if (buffer_.getLength() == 0) {
+ span_ = Span(begin, length);
+ } else {
+ buffer_.append(begin, length);
+ }
+ }
+}
+
+void Pad::addEphemeral(char const * begin, sal_Int32 length) {
+ OSL_ASSERT(
+ begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0));
+ if (length != 0) {
+ flushSpan();
+ buffer_.append(begin, length);
+ }
+}
+
+void Pad::clear() {
+ OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
+ span_.clear();
+ buffer_.setLength(0);
+}
+
+Span Pad::get() const {
+ OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0));
+ if (span_.is()) {
+ return span_;
+ } else if (buffer_.getLength() == 0) {
+ return Span(RTL_CONSTASCII_STRINGPARAM(""));
+ } else {
+ return Span(buffer_.getStr(), buffer_.getLength());
+ }
+}
+
+void Pad::flushSpan() {
+ if (span_.is()) {
+ buffer_.append(span_.begin, span_.length);
+ span_.clear();
+ }
+}
+
+}
diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx
new file mode 100644
index 000000000..3b936553b
--- /dev/null
+++ b/xmlreader/source/span.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+*
+* 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_xmlreader.hxx"
+#include "sal/config.h"
+
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "osl/diagnose.h"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "xmlreader/span.hxx"
+
+namespace xmlreader {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+rtl::OUString Span::convertFromUtf8() const {
+ OSL_ASSERT(is());
+ rtl_uString * s = 0;
+ if (!rtl_convertStringToUString(
+ &s, begin, length, RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("cannot convert from UTF-8")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return rtl::OUString(s, SAL_NO_ACQUIRE);
+}
+
+}
diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx
new file mode 100644
index 000000000..27350a8f0
--- /dev/null
+++ b/xmlreader/source/xmlreader.cxx
@@ -0,0 +1,1054 @@
+/*************************************************************************
+*
+* 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_xmlreader.hxx"
+#include "sal/config.h"
+
+#include <climits>
+#include <cstddef>
+
+#include "com/sun/star/container/NoSuchElementException.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "osl/diagnose.h"
+#include "osl/file.h"
+#include "rtl/string.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "xmlreader/pad.hxx"
+#include "xmlreader/span.hxx"
+#include "xmlreader/xmlreader.hxx"
+
+namespace xmlreader {
+
+namespace {
+
+namespace css = com::sun::star;
+
+bool isSpace(char c) {
+ switch (c) {
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ case ' ':
+ return true;
+ default:
+ return false;
+ }
+}
+
+}
+
+XmlReader::XmlReader(rtl::OUString const & fileUrl)
+ SAL_THROW((
+ css::container::NoSuchElementException, css::uno::RuntimeException)):
+ fileUrl_(fileUrl)
+{
+ switch (osl_openFile(fileUrl_.pData, &fileHandle_, osl_File_OpenFlag_Read))
+ {
+ case osl_File_E_None:
+ break;
+ case osl_File_E_NOENT:
+ throw css::container::NoSuchElementException(
+ fileUrl_, css::uno::Reference< css::uno::XInterface >());
+ default:
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot open ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ oslFileError e = osl_getFileSize(fileHandle_, &fileSize_);
+ if (e == osl_File_E_None) {
+ e = osl_mapFile(
+ fileHandle_, &fileAddress_, fileSize_, 0,
+ osl_File_MapFlag_WillNeed);
+ }
+ if (e != osl_File_E_None) {
+ e = osl_closeFile(fileHandle_);
+ if (e != osl_File_E_None) {
+ OSL_TRACE("osl_closeFile failed with %ld", static_cast< long >(e));
+ }
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot mmap ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ namespaceIris_.push_back(
+ Span(
+ RTL_CONSTASCII_STRINGPARAM(
+ "http://www.w3.org/XML/1998/namespace")));
+ namespaces_.push_back(
+ NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xml")), NAMESPACE_XML));
+ pos_ = static_cast< char * >(fileAddress_);
+ end_ = pos_ + fileSize_;
+ state_ = STATE_CONTENT;
+}
+
+XmlReader::~XmlReader() {
+ oslFileError e = osl_unmapFile(fileAddress_, fileSize_);
+ if (e != osl_File_E_None) {
+ OSL_TRACE("osl_unmapFile failed with %ld", static_cast< long >(e));
+ }
+ e = osl_closeFile(fileHandle_);
+ if (e != osl_File_E_None) {
+ OSL_TRACE("osl_closeFile failed with %ld", static_cast< long >(e));
+ }
+}
+
+int XmlReader::registerNamespaceIri(Span const & iri) {
+ int id = toNamespaceId(namespaceIris_.size());
+ namespaceIris_.push_back(iri);
+ if (iri.equals(
+ Span(
+ RTL_CONSTASCII_STRINGPARAM(
+ "http://www.w3.org/2001/XMLSchema-instance"))))
+ {
+ // Old user layer .xcu files used the xsi namespace prefix without
+ // declaring a corresponding namespace binding, see issue 77174; reading
+ // those files during migration would fail without this hack that can be
+ // removed once migration is no longer relevant (see
+ // configmgr::Components::parseModificationLayer):
+ namespaces_.push_back(
+ NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xsi")), id));
+ }
+ return id;
+}
+
+XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId)
+{
+ switch (state_) {
+ case STATE_CONTENT:
+ switch (reportText) {
+ case TEXT_NONE:
+ return handleSkippedText(data, nsId);
+ case TEXT_RAW:
+ return handleRawText(data);
+ case TEXT_NORMALIZED:
+ return handleNormalizedText(data);
+ }
+ case STATE_START_TAG:
+ return handleStartTag(nsId, data);
+ case STATE_END_TAG:
+ return handleEndTag();
+ case STATE_EMPTY_ELEMENT_TAG:
+ handleElementEnd();
+ return RESULT_END;
+ default: // STATE_DONE
+ return RESULT_DONE;
+ }
+}
+
+bool XmlReader::nextAttribute(int * nsId, Span * localName) {
+ OSL_ASSERT(nsId != 0 && localName != 0);
+ if (firstAttribute_) {
+ currentAttribute_ = attributes_.begin();
+ firstAttribute_ = false;
+ } else {
+ ++currentAttribute_;
+ }
+ if (currentAttribute_ == attributes_.end()) {
+ return false;
+ }
+ if (currentAttribute_->nameColon == 0) {
+ *nsId = NAMESPACE_NONE;
+ *localName = Span(
+ currentAttribute_->nameBegin,
+ currentAttribute_->nameEnd - currentAttribute_->nameBegin);
+ } else {
+ *nsId = getNamespaceId(
+ Span(
+ currentAttribute_->nameBegin,
+ currentAttribute_->nameColon - currentAttribute_->nameBegin));
+ *localName = Span(
+ currentAttribute_->nameColon + 1,
+ currentAttribute_->nameEnd - (currentAttribute_->nameColon + 1));
+ }
+ return true;
+}
+
+Span XmlReader::getAttributeValue(bool fullyNormalize) {
+ return handleAttributeValue(
+ currentAttribute_->valueBegin, currentAttribute_->valueEnd,
+ fullyNormalize);
+}
+
+int XmlReader::getNamespaceId(Span const & prefix) const {
+ for (NamespaceList::const_reverse_iterator i(namespaces_.rbegin());
+ i != namespaces_.rend(); ++i)
+ {
+ if (prefix.equals(i->prefix)) {
+ return i->nsId;
+ }
+ }
+ return NAMESPACE_UNKNOWN;
+}
+
+rtl::OUString XmlReader::getUrl() const {
+ return fileUrl_;
+}
+
+void XmlReader::normalizeLineEnds(Span const & text) {
+ char const * p = text.begin;
+ sal_Int32 n = text.length;
+ for (;;) {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(p, n, '\x0D');
+ if (i < 0) {
+ break;
+ }
+ pad_.add(p, i);
+ p += i + 1;
+ n -= i + 1;
+ if (n == 0 || *p != '\x0A') {
+ pad_.add(RTL_CONSTASCII_STRINGPARAM("\x0A"));
+ }
+ }
+ pad_.add(p, n);
+}
+
+void XmlReader::skipSpace() {
+ while (isSpace(peek())) {
+ ++pos_;
+ }
+}
+
+bool XmlReader::skipComment() {
+ if (rtl_str_shortenedCompare_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("--"),
+ RTL_CONSTASCII_LENGTH("--")) !=
+ 0)
+ {
+ return false;
+ }
+ pos_ += RTL_CONSTASCII_LENGTH("--");
+ sal_Int32 i = rtl_str_indexOfStr_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("--"));
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within comment) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + RTL_CONSTASCII_LENGTH("--");
+ if (read() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "illegal \"--\" within comment in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return true;
+}
+
+void XmlReader::skipProcessingInstruction() {
+ sal_Int32 i = rtl_str_indexOfStr_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("?>"));
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad '<?' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + RTL_CONSTASCII_LENGTH("?>");
+}
+
+void XmlReader::skipDocumentTypeDeclaration() {
+ // Neither is it checked that the doctypedecl is at the correct position in
+ // the document, nor that it is well-formed:
+ for (;;) {
+ char c = read();
+ switch (c) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '"':
+ case '\'':
+ {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(
+ pos_, end_ - pos_, c);
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + 1;
+ }
+ break;
+ case '>':
+ return;
+ case '[':
+ for (;;) {
+ c = read();
+ switch (c) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '"':
+ case '\'':
+ {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(
+ pos_, end_ - pos_, c);
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + 1;
+ }
+ break;
+ case '<':
+ switch (read()) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within DTD) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '!':
+ skipComment();
+ break;
+ case '?':
+ skipProcessingInstruction();
+ break;
+ default:
+ break;
+ }
+ break;
+ case ']':
+ skipSpace();
+ if (read() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "missing \">\" of DTD in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return;
+ default:
+ break;
+ }
+ }
+ default:
+ break;
+ }
+ }
+}
+
+Span XmlReader::scanCdataSection() {
+ if (rtl_str_shortenedCompare_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("[CDATA["),
+ RTL_CONSTASCII_LENGTH("[CDATA[")) !=
+ 0)
+ {
+ return Span();
+ }
+ pos_ += RTL_CONSTASCII_LENGTH("[CDATA[");
+ char const * begin = pos_;
+ sal_Int32 i = rtl_str_indexOfStr_WithLength(
+ pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("]]>"));
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "premature end (within CDATA section) of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + RTL_CONSTASCII_LENGTH("]]>");
+ return Span(begin, i);
+}
+
+bool XmlReader::scanName(char const ** nameColon) {
+ OSL_ASSERT(nameColon != 0 && *nameColon == 0);
+ for (char const * begin = pos_;; ++pos_) {
+ switch (peek()) {
+ case '\0': // i.e., EOF
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ case ' ':
+ case '/':
+ case '=':
+ case '>':
+ return pos_ != begin;
+ case ':':
+ *nameColon = pos_;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+int XmlReader::scanNamespaceIri(char const * begin, char const * end) {
+ OSL_ASSERT(begin != 0 && begin <= end);
+ Span iri(handleAttributeValue(begin, end, false));
+ for (NamespaceIris::size_type i = 0; i < namespaceIris_.size(); ++i) {
+ if (namespaceIris_[i].equals(iri)) {
+ return toNamespaceId(i);
+ }
+ }
+ return XmlReader::NAMESPACE_UNKNOWN;
+}
+
+char const * XmlReader::handleReference(char const * position, char const * end)
+{
+ OSL_ASSERT(position != 0 && *position == '&' && position < end);
+ ++position;
+ if (*position == '#') {
+ ++position;
+ sal_Int32 val = 0;
+ char const * p;
+ if (*position == 'x') {
+ ++position;
+ p = position;
+ for (;; ++position) {
+ char c = *position;
+ if (c >= '0' && c <= '9') {
+ val = 16 * val + (c - '0');
+ } else if (c >= 'A' && c <= 'F') {
+ val = 16 * val + (c - 'A') + 10;
+ } else if (c >= 'a' && c <= 'f') {
+ val = 16 * val + (c - 'a') + 10;
+ } else {
+ break;
+ }
+ if (val > 0x10FFFF) { // avoid overflow
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "'&#x...' too large in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ } else {
+ p = position;
+ for (;; ++position) {
+ char c = *position;
+ if (c >= '0' && c <= '9') {
+ val = 10 * val + (c - '0');
+ } else {
+ break;
+ }
+ if (val > 0x10FFFF) { // avoid overflow
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "'&#...' too large in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ }
+ if (position == p || *position++ != ';') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("'&#...' missing ';' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ OSL_ASSERT(val >= 0 && val <= 0x10FFFF);
+ if ((val < 0x20 && val != 0x9 && val != 0xA && val != 0xD) ||
+ (val >= 0xD800 && val <= 0xDFFF) || val == 0xFFFE || val == 0xFFFF)
+ {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "character reference denoting invalid character in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char buf[4];
+ sal_Int32 len;
+ if (val < 0x80) {
+ buf[0] = static_cast< char >(val);
+ len = 1;
+ } else if (val < 0x800) {
+ buf[0] = static_cast< char >((val >> 6) | 0xC0);
+ buf[1] = static_cast< char >((val & 0x3F) | 0x80);
+ len = 2;
+ } else if (val < 0x10000) {
+ buf[0] = static_cast< char >((val >> 12) | 0xE0);
+ buf[1] = static_cast< char >(((val >> 6) & 0x3F) | 0x80);
+ buf[2] = static_cast< char >((val & 0x3F) | 0x80);
+ len = 3;
+ } else {
+ buf[0] = static_cast< char >((val >> 18) | 0xF0);
+ buf[1] = static_cast< char >(((val >> 12) & 0x3F) | 0x80);
+ buf[2] = static_cast< char >(((val >> 6) & 0x3F) | 0x80);
+ buf[3] = static_cast< char >((val & 0x3F) | 0x80);
+ len = 4;
+ }
+ pad_.addEphemeral(buf, len);
+ return position;
+ } else {
+ struct EntityRef {
+ char const * inBegin;
+ sal_Int32 inLength;
+ char const * outBegin;
+ sal_Int32 outLength;
+ };
+ static EntityRef const refs[] = {
+ { RTL_CONSTASCII_STRINGPARAM("amp;"),
+ RTL_CONSTASCII_STRINGPARAM("&") },
+ { RTL_CONSTASCII_STRINGPARAM("lt;"),
+ RTL_CONSTASCII_STRINGPARAM("<") },
+ { RTL_CONSTASCII_STRINGPARAM("gt;"),
+ RTL_CONSTASCII_STRINGPARAM(">") },
+ { RTL_CONSTASCII_STRINGPARAM("apos;"),
+ RTL_CONSTASCII_STRINGPARAM("'") },
+ { RTL_CONSTASCII_STRINGPARAM("quot;"),
+ RTL_CONSTASCII_STRINGPARAM("\"") } };
+ for (std::size_t i = 0; i < sizeof refs / sizeof refs[0]; ++i) {
+ if (rtl_str_shortenedCompare_WithLength(
+ position, end - position, refs[i].inBegin, refs[i].inLength,
+ refs[i].inLength) ==
+ 0)
+ {
+ position += refs[i].inLength;
+ pad_.add(refs[i].outBegin, refs[i].outLength);
+ return position;
+ }
+ }
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("unknown entity reference in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+Span XmlReader::handleAttributeValue(
+ char const * begin, char const * end, bool fullyNormalize)
+{
+ pad_.clear();
+ if (fullyNormalize) {
+ while (begin != end && isSpace(*begin)) {
+ ++begin;
+ }
+ while (end != begin && isSpace(end[-1])) {
+ --end;
+ }
+ char const * p = begin;
+ enum Space { SPACE_NONE, SPACE_SPAN, SPACE_BREAK };
+ // a single true space character can go into the current span,
+ // everything else breaks the span
+ Space space = SPACE_NONE;
+ while (p != end) {
+ switch (*p) {
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ switch (space) {
+ case SPACE_NONE:
+ pad_.add(begin, p - begin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ space = SPACE_BREAK;
+ break;
+ case SPACE_SPAN:
+ pad_.add(begin, p - begin);
+ space = SPACE_BREAK;
+ break;
+ case SPACE_BREAK:
+ break;
+ }
+ begin = ++p;
+ break;
+ case ' ':
+ switch (space) {
+ case SPACE_NONE:
+ ++p;
+ space = SPACE_SPAN;
+ break;
+ case SPACE_SPAN:
+ pad_.add(begin, p - begin);
+ begin = ++p;
+ space = SPACE_BREAK;
+ break;
+ case SPACE_BREAK:
+ begin = ++p;
+ break;
+ }
+ break;
+ case '&':
+ pad_.add(begin, p - begin);
+ p = handleReference(p, end);
+ begin = p;
+ space = SPACE_NONE;
+ break;
+ default:
+ ++p;
+ space = SPACE_NONE;
+ break;
+ }
+ }
+ pad_.add(begin, p - begin);
+ } else {
+ char const * p = begin;
+ while (p != end) {
+ switch (*p) {
+ case '\x09':
+ case '\x0A':
+ pad_.add(begin, p - begin);
+ begin = ++p;
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ case '\x0D':
+ pad_.add(begin, p - begin);
+ ++p;
+ if (peek() == '\x0A') {
+ ++p;
+ }
+ begin = p;
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ case '&':
+ pad_.add(begin, p - begin);
+ p = handleReference(p, end);
+ begin = p;
+ break;
+ default:
+ ++p;
+ break;
+ }
+ }
+ pad_.add(begin, p - begin);
+ }
+ return pad_.get();
+}
+
+XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) {
+ OSL_ASSERT(nsId != 0 && localName);
+ char const * nameBegin = pos_;
+ char const * nameColon = 0;
+ if (!scanName(&nameColon)) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad tag name in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * nameEnd = pos_;
+ NamespaceList::size_type inheritedNamespaces = namespaces_.size();
+ bool hasDefaultNs = false;
+ int defaultNsId = NAMESPACE_NONE;
+ attributes_.clear();
+ for (;;) {
+ char const * p = pos_;
+ skipSpace();
+ if (peek() == '/' || peek() == '>') {
+ break;
+ }
+ if (pos_ == p) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "missing whitespace before attribute in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * attrNameBegin = pos_;
+ char const * attrNameColon = 0;
+ if (!scanName(&attrNameColon)) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("bad attribute name in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * attrNameEnd = pos_;
+ skipSpace();
+ if (read() != '=') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '=' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ skipSpace();
+ char del = read();
+ if (del != '\'' && del != '"') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("bad attribute value in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * valueBegin = pos_;
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, del);
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "unterminated attribute value in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * valueEnd = pos_ + i;
+ pos_ += i + 1;
+ if (attrNameColon == 0 &&
+ Span(attrNameBegin, attrNameEnd - attrNameBegin).equals(
+ RTL_CONSTASCII_STRINGPARAM("xmlns")))
+ {
+ hasDefaultNs = true;
+ defaultNsId = scanNamespaceIri(valueBegin, valueEnd);
+ } else if (attrNameColon != 0 &&
+ Span(attrNameBegin, attrNameColon - attrNameBegin).equals(
+ RTL_CONSTASCII_STRINGPARAM("xmlns")))
+ {
+ namespaces_.push_back(
+ NamespaceData(
+ Span(attrNameColon + 1, attrNameEnd - (attrNameColon + 1)),
+ scanNamespaceIri(valueBegin, valueEnd)));
+ } else {
+ attributes_.push_back(
+ AttributeData(
+ attrNameBegin, attrNameEnd, attrNameColon, valueBegin,
+ valueEnd));
+ }
+ }
+ if (!hasDefaultNs && !elements_.empty()) {
+ defaultNsId = elements_.top().defaultNamespaceId;
+ }
+ firstAttribute_ = true;
+ if (peek() == '/') {
+ state_ = STATE_EMPTY_ELEMENT_TAG;
+ ++pos_;
+ } else {
+ state_ = STATE_CONTENT;
+ }
+ if (peek() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '>' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ ++pos_;
+ elements_.push(
+ ElementData(
+ Span(nameBegin, nameEnd - nameBegin), inheritedNamespaces,
+ defaultNsId));
+ if (nameColon == 0) {
+ *nsId = defaultNsId;
+ *localName = Span(nameBegin, nameEnd - nameBegin);
+ } else {
+ *nsId = getNamespaceId(Span(nameBegin, nameColon - nameBegin));
+ *localName = Span(nameColon + 1, nameEnd - (nameColon + 1));
+ }
+ return RESULT_BEGIN;
+}
+
+XmlReader::Result XmlReader::handleEndTag() {
+ if (elements_.empty()) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("spurious end tag in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ char const * nameBegin = pos_;
+ char const * nameColon = 0;
+ if (!scanName(&nameColon) ||
+ !elements_.top().name.equals(nameBegin, pos_ - nameBegin))
+ {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tag mismatch in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ handleElementEnd();
+ skipSpace();
+ if (peek() != '>') {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '>' in ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ ++pos_;
+ return RESULT_END;
+}
+
+void XmlReader::handleElementEnd() {
+ OSL_ASSERT(!elements_.empty());
+ namespaces_.resize(elements_.top().inheritedNamespaces);
+ elements_.pop();
+ state_ = elements_.empty() ? STATE_DONE : STATE_CONTENT;
+}
+
+XmlReader::Result XmlReader::handleSkippedText(Span * data, int * nsId) {
+ for (;;) {
+ sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, '<');
+ if (i < 0) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("premature end of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ pos_ += i + 1;
+ switch (peek()) {
+ case '!':
+ ++pos_;
+ if (!skipComment() && !scanCdataSection().is()) {
+ skipDocumentTypeDeclaration();
+ }
+ break;
+ case '/':
+ ++pos_;
+ return handleEndTag();
+ case '?':
+ ++pos_;
+ skipProcessingInstruction();
+ break;
+ default:
+ return handleStartTag(nsId, data);
+ }
+ }
+}
+
+XmlReader::Result XmlReader::handleRawText(Span * text) {
+ pad_.clear();
+ for (char const * begin = pos_;;) {
+ switch (peek()) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("premature end of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '\x0D':
+ pad_.add(begin, pos_ - begin);
+ ++pos_;
+ if (peek() != '\x0A') {
+ pad_.add(RTL_CONSTASCII_STRINGPARAM("\x0A"));
+ }
+ begin = pos_;
+ break;
+ case '&':
+ pad_.add(begin, pos_ - begin);
+ pos_ = handleReference(pos_, end_);
+ begin = pos_;
+ break;
+ case '<':
+ pad_.add(begin, pos_ - begin);
+ ++pos_;
+ switch (peek()) {
+ case '!':
+ ++pos_;
+ if (!skipComment()) {
+ Span cdata(scanCdataSection());
+ if (cdata.is()) {
+ normalizeLineEnds(cdata);
+ } else {
+ skipDocumentTypeDeclaration();
+ }
+ }
+ begin = pos_;
+ break;
+ case '/':
+ *text = pad_.get();
+ ++pos_;
+ state_ = STATE_END_TAG;
+ return RESULT_TEXT;
+ case '?':
+ ++pos_;
+ skipProcessingInstruction();
+ begin = pos_;
+ break;
+ default:
+ *text = pad_.get();
+ state_ = STATE_START_TAG;
+ return RESULT_TEXT;
+ }
+ break;
+ default:
+ ++pos_;
+ break;
+ }
+ }
+}
+
+XmlReader::Result XmlReader::handleNormalizedText(Span * text) {
+ pad_.clear();
+ char const * flowBegin = pos_;
+ char const * flowEnd = pos_;
+ enum Space { SPACE_START, SPACE_NONE, SPACE_SPAN, SPACE_BREAK };
+ // a single true space character can go into the current flow,
+ // everything else breaks the flow
+ Space space = SPACE_START;
+ for (;;) {
+ switch (peek()) {
+ case '\0': // i.e., EOF
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("premature end of ")) +
+ fileUrl_),
+ css::uno::Reference< css::uno::XInterface >());
+ case '\x09':
+ case '\x0A':
+ case '\x0D':
+ switch (space) {
+ case SPACE_START:
+ case SPACE_BREAK:
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ space = SPACE_BREAK;
+ break;
+ }
+ ++pos_;
+ break;
+ case ' ':
+ switch (space) {
+ case SPACE_START:
+ case SPACE_BREAK:
+ break;
+ case SPACE_NONE:
+ space = SPACE_SPAN;
+ break;
+ case SPACE_SPAN:
+ space = SPACE_BREAK;
+ break;
+ }
+ ++pos_;
+ break;
+ case '&':
+ switch (space) {
+ case SPACE_START:
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ pad_.add(flowBegin, pos_ - flowBegin);
+ break;
+ case SPACE_BREAK:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ }
+ pos_ = handleReference(pos_, end_);
+ flowBegin = pos_;
+ flowEnd = pos_;
+ space = SPACE_NONE;
+ break;
+ case '<':
+ ++pos_;
+ switch (peek()) {
+ case '!':
+ ++pos_;
+ if (skipComment()) {
+ space = SPACE_BREAK;
+ } else {
+ Span cdata(scanCdataSection());
+ if (cdata.is()) {
+ // CDATA is not normalized (similar to character
+ // references; it keeps the code simple), but it might
+ // arguably be better to normalize it:
+ switch (space) {
+ case SPACE_START:
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ pad_.add(flowBegin, pos_ - flowBegin);
+ break;
+ case SPACE_BREAK:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ break;
+ }
+ normalizeLineEnds(cdata);
+ flowBegin = pos_;
+ flowEnd = pos_;
+ space = SPACE_NONE;
+ } else {
+ skipDocumentTypeDeclaration();
+ }
+ }
+ break;
+ case '/':
+ ++pos_;
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ *text = pad_.get();
+ state_ = STATE_END_TAG;
+ return RESULT_TEXT;
+ case '?':
+ ++pos_;
+ skipProcessingInstruction();
+ space = SPACE_BREAK;
+ break;
+ default:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ *text = pad_.get();
+ state_ = STATE_START_TAG;
+ return RESULT_TEXT;
+ }
+ break;
+ default:
+ switch (space) {
+ case SPACE_START:
+ flowBegin = pos_;
+ break;
+ case SPACE_NONE:
+ case SPACE_SPAN:
+ break;
+ case SPACE_BREAK:
+ pad_.add(flowBegin, flowEnd - flowBegin);
+ pad_.add(RTL_CONSTASCII_STRINGPARAM(" "));
+ flowBegin = pos_;
+ break;
+ }
+ flowEnd = ++pos_;
+ space = SPACE_NONE;
+ break;
+ }
+ }
+}
+
+int XmlReader::toNamespaceId(NamespaceIris::size_type pos) {
+ OSL_ASSERT(pos <= INT_MAX);
+ return static_cast< int >(pos);
+}
+
+}