diff options
570 files changed, 10217 insertions, 18260 deletions
diff --git a/binaryurp/prj/build.lst b/binaryurp/prj/build.lst new file mode 100644 index 000000000..230b323f0 --- /dev/null +++ b/binaryurp/prj/build.lst @@ -0,0 +1,3 @@ +bu binaryurp : BOOST:boost LIBXSLT:libxslt cppu cppuhelper offuh sal salhelper stlport NULL +bu binaryurp\source nmake - all bu_source NULL +bu binaryurp\qa nmake - all bu_qa bu_source NULL diff --git a/binaryurp/prj/d.lst b/binaryurp/prj/d.lst new file mode 100644 index 000000000..48ebd3be8 --- /dev/null +++ b/binaryurp/prj/d.lst @@ -0,0 +1,4 @@ +..\%__SRC%\bin\binaryurp.uno.dll %_DEST%\bin%_EXT%\binaryurp.uno.dll +..\%__SRC%\lib\binaryurp.uno.dylib %_DEST%\lib%_EXT%\binaryurp.uno.dylib +..\%__SRC%\lib\binaryurp.uno.so %_DEST%\lib%_EXT%\binaryurp.uno.so +..\%__SRC%\misc\binaryurp.component %_DEST%\xml%_EXT%\binaryurp.component diff --git a/binaryurp/qa/makefile.mk b/binaryurp/qa/makefile.mk new file mode 100644 index 000000000..14b80c86c --- /dev/null +++ b/binaryurp/qa/makefile.mk @@ -0,0 +1,77 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2011 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 = binaryurp +TARGET = qa + +ENABLE_EXCEPTIONS = TRUE + +.INCLUDE: settings.mk + +CFLAGSCXX += $(CPPUNIT_CFLAGS) + +DLLPRE = + +SLOFILES = $(SLO)/test-cache.obj $(SLO)/test-unmarshal.obj + +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLO)/test-cache.obj +SHL1RPATH = NONE +SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) +SHL1TARGET = test-cache +SHL1VERSIONMAP = version.map +DEF1NAME = $(SHL1TARGET) + +SHL2IMPLIB = i$(SHL2TARGET) +SHL2OBJS = \ + $(SLO)/test-unmarshal.obj \ + $(SLO)/binaryany.obj \ + $(SLO)/bridge.obj \ + $(SLO)/bridgefactory.obj \ + $(SLO)/currentcontext.obj \ + $(SLO)/incomingrequest.obj \ + $(SLO)/lessoperators.obj \ + $(SLO)/marshal.obj \ + $(SLO)/outgoingrequests.obj \ + $(SLO)/proxy.obj \ + $(SLO)/reader.obj \ + $(SLO)/unmarshal.obj \ + $(SLO)/writer.obj +SHL2RPATH = NONE +SHL2STDLIBS = \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(CPPUNITLIB) \ + $(SALHELPERLIB) \ + $(SALLIB) +SHL2TARGET = test-unmarshal +SHL2VERSIONMAP = version.map +DEF2NAME = $(SHL2TARGET) + +.INCLUDE: target.mk +.INCLUDE: _cppunit.mk diff --git a/binaryurp/qa/test-cache.cxx b/binaryurp/qa/test-cache.cxx new file mode 100644 index 000000000..f9a3946c0 --- /dev/null +++ b/binaryurp/qa/test-cache.cxx @@ -0,0 +1,84 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" + +#include "../source/cache.hxx" + +namespace { + +class Test: public CppUnit::TestFixture { +private: + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(testNothingLostFromLruList); + CPPUNIT_TEST_SUITE_END(); + + void testNothingLostFromLruList(); +}; + +// cf. jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java: +void Test::testNothingLostFromLruList() { + int a[8]; + for (int i = 0; i != sizeof a / sizeof a[0]; ++i) { + for (int j = 0; j != i; ++j) { + a[j] = 0; + } + for (;;) { + binaryurp::Cache< int > c(4); + for (int k = 0; k != i; ++k) { + bool f; + c.add(a[k], &f); + } + bool f; + CPPUNIT_ASSERT_EQUAL( + 6, + c.add(-1, &f) + c.add(-2, &f) + c.add(-3, &f) + c.add(-4, &f)); + int j = i - 1; + while (j >= 0 && a[j] == 3) { + --j; + } + if (j < 0) { + break; + } + ++a[j]; + for (int k = j + 1; k != i; ++k) { + a[k] = 0; + } + } + } +} + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/binaryurp/qa/test-unmarshal.cxx b/binaryurp/qa/test-unmarshal.cxx new file mode 100644 index 000000000..3d3c1795a --- /dev/null +++ b/binaryurp/qa/test-unmarshal.cxx @@ -0,0 +1,112 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include "com/sun/star/io/IOException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppu/unotype.hxx" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "rtl/ref.hxx" +#include "rtl/string.h" +#include "sal/types.h" +#include "typelib/typedescription.hxx" + +#include "../source/bridge.hxx" +#include "../source/cache.hxx" +#include "../source/readerstate.hxx" +#include "../source/unmarshal.hxx" + +namespace { + +namespace css = com::sun::star; + +class Test: public CppUnit::TestFixture { +private: + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(testTypeOfBooleanSequence); + CPPUNIT_TEST(testTypeOfVoidSequence); + CPPUNIT_TEST_SUITE_END(); + + void testTypeOfBooleanSequence(); + + void testTypeOfVoidSequence(); +}; + +void Test::testTypeOfBooleanSequence() { + binaryurp::ReaderState state; + css::uno::Sequence< sal_Int8 > buf(13); + buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag + buf[1] = static_cast< sal_Int8 >(binaryurp::cache::ignore >> 8); + buf[2] = static_cast< sal_Int8 >(binaryurp::cache::ignore & 0xFF); + buf[3] = RTL_CONSTASCII_LENGTH("[]boolean"); + buf[4] = '['; + buf[5] = ']'; + buf[6] = 'b'; + buf[7] = 'o'; + buf[8] = 'o'; + buf[9] = 'l'; + buf[10] = 'e'; + buf[11] = 'a'; + buf[12] = 'n'; + binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf); + css::uno::TypeDescription t(m.readType()); + CPPUNIT_ASSERT( + t.equals( + css::uno::TypeDescription( + cppu::UnoType< css::uno::Sequence< bool > >::get()))); + m.done(); +} + +void Test::testTypeOfVoidSequence() { + binaryurp::ReaderState state; + css::uno::Sequence< sal_Int8 > buf(10); + buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag + buf[1] = static_cast< sal_Int8 >(binaryurp::cache::ignore >> 8); + buf[2] = static_cast< sal_Int8 >(binaryurp::cache::ignore & 0xFF); + buf[3] = RTL_CONSTASCII_LENGTH("[]void"); + buf[4] = '['; + buf[5] = ']'; + buf[6] = 'v'; + buf[7] = 'o'; + buf[8] = 'i'; + buf[9] = 'd'; + binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf); + try { + m.readType(); + CPPUNIT_FAIL("exception expected"); + } catch (css::io::IOException &) {} +} + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/bridges/source/remote/context/makefile.mk b/binaryurp/qa/version.map index cc2a52355..ef2ab497c 100644 --- a/bridges/source/remote/context/makefile.mk +++ b/binaryurp/qa/version.map @@ -1,8 +1,8 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -23,43 +23,12 @@ # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=bridges -TARGET=rmcxt -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -UNIXVERSIONNAMES=UDK - -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk -# ------------------------------------------------------------------ - -UNOUCRDEP=$(SOLARUCRDIR)$/uce.rdb -UNOUCRRDB=$(SOLARUCRDIR)$/uce.rdb - -SLOFILES= $(SLO)$/context.obj - -SHL1TARGET= $(TARGET) - -SHL1STDLIBS= \ - $(SALLIB) - -SHL1DEPN= -SHL1IMPLIB= i$(TARGET) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1RPATH=URELIB - -SHL1VERSIONMAP= $(TARGET).map - -DEF1NAME= $(SHL1TARGET) -#DEF1EXPORTFILE= exports.dxp - +#***********************************************************************/ -# --- Targets ------------------------------------------------------ +UDK_3_0_0 { + global: + cppunitTestPlugIn; -.INCLUDE : target.mk + local: + *; +}; diff --git a/binaryurp/source/binaryany.cxx b/binaryurp/source/binaryany.cxx new file mode 100644 index 000000000..c5b8b1a3c --- /dev/null +++ b/binaryurp/source/binaryany.cxx @@ -0,0 +1,98 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include "osl/diagnose.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.hxx" +#include "uno/any2.h" + +#include "binaryany.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +} + +BinaryAny::BinaryAny() throw () { + uno_any_construct(&data_, 0, 0, 0); +} + +BinaryAny::BinaryAny(css::uno::TypeDescription const & type, void * value) + throw () +{ + OSL_ASSERT(type.is()); + uno_any_construct(&data_, value, type.get(), 0); +} + +BinaryAny::BinaryAny(uno_Any const & raw) throw () { + OSL_ASSERT(raw.pType != 0); + data_.pType = raw.pType; + typelib_typedescriptionreference_acquire(data_.pType); + data_.pData = raw.pData == &raw.pReserved ? &data_.pReserved : raw.pData; + data_.pReserved = raw.pReserved; +} + +BinaryAny::BinaryAny(BinaryAny const & other) throw () { + uno_type_any_construct(&data_, other.data_.pData, other.data_.pType, 0); +} + +BinaryAny::~BinaryAny() throw () { + uno_any_destruct(&data_, 0); +} + +BinaryAny & BinaryAny::operator =(BinaryAny const & other) throw () { + if (&other != this) { + uno_type_any_assign(&data_, other.data_.pData, other.data_.pType, 0, 0); + } + return *this; +} + +uno_Any * BinaryAny::get() throw () { + return &data_; +} + +css::uno::TypeDescription BinaryAny::getType() const throw () { + return css::uno::TypeDescription(data_.pType); +} + +void * BinaryAny::getValue(css::uno::TypeDescription const & type) const + throw () +{ + OSL_ASSERT( + type.is() && + (type.get()->eTypeClass == typelib_TypeClass_ANY || + type.equals(css::uno::TypeDescription(data_.pType)))); + return type.get()->eTypeClass == typelib_TypeClass_ANY + ? &data_ : data_.pData; +} + +} diff --git a/binaryurp/source/binaryany.hxx b/binaryurp/source/binaryany.hxx new file mode 100644 index 000000000..4dd6112b5 --- /dev/null +++ b/binaryurp/source/binaryany.hxx @@ -0,0 +1,73 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_BINARYANY_HXX +#define INCLUDED_BINARYURP_SOURCE_BINARYANY_HXX + +#include "sal/config.h" + +#include "uno/any2.h" + +namespace com { namespace sun { namespace star { namespace uno { + class TypeDescription; +} } } } + +namespace binaryurp { + +class BinaryAny { +public: + BinaryAny() throw (); + + BinaryAny(com::sun::star::uno::TypeDescription const & type, void * value) + throw (); + + explicit BinaryAny(uno_Any const & raw) throw (); + // takes over raw.pData (but copies raw.pType); raw must not be passed + // to uno_any_destruct + + BinaryAny(BinaryAny const & other) throw (); + + ~BinaryAny() throw (); + + BinaryAny & operator =(BinaryAny const & other) throw (); + + uno_Any * get() throw (); + + com::sun::star::uno::TypeDescription getType() const throw (); + + void * getValue(com::sun::star::uno::TypeDescription const & type) const + throw (); + +private: + mutable uno_Any data_; + // mutable so that getValue() can return a non-const void *, as in turn + // required at various places in binary UNO +}; + +} + +#endif diff --git a/remotebridges/source/factory/bridgefac.component b/binaryurp/source/binaryurp.component index e20bc3425..19554bcc0 100644 --- a/remotebridges/source/factory/bridgefac.component +++ b/binaryurp/source/binaryurp.component @@ -3,7 +3,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * -* Copyright 2000, 2010 Oracle and/or its affiliates. +* Copyright 2000, 2011 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * @@ -28,7 +28,7 @@ <component loader="com.sun.star.loader.SharedLibrary" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.remotebridges.BridgeFactory"> + <implementation name="com.sun.star.comp.bridge.BridgeFactory"> <service name="com.sun.star.bridge.BridgeFactory"/> </implementation> </component> diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx new file mode 100644 index 000000000..dcf77662c --- /dev/null +++ b/binaryurp/source/bridge.cxx @@ -0,0 +1,978 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <algorithm> +#include <cstddef> +#include <limits> +#include <memory> +#include <vector> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/bridge/InvalidProtocolChangeException.hpp" +#include "com/sun/star/bridge/XBridge.hpp" +#include "com/sun/star/bridge/XInstanceProvider.hpp" +#include "com/sun/star/bridge/XProtocolProperties.hpp" +#include "com/sun/star/connection/XConnection.hpp" +#include "com/sun/star/io/IOException.hpp" +#include "com/sun/star/lang/DisposedException.hpp" +#include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/lang/XEventListener.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/exc_hlp.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/diagnose.h" +#include "osl/mutex.hxx" +#include "osl/thread.hxx" +#include "rtl/byteseq.hxx" +#include "rtl/random.h" +#include "rtl/ref.hxx" +#include "rtl/textenc.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" +#include "typelib/typedescription.hxx" +#include "uno/dispatcher.hxx" +#include "uno/environment.hxx" +#include "uno/lbnames.h" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "bridgefactory.hxx" +#include "incomingreply.hxx" +#include "lessoperators.hxx" +#include "outgoingrequest.hxx" +#include "outgoingrequests.hxx" +#include "proxy.hxx" +#include "reader.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +sal_Int32 random() { + sal_Int32 n; + rtlRandomPool pool = rtl_random_createPool(); + rtl_random_getBytes(pool, &n, sizeof n); + rtl_random_destroyPool(pool); + return n; +} + +extern "C" void SAL_CALL freeProxyCallback(uno_ExtEnvironment *, void * pProxy) +{ + OSL_ASSERT(pProxy != 0); + static_cast< Proxy * >(pProxy)->do_free(); +} + +void joinThread(osl::Thread * thread) { + OSL_ASSERT(thread != 0); + if (thread->getIdentifier() != osl::Thread::getCurrentIdentifier()) { + thread->join(); + } +} + +class AttachThread: private boost::noncopyable { +public: + explicit AttachThread(uno_ThreadPool threadPool); + + ~AttachThread(); + + rtl::ByteSequence getTid() throw (); + +private: + uno_ThreadPool threadPool_; + rtl::ByteSequence tid_; +}; + +AttachThread::AttachThread(uno_ThreadPool threadPool): threadPool_(threadPool) { + sal_Sequence * s = 0; + uno_getIdOfCurrentThread(&s); + tid_ = rtl::ByteSequence(s, rtl::BYTESEQ_NOACQUIRE); + uno_threadpool_attach(threadPool_); +} + +AttachThread::~AttachThread() { + uno_threadpool_detach(threadPool_); + uno_releaseIdFromCurrentThread(); +} + +rtl::ByteSequence AttachThread::getTid() throw () { + return tid_; +} + +class PopOutgoingRequest: private boost::noncopyable { +public: + PopOutgoingRequest( + OutgoingRequests & requests, rtl::ByteSequence const & tid, + OutgoingRequest const & request); + + ~PopOutgoingRequest(); + + void clear(); + +private: + OutgoingRequests & requests_; + rtl::ByteSequence tid_; + bool cleared_; +}; + +PopOutgoingRequest::PopOutgoingRequest( + OutgoingRequests & requests, rtl::ByteSequence const & tid, + OutgoingRequest const & request): + requests_(requests), tid_(tid), cleared_(false) +{ + requests_.push(tid_, request); +} + +PopOutgoingRequest::~PopOutgoingRequest() { + if (!cleared_) { + requests_.pop(tid_); + } +} + +void PopOutgoingRequest::clear() { + cleared_ = true; +} + +} + +struct Bridge::SubStub { + com::sun::star::uno::UnoInterfaceReference object; + + sal_uInt32 references; +}; + +Bridge::Bridge( + rtl::Reference< BridgeFactory > const & factory, rtl::OUString const & name, + css::uno::Reference< css::connection::XConnection > const & connection, + css::uno::Reference< css::bridge::XInstanceProvider > const & provider): + factory_(factory), name_(name), connection_(connection), + provider_(provider), + binaryUno_(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))), + cppToBinaryMapping_( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))), + binaryToCppMapping_( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME))), + protPropTid_( + reinterpret_cast< sal_Int8 const * >(".UrpProtocolPropertiesTid"), + RTL_CONSTASCII_LENGTH(".UrpProtocolPropertiesTid")), + protPropOid_(RTL_CONSTASCII_USTRINGPARAM("UrpProtocolProperties")), + protPropType_( + cppu::UnoType< + css::uno::Reference< css::bridge::XProtocolProperties > >::get()), + protPropRequest_( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.bridge.XProtocolProperties::requestChange"))), + protPropCommit_( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.bridge.XProtocolProperties::commitChange"))), + threadPool_(0), currentContextMode_(false), proxies_(0), calls_(0), + normalCall_(false), activeCalls_(0), terminated_(false), + mode_(MODE_REQUESTED) +{ + OSL_ASSERT(factory.is() && connection.is()); + if (!binaryUno_.is()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("URP: no binary UNO environment")), + css::uno::Reference< css::uno::XInterface >()); + } + if (!(cppToBinaryMapping_.is() && binaryToCppMapping_.is())) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("URP: no C++ UNO mapping")), + css::uno::Reference< css::uno::XInterface >()); + } + passive_.set(); +} + +void Bridge::start() { + OSL_ASSERT(threadPool_ == 0 && !writer_.is() && !reader_.is()); + threadPool_ = uno_threadpool_create(); + OSL_ASSERT(threadPool_ != 0); + writer_.set(new Writer(this)); + writer_->create(); + reader_.set(new Reader(this)); + reader_->create(); +} + +void Bridge::terminate() { + rtl::Reference< Reader > r; + rtl::Reference< Writer > w; + Listeners ls; + { + osl::MutexGuard g(mutex_); + if (terminated_) { + return; + } + std::swap(reader_, r); + std::swap(writer_, w); + ls.swap(listeners_); + terminated_ = true; + } + try { + connection_->close(); + } catch (css::io::IOException & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught IO exception '%s'", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + } + OSL_ASSERT(w.is()); + w->stop(); + joinThread(r.get()); + joinThread(w.get()); + OSL_ASSERT(threadPool_ != 0); + uno_threadpool_dispose(threadPool_); + Stubs s; + { + osl::MutexGuard g(mutex_); + s.swap(stubs_); + } + for (Stubs::iterator i(s.begin()); i != s.end(); ++i) { + for (Stub::iterator j(i->second.begin()); j != i->second.end(); ++j) { + binaryUno_.get()->pExtEnv->revokeInterface( + binaryUno_.get()->pExtEnv, j->second.object.get()); + } + } + factory_->removeBridge(this); + for (Listeners::iterator i(ls.begin()); i != ls.end(); ++i) { + try { + (*i)->disposing( + css::lang::EventObject( + static_cast< cppu::OWeakObject * >(this))); + } catch (css::uno::RuntimeException & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught runtime exception '%s'", + rtl::OUStringToOString( + e.Message, RTL_TEXTENCODING_UTF8).getStr()); + } + } +} + +css::uno::Reference< css::connection::XConnection > Bridge::getConnection() + const +{ + return connection_; +} + +css::uno::Reference< css::bridge::XInstanceProvider > Bridge::getProvider() + const +{ + return provider_; +} + +css::uno::Mapping & Bridge::getCppToBinaryMapping() { + return cppToBinaryMapping_; +} + +BinaryAny Bridge::mapCppToBinaryAny(css::uno::Any const & cppAny) { + css::uno::Any in(cppAny); + BinaryAny out; + out.~BinaryAny(); + uno_copyAndConvertData( + out.get(), &in, + css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()).get(), + cppToBinaryMapping_.get()); + return out; +} + +uno_ThreadPool Bridge::getThreadPool() const { + OSL_ASSERT(threadPool_ != 0); + return threadPool_; +} + +rtl::Reference< Writer > Bridge::getWriter() { + osl::MutexGuard g(mutex_); + if (terminated_) { + throw css::lang::DisposedException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Binary URP bridge already disposed")), + static_cast< cppu::OWeakObject * >(this)); + } + OSL_ASSERT(writer_.is()); + return writer_; +} + +css::uno::UnoInterfaceReference Bridge::registerIncomingInterface( + rtl::OUString const & oid, css::uno::TypeDescription const & type) +{ + OSL_ASSERT(type.is()); + if (oid.getLength() == 0) { + return css::uno::UnoInterfaceReference(); + } + css::uno::UnoInterfaceReference obj(findStub(oid, type)); + if (!obj.is()) { + binaryUno_.get()->pExtEnv->getRegisteredInterface( + binaryUno_.get()->pExtEnv, + reinterpret_cast< void ** >(&obj.m_pUnoI), oid.pData, + reinterpret_cast< typelib_InterfaceTypeDescription * >(type.get())); + if (obj.is()) { + makeReleaseCall(oid, type); + } else { + obj.set(new Proxy(this, oid, type), SAL_NO_ACQUIRE); + { + osl::MutexGuard g(mutex_); + OSL_ASSERT( + proxies_ < std::numeric_limits< std::size_t >::max()); + ++proxies_; + } + binaryUno_.get()->pExtEnv->registerProxyInterface( + binaryUno_.get()->pExtEnv, + reinterpret_cast< void ** >(&obj.m_pUnoI), &freeProxyCallback, + oid.pData, + reinterpret_cast< typelib_InterfaceTypeDescription * >( + type.get())); + } + } + return obj; +} + +rtl::OUString Bridge::registerOutgoingInterface( + css::uno::UnoInterfaceReference const & object, + css::uno::TypeDescription const & type) +{ + OSL_ASSERT(type.is()); + if (!object.is()) { + return rtl::OUString(); + } + rtl::OUString oid; + if (!Proxy::isProxy(this, object, &oid)) { + binaryUno_.get()->pExtEnv->getObjectIdentifier( + binaryUno_.get()->pExtEnv, &oid.pData, object.get()); + osl::MutexGuard g(mutex_); + Stubs::iterator i(stubs_.find(oid)); + Stub newStub; + Stub * stub = i == stubs_.end() ? &newStub : &i->second; + Stub::iterator j(stub->find(type)); + //TODO: Release sub-stub if it is not successfully sent to remote side + // (otherwise, stub will leak until terminate()): + if (j == stub->end()) { + j = stub->insert(Stub::value_type(type, SubStub())).first; + if (stub == &newStub) { + i = stubs_.insert(Stubs::value_type(oid, Stub())).first; + std::swap(i->second, newStub); + j = i->second.find(type); + OSL_ASSERT(j != i->second.end()); + } + j->second.object = object; + j->second.references = 1; + binaryUno_.get()->pExtEnv->registerInterface( + binaryUno_.get()->pExtEnv, + reinterpret_cast< void ** >(&j->second.object.m_pUnoI), + oid.pData, + reinterpret_cast< typelib_InterfaceTypeDescription * >( + type.get())); + } else { + OSL_ASSERT(stub != &newStub); + if (j->second.references == SAL_MAX_UINT32) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: stub reference count overflow")), + css::uno::Reference< css::uno::XInterface >()); + } + ++j->second.references; + } + } + return oid; +} + +css::uno::UnoInterfaceReference Bridge::findStub( + rtl::OUString const & oid, css::uno::TypeDescription const & type) +{ + OSL_ASSERT(oid.getLength() != 0 && type.is()); + osl::MutexGuard g(mutex_); + Stubs::iterator i(stubs_.find(oid)); + if (i != stubs_.end()) { + Stub::iterator j(i->second.find(type)); + if (j != i->second.end()) { + return j->second.object; + } + for (j = i->second.begin(); j != i->second.end(); ++j) { + if (typelib_typedescription_isAssignableFrom( + type.get(), j->first.get())) + { + return j->second.object; + } + } + } + return css::uno::UnoInterfaceReference(); +} + +void Bridge::releaseStub( + rtl::OUString const & oid, css::uno::TypeDescription const & type) +{ + OSL_ASSERT(oid.getLength() != 0 && type.is()); + css::uno::UnoInterfaceReference obj; + bool unused; + { + osl::MutexGuard g(mutex_); + Stubs::iterator i(stubs_.find(oid)); + if (i == stubs_.end()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("URP: release unknown stub")), + css::uno::Reference< css::uno::XInterface >()); + } + Stub::iterator j(i->second.find(type)); + if (j == i->second.end()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("URP: release unknown stub")), + css::uno::Reference< css::uno::XInterface >()); + } + OSL_ASSERT(j->second.references > 0); + --j->second.references; + if (j->second.references == 0) { + obj = j->second.object; + i->second.erase(j); + if (i->second.empty()) { + stubs_.erase(i); + } + } + unused = becameUnused(); + } + if (obj.is()) { + binaryUno_.get()->pExtEnv->revokeInterface( + binaryUno_.get()->pExtEnv, obj.get()); + } + terminateWhenUnused(unused); +} + +void Bridge::resurrectProxy(Proxy & proxy) { + uno_Interface * p = &proxy; + binaryUno_.get()->pExtEnv->registerProxyInterface( + binaryUno_.get()->pExtEnv, + reinterpret_cast< void ** >(&p), &freeProxyCallback, + proxy.getOid().pData, + reinterpret_cast< typelib_InterfaceTypeDescription * >( + proxy.getType().get())); + OSL_ASSERT(p == &proxy); +} + +void Bridge::revokeProxy(Proxy & proxy) { + binaryUno_.get()->pExtEnv->revokeInterface( + binaryUno_.get()->pExtEnv, &proxy); +} + +void Bridge::freeProxy(Proxy & proxy) { + try { + makeReleaseCall(proxy.getOid(), proxy.getType()); + } catch (css::uno::RuntimeException & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught runtime exception '%s'", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + } catch (std::exception & e) { + OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); + } + bool unused; + { + osl::MutexGuard g(mutex_); + OSL_ASSERT(proxies_ > 0); + --proxies_; + unused = becameUnused(); + } + terminateWhenUnused(unused); +} + +void Bridge::incrementCalls(bool normalCall) throw () { + osl::MutexGuard g(mutex_); + OSL_ASSERT(calls_ < std::numeric_limits< std::size_t >::max()); + ++calls_; + normalCall_ |= normalCall; +} + +void Bridge::decrementCalls() { + bool unused; + { + osl::MutexGuard g(mutex_); + OSL_ASSERT(calls_ > 0); + --calls_; + unused = becameUnused(); + } + terminateWhenUnused(unused); +} + +void Bridge::incrementActiveCalls() throw () { + osl::MutexGuard g(mutex_); + OSL_ASSERT( + activeCalls_ <= calls_ && + activeCalls_ < std::numeric_limits< std::size_t >::max()); + ++activeCalls_; + passive_.reset(); +} + +void Bridge::decrementActiveCalls() throw () { + osl::MutexGuard g(mutex_); + OSL_ASSERT(activeCalls_ <= calls_ && activeCalls_ > 0); + --activeCalls_; + if (activeCalls_ == 0) { + passive_.set(); + } +} + +bool Bridge::makeCall( + rtl::OUString const & oid, css::uno::TypeDescription const & member, + bool setter, std::vector< BinaryAny > const & inArguments, + BinaryAny * returnValue, std::vector< BinaryAny > * outArguments) +{ + std::auto_ptr< IncomingReply > resp; + { + AttachThread att(threadPool_); + PopOutgoingRequest pop( + outgoingRequests_, att.getTid(), + OutgoingRequest(OutgoingRequest::KIND_NORMAL, member, setter)); + sendRequest( + att.getTid(), oid, css::uno::TypeDescription(), member, + inArguments); + pop.clear(); + incrementCalls(true); + incrementActiveCalls(); + void * job; + uno_threadpool_enter(threadPool_, &job); + resp.reset(static_cast< IncomingReply * >(job)); + decrementActiveCalls(); + decrementCalls(); + } + if (resp.get() == 0) { + throw css::lang::DisposedException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Binary URP bridge disposed during call")), + static_cast< cppu::OWeakObject * >(this)); + } + *returnValue = resp->returnValue; + if (!resp->exception) { + *outArguments = resp->outArguments; + } + return resp->exception; +} + +void Bridge::sendRequestChangeRequest() { + OSL_ASSERT(mode_ == MODE_REQUESTED); + random_ = random(); + std::vector< BinaryAny > a; + a.push_back( + BinaryAny( + css::uno::TypeDescription(cppu::UnoType< sal_Int32 >::get()), + &random_)); + sendProtPropRequest(OutgoingRequest::KIND_REQUEST_CHANGE, a); +} + +void Bridge::handleRequestChangeReply( + bool exception, BinaryAny const & returnValue) +{ + throwException(exception, returnValue); + sal_Int32 n = *static_cast< sal_Int32 * >( + returnValue.getValue( + css::uno::TypeDescription(cppu::UnoType< sal_Int32 >::get()))); + sal_Int32 exp = 0; + switch (mode_) { + case MODE_REQUESTED: + case MODE_REPLY_1: + exp = 1; + break; + case MODE_REPLY_MINUS1: + exp = -1; + mode_ = MODE_REQUESTED; + break; + case MODE_REPLY_0: + exp = 0; + mode_ = MODE_WAIT; + break; + default: + OSL_ASSERT(false); // this cannot happen + break; + } + if (n != exp) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: requestChange reply with unexpected return value" + " received")), + static_cast< cppu::OWeakObject * >(this)); + } + decrementCalls(); + switch (exp) { + case -1: + sendRequestChangeRequest(); + break; + case 0: + break; + case 1: + sendCommitChangeRequest(); + break; + default: + OSL_ASSERT(false); // this cannot happen + break; + } +} + +void Bridge::handleCommitChangeReply( + bool exception, BinaryAny const & returnValue) +{ + bool ccMode = true; + try { + throwException(exception, returnValue); + } catch (css::bridge::InvalidProtocolChangeException &) { + ccMode = false; + } + if (ccMode) { + setCurrentContextMode(); + } + OSL_ASSERT(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1); + mode_ = MODE_NORMAL; + getWriter()->unblock(); + decrementCalls(); +} + +void Bridge::handleRequestChangeRequest( + rtl::ByteSequence const & tid, std::vector< BinaryAny > const & inArguments) +{ + OSL_ASSERT(inArguments.size() == 1); + switch (mode_) { + case MODE_REQUESTED: + { + sal_Int32 n2 = *static_cast< sal_Int32 * >( + inArguments[0].getValue( + css::uno::TypeDescription( + cppu::UnoType< sal_Int32 >::get()))); + sal_Int32 ret; + if (n2 > random_) { + ret = 1; + mode_ = MODE_REPLY_0; + } else if (n2 == random_) { + ret = -1; + mode_ = MODE_REPLY_MINUS1; + } else { + ret = 0; + mode_ = MODE_REPLY_1; + } + getWriter()->sendDirectReply( + tid, protPropRequest_, false, + BinaryAny( + css::uno::TypeDescription( + cppu::UnoType< sal_Int32 >::get()), + &ret), + std::vector< BinaryAny >()); + break; + } + case MODE_NORMAL: + { + mode_ = MODE_NORMAL_WAIT; + sal_Int32 ret = 1; + getWriter()->queueReply( + tid, protPropRequest_, false, false, + BinaryAny( + css::uno::TypeDescription( + cppu::UnoType< sal_Int32 >::get()), + &ret), + std::vector< BinaryAny >(), false); + break; + } + default: + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: unexpected requestChange request received")), + static_cast< cppu::OWeakObject * >(this)); + } +} + +void Bridge::handleCommitChangeRequest( + rtl::ByteSequence const & tid, std::vector< BinaryAny > const & inArguments) +{ + bool ccMode = false; + bool exc = false; + BinaryAny ret; + OSL_ASSERT(inArguments.size() == 1); + css::uno::Sequence< css::bridge::ProtocolProperty > s; + OSL_VERIFY(mapBinaryToCppAny(inArguments[0]) >>= s); + for (sal_Int32 i = 0; i != s.getLength(); ++i) { + if (s[i].Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("CurrentContext"))) + { + ccMode = true; + } else { + ccMode = false; + exc = true; + ret = mapCppToBinaryAny( + css::uno::makeAny( + css::bridge::InvalidProtocolChangeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "InvalidProtocolChangeException")), + css::uno::Reference< css::uno::XInterface >(), s[i], + 1))); + break; + } + } + switch (mode_) { + case MODE_WAIT: + getWriter()->sendDirectReply( + tid, protPropCommit_, exc, ret, std::vector< BinaryAny >()); + if (ccMode) { + setCurrentContextMode(); + mode_ = MODE_NORMAL; + getWriter()->unblock(); + } else { + mode_ = MODE_REQUESTED; + sendRequestChangeRequest(); + } + break; + case MODE_NORMAL_WAIT: + getWriter()->queueReply( + tid, protPropCommit_, false, false, ret, std::vector< BinaryAny >(), + ccMode); + mode_ = MODE_NORMAL; + break; + default: + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: unexpected commitChange request received")), + static_cast< cppu::OWeakObject * >(this)); + } +} + +OutgoingRequest Bridge::lastOutgoingRequest(rtl::ByteSequence const & tid) { + OutgoingRequest req(outgoingRequests_.top(tid)); + outgoingRequests_.pop(tid); + return req; +} + +bool Bridge::isProtocolPropertiesRequest( + rtl::OUString const & oid, css::uno::TypeDescription const & type) const +{ + return oid == protPropOid_ && type.equals(protPropType_); +} + +void Bridge::setCurrentContextMode() { + osl::MutexGuard g(mutex_); + currentContextMode_ = true; +} + +bool Bridge::isCurrentContextMode() { + osl::MutexGuard g(mutex_); + return currentContextMode_; +} + +Bridge::~Bridge() { + if (threadPool_ != 0) { + uno_threadpool_destroy(threadPool_); + } +} + +css::uno::Reference< css::uno::XInterface > Bridge::getInstance( + rtl::OUString const & sInstanceName) throw (css::uno::RuntimeException) +{ + if (sInstanceName.getLength() == 0) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "XBridge::getInstance sInstanceName must be non-empty")), + static_cast< cppu::OWeakObject * >(this)); + } + for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) { + if (sInstanceName[i] > 0x7F) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "XBridge::getInstance sInstanceName contains non-ASCII" + " character")), + css::uno::Reference< css::uno::XInterface >()); + } + } + css::uno::TypeDescription ifc( + cppu::UnoType< css::uno::Reference< css::uno::XInterface > >::get()); + typelib_TypeDescription * p = ifc.get(); + std::vector< BinaryAny > inArgs; + inArgs.push_back( + BinaryAny( + css::uno::TypeDescription(cppu::UnoType< css::uno::Type >::get()), + &p)); + BinaryAny ret; + std::vector< BinaryAny> outArgs; + bool exc = makeCall( + sInstanceName, + css::uno::TypeDescription( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.uno.XInterface::queryInterface"))), + false, inArgs, &ret, &outArgs); + throwException(exc, ret); + return css::uno::Reference< css::uno::XInterface >( + static_cast< css::uno::XInterface * >( + binaryToCppMapping_.mapInterface( + *static_cast< uno_Interface ** >(ret.getValue(ifc)), + ifc.get())), + css::uno::UNO_REF_NO_ACQUIRE); +} + +rtl::OUString Bridge::getName() throw (css::uno::RuntimeException) { + return name_; +} + +rtl::OUString Bridge::getDescription() throw (css::uno::RuntimeException) { + rtl::OUStringBuffer b(name_); + b.append(sal_Unicode(':')); + b.append(connection_->getDescription()); + return b.makeStringAndClear(); +} + +void Bridge::dispose() throw (css::uno::RuntimeException) { + terminate(); + // OOo expects dispose to not return while there are still remote calls in + // progress; an external protocol must ensure that dispose is not called + // from within an incoming or outgoing remote call, as passive_.wait() would + // otherwise deadlock: + passive_.wait(); +} + +void Bridge::addEventListener( + css::uno::Reference< css::lang::XEventListener > const & xListener) + throw (css::uno::RuntimeException) +{ + OSL_ASSERT(xListener.is()); + { + osl::MutexGuard g(mutex_); + if (!terminated_) { + listeners_.push_back(xListener); + return; + } + } + xListener->disposing( + css::lang::EventObject(static_cast< cppu::OWeakObject * >(this))); +} + +void Bridge::removeEventListener( + css::uno::Reference< css::lang::XEventListener > const & aListener) + throw (css::uno::RuntimeException) +{ + osl::MutexGuard g(mutex_); + Listeners::iterator i( + std::find(listeners_.begin(), listeners_.end(), aListener)); + if (i != listeners_.end()) { + listeners_.erase(i); + } +} + +void Bridge::sendCommitChangeRequest() { + OSL_ASSERT(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1); + css::uno::Sequence< css::bridge::ProtocolProperty > s(1); + s[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentContext")); + std::vector< BinaryAny > a; + a.push_back(mapCppToBinaryAny(css::uno::makeAny(s))); + sendProtPropRequest(OutgoingRequest::KIND_COMMIT_CHANGE, a); +} + +void Bridge::sendProtPropRequest( + OutgoingRequest::Kind kind, std::vector< BinaryAny > const & inArguments) +{ + OSL_ASSERT( + kind == OutgoingRequest::KIND_REQUEST_CHANGE || + kind == OutgoingRequest::KIND_COMMIT_CHANGE); + incrementCalls(false); + css::uno::TypeDescription member( + kind == OutgoingRequest::KIND_REQUEST_CHANGE + ? protPropRequest_ : protPropCommit_); + PopOutgoingRequest pop( + outgoingRequests_, protPropTid_, OutgoingRequest(kind, member, false)); + getWriter()->sendDirectRequest( + protPropTid_, protPropOid_, protPropType_, member, inArguments); + pop.clear(); +} + +void Bridge::makeReleaseCall( + rtl::OUString const & oid, css::uno::TypeDescription const & type) +{ + AttachThread att(threadPool_); + sendRequest( + att.getTid(), oid, type, + css::uno::TypeDescription( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.uno.XInterface::release"))), + std::vector< BinaryAny >()); +} + +void Bridge::sendRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + css::uno::TypeDescription const & type, + css::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments) +{ + getWriter()->queueRequest(tid, oid, type, member, inArguments); +} + +void Bridge::throwException(bool exception, BinaryAny const & value) { + if (exception) { + cppu::throwException(mapBinaryToCppAny(value)); + } +} + +css::uno::Any Bridge::mapBinaryToCppAny(BinaryAny const & binaryAny) { + BinaryAny in(binaryAny); + css::uno::Any out; + out.~Any(); + uno_copyAndConvertData( + &out, in.get(), + css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()).get(), + binaryToCppMapping_.get()); + return out; +} + +bool Bridge::becameUnused() const { + return stubs_.empty() && proxies_ == 0 && calls_ == 0 && normalCall_; +} + +void Bridge::terminateWhenUnused(bool unused) { + if (unused) { + // That the current thread considers the bridge unused implies that it + // is not within an incoming or outgoing remote call (so calling + // terminate cannot lead to deadlock): + terminate(); + } +} + +} diff --git a/binaryurp/source/bridge.hxx b/binaryurp/source/bridge.hxx new file mode 100644 index 000000000..73e32aac0 --- /dev/null +++ b/binaryurp/source/bridge.hxx @@ -0,0 +1,287 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_BRIDGE_HXX +#define INCLUDED_BINARYURP_SOURCE_BRIDGE_HXX + +#include "sal/config.h" + +#include <cstddef> +#include <list> +#include <map> +#include <vector> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/bridge/XBridge.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "cppuhelper/implbase2.hxx" +#include "osl/conditn.hxx" +#include "osl/mutex.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "uno/environment.hxx" +#include "uno/mapping.hxx" +#include "uno/threadpool.h" + +#include "outgoingrequest.hxx" +#include "outgoingrequests.hxx" +#include "writer.hxx" + +namespace binaryurp { + class BinaryAny; + class BridgeFactory; + class Proxy; + class Reader; +} +namespace com { namespace sun { namespace star { + namespace bridge { class XInstanceProvider; } + namespace connection { class XConnection; } + namespace lang { class XEventListener; } + namespace uno { + class Any; + class TypeDescription; + class UnoInterfaceReference; + class XInterface; + } +} } } +namespace rtl { class ByteSequence; } + +namespace binaryurp { + +class Bridge: + public cppu::WeakImplHelper2< + com::sun::star::bridge::XBridge, com::sun::star::lang::XComponent >, + private boost::noncopyable +{ +public: + Bridge( + rtl::Reference< BridgeFactory > const & factory, + rtl::OUString const & name, + com::sun::star::uno::Reference< + com::sun::star::connection::XConnection > const & connection, + com::sun::star::uno::Reference< + com::sun::star::bridge::XInstanceProvider > const & provider); + + void start(); + + // Internally waits for all incoming and outgoing remote calls to terminate, + // so must not be called from within such a call: + void terminate(); + + com::sun::star::uno::Reference< com::sun::star::connection::XConnection > + getConnection() const; + + com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > + getProvider() const; + + com::sun::star::uno::Mapping & getCppToBinaryMapping(); + + BinaryAny mapCppToBinaryAny(com::sun::star::uno::Any const & cppAny); + + uno_ThreadPool getThreadPool() const; + + rtl::Reference< Writer > getWriter(); + + com::sun::star::uno::UnoInterfaceReference registerIncomingInterface( + rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type); + + rtl::OUString registerOutgoingInterface( + com::sun::star::uno::UnoInterfaceReference const & object, + com::sun::star::uno::TypeDescription const & type); + + com::sun::star::uno::UnoInterfaceReference findStub( + rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type); + + void releaseStub( + rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type); + + void resurrectProxy(Proxy & proxy); + + void revokeProxy(Proxy & proxy); + + void freeProxy(Proxy & proxy); + + void incrementCalls(bool normalCall) throw (); + + void decrementCalls(); + + void incrementActiveCalls() throw (); + + void decrementActiveCalls() throw (); + + bool makeCall( + rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & member, bool setter, + std::vector< BinaryAny > const & inArguments, BinaryAny * returnValue, + std::vector< BinaryAny > * outArguments); + + // Only called from reader_ thread: + void sendRequestChangeRequest(); + + // Only called from reader_ thread: + void handleRequestChangeReply( + bool exception, BinaryAny const & returnValue); + + // Only called from reader_ thread: + void handleCommitChangeReply(bool exception, BinaryAny const & returnValue); + + // Only called from reader_ thread: + void handleRequestChangeRequest( + rtl::ByteSequence const & tid, + std::vector< BinaryAny > const & inArguments); + + // Only called from reader_ thread: + void handleCommitChangeRequest( + rtl::ByteSequence const & tid, + std::vector< BinaryAny > const & inArguments); + + OutgoingRequest lastOutgoingRequest(rtl::ByteSequence const & tid); + + bool isProtocolPropertiesRequest( + rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type) const; + + void setCurrentContextMode(); + + bool isCurrentContextMode(); + +private: + virtual ~Bridge(); + + virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + SAL_CALL getInstance(rtl::OUString const & sInstanceName) + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getName() + throw (com::sun::star::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getDescription() + throw (com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL dispose() + throw (com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addEventListener( + com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > + const & xListener) + throw (com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeEventListener( + com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > + const & aListener) + throw (com::sun::star::uno::RuntimeException); + + // Only called from reader_ thread: + void sendCommitChangeRequest(); + + // Only called from reader_ thread: + void sendProtPropRequest( + OutgoingRequest::Kind kind, + std::vector< BinaryAny > const & inArguments); + + void makeReleaseCall( + rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type); + + void sendRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type, + com::sun::star::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments); + + void throwException(bool exception, BinaryAny const & value); + + com::sun::star::uno::Any mapBinaryToCppAny(BinaryAny const & binaryAny); + + bool becameUnused() const; + + void terminateWhenUnused(bool unused); + + typedef + std::list< + com::sun::star::uno::Reference< + com::sun::star::lang::XEventListener > > + Listeners; + + struct SubStub; + + typedef std::map< com::sun::star::uno::TypeDescription, SubStub > Stub; + + typedef std::map< rtl::OUString, Stub > Stubs; + + enum Mode { + MODE_REQUESTED, MODE_REPLY_MINUS1, MODE_REPLY_0, MODE_REPLY_1, + MODE_WAIT, MODE_NORMAL, MODE_NORMAL_WAIT }; + + rtl::Reference< BridgeFactory > factory_; + rtl::OUString name_; + com::sun::star::uno::Reference< com::sun::star::connection::XConnection > + connection_; + com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider > + provider_; + com::sun::star::uno::Environment binaryUno_; + com::sun::star::uno::Mapping cppToBinaryMapping_; + com::sun::star::uno::Mapping binaryToCppMapping_; + rtl::ByteSequence protPropTid_; + rtl::OUString protPropOid_; + com::sun::star::uno::TypeDescription protPropType_; + com::sun::star::uno::TypeDescription protPropRequest_; + com::sun::star::uno::TypeDescription protPropCommit_; + uno_ThreadPool threadPool_; + OutgoingRequests outgoingRequests_; + + osl::Mutex mutex_; + Listeners listeners_; + rtl::Reference< Writer > writer_; + rtl::Reference< Reader > reader_; + bool currentContextMode_; + Stubs stubs_; + std::size_t proxies_; + std::size_t calls_; + bool normalCall_; + std::size_t activeCalls_; + osl::Condition passive_; + // to guarantee that passive_ is eventually set (to avoid deadlock, see + // dispose), activeCalls_ only counts those calls for which it can be + // guaranteed that incrementActiveCalls is indeed followed by + // decrementActiveCalls, without an intervening exception + bool terminated_; + + // Only accessed from reader_ thread: + Mode mode_; + sal_Int32 random_; +}; + +} + +#endif diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx new file mode 100644 index 000000000..16bd9cf1b --- /dev/null +++ b/binaryurp/source/bridgefactory.cxx @@ -0,0 +1,232 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <algorithm> + +#include "com/sun/star/connection/XConnection.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "osl/diagnose.h" +#include "rtl/ref.hxx" +#include "sal/types.h" +#include "uno/lbnames.h" + +#include "bridge.hxx" +#include "bridgefactory.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +} + +css::uno::Reference< css::uno::XInterface > BridgeFactory::static_create( + css::uno::Reference< css::uno::XComponentContext > const & xContext) + SAL_THROW((css::uno::Exception)) +{ + return static_cast< cppu::OWeakObject * >(new BridgeFactory(xContext)); +} + +rtl::OUString BridgeFactory::static_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.bridge.BridgeFactory")); +} + +css::uno::Sequence< rtl::OUString > +BridgeFactory::static_getSupportedServiceNames() { + rtl::OUString name( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory")); + return css::uno::Sequence< rtl::OUString >(&name, 1); +} + +void BridgeFactory::removeBridge( + css::uno::Reference< css::bridge::XBridge > const & bridge) +{ + OSL_ASSERT(bridge.is()); + rtl::OUString n(bridge->getName()); + osl::MutexGuard g(*this); + if (n.getLength() == 0) { + BridgeList::iterator i( + std::find(unnamed_.begin(), unnamed_.end(), bridge)); + if (i != unnamed_.end()) { + unnamed_.erase(i); + } + } else { + BridgeMap::iterator i(named_.find(n)); + if (i != named_.end() && i->second == bridge) { + named_.erase(i); + } + } +} + +BridgeFactory::BridgeFactory( + css::uno::Reference< css::uno::XComponentContext > const & context): + BridgeFactoryBase(*static_cast< osl::Mutex * >(this)), context_(context) +{ + OSL_ASSERT(context.is()); +} + +BridgeFactory::~BridgeFactory() {} + +rtl::OUString BridgeFactory::getImplementationName() + throw (css::uno::RuntimeException) +{ + return static_getImplementationName(); +} + +sal_Bool BridgeFactory::supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > s(getSupportedServiceNames()); + for (sal_Int32 i = 0; i != s.getLength(); ++i) { + if (ServiceName == s[i]) { + return true; + } + } + return false; +} + +css::uno::Sequence< rtl::OUString > BridgeFactory::getSupportedServiceNames() + throw (css::uno::RuntimeException) +{ + return static_getSupportedServiceNames(); +} + +css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge( + rtl::OUString const & sName, rtl::OUString const & sProtocol, + css::uno::Reference< css::connection::XConnection > const & aConnection, + css::uno::Reference< css::bridge::XInstanceProvider > const & + anInstanceProvider) + throw ( + css::bridge::BridgeExistsException, css::lang::IllegalArgumentException, + css::uno::RuntimeException) +{ + rtl::Reference< Bridge > b; + { + osl::MutexGuard g(*this); + if (named_.find(sName) != named_.end()) { + throw css::bridge::BridgeExistsException( + sName, static_cast< cppu::OWeakObject * >(this)); + } + if (!(sProtocol.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("urp")) && + aConnection.is())) + { + throw css::lang::IllegalArgumentException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "BridgeFactory::createBridge: sProtocol != urp ||" + " aConnection == null")), + static_cast< cppu::OWeakObject * >(this), -1); + } + b.set(new Bridge(this, sName, aConnection, anInstanceProvider)); + if (sName.getLength() == 0) { + unnamed_.push_back( + css::uno::Reference< css::bridge::XBridge >(b.get())); + } else { + named_[sName] = b.get(); + } + } + b->start(); + return css::uno::Reference< css::bridge::XBridge >(b.get()); +} + +css::uno::Reference< css::bridge::XBridge > BridgeFactory::getBridge( + rtl::OUString const & sName) throw (css::uno::RuntimeException) +{ + osl::MutexGuard g(*this); + BridgeMap::iterator i(named_.find(sName)); + return i == named_.end() + ? css::uno::Reference< css::bridge::XBridge >() : i->second; +} + +css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > > +BridgeFactory::getExistingBridges() throw (css::uno::RuntimeException) { + osl::MutexGuard g(*this); + if (unnamed_.size() > SAL_MAX_INT32) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "BridgeFactory::getExistingBridges: too many")), + static_cast< cppu::OWeakObject * >(this)); + } + sal_Int32 n = static_cast< sal_Int32 >(unnamed_.size()); + if (named_.size() > static_cast< sal_uInt32 >(SAL_MAX_INT32 - n)) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "BridgeFactory::getExistingBridges: too many")), + static_cast< cppu::OWeakObject * >(this)); + } + n = static_cast< sal_Int32 >(n + named_.size()); + css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > > s(n); + sal_Int32 i = 0; + for (BridgeList::iterator j(unnamed_.begin()); j != unnamed_.end(); ++j) { + s[i++] = *j; + } + for (BridgeMap::iterator j(named_.begin()); j != named_.end(); ++j) { + s[i++] = j->second; + } + return s; +} + +} + +namespace { + +static cppu::ImplementationEntry const services[] = { + { &binaryurp::BridgeFactory::static_create, + &binaryurp::BridgeFactory::static_getImplementationName, + &binaryurp::BridgeFactory::static_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; + +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); +} + +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL +component_getImplementationEnvironment( + char const ** ppEnvTypeName, uno_Environment **) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} diff --git a/binaryurp/source/bridgefactory.hxx b/binaryurp/source/bridgefactory.hxx new file mode 100755 index 000000000..af6499d61 --- /dev/null +++ b/binaryurp/source/bridgefactory.hxx @@ -0,0 +1,144 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_BRIDGEFACTORY_HXX +#define INCLUDED_BINARYURP_SOURCE_BRIDGEFACTORY_HXX + +#include "sal/config.h" + +#include <list> +#include <map> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/bridge/XBridgeFactory.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "cppuhelper/compbase2.hxx" +#include "sal/types.h" + +namespace com { namespace sun { namespace star { + namespace connection { class XConnection; } + namespace uno { + class XComponentContext; + class XInterface; + } +} } } + +namespace binaryurp { + +// That BridgeFactory derives from XComponent appears to be a historic mistake; +// the implementation does not care about a disposed state: + +typedef + cppu::WeakComponentImplHelper2< + com::sun::star::lang::XServiceInfo, + com::sun::star::bridge::XBridgeFactory > + BridgeFactoryBase; + +class BridgeFactory: + private osl::Mutex, public BridgeFactoryBase, private boost::noncopyable +{ +public: + static com::sun::star::uno::Reference< com::sun::star::uno::XInterface > + SAL_CALL static_create( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & xContext) + SAL_THROW((com::sun::star::uno::Exception)); + + static rtl::OUString SAL_CALL static_getImplementationName(); + + static com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + static_getSupportedServiceNames(); + + void removeBridge( + com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > + const & bridge); + + using BridgeFactoryBase::acquire; + using BridgeFactoryBase::release; + +private: + explicit BridgeFactory( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + const & context); + + virtual ~BridgeFactory(); + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > + SAL_CALL createBridge( + rtl::OUString const & sName, rtl::OUString const & sProtocol, + com::sun::star::uno::Reference< + com::sun::star::connection::XConnection > const & aConnection, + com::sun::star::uno::Reference< + com::sun::star::bridge::XInstanceProvider > const & + anInstanceProvider) + throw ( + com::sun::star::bridge::BridgeExistsException, + com::sun::star::lang::IllegalArgumentException, + com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > + SAL_CALL getBridge( + rtl::OUString const & sName) + throw (com::sun::star::uno::RuntimeException); + + virtual + com::sun::star::uno::Sequence< + com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > > + SAL_CALL getExistingBridges() throw (com::sun::star::uno::RuntimeException); + + typedef + std::list< + com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > > + BridgeList; + + typedef + std::map< + rtl::OUString, + com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > > + BridgeMap; + + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > + context_; + BridgeList unnamed_; + BridgeMap named_; +}; + +} + +#endif diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx new file mode 100755 index 000000000..118b8a07b --- /dev/null +++ b/binaryurp/source/cache.hxx @@ -0,0 +1,134 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_CACHE_HXX +#define INCLUDED_BINARYURP_SOURCE_CACHE_HXX + +#include "sal/config.h" + +#include <cstddef> +#include <map> + +#include "boost/noncopyable.hpp" +#include "osl/diagnose.h" +#include "sal/types.h" + +namespace binaryurp { + +namespace cache { + +enum { size = 256, ignore = 0xFFFF }; + +} + +template< typename T > class Cache: private boost::noncopyable { +public: + explicit Cache(std::size_t size): + size_(size), first_(map_.end()), last_(map_.end()) + { + OSL_ASSERT(size < cache::ignore); + } + + sal_uInt16 add(T const & content, bool * found) { + OSL_ASSERT(found != 0); + typename Map::iterator i(map_.find(content)); + *found = i != map_.end(); + if (i == map_.end()) { + typename Map::size_type n = map_.size(); + if (n < size_) { + i = + (map_.insert( + typename Map::value_type( + content, + Entry( + static_cast< sal_uInt16 >(n), map_.end(), + first_)))). + first; + if (first_ == map_.end()) { + last_ = i; + } else { + first_->second.prev = i; + } + first_ = i; + } else if (last_ != map_.end()) { + i = + (map_.insert( + typename Map::value_type( + content, + Entry(last_->second.index, map_.end(), first_)))). + first; + first_->second.prev = i; + first_ = i; + typename Map::iterator j(last_); + last_ = last_->second.prev; + last_->second.next = map_.end(); + map_.erase(j); + } else { + // Reached iff size_ == 0: + return cache::ignore; + } + } else if (i != first_) { + // Move to front (reached only if size_ > 1): + i->second.prev->second.next = i->second.next; + if (i->second.next == map_.end()) { + last_ = i->second.prev; + } else { + i->second.next->second.prev = i->second.prev; + } + i->second.prev = map_.end(); + i->second.next = first_; + first_->second.prev = i; + first_ = i; + } + return i->second.index; + } + +private: + struct Entry; + + typedef std::map< T, Entry > Map; + + struct Entry { + sal_uInt16 index; + typename Map::iterator prev; + typename Map::iterator next; + + Entry( + sal_uInt16 theIndex, typename Map::iterator thePrev, + typename Map::iterator theNext): + index(theIndex), prev(thePrev), next(theNext) {} + }; + + std::size_t size_; + Map map_; + typename Map::iterator first_; + typename Map::iterator last_; +}; + +} + +#endif diff --git a/binaryurp/source/currentcontext.cxx b/binaryurp/source/currentcontext.cxx new file mode 100644 index 000000000..aed9640d8 --- /dev/null +++ b/binaryurp/source/currentcontext.cxx @@ -0,0 +1,80 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "uno/current_context.h" +#include "uno/dispatcher.hxx" +#include "uno/lbnames.h" + +#include "currentcontext.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +} + +namespace current_context { + +css::uno::UnoInterfaceReference get() { + css::uno::UnoInterfaceReference cc; + if (!uno_getCurrentContext( + reinterpret_cast< void ** >(&cc.m_pUnoI), + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)).pData, 0)) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("uno_getCurrentContext failed")), + css::uno::Reference< css::uno::XInterface >()); + } + return cc; +} + +void set(css::uno::UnoInterfaceReference const & value) { + css::uno::UnoInterfaceReference cc(value); + if (!uno_setCurrentContext( + cc.m_pUnoI, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)).pData, 0)) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("uno_setCurrentContext failed")), + css::uno::Reference< css::uno::XInterface >()); + } +} + +} + +} diff --git a/binaryurp/source/currentcontext.hxx b/binaryurp/source/currentcontext.hxx new file mode 100644 index 000000000..558d9ac04 --- /dev/null +++ b/binaryurp/source/currentcontext.hxx @@ -0,0 +1,49 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_CURRENTCONTEXT_HXX +#define INCLUDED_BINARYURP_SOURCE_CURRENTCONTEXT_HXX + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { + class UnoInterfaceReference; +} } } } + +namespace binaryurp { + +namespace current_context { + +com::sun::star::uno::UnoInterfaceReference get(); + +void set(com::sun::star::uno::UnoInterfaceReference const & value); + +} + +} + +#endif diff --git a/binaryurp/source/incomingreply.hxx b/binaryurp/source/incomingreply.hxx new file mode 100644 index 000000000..654542f70 --- /dev/null +++ b/binaryurp/source/incomingreply.hxx @@ -0,0 +1,58 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_INCOMINGREPLY_HXX +#define INCLUDED_BINARYURP_SOURCE_INCOMINGREPLY_HXX + +#include "sal/config.h" + +#include <vector> + +#include "boost/noncopyable.hpp" + +#include "binaryany.hxx" + +namespace binaryurp { + +struct IncomingReply: private boost::noncopyable { + IncomingReply( + bool theException, BinaryAny const & theReturnValue, + std::vector< BinaryAny > const & theOutArguments): + exception(theException), returnValue(theReturnValue), + outArguments(theOutArguments) + {} + + bool exception; + + BinaryAny returnValue; + + std::vector< BinaryAny > outArguments; +}; + +} + +#endif diff --git a/binaryurp/source/incomingrequest.cxx b/binaryurp/source/incomingrequest.cxx new file mode 100644 index 000000000..646a868f6 --- /dev/null +++ b/binaryurp/source/incomingrequest.cxx @@ -0,0 +1,300 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <list> +#include <vector> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/bridge/XInstanceProvider.hpp" +#include "cppuhelper/exc_hlp.hxx" +#include "rtl/byteseq.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typedescription.hxx" +#include "uno/dispatcher.hxx" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "currentcontext.hxx" +#include "incomingrequest.hxx" +#include "specialfunctionids.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +} + +IncomingRequest::IncomingRequest( + rtl::Reference< Bridge > const & bridge, rtl::ByteSequence const & tid, + rtl::OUString const & oid, css::uno::UnoInterfaceReference const & object, + css::uno::TypeDescription const & type, sal_uInt16 functionId, + bool synchronous, css::uno::TypeDescription const & member, bool setter, + std::vector< BinaryAny > const & inArguments, bool currentContextMode, + css::uno::UnoInterfaceReference const & currentContext): + bridge_(bridge), tid_(tid), oid_(oid), object_(object), type_(type), + functionId_(functionId), synchronous_(synchronous), member_(member), + setter_(setter), inArguments_(inArguments), + currentContextMode_(currentContextMode), currentContext_(currentContext) +{ + OSL_ASSERT(bridge.is() && member.is() && member.get()->bComplete); +} + +IncomingRequest::~IncomingRequest() {} + +void IncomingRequest::execute() const { + BinaryAny ret; + std::vector< BinaryAny > outArgs; + bool isExc; + try { + bool resetCc = false; + css::uno::UnoInterfaceReference oldCc; + if (currentContextMode_) { + oldCc = current_context::get(); + current_context::set(currentContext_); + resetCc = true; + } + try { + try { + isExc = !execute_throw(&ret, &outArgs); + } catch (std::exception & e) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("caught C++ exception: ")) + + rtl::OStringToOUString( + rtl::OString(e.what()), RTL_TEXTENCODING_ASCII_US)), + css::uno::Reference< css::uno::XInterface >()); + // best-effort string conversion + } + } catch (css::uno::RuntimeException &) { + css::uno::Any exc(cppu::getCaughtException()); + ret = bridge_->mapCppToBinaryAny(exc); + isExc = true; + } + if (resetCc) { + current_context::set(oldCc); + } + } catch (css::uno::RuntimeException &) { + css::uno::Any exc(cppu::getCaughtException()); + ret = bridge_->mapCppToBinaryAny(exc); + isExc = true; + } + if (synchronous_) { + bridge_->decrementActiveCalls(); + try { + bridge_->getWriter()->queueReply( + tid_, member_, setter_, isExc, ret, outArgs, false); + return; + } catch (css::uno::RuntimeException & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught UNO runtime exception '%s'", + (rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8). + getStr())); + } catch (std::exception & e) { + OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); + } + bridge_->terminate(); + } else { + if (isExc) { + OSL_TRACE(OSL_LOG_PREFIX "oneway method raised exception"); + } + bridge_->decrementCalls(); + } +} + +bool IncomingRequest::execute_throw( + BinaryAny * returnValue, std::vector< BinaryAny > * outArguments) const +{ + OSL_ASSERT( + returnValue != 0 && + returnValue->getType().equals( + css::uno::TypeDescription( + cppu::UnoType< cppu::UnoVoidType >::get())) && + outArguments != 0 && outArguments->empty()); + bool isExc = false; + switch (functionId_) { + case SPECIAL_FUNCTION_ID_RESERVED: + OSL_ASSERT(false); // this cannot happen + break; + case SPECIAL_FUNCTION_ID_RELEASE: + bridge_->releaseStub(oid_, type_); + break; + case SPECIAL_FUNCTION_ID_QUERY_INTERFACE: + if (!object_.is()) { + css::uno::Reference< css::uno::XInterface > ifc; + css::uno::Reference< css::bridge::XInstanceProvider > prov( + bridge_->getProvider()); + if (prov.is()) { + try { + ifc = prov->getInstance(oid_); + } catch (css::container::NoSuchElementException & e) { + OSL_TRACE( + (OSL_LOG_PREFIX "initial element '%s':" + " NoSuchElementException '%s'"), + (rtl::OUStringToOString(oid_, RTL_TEXTENCODING_UTF8). + getStr()), + (rtl::OUStringToOString( + e.Message, RTL_TEXTENCODING_UTF8). + getStr())); + } + } + if (ifc.is()) { + css::uno::UnoInterfaceReference unoIfc( + static_cast< uno_Interface * >( + bridge_->getCppToBinaryMapping().mapInterface( + ifc.get(), + (css::uno::TypeDescription( + cppu::UnoType< + css::uno::Reference< + css::uno::XInterface > >::get()). + get()))), + SAL_NO_ACQUIRE); + *returnValue = BinaryAny( + css::uno::TypeDescription( + cppu::UnoType< + css::uno::Reference< + css::uno::XInterface > >::get()), + &unoIfc.m_pUnoI); + } + break; + } + // fall through + default: + { + OSL_ASSERT(object_.is()); + css::uno::TypeDescription retType; + std::list< std::vector< char > > outBufs; + std::vector< void * > args; + switch (member_.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + { + css::uno::TypeDescription t( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + member_.get())-> + pAttributeTypeRef); + if (setter_) { + OSL_ASSERT(inArguments_.size() == 1); + args.push_back(inArguments_[0].getValue(t)); + } else { + OSL_ASSERT(inArguments_.empty()); + retType = t; + } + break; + } + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription * >( + member_.get()); + retType = css::uno::TypeDescription(mtd->pReturnTypeRef); + std::vector< BinaryAny >::const_iterator i( + inArguments_.begin()); + for (sal_Int32 j = 0; j != mtd->nParams; ++j) { + void * p; + if (mtd->pParams[j].bIn) { + p = i++->getValue( + css::uno::TypeDescription( + mtd->pParams[j].pTypeRef)); + } else { + outBufs.push_back( + std::vector< char >( + css::uno::TypeDescription( + mtd->pParams[j].pTypeRef). + get()->nSize)); + p = &outBufs.back()[0]; + } + args.push_back(p); + if (mtd->pParams[j].bOut) { + outArguments->push_back(BinaryAny()); + } + } + OSL_ASSERT(i == inArguments_.end()); + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + std::vector< char > retBuf(retType.is() ? retType.get()->nSize : 0); + uno_Any exc; + uno_Any * pexc = &exc; + (*object_.get()->pDispatcher)( + object_.get(), member_.get(), retBuf.empty() ? 0 : &retBuf[0], + args.empty() ? 0 : &args[0], &pexc); + isExc = pexc != 0; + if (isExc) { + *returnValue = BinaryAny( + css::uno::TypeDescription( + cppu::UnoType< css::uno::Any >::get()), + &exc); + uno_any_destruct(&exc, 0); + } else { + if (!retBuf.empty()) { + *returnValue = BinaryAny(retType, &retBuf[0]); + uno_destructData(&retBuf[0], retType.get(), 0); + } + if (!outArguments->empty()) { + OSL_ASSERT( + member_.get()->eTypeClass == + typelib_TypeClass_INTERFACE_METHOD); + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription * >( + member_.get()); + std::vector< BinaryAny >::iterator i(outArguments->begin()); + std::list< std::vector< char > >::iterator j( + outBufs.begin()); + for (sal_Int32 k = 0; k != mtd->nParams; ++k) { + if (mtd->pParams[k].bOut) { + *i++ = BinaryAny( + css::uno::TypeDescription( + mtd->pParams[k].pTypeRef), + args[k]); + } + if (!mtd->pParams[k].bIn) { + uno_type_destructData( + &(*j++)[0], mtd->pParams[k].pTypeRef, 0); + } + } + OSL_ASSERT(i == outArguments->end()); + OSL_ASSERT(j == outBufs.end()); + } + } + break; + } + } + return !isExc; +} + +} diff --git a/binaryurp/source/incomingrequest.hxx b/binaryurp/source/incomingrequest.hxx new file mode 100644 index 000000000..ead7067f8 --- /dev/null +++ b/binaryurp/source/incomingrequest.hxx @@ -0,0 +1,86 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_INCOMINGREQUEST_HXX +#define INCLUDED_BINARYURP_SOURCE_INCOMINGREQUEST_HXX + +#include "sal/config.h" + +#include <vector> + +#include "boost/noncopyable.hpp" +#include "rtl/byteseq.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typedescription.hxx" +#include "uno/dispatcher.hxx" + +namespace binaryurp { + class BinaryAny; + class Bridge; +} + +namespace binaryurp { + +class IncomingRequest: private boost::noncopyable { +public: + IncomingRequest( + rtl::Reference< Bridge > const & bridge, rtl::ByteSequence const & tid, + rtl::OUString const & oid, + com::sun::star::uno::UnoInterfaceReference const & object, + com::sun::star::uno::TypeDescription const & type, + sal_uInt16 functionId, bool synchronous, + com::sun::star::uno::TypeDescription const & member, bool setter, + std::vector< BinaryAny > const & inArguments, bool currentContextMode, + com::sun::star::uno::UnoInterfaceReference const & currentContext); + + ~IncomingRequest(); + + void execute() const; + +private: + bool execute_throw( + BinaryAny * returnValue, std::vector< BinaryAny > * outArguments) const; + + rtl::Reference< Bridge > bridge_; + rtl::ByteSequence tid_; + rtl::OUString oid_; // initial object queryInterface; release + com::sun::star::uno::UnoInterfaceReference object_; + com::sun::star::uno::TypeDescription type_; + sal_uInt16 functionId_; + bool synchronous_; + com::sun::star::uno::TypeDescription member_; + bool setter_; + std::vector< BinaryAny > inArguments_; + bool currentContextMode_; + com::sun::star::uno::UnoInterfaceReference currentContext_; +}; + +} + +#endif diff --git a/binaryurp/source/lessoperators.cxx b/binaryurp/source/lessoperators.cxx new file mode 100644 index 000000000..354118625 --- /dev/null +++ b/binaryurp/source/lessoperators.cxx @@ -0,0 +1,71 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <algorithm> + +#include "osl/diagnose.h" +#include "rtl/byteseq.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.hxx" + +#include "lessoperators.hxx" + +namespace com { namespace sun { namespace star { namespace uno { + +bool operator <(TypeDescription const & left, TypeDescription const & right) { + OSL_ASSERT(left.is() && right.is()); + typelib_TypeClass tc1 = left.get()->eTypeClass; + typelib_TypeClass tc2 = right.get()->eTypeClass; + return tc1 < tc2 || + (tc1 == tc2 && + (rtl::OUString(left.get()->pTypeName) < + rtl::OUString(right.get()->pTypeName))); +} + +} } } } + +namespace rtl { + +bool operator <(ByteSequence const & left, ByteSequence const & right) { + for (sal_Int32 i = 0; i != std::min(left.getLength(), right.getLength()); + ++i) + { + if (left[i] < right[i]) { + return true; + } + if (right[i] < left[i]) { + return false; + } + } + return left.getLength() < right.getLength(); +} + +} diff --git a/binaryurp/source/lessoperators.hxx b/binaryurp/source/lessoperators.hxx new file mode 100644 index 000000000..014f0f4d5 --- /dev/null +++ b/binaryurp/source/lessoperators.hxx @@ -0,0 +1,50 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_LESSOPERATORS_HXX +#define INCLUDED_BINARYURP_SOURCE_LESSOPERATORS_HXX + +#include "sal/config.h" + +namespace com { namespace sun { namespace star { namespace uno { + class TypeDescription; +} } } } +namespace rtl { class ByteSequence; } + +namespace com { namespace sun { namespace star { namespace uno { + +bool operator <(TypeDescription const & left, TypeDescription const & right); + +} } } } + +namespace rtl { + +bool operator <(ByteSequence const & left, ByteSequence const & right); + +} + +#endif diff --git a/remotebridges/source/factory/makefile.mk b/binaryurp/source/makefile.mk index b47207077..ca9e7c72b 100644 --- a/remotebridges/source/factory/makefile.mk +++ b/binaryurp/source/makefile.mk @@ -1,8 +1,8 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -23,51 +23,47 @@ # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +PRJ = .. +PRJNAME = binaryurp +TARGET = binaryurp -PRJNAME=remotebridges -TARGET = bridgefac.uno -ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST = brdgfctr - -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk -.IF "$(L10N_framework)"=="" -DLLPRE = -# ------------------------------------------------------------------ +ENABLE_EXCEPTIONS = TRUE +VISIBILITY_HIDDEN = TRUE -SLOFILES= \ - $(SLO)$/bridgefactory.obj\ - $(SLO)$/bridgeimpl.obj +.INCLUDE: settings.mk -SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map - -SHL1STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(RMCXTLIB) - -#SHL1DEPN= -SHL1IMPLIB= i$(TARGET) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1RPATH= URELIB +DLLPRE = -DEF1NAME= $(SHL1TARGET) -.ENDIF # L10N_framework +SLOFILES = \ + $(SLO)/binaryany.obj \ + $(SLO)/bridge.obj \ + $(SLO)/bridgefactory.obj \ + $(SLO)/currentcontext.obj \ + $(SLO)/incomingrequest.obj \ + $(SLO)/lessoperators.obj \ + $(SLO)/marshal.obj \ + $(SLO)/outgoingrequests.obj \ + $(SLO)/proxy.obj \ + $(SLO)/reader.obj \ + $(SLO)/unmarshal.obj \ + $(SLO)/writer.obj -# --- Targets ------------------------------------------------------ +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLOFILES) +SHL1RPATH = URELIB +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB) +SHL1TARGET = binaryurp.uno +SHL1USE_EXPORTS = name +DEF1NAME = $(SHL1TARGET) -.INCLUDE : target.mk +.INCLUDE: target.mk -ALLTAR : $(MISC)/bridgefac.component +ALLTAR : $(MISC)/binaryurp.component -$(MISC)/bridgefac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ - bridgefac.component +$(MISC)/binaryurp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + binaryurp.component $(XSLTPROC) --nonet --stringparam uri \ '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt bridgefac.component + $(SOLARENV)/bin/createcomponent.xslt binaryurp.component diff --git a/binaryurp/source/marshal.cxx b/binaryurp/source/marshal.cxx new file mode 100644 index 000000000..ce520382e --- /dev/null +++ b/binaryurp/source/marshal.cxx @@ -0,0 +1,314 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <vector> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppu/unotype.hxx" +#include "osl/diagnose.h" +#include "rtl/byteseq.hxx" +#include "rtl/string.hxx" +#include "rtl/textcvt.h" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" +#include "typelib/typedescription.hxx" +#include "uno/dispatcher.hxx" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "cache.hxx" +#include "lessoperators.hxx" +#include "marshal.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +void write64(std::vector< unsigned char > * buffer, sal_uInt64 value) { + Marshal::write8(buffer, value >> 56); + Marshal::write8(buffer, (value >> 48) & 0xFF); + Marshal::write8(buffer, (value >> 40) & 0xFF); + Marshal::write8(buffer, (value >> 32) & 0xFF); + Marshal::write8(buffer, (value >> 24) & 0xFF); + Marshal::write8(buffer, (value >> 16) & 0xFF); + Marshal::write8(buffer, (value >> 8) & 0xFF); + Marshal::write8(buffer, value & 0xFF); +} + +void writeCompressed(std::vector< unsigned char > * buffer, sal_uInt32 value) { + if (value < 0xFF) { + Marshal::write8(buffer, static_cast< sal_uInt8 >(value)); + } else { + Marshal::write8(buffer, 0xFF); + Marshal::write32(buffer, value); + } +} + +void writeString( + std::vector< unsigned char > * buffer, rtl::OUString const & value) +{ + OSL_ASSERT(buffer != 0); + rtl::OString v; + if (!value.convertToString( + &v, RTL_TEXTENCODING_UTF8, + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "UNO string contains invalid UTF-16 sequence")), + css::uno::Reference< css::uno::XInterface >()); + } + writeCompressed(buffer, static_cast< sal_uInt32 >(v.getLength())); + buffer->insert(buffer->end(), v.getStr(), v.getStr() + v.getLength()); +} + +} + +Marshal::Marshal(rtl::Reference< Bridge > const & bridge, WriterState & state): + bridge_(bridge), state_(state) +{ + OSL_ASSERT(bridge.is()); +} + +Marshal::~Marshal() {} + +void Marshal::write8(std::vector< unsigned char > * buffer, sal_uInt8 value) { + OSL_ASSERT(buffer != 0); + buffer->push_back(value); +} + +void Marshal::write16(std::vector< unsigned char > * buffer, sal_uInt16 value) { + write8(buffer, value >> 8); + write8(buffer, value & 0xFF); +} + +void Marshal::write32(std::vector< unsigned char > * buffer, sal_uInt32 value) { + write8(buffer, value >> 24); + write8(buffer, (value >> 16) & 0xFF); + write8(buffer, (value >> 8) & 0xFF); + write8(buffer, value & 0xFF); +} + +void Marshal::writeValue( + std::vector< unsigned char > * buffer, + css::uno::TypeDescription const & type, BinaryAny const & value) +{ + OSL_ASSERT( + type.is() && + (type.get()->eTypeClass == typelib_TypeClass_ANY || + value.getType().equals(type))); + writeValue(buffer, type, value.getValue(type)); +} + +void Marshal::writeType( + std::vector< unsigned char > * buffer, + css::uno::TypeDescription const & value) +{ + value.makeComplete(); + OSL_ASSERT(value.is()); + typelib_TypeClass tc = value.get()->eTypeClass; + if (tc <= typelib_TypeClass_ANY) { + write8(buffer, static_cast< sal_uInt8 >(tc)); + } else { + bool found; + sal_uInt16 idx = state_.typeCache.add(value, &found); + if (found) { + write8(buffer, static_cast< sal_uInt8 >(tc)); + write16(buffer, idx); + } else { + write8(buffer, static_cast< sal_uInt8 >(tc) | 0x80); + write16(buffer, idx); + writeString(buffer, rtl::OUString(value.get()->pTypeName)); + } + } +} + +void Marshal::writeOid( + std::vector< unsigned char > * buffer, rtl::OUString const & oid) +{ + bool found; + sal_uInt16 idx; + if (oid.getLength() == 0) { + found = true; + idx = cache::ignore; + } else { + idx = state_.oidCache.add(oid, &found); + } + if (found) { + write8(buffer, 0); + } else { + writeString(buffer, oid); + } + write16(buffer, idx); +} + +void Marshal::writeTid( + std::vector< unsigned char > * buffer, rtl::ByteSequence const & tid) +{ + bool found; + sal_uInt16 idx = state_.tidCache.add(tid, &found); + if (found) { + write8(buffer, 0); + } else { + sal_Sequence * p = tid.getHandle(); + writeValue( + buffer, + css::uno::TypeDescription( + cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get()), &p); + } + write16(buffer, idx); +} + +void Marshal::writeValue( + std::vector< unsigned char > * buffer, + css::uno::TypeDescription const & type, void const * value) +{ + OSL_ASSERT(buffer != 0 && type.is()); + type.makeComplete(); + switch (type.get()->eTypeClass) { + case typelib_TypeClass_VOID: + break; + case typelib_TypeClass_BOOLEAN: + OSL_ASSERT(*static_cast< sal_uInt8 const * >(value) <= 1); + // fall through + case typelib_TypeClass_BYTE: + write8(buffer, *static_cast< sal_uInt8 const * >(value)); + break; + case typelib_TypeClass_SHORT: + case typelib_TypeClass_UNSIGNED_SHORT: + case typelib_TypeClass_CHAR: + write16(buffer, *static_cast< sal_uInt16 const * >(value)); + break; + case typelib_TypeClass_LONG: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_FLOAT: + case typelib_TypeClass_ENUM: + write32(buffer, *static_cast< sal_uInt32 const * >(value)); + break; + case typelib_TypeClass_HYPER: + case typelib_TypeClass_UNSIGNED_HYPER: + case typelib_TypeClass_DOUBLE: + write64(buffer, *static_cast< sal_uInt64 const * >(value)); + break; + case typelib_TypeClass_STRING: + writeString( + buffer, + rtl::OUString(*static_cast< rtl_uString * const * >(value))); + break; + case typelib_TypeClass_TYPE: + writeType( + buffer, + css::uno::TypeDescription( + *static_cast< typelib_TypeDescriptionReference * const * >( + value))); + break; + case typelib_TypeClass_ANY: + { + uno_Any const * p = static_cast< uno_Any const * >(value); + css::uno::TypeDescription t(p->pType); + writeType(buffer, t); + writeValue(buffer, t, p->pData); + break; + } + case typelib_TypeClass_SEQUENCE: + { + sal_Sequence * p = *static_cast< sal_Sequence * const * >(value); + writeCompressed(buffer, static_cast< sal_uInt32 >(p->nElements)); + css::uno::TypeDescription ctd( + reinterpret_cast< typelib_IndirectTypeDescription * >( + type.get())-> + pType); + OSL_ASSERT(ctd.is()); + if (ctd.get()->eTypeClass == typelib_TypeClass_BYTE) { + buffer->insert( + buffer->end(), p->elements, p->elements + p->nElements); + } else { + for (sal_Int32 i = 0; i != p->nElements; ++i) { + writeValue(buffer, ctd, p->elements + i * ctd.get()->nSize); + } + } + break; + } + case typelib_TypeClass_STRUCT: + case typelib_TypeClass_EXCEPTION: + writeMemberValues(buffer, type, value); + break; + case typelib_TypeClass_INTERFACE: + writeOid( + buffer, + bridge_->registerOutgoingInterface( + css::uno::UnoInterfaceReference( + *static_cast< uno_Interface * const * >(value)), + type)); + break; + default: + OSL_ASSERT(false); // this cannot happen + break; + } +} + +void Marshal::writeMemberValues( + std::vector< unsigned char > * buffer, + css::uno::TypeDescription const & type, void const * aggregateValue) +{ + OSL_ASSERT( + type.is() && + (type.get()->eTypeClass == typelib_TypeClass_STRUCT || + type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) && + aggregateValue != 0); + type.makeComplete(); + typelib_CompoundTypeDescription * ctd = + reinterpret_cast< typelib_CompoundTypeDescription * >(type.get()); + if (ctd->pBaseTypeDescription != 0) { + writeMemberValues( + buffer, + css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase), + aggregateValue); + } + for (sal_Int32 i = 0; i != ctd->nMembers; ++i) { + writeValue( + buffer, css::uno::TypeDescription(ctd->ppTypeRefs[i]), + (static_cast< char const * >(aggregateValue) + + ctd->pMemberOffsets[i])); + } +} + +} diff --git a/binaryurp/source/marshal.hxx b/binaryurp/source/marshal.hxx new file mode 100755 index 000000000..a922ec100 --- /dev/null +++ b/binaryurp/source/marshal.hxx @@ -0,0 +1,95 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_MARSHAL_HXX +#define INCLUDED_BINARYURP_SOURCE_MARSHAL_HXX + +#include "sal/config.h" + +#include <vector> + +#include "boost/noncopyable.hpp" +#include "rtl/byteseq.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typedescription.hxx" + +namespace binaryurp { + class BinaryAny; + class Bridge; + struct WriterState; +} + +namespace binaryurp { + +class Marshal: private boost::noncopyable { +public: + Marshal(rtl::Reference< Bridge > const & bridge, WriterState & state); + + ~Marshal(); + + static void write8(std::vector< unsigned char > * buffer, sal_uInt8 value); + + static void write16( + std::vector< unsigned char > * buffer, sal_uInt16 value); + + static void write32( + std::vector< unsigned char > * buffer, sal_uInt32 value); + + void writeValue( + std::vector< unsigned char > * buffer, + com::sun::star::uno::TypeDescription const & type, + BinaryAny const & value); + + void writeType( + std::vector< unsigned char > * buffer, + com::sun::star::uno::TypeDescription const & value); + + void writeOid( + std::vector< unsigned char > * buffer, rtl::OUString const & oid); + + void writeTid( + std::vector< unsigned char > * buffer, rtl::ByteSequence const & tid); + +private: + void writeValue( + std::vector< unsigned char > * buffer, + com::sun::star::uno::TypeDescription const & type, void const * value); + + void writeMemberValues( + std::vector< unsigned char > * buffer, + com::sun::star::uno::TypeDescription const & type, + void const * aggregateValue); + + rtl::Reference< Bridge > bridge_; + WriterState & state_; +}; + +} + +#endif diff --git a/binaryurp/source/outgoingrequest.hxx b/binaryurp/source/outgoingrequest.hxx new file mode 100644 index 000000000..7fe67bf96 --- /dev/null +++ b/binaryurp/source/outgoingrequest.hxx @@ -0,0 +1,55 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_OUTGOINGREQUEST_HXX +#define INCLUDED_BINARYURP_SOURCE_OUTGOINGREQUEST_HXX + +#include "sal/config.h" + +#include "typelib/typedescription.hxx" + +namespace binaryurp { + +struct OutgoingRequest { + enum Kind { KIND_NORMAL, KIND_REQUEST_CHANGE, KIND_COMMIT_CHANGE }; + + OutgoingRequest( + Kind theKind, com::sun::star::uno::TypeDescription const & theMember, + bool theSetter): + kind(theKind), member(theMember), setter(theSetter) + {} + + Kind kind; + + com::sun::star::uno::TypeDescription member; + + bool setter; +}; + +} + +#endif diff --git a/binaryurp/source/outgoingrequests.cxx b/binaryurp/source/outgoingrequests.cxx new file mode 100644 index 000000000..388b77554 --- /dev/null +++ b/binaryurp/source/outgoingrequests.cxx @@ -0,0 +1,80 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include "com/sun/star/uno/RuntimeException.hpp" +#include "rtl/byteseq.hxx" +#include "osl/mutex.hxx" + +#include "lessoperators.hxx" +#include "outgoingrequest.hxx" +#include "outgoingrequests.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +} + +OutgoingRequests::OutgoingRequests() {} + +OutgoingRequests::~OutgoingRequests() {} + +void OutgoingRequests::push( + rtl::ByteSequence const & tid, OutgoingRequest const & request) +{ + osl::MutexGuard g(mutex_); + map_[tid].push_back(request); +} + +OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) { + osl::MutexGuard g(mutex_); + Map::iterator i(map_.find(tid)); + if (i == map_.end()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("URP: reply for unknown TID")), + css::uno::Reference< css::uno::XInterface >()); + } + OSL_ASSERT(!i->second.empty()); + return i->second.back(); +} + +void OutgoingRequests::pop(rtl::ByteSequence const & tid) throw () { + osl::MutexGuard g(mutex_); + Map::iterator i(map_.find(tid)); + OSL_ASSERT(i != map_.end()); + i->second.pop_back(); + if (i->second.empty()) { + map_.erase(i); + } +} + +} diff --git a/binaryurp/source/outgoingrequests.hxx b/binaryurp/source/outgoingrequests.hxx new file mode 100644 index 000000000..92ee622bf --- /dev/null +++ b/binaryurp/source/outgoingrequests.hxx @@ -0,0 +1,65 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_OUTGOINGREQUESTS_HXX +#define INCLUDED_BINARYURP_SOURCE_OUTGOINGREQUESTS_HXX + +#include "sal/config.h" + +#include <map> +#include <vector> + +#include "boost/noncopyable.hpp" +#include "osl/mutex.hxx" + +namespace binaryurp { struct OutgoingRequest; } +namespace rtl { class ByteSequence; } + +namespace binaryurp { + +class OutgoingRequests: private boost::noncopyable { +public: + OutgoingRequests(); + + ~OutgoingRequests(); + + void push(rtl::ByteSequence const & tid, OutgoingRequest const & request); + + OutgoingRequest top(rtl::ByteSequence const & tid); + + void pop(rtl::ByteSequence const & tid) throw (); + +private: + typedef std::map< rtl::ByteSequence, std::vector< OutgoingRequest > > Map; + + osl::Mutex mutex_; + Map map_; +}; + +} + +#endif diff --git a/binaryurp/source/proxy.cxx b/binaryurp/source/proxy.cxx new file mode 100644 index 000000000..876199e7b --- /dev/null +++ b/binaryurp/source/proxy.cxx @@ -0,0 +1,260 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <exception> +#include <vector> + +#include "cppuhelper/exc_hlp.hxx" +#include "osl/diagnose.h" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typedescription.h" +#include "typelib/typedescription.hxx" +#include "uno/any2.h" +#include "uno/dispatcher.h" +#include "uno/dispatcher.hxx" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "proxy.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +extern "C" void SAL_CALL proxy_acquireInterface(uno_Interface * pInterface) { + OSL_ASSERT(pInterface != 0); + static_cast< Proxy * >(pInterface)->do_acquire(); +} + +extern "C" void SAL_CALL proxy_releaseInterface(uno_Interface * pInterface) { + OSL_ASSERT(pInterface != 0); + static_cast< Proxy * >(pInterface)->do_release(); +} + +extern "C" void SAL_CALL proxy_dispatchInterface( + uno_Interface * pUnoI, typelib_TypeDescription const * pMemberType, + void * pReturn, void ** pArgs, uno_Any ** ppException) +{ + OSL_ASSERT(pUnoI != 0); + static_cast< Proxy * >(pUnoI)->do_dispatch( + pMemberType, pReturn, pArgs, ppException); +} + +} + +Proxy::Proxy( + rtl::Reference< Bridge > const & bridge, rtl::OUString const & oid, + css::uno::TypeDescription const & type): + bridge_(bridge), oid_(oid), type_(type), references_(1) +{ + OSL_ASSERT(bridge.is()); + acquire = &proxy_acquireInterface; + release = &proxy_releaseInterface; + pDispatcher = &proxy_dispatchInterface; +} + +rtl::OUString Proxy::getOid() const { + return oid_; +} + +css::uno::TypeDescription Proxy::getType() const { + return type_; +} + +void Proxy::do_acquire() { + if (osl_incrementInterlockedCount(&references_) == 1) { + bridge_->resurrectProxy(*this); + } +} + +void Proxy::do_release() { + if (osl_decrementInterlockedCount(&references_) == 0) { + bridge_->revokeProxy(*this); + } +} + +void Proxy::do_free() { + bridge_->freeProxy(*this); + delete this; +} + +void Proxy::do_dispatch( + typelib_TypeDescription const * member, void * returnValue, + void ** arguments, uno_Any ** exception) const +{ + try { + try { + do_dispatch_throw(member, returnValue, arguments, exception); + } catch (std::exception & e) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("caught C++ exception: ")) + + rtl::OStringToOUString( + rtl::OString(e.what()), RTL_TEXTENCODING_ASCII_US)), + css::uno::Reference< css::uno::XInterface >()); + // best-effort string conversion + } + } catch (css::uno::RuntimeException &) { + css::uno::Any exc(cppu::getCaughtException()); + uno_copyAndConvertData( + *exception, &exc, + (css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()). + get()), + bridge_->getCppToBinaryMapping().get()); + } +} + +bool Proxy::isProxy( + rtl::Reference< Bridge > const & bridge, + css::uno::UnoInterfaceReference const & object, rtl::OUString * oid) +{ + OSL_ASSERT(object.is()); + return object.m_pUnoI->acquire == &proxy_acquireInterface && + static_cast< Proxy * >(object.m_pUnoI)->isProxy(bridge, oid); +} + +Proxy::~Proxy() {} + +void Proxy::do_dispatch_throw( + typelib_TypeDescription const * member, void * returnValue, + void ** arguments, uno_Any ** exception) const +{ + //TODO: Optimize queryInterface: + OSL_ASSERT(member != 0); + bool setter = false; + std::vector< BinaryAny > inArgs; + switch (member->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + setter = returnValue == 0; + if (setter) { + inArgs.push_back( + BinaryAny( + css::uno::TypeDescription( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription const * >( + member)-> + pAttributeTypeRef), + arguments[0])); + } + break; + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription const * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription const * >(member); + for (sal_Int32 i = 0; i != mtd->nParams; ++i) { + if (mtd->pParams[i].bIn) { + inArgs.push_back( + BinaryAny( + css::uno::TypeDescription(mtd->pParams[i].pTypeRef), + arguments[i])); + } + } + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + BinaryAny ret; + std::vector< BinaryAny > outArgs; + if (bridge_->makeCall( + oid_, + css::uno::TypeDescription( + const_cast< typelib_TypeDescription * >(member)), + setter, inArgs, &ret, &outArgs)) + { + OSL_ASSERT( + ret.getType().get()->eTypeClass == typelib_TypeClass_EXCEPTION); + uno_any_construct( + *exception, ret.getValue(ret.getType()), ret.getType().get(), 0); + } else { + switch (member->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + if (!setter) { + css::uno::TypeDescription t( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription const * >( + member)-> + pAttributeTypeRef); + uno_copyData(returnValue, ret.getValue(t), t.get(), 0); + } + break; + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription const * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription const * >( + member); + css::uno::TypeDescription t(mtd->pReturnTypeRef); + if (t.get()->eTypeClass != typelib_TypeClass_VOID) { + uno_copyData(returnValue, ret.getValue(t), t.get(), 0); + } + std::vector< BinaryAny >::iterator i(outArgs.begin()); + for (sal_Int32 j = 0; j != mtd->nParams; ++j) { + if (mtd->pParams[j].bOut) { + css::uno::TypeDescription pt(mtd->pParams[j].pTypeRef); + if (mtd->pParams[j].bIn) { + uno_assignData( + arguments[j], pt.get(), i++->getValue(pt), + pt.get(), 0, 0, 0); + } else { + uno_copyData( + arguments[j], i++->getValue(pt), pt.get(), 0); + } + } + } + OSL_ASSERT(i == outArgs.end()); + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + *exception = 0; + } +} + +bool Proxy::isProxy( + rtl::Reference< Bridge > const & bridge, rtl::OUString * oid) const +{ + OSL_ASSERT(oid != 0); + if (bridge == bridge_) { + *oid = oid_; + return true; + } else { + return false; + } +} + +} diff --git a/binaryurp/source/proxy.hxx b/binaryurp/source/proxy.hxx new file mode 100644 index 000000000..c67ab4eb5 --- /dev/null +++ b/binaryurp/source/proxy.hxx @@ -0,0 +1,92 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_PROXY_HXX +#define INCLUDED_BINARYURP_SOURCE_PROXY_HXX + +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "osl/interlck.h" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "typelib/typedescription.h" +#include "typelib/typedescription.hxx" +#include "uno/any2.h" +#include "uno/dispatcher.h" + +namespace binaryurp { class Bridge; } +namespace com { namespace sun { namespace star { namespace uno { + class UnoInterfaceReference; +} } } } + +namespace binaryurp { + +class Proxy: public uno_Interface, private boost::noncopyable { +public: + Proxy( + rtl::Reference< Bridge > const & bridge, rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type); + + rtl::OUString getOid() const; + + com::sun::star::uno::TypeDescription getType() const; + + void do_acquire(); + + void do_release(); + + void do_free(); + + void do_dispatch( + typelib_TypeDescription const * member, void * returnValue, + void ** arguments, uno_Any ** exception) const; + + static bool isProxy( + rtl::Reference< Bridge > const & bridge, + com::sun::star::uno::UnoInterfaceReference const & object, + rtl::OUString * oid); + +private: + ~Proxy(); + + void do_dispatch_throw( + typelib_TypeDescription const * member, void * returnValue, + void ** arguments, uno_Any ** exception) const; + + bool isProxy(rtl::Reference< Bridge > const & bridge, rtl::OUString * oid) + const; + + rtl::Reference< Bridge > bridge_; + rtl::OUString oid_; + com::sun::star::uno::TypeDescription type_; + oslInterlockedCount references_; +}; + +} + +#endif diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx new file mode 100755 index 000000000..f622fb5b0 --- /dev/null +++ b/binaryurp/source/reader.cxx @@ -0,0 +1,553 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <exception> +#include <memory> +#include <vector> + +#include "com/sun/star/connection/XConnection.hpp" +#include "com/sun/star/io/IOException.hpp" +#include "com/sun/star/uno/Any.hxx" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/Type.hxx" +#include "com/sun/star/uno/XCurrentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppu/unotype.hxx" +#include "osl/diagnose.h" +#include "rtl/byteseq.h" +#include "rtl/string.h" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" +#include "typelib/typedescription.hxx" +#include "uno/lbnames.h" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "incomingreply.hxx" +#include "incomingrequest.hxx" +#include "outgoingrequest.hxx" +#include "reader.hxx" +#include "specialfunctionids.hxx" +#include "unmarshal.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +css::uno::Sequence< sal_Int8 > read( + css::uno::Reference< css::connection::XConnection > const & connection, + sal_uInt32 size, bool eofOk) +{ + OSL_ASSERT(connection.is()); + if (size > SAL_MAX_INT32) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Reader: block size too large")), + css::uno::Reference< css::uno::XInterface >()); + } + css::uno::Sequence< sal_Int8 > buf; + sal_Int32 n = connection->read(buf, static_cast< sal_Int32 >(size)); + if (n == 0 && eofOk) { + return css::uno::Sequence< sal_Int8 >(); + } + if (n != static_cast< sal_Int32 >(size)) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Reader: premature end of input")), + css::uno::Reference< css::uno::XInterface >()); + } + OSL_ASSERT(buf.getLength() == static_cast< sal_Int32 >(size)); + return buf; +} + +extern "C" void SAL_CALL request(void * pThreadSpecificData) { + OSL_ASSERT(pThreadSpecificData != 0); + std::auto_ptr< IncomingRequest >( + static_cast< IncomingRequest * >(pThreadSpecificData))-> + execute(); +} + +} + +Reader::Reader(rtl::Reference< Bridge > const & bridge): bridge_(bridge) { + OSL_ASSERT(bridge.is()); + acquire(); +} + +Reader::~Reader() {} + +void Reader::run() { + setName("binaryurpReader"); + try { + bridge_->sendRequestChangeRequest(); + css::uno::Reference< css::connection::XConnection > con( + bridge_->getConnection()); + for (;;) { + css::uno::Sequence< sal_Int8 > s(read(con, 8, true)); + if (s.getLength() == 0) { + break; + } + Unmarshal header(bridge_, state_, s); + sal_uInt32 size = header.read32(); + sal_uInt32 count = header.read32(); + header.done(); + if (count == 0) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Reader: block with zero message count" + " received")), + css::uno::Reference< css::uno::XInterface >()); + } + Unmarshal block(bridge_, state_, read(con, size, false)); + for (sal_uInt32 i = 0; i != count; ++i) { + readMessage(block); + } + block.done(); + } + } catch (css::uno::Exception & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught UNO exception '%s'", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + } catch (std::exception & e) { + OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); + } + bridge_->terminate(); +} + +void Reader::onTerminated() { + release(); +} + +void Reader::readMessage(Unmarshal & unmarshal) { + sal_uInt8 flags1 = unmarshal.read8(); + bool newType; + bool newOid; + bool newTid; + bool forceSynchronous; + sal_uInt16 functionId; + if ((flags1 & 0x80) != 0) { // bit 7: LONGHEADER + if ((flags1 & 0x40) == 0) { // bit 6: REQUEST + readReplyMessage(unmarshal, flags1); + return; + } + newType = (flags1 & 0x20) != 0; // bit 5: NEWTYPE + newOid = (flags1 & 0x10) != 0; // bit 4: NEWOID + newTid = (flags1 & 0x08) != 0; // bit 3: NEWTID + if ((flags1 & 0x01) != 0) { // bit 0: MOREFLAGSS + sal_uInt8 flags2 = unmarshal.read8(); + forceSynchronous = (flags2 & 0x80) != 0; // bit 7: MUSTREPLY + if (((flags2 & 0x40) != 0) != forceSynchronous) { + // bit 6: SYNCHRONOUS + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with MUSTREPLY != SYNCHRONOUS" + " received")), + css::uno::Reference< css::uno::XInterface >()); + } + } else { + forceSynchronous = false; + } + functionId = ((flags1 & 0x04) != 0) // bit 2: FUNCTIONID16 + ? unmarshal.read16() : unmarshal.read8(); + } else { + newType = false; + newOid = false; + newTid = false; + forceSynchronous = false; + functionId = ((flags1 & 0x40) != 0) // bit 6: FUNCTIONID14 + ? ((flags1 & 0x3F) << 8) | unmarshal.read8() : flags1 & 0x3F; + } + css::uno::TypeDescription type; + if (newType) { + type = unmarshal.readType(); + lastType_ = type; + } else { + if (!lastType_.is()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with NEWTYPE received when last" + " interface type has not yet been set")), + css::uno::Reference< css::uno::XInterface >()); + } + type = lastType_; + } + rtl::OUString oid; + if (newOid) { + oid = unmarshal.readOid(); + if (oid.getLength() == 0) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: emtpy OID")), + css::uno::Reference< css::uno::XInterface >()); + } + lastOid_ = oid; + } else { + if (lastOid_.getLength() == 0) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with NEWOID received when last" + " OID has not yet been set")), + css::uno::Reference< css::uno::XInterface >()); + } + oid = lastOid_; + } + rtl::ByteSequence tid(getTid(unmarshal, newTid)); + lastTid_ = tid; + type.makeComplete(); + if (type.get()->eTypeClass != typelib_TypeClass_INTERFACE) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with non-interface interface type" + " received")), + css::uno::Reference< css::uno::XInterface >()); + } + typelib_InterfaceTypeDescription * itd = + reinterpret_cast< typelib_InterfaceTypeDescription * >(type.get()); + if (functionId >= itd->nMapFunctionIndexToMemberIndex) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with unknown function ID received")), + css::uno::Reference< css::uno::XInterface >()); + } + sal_Int32 memberId = itd->pMapFunctionIndexToMemberIndex[functionId]; + css::uno::TypeDescription memberTd(itd->ppAllMembers[memberId]); + memberTd.makeComplete(); + OSL_ASSERT(memberTd.is()); + bool protProps = bridge_->isProtocolPropertiesRequest(oid, type); + bool ccMode = !protProps && functionId != SPECIAL_FUNCTION_ID_RELEASE && + bridge_->isCurrentContextMode(); + css::uno::UnoInterfaceReference cc; + if (ccMode) { + css::uno::TypeDescription t( + cppu::UnoType< css::uno::Reference< css::uno::XCurrentContext > >:: + get()); + cc.set( + *static_cast< uno_Interface ** >( + unmarshal.readValue(t).getValue(t))); + } + bool synchronous; + if (memberTd.get()->eTypeClass == typelib_TypeClass_INTERFACE_METHOD && + (reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( + memberTd.get())-> + bOneWay)) + { + synchronous = forceSynchronous; + } else { + if (forceSynchronous) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: synchronous request message with non-oneway" + " function ID received")), + css::uno::Reference< css::uno::XInterface >()); + } + synchronous = true; + } + bool setter = false; + std::vector< BinaryAny > inArgs; + switch (memberTd.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + setter = itd->pMapMemberIndexToFunctionIndex[memberId] != functionId; + // pMapMemberIndexToFunctionIndex contains function index of + // attribute getter + if (setter) { + inArgs.push_back( + unmarshal.readValue( + css::uno::TypeDescription( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + memberTd.get())-> + pAttributeTypeRef))); + } + break; + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( + memberTd.get()); + for (sal_Int32 i = 0; i != mtd->nParams; ++i) { + if (mtd->pParams[i].bIn) { + inArgs.push_back( + unmarshal.readValue( + css::uno::TypeDescription( + mtd->pParams[i].pTypeRef))); + } + } + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + bridge_->incrementCalls( + !protProps && functionId != SPECIAL_FUNCTION_ID_RELEASE); + if (protProps) { + switch (functionId) { + case SPECIAL_FUNCTION_ID_REQUEST_CHANGE: + bridge_->handleRequestChangeRequest(tid, inArgs); + break; + case SPECIAL_FUNCTION_ID_COMMIT_CHANGE: + bridge_->handleCommitChangeRequest(tid, inArgs); + break; + default: + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with UrpProtocolProperties OID" + " and unknown function ID received")), + css::uno::Reference< css::uno::XInterface >()); + } + } else { + css::uno::UnoInterfaceReference obj; + switch (functionId) { + case SPECIAL_FUNCTION_ID_QUERY_INTERFACE: + obj = bridge_->findStub(oid, type); + if (!obj.is()) { + OSL_ASSERT( + inArgs.size() == 1 + && inArgs[0].getType().equals( + css::uno::TypeDescription( + cppu::UnoType< css::uno::Type >::get()))); + if (!(type.equals( + css::uno::TypeDescription( + cppu::UnoType< + css::uno::Reference< + css::uno::XInterface > >::get())) + && (css::uno::TypeDescription( + *static_cast< + typelib_TypeDescriptionReference ** >( + inArgs[0].getValue(inArgs[0].getType()))). + equals( + css::uno::TypeDescription( + cppu::UnoType< + css::uno::Reference< + css::uno::XInterface > >::get()))))) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: queryInterface request message with" + " unknown OID received")), + css::uno::Reference< css::uno::XInterface >()); + } + } + break; + case SPECIAL_FUNCTION_ID_RESERVED: + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with unknown function ID 1" + " received")), + css::uno::Reference< css::uno::XInterface >()); + case SPECIAL_FUNCTION_ID_RELEASE: + break; + default: + obj = bridge_->findStub(oid, type); + if (!obj.is()) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: request message with unknown OID received")), + css::uno::Reference< css::uno::XInterface >()); + } + break; + } + std::auto_ptr< IncomingRequest > req( + new IncomingRequest( + bridge_, tid, oid, obj, type, functionId, synchronous, memberTd, + setter, inArgs, ccMode, cc)); + if (synchronous) { + bridge_->incrementActiveCalls(); + } + uno_threadpool_putJob( + bridge_->getThreadPool(), tid.getHandle(), req.get(), &request, + !synchronous); + req.release(); + } +} + +void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) { + rtl::ByteSequence tid(getTid(unmarshal, (flags1 & 0x08) != 0)); + // bit 3: NEWTID + lastTid_ = tid; + OutgoingRequest req(bridge_->lastOutgoingRequest(tid)); + bool exc = (flags1 & 0x20) != 0; // bit 5: EXCEPTION + BinaryAny ret; + std::vector< BinaryAny > outArgs; + if (exc) { + ret = unmarshal.readValue( + css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get())); + if (!typelib_typedescription_isAssignableFrom( + (css::uno::TypeDescription( + cppu::UnoType< css::uno::RuntimeException >::get()). + get()), + ret.getType().get())) + { + sal_Int32 n = 0; + typelib_TypeDescriptionReference ** p = 0; + switch (req.member.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + { + typelib_InterfaceAttributeTypeDescription * atd = + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + req.member.get()); + n = req.setter ? atd->nSetExceptions : atd->nGetExceptions; + p = req.setter + ? atd->ppSetExceptions : atd->ppGetExceptions; + break; + } + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription * >( + req.member.get()); + n = mtd->nExceptions; + p = mtd->ppExceptions; + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + bool ok = false; + for (sal_Int32 i = 0; i != n; ++i) { + if (typelib_typedescriptionreference_isAssignableFrom( + p[i], + reinterpret_cast< typelib_TypeDescriptionReference * >( + ret.getType().get()))) + { + ok = true; + break; + } + } + if (!ok) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: reply message with bad exception type" + " received")), + css::uno::Reference< css::uno::XInterface >()); + } + } + } else { + switch (req.member.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + if (!req.setter) { + ret = unmarshal.readValue( + css::uno::TypeDescription( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + req.member.get())-> + pAttributeTypeRef)); + } + break; + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription * >( + req.member.get()); + ret = unmarshal.readValue( + css::uno::TypeDescription(mtd->pReturnTypeRef)); + for (sal_Int32 i = 0; i != mtd->nParams; ++i) { + if (mtd->pParams[i].bOut) { + outArgs.push_back( + unmarshal.readValue( + css::uno::TypeDescription( + mtd->pParams[i].pTypeRef))); + } + } + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + } + switch (req.kind) { + case OutgoingRequest::KIND_NORMAL: + { + std::auto_ptr< IncomingReply > resp( + new IncomingReply(exc, ret, outArgs)); + uno_threadpool_putJob( + bridge_->getThreadPool(), tid.getHandle(), resp.get(), 0, + false); + resp.release(); + break; + } + case OutgoingRequest::KIND_REQUEST_CHANGE: + OSL_ASSERT(outArgs.empty()); + bridge_->handleRequestChangeReply(exc, ret); + break; + case OutgoingRequest::KIND_COMMIT_CHANGE: + OSL_ASSERT(outArgs.empty()); + bridge_->handleCommitChangeReply(exc, ret); + break; + default: + OSL_ASSERT(false); // this cannot happen + break; + } +} + +rtl::ByteSequence Reader::getTid(Unmarshal & unmarshal, bool newTid) const { + if (newTid) { + return unmarshal.readTid(); + } + if (lastTid_.getLength() == 0) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "URP: message with NEWTID received when last TID has not" + " yet been set")), + css::uno::Reference< css::uno::XInterface >()); + } + return lastTid_; +} + +} diff --git a/binaryurp/source/reader.hxx b/binaryurp/source/reader.hxx new file mode 100644 index 000000000..37d0b9462 --- /dev/null +++ b/binaryurp/source/reader.hxx @@ -0,0 +1,89 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_READER_HXX +#define INCLUDED_BINARYURP_SOURCE_READER_HXX + +#include "sal/config.h" + +#include <cstddef> + +#include "boost/noncopyable.hpp" +#include "osl/thread.hxx" +#include "rtl/byteseq.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "typelib/typedescription.hxx" + +#include "readerstate.hxx" + +namespace binaryurp { + class BinaryAny; + class Bridge; + class Unmarshal; +} + +namespace binaryurp { + +class Reader: + public osl::Thread, public salhelper::SimpleReferenceObject, + private boost::noncopyable +{ +public: + static void * operator new(std::size_t size) + { return Thread::operator new(size); } + + static void operator delete(void * pointer) + { Thread::operator delete(pointer); } + + explicit Reader(rtl::Reference< Bridge > const & bridge); + +private: + virtual ~Reader(); + + virtual void SAL_CALL run(); + + virtual void SAL_CALL onTerminated(); + + void readMessage(Unmarshal & unmarshal); + + void readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1); + + rtl::ByteSequence getTid(Unmarshal & unmarshal, bool newTid) const; + + rtl::Reference< Bridge > bridge_; + com::sun::star::uno::TypeDescription lastType_; + rtl::OUString lastOid_; + rtl::ByteSequence lastTid_; + ReaderState state_; +}; + +} + +#endif diff --git a/binaryurp/source/readerstate.hxx b/binaryurp/source/readerstate.hxx new file mode 100644 index 000000000..ef7ed4d71 --- /dev/null +++ b/binaryurp/source/readerstate.hxx @@ -0,0 +1,52 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_READERSTATE_HXX +#define INCLUDED_BINARYURP_SOURCE_READERSTATE_HXX + +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "rtl/byteseq.hxx" +#include "rtl/ustring.hxx" +#include "typelib/typedescription.hxx" + +#include "cache.hxx" + +namespace binaryurp { + +struct ReaderState: private boost::noncopyable { + com::sun::star::uno::TypeDescription typeCache[cache::size]; + + rtl::OUString oidCache[cache::size]; + + rtl::ByteSequence tidCache[cache::size]; +}; + +} + +#endif diff --git a/binaryurp/source/specialfunctionids.hxx b/binaryurp/source/specialfunctionids.hxx new file mode 100644 index 000000000..a2a59791b --- /dev/null +++ b/binaryurp/source/specialfunctionids.hxx @@ -0,0 +1,49 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_SPECIALFUNCTIONIDS_HXX +#define INCLUDED_BINARYURP_SOURCE_SPECIALFUNCTIONIDS_HXX + +#include "sal/config.h" + +namespace binaryurp { + +enum SpecialFunctionIds { + SPECIAL_FUNCTION_ID_QUERY_INTERFACE = 0, + + SPECIAL_FUNCTION_ID_RESERVED = 1, + + SPECIAL_FUNCTION_ID_RELEASE = 2, + + SPECIAL_FUNCTION_ID_REQUEST_CHANGE = 4, + + SPECIAL_FUNCTION_ID_COMMIT_CHANGE = 5 +}; + +} + +#endif diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx new file mode 100755 index 000000000..62f8683e3 --- /dev/null +++ b/binaryurp/source/unmarshal.cxx @@ -0,0 +1,563 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <cstdlib> +#include <new> +#include <vector> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/io/IOException.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppu/unotype.hxx" +#include "osl/diagnose.h" +#include "rtl/byteseq.hxx" +#include "rtl/ref.hxx" +#include "rtl/textcvt.h" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" +#include "typelib/typedescription.hxx" +#include "uno/any2.h" +#include "uno/data.h" +#include "uno/dispatcher.hxx" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "cache.hxx" +#include "readerstate.hxx" +#include "unmarshal.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +void * allocate(sal_Size size) { + void * p = rtl_allocateMemory(size); + if (p == 0) { + throw std::bad_alloc(); + } + return p; +} + +std::vector< BinaryAny >::iterator copyMemberValues( + css::uno::TypeDescription const & type, + std::vector< BinaryAny >::iterator const & it, void * buffer) throw () +{ + OSL_ASSERT( + type.is() && + (type.get()->eTypeClass == typelib_TypeClass_STRUCT || + type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) && + buffer != 0); + type.makeComplete(); + std::vector< BinaryAny >::iterator i(it); + typelib_CompoundTypeDescription * ctd = + reinterpret_cast< typelib_CompoundTypeDescription * >(type.get()); + if (ctd->pBaseTypeDescription != 0) { + i = copyMemberValues( + css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase), i, + buffer); + } + for (sal_Int32 j = 0; j != ctd->nMembers; ++j) { + uno_type_copyData( + static_cast< char * >(buffer) + ctd->pMemberOffsets[j], + const_cast< void * >( + i++->getValue(css::uno::TypeDescription(ctd->ppTypeRefs[j]))), + ctd->ppTypeRefs[j], 0); + } + return i; +} + +} + +Unmarshal::Unmarshal( + rtl::Reference< Bridge > const & bridge, ReaderState & state, + css::uno::Sequence< sal_Int8 > const & buffer): + bridge_(bridge), state_(state), buffer_(buffer) +{ + data_ = reinterpret_cast< sal_uInt8 const * >(buffer_.getConstArray()); + end_ = data_ + buffer_.getLength(); +} + +Unmarshal::~Unmarshal() {} + +sal_uInt8 Unmarshal::read8() { + check(1); + return *data_++; +} + +sal_uInt16 Unmarshal::read16() { + check(2); + sal_uInt16 n = static_cast< sal_uInt16 >(*data_++) << 8; + return n | *data_++; +} + +sal_uInt32 Unmarshal::read32() { + check(4); + sal_uInt32 n = static_cast< sal_uInt32 >(*data_++) << 24; + n |= static_cast< sal_uInt32 >(*data_++) << 16; + n |= static_cast< sal_uInt32 >(*data_++) << 8; + return n | *data_++; +} + +css::uno::TypeDescription Unmarshal::readType() { + sal_uInt8 flags = read8(); + typelib_TypeClass tc = static_cast< typelib_TypeClass >(flags & 0x7F); + switch (tc) { + case typelib_TypeClass_VOID: + case typelib_TypeClass_BOOLEAN: + case typelib_TypeClass_BYTE: + case typelib_TypeClass_SHORT: + case typelib_TypeClass_UNSIGNED_SHORT: + case typelib_TypeClass_LONG: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_HYPER: + case typelib_TypeClass_UNSIGNED_HYPER: + case typelib_TypeClass_FLOAT: + case typelib_TypeClass_DOUBLE: + case typelib_TypeClass_CHAR: + case typelib_TypeClass_STRING: + case typelib_TypeClass_TYPE: + case typelib_TypeClass_ANY: + if ((flags & 0x80) != 0) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: cache flag of simple type is" + " set")), + css::uno::Reference< css::uno::XInterface >()); + } + return css::uno::TypeDescription( + *typelib_static_type_getByTypeClass( + static_cast< typelib_TypeClass >(tc))); + case typelib_TypeClass_SEQUENCE: + case typelib_TypeClass_ENUM: + case typelib_TypeClass_STRUCT: + case typelib_TypeClass_EXCEPTION: + case typelib_TypeClass_INTERFACE: + { + sal_uInt16 idx = readCacheIndex(); + if ((flags & 0x80) == 0) { + if (idx == cache::ignore || !state_.typeCache[idx].is()) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: unknown type cache" + " index")), + css::uno::Reference< css::uno::XInterface >()); + } + return state_.typeCache[idx]; + } else { + css::uno::TypeDescription t(readString()); + if (!t.is() || + t.get()->eTypeClass != static_cast< typelib_TypeClass >(tc)) + { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: type with unknown" + " name")), + css::uno::Reference< css::uno::XInterface >()); + } + for (css::uno::TypeDescription t2(t); + t2.get()->eTypeClass == typelib_TypeClass_SEQUENCE;) + { + t2.makeComplete(); + t2 = css::uno::TypeDescription( + reinterpret_cast< typelib_IndirectTypeDescription * >( + t2.get())->pType); + if (!t2.is()) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: sequence type with" + " unknown component type")), + css::uno::Reference< css::uno::XInterface >()); + } + switch (t2.get()->eTypeClass) { + case typelib_TypeClass_VOID: + case typelib_TypeClass_EXCEPTION: + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: sequence type with" + " bad component type")), + css::uno::Reference< css::uno::XInterface >()); + default: + break; + } + } + if (idx != cache::ignore) { + state_.typeCache[idx] = t; + } + return t; + } + } + default: + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: type of unknown type class")), + css::uno::Reference< css::uno::XInterface >()); + } +} + +rtl::OUString Unmarshal::readOid() { + rtl::OUString oid(readString()); + for (sal_Int32 i = 0; i != oid.getLength(); ++i) { + if (oid[i] > 0x7F) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: OID contains non-ASCII" + " character")), + css::uno::Reference< css::uno::XInterface >()); + } + } + sal_uInt16 idx = readCacheIndex(); + if (oid.getLength() == 0 && idx != cache::ignore) { + if (state_.oidCache[idx].getLength() == 0) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: unknown OID cache index")), + css::uno::Reference< css::uno::XInterface >()); + } + return state_.oidCache[idx]; + } + if (idx != cache::ignore) { + state_.oidCache[idx] = oid; + } + return oid; +} + +rtl::ByteSequence Unmarshal::readTid() { + rtl::ByteSequence tid( + *static_cast< sal_Sequence * const * >( + readSequence( + css::uno::TypeDescription( + cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get())). + getValue( + css::uno::TypeDescription( + cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get())))); + sal_uInt16 idx = readCacheIndex(); + if (tid.getLength() == 0) { + if (idx == cache::ignore || state_.tidCache[idx].getLength() == 0) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: unknown TID cache index")), + css::uno::Reference< css::uno::XInterface >()); + } + return state_.tidCache[idx]; + } + if (idx != cache::ignore) { + state_.tidCache[idx] = tid; + } + return tid; +} + +BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) { + OSL_ASSERT(type.is()); + switch (type.get()->eTypeClass) { + default: + std::abort(); // this cannot happen + // pseudo fall-through to avoid compiler warnings + case typelib_TypeClass_VOID: + return BinaryAny(); + case typelib_TypeClass_BOOLEAN: + { + sal_uInt8 v = read8(); + if (v > 1) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: boolean of unknown value")), + css::uno::Reference< css::uno::XInterface >()); + } + return BinaryAny(type, &v); + } + case typelib_TypeClass_BYTE: + { + sal_uInt8 v = read8(); + return BinaryAny(type, &v); + } + case typelib_TypeClass_SHORT: + case typelib_TypeClass_UNSIGNED_SHORT: + case typelib_TypeClass_CHAR: + { + sal_uInt16 v = read16(); + return BinaryAny(type, &v); + } + case typelib_TypeClass_LONG: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_FLOAT: + { + sal_uInt32 v = read32(); + return BinaryAny(type, &v); + } + case typelib_TypeClass_HYPER: + case typelib_TypeClass_UNSIGNED_HYPER: + case typelib_TypeClass_DOUBLE: + { + sal_uInt64 v = read64(); + return BinaryAny(type, &v); + } + case typelib_TypeClass_STRING: + { + rtl::OUString v(readString()); + return BinaryAny(type, &v.pData); + } + case typelib_TypeClass_TYPE: + { + css::uno::TypeDescription v(readType()); + typelib_TypeDescription * p = v.get(); + return BinaryAny(type, &p); + } + case typelib_TypeClass_ANY: + { + css::uno::TypeDescription t(readType()); + if (t.get()->eTypeClass == typelib_TypeClass_ANY) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: any of type ANY")), + css::uno::Reference< css::uno::XInterface >()); + } + return readValue(t); + } + case typelib_TypeClass_SEQUENCE: + type.makeComplete(); + return readSequence(type); + case typelib_TypeClass_ENUM: + { + sal_Int32 v = static_cast< sal_Int32 >(read32()); + type.makeComplete(); + typelib_EnumTypeDescription * etd = + reinterpret_cast< typelib_EnumTypeDescription * >(type.get()); + bool found = false; + for (sal_Int32 i = 0; i != etd->nEnumValues; ++i) { + if (etd->pEnumValues[i] == v) { + found = true; + break; + } + } + if (!found) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: unknown enum value")), + css::uno::Reference< css::uno::XInterface >()); + } + return BinaryAny(type, &v); + } + case typelib_TypeClass_STRUCT: + case typelib_TypeClass_EXCEPTION: + { + std::vector< BinaryAny > as; + readMemberValues(type, &as); + void * buf = allocate(type.get()->nSize); + copyMemberValues(type, as.begin(), buf); + uno_Any raw; + raw.pType = reinterpret_cast< typelib_TypeDescriptionReference * >( + type.get()); + raw.pData = buf; + raw.pReserved = 0; + return BinaryAny(raw); + } + case typelib_TypeClass_INTERFACE: + { + css::uno::UnoInterfaceReference obj( + bridge_->registerIncomingInterface(readOid(), type)); + return BinaryAny(type, &obj.m_pUnoI); + } + } +} + +void Unmarshal::done() const { + if (data_ != end_) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: block contains excess data")), + css::uno::Reference< css::uno::XInterface >()); + } +} + +void Unmarshal::check(sal_Int32 size) const { + if (end_ - data_ < size) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: trying to read past end of block")), + css::uno::Reference< css::uno::XInterface >()); + } +} + +sal_uInt32 Unmarshal::readCompressed() { + sal_uInt8 n = read8(); + return n == 0xFF ? read32() : n; +} + +sal_uInt16 Unmarshal::readCacheIndex() { + sal_uInt16 idx = read16(); + if (idx >= cache::size && idx != cache::ignore) { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: cache index out of range")), + css::uno::Reference< css::uno::XInterface >()); + } + return idx; +} + +sal_uInt64 Unmarshal::read64() { + check(8); + sal_uInt64 n = static_cast< sal_uInt64 >(*data_++) << 56; + n |= static_cast< sal_uInt64 >(*data_++) << 48; + n |= static_cast< sal_uInt64 >(*data_++) << 40; + n |= static_cast< sal_uInt64 >(*data_++) << 32; + n |= static_cast< sal_uInt64 >(*data_++) << 24; + n |= static_cast< sal_uInt64 >(*data_++) << 16; + n |= static_cast< sal_uInt64 >(*data_++) << 8; + return n | *data_++; +} + +rtl::OUString Unmarshal::readString() { + sal_uInt32 n = readCompressed(); + if (n > SAL_MAX_INT32) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: string size too large")), + css::uno::Reference< css::uno::XInterface >()); + } + check(static_cast< sal_Int32 >(n)); + rtl::OUString s; + if (!rtl_convertStringToUString( + &s.pData, reinterpret_cast< char const * >(data_), + static_cast< sal_Int32 >(n), RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) + { + throw css::io::IOException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: string does not contain UTF-8")), + css::uno::Reference< css::uno::XInterface >()); + } + data_ += n; + return s; +} + +BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) { + OSL_ASSERT( + type.is() && type.get()->eTypeClass == typelib_TypeClass_SEQUENCE); + sal_uInt32 n = readCompressed(); + if (n > SAL_MAX_INT32) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: sequence size too large")), + css::uno::Reference< css::uno::XInterface >()); + } + if (n == 0) { + return BinaryAny(type, 0); + } + css::uno::TypeDescription ctd( + reinterpret_cast< typelib_IndirectTypeDescription * >( + type.get())->pType); + if (ctd.get()->eTypeClass == typelib_TypeClass_BYTE) { + check(static_cast< sal_Int32 >(n)); + rtl::ByteSequence s( + reinterpret_cast< sal_Int8 const * >(data_), + static_cast< sal_Int32 >(n)); + data_ += n; + sal_Sequence * p = s.getHandle(); + return BinaryAny(type, &p); + } + std::vector< BinaryAny > as; + for (sal_uInt32 i = 0; i != n; ++i) { + as.push_back(readValue(ctd)); + } + OSL_ASSERT(ctd.get()->nSize >= 0); + sal_uInt64 size = static_cast< sal_uInt64 >(n) * + static_cast< sal_uInt64 >(ctd.get()->nSize); + // sal_uInt32 * sal_Int32 -> sal_uInt64 cannot overflow + if (size > SAL_MAX_SIZE - SAL_SEQUENCE_HEADER_SIZE) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "binaryurp::Unmarshal: sequence size too large")), + css::uno::Reference< css::uno::XInterface >()); + } + void * buf = allocate( + SAL_SEQUENCE_HEADER_SIZE + static_cast< sal_Size >(size)); + static_cast< sal_Sequence * >(buf)->nRefCount = 0; + static_cast< sal_Sequence * >(buf)->nElements = + static_cast< sal_Int32 >(n); + for (sal_uInt32 i = 0; i != n; ++i) { + uno_copyData( + static_cast< sal_Sequence * >(buf)->elements + i * ctd.get()->nSize, + const_cast< void * >(as[i].getValue(ctd)), ctd.get(), 0); + } + return BinaryAny(type, reinterpret_cast< sal_Sequence ** >(&buf)); +} + +void Unmarshal::readMemberValues( + css::uno::TypeDescription const & type, std::vector< BinaryAny > * values) +{ + OSL_ASSERT( + type.is() && + (type.get()->eTypeClass == typelib_TypeClass_STRUCT || + type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) && + values != 0); + type.makeComplete(); + typelib_CompoundTypeDescription * ctd = + reinterpret_cast< typelib_CompoundTypeDescription * >(type.get()); + if (ctd->pBaseTypeDescription != 0) { + readMemberValues( + css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase), + values); + } + for (sal_Int32 i = 0; i != ctd->nMembers; ++i) { + values->push_back( + readValue(css::uno::TypeDescription(ctd->ppTypeRefs[i]))); + } +} + +} diff --git a/binaryurp/source/unmarshal.hxx b/binaryurp/source/unmarshal.hxx new file mode 100644 index 000000000..33a4aafec --- /dev/null +++ b/binaryurp/source/unmarshal.hxx @@ -0,0 +1,106 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_UNMARSHAL_HXX +#define INCLUDED_BINARYURP_SOURCE_UNMARSHAL_HXX + +#include "sal/config.h" + +#include <vector> + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "rtl/ref.hxx" +#include "sal/types.h" +#include "typelib/typedescription.hxx" + +namespace binaryurp { + class BinaryAny; + class Bridge; + struct ReaderState; +} +namespace com { namespace sun { namespace star { namespace uno { + class TypeDescription; +} } } } +namespace rtl { + class ByteSequecne; + class OUString; +} + +namespace binaryurp { + +class Unmarshal: private boost::noncopyable { +public: + Unmarshal( + rtl::Reference< Bridge > const & bridge, ReaderState & state, + com::sun::star::uno::Sequence< sal_Int8 > const & buffer); + + ~Unmarshal(); + + sal_uInt8 read8(); + + sal_uInt16 read16(); + + sal_uInt32 read32(); + + com::sun::star::uno::TypeDescription readType(); + + rtl::OUString readOid(); + + rtl::ByteSequence readTid(); + + BinaryAny readValue(com::sun::star::uno::TypeDescription const & type); + + void done() const; + +private: + void check(sal_Int32 size) const; + + sal_uInt32 readCompressed(); + + sal_uInt16 readCacheIndex(); + + sal_uInt64 read64(); + + rtl::OUString readString(); + + BinaryAny readSequence(com::sun::star::uno::TypeDescription const & type); + + void readMemberValues( + com::sun::star::uno::TypeDescription const & type, + std::vector< BinaryAny > * values); + + rtl::Reference< Bridge > bridge_; + ReaderState & state_; + com::sun::star::uno::Sequence< sal_Int8 > buffer_; + sal_uInt8 const * data_; + sal_uInt8 const * end_; +}; + +} + +#endif diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx new file mode 100755 index 000000000..97a60157e --- /dev/null +++ b/binaryurp/source/writer.cxx @@ -0,0 +1,476 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 "sal/config.h" + +#include <exception> +#include <vector> + +#include "com/sun/star/connection/XConnection.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/uno/XCurrentContext.hpp" +#include "cppuhelper/exc_hlp.hxx" +#include "osl/mutex.hxx" +#include "rtl/memory.h" +#include "uno/dispatcher.hxx" + +#include "binaryany.hxx" +#include "bridge.hxx" +#include "currentcontext.hxx" +#include "specialfunctionids.hxx" +#include "writer.hxx" + +namespace binaryurp { + +namespace { + +namespace css = com::sun::star; + +bool isProtocolPropertyMessage(rtl::OUString const & oid) { + return oid.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("UrpProtocolProperties")); +} + +} + +Writer::Item::Item() {} + +Writer::Item::Item( + rtl::ByteSequence const & theTid, rtl::OUString const & theOid, + css::uno::TypeDescription const & theType, + css::uno::TypeDescription const & theMember, + std::vector< BinaryAny > const & inArguments, + css::uno::UnoInterfaceReference const & theCurrentContext): + request(true), tid(theTid), oid(theOid), type(theType), member(theMember), + arguments(inArguments), currentContext(theCurrentContext) +{} + +Writer::Item::Item( + rtl::ByteSequence const & theTid, + css::uno::TypeDescription const & theMember, bool theSetter, + bool theException, BinaryAny const & theReturnValue, + std::vector< BinaryAny > const & outArguments, + bool theSetCurrentContextMode): + request(false), tid(theTid), member(theMember), setter(theSetter), + arguments(outArguments), exception(theException), + returnValue(theReturnValue), setCurrentContextMode(theSetCurrentContextMode) +{} + +Writer::Writer(rtl::Reference< Bridge > const & bridge): + bridge_(bridge), marshal_(bridge, state_), stop_(false) +{ + OSL_ASSERT(bridge.is()); + acquire(); +} + +void Writer::sendDirectRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + css::uno::TypeDescription const & type, + css::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments) +{ + OSL_ASSERT(!unblocked_.check()); + sendRequest( + tid, oid, type, member, inArguments, false, + css::uno::UnoInterfaceReference()); +} + +void Writer::sendDirectReply( + rtl::ByteSequence const & tid, css::uno::TypeDescription const & member, + bool exception, BinaryAny const & returnValue, + std::vector< BinaryAny > const & outArguments) +{ + OSL_ASSERT(!unblocked_.check()); + sendReply(tid, member, false, exception, returnValue,outArguments); +} + +void Writer::queueRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + css::uno::TypeDescription const & type, + css::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments) +{ + css::uno::UnoInterfaceReference cc(current_context::get()); + osl::MutexGuard g(mutex_); + queue_.push_back(Item(tid, oid, type, member, inArguments, cc)); + items_.set(); +} + +void Writer::queueReply( + rtl::ByteSequence const & tid, + com::sun::star::uno::TypeDescription const & member, bool setter, + bool exception, BinaryAny const & returnValue, + std::vector< BinaryAny > const & outArguments, bool setCurrentContextMode) +{ + osl::MutexGuard g(mutex_); + queue_.push_back( + Item( + tid, member, setter, exception, returnValue, outArguments, + setCurrentContextMode)); + items_.set(); +} + +void Writer::unblock() { + // Assumes that osl::Condition::set works as a memory barrier, so that + // changes made by preceeding sendDirectRequest/Reply calls are visible to + // subsequent sendRequest/Reply calls: + unblocked_.set(); +} + +void Writer::stop() { + { + osl::MutexGuard g(mutex_); + stop_ = true; + } + unblocked_.set(); + items_.set(); +} + +Writer::~Writer() {} + +void Writer::run() { + setName("binaryurpWriter"); + try { + unblocked_.wait(); + for (;;) { + items_.wait(); + Item item; + { + osl::MutexGuard g(mutex_); + if (stop_) { + return; + } + OSL_ASSERT(!queue_.empty()); + item = queue_.front(); + queue_.pop_front(); + if (queue_.empty()) { + items_.reset(); + } + } + if (item.request) { + sendRequest( + item.tid, item.oid, item.type, item.member, item.arguments, + (!item.oid.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("UrpProtocolProperties")) && + !item.member.equals( + css::uno::TypeDescription( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.uno.XInterface::" + "release")))) && + bridge_->isCurrentContextMode()), + item.currentContext); + } else { + sendReply( + item.tid, item.member, item.setter, item.exception, + item.returnValue, item.arguments); + if (item.setCurrentContextMode) { + bridge_->setCurrentContextMode(); + } + } + } + } catch (css::uno::Exception & e) { + OSL_TRACE( + OSL_LOG_PREFIX "caught UNO exception '%s'", + rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); + } catch (std::exception & e) { + OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what()); + } + bridge_->terminate(); +} + +void Writer::onTerminated() { + release(); +} + +void Writer::sendRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + css::uno::TypeDescription const & type, + css::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments, bool currentContextMode, + css::uno::UnoInterfaceReference const & currentContext) +{ + OSL_ASSERT(tid.getLength() != 0 && oid.getLength() != 0 && member.is()); + css::uno::TypeDescription t(type); + sal_Int32 functionId = 0; + bool forceSynchronous = false; + member.makeComplete(); + switch (member.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + { + typelib_InterfaceAttributeTypeDescription * atd = + reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( + member.get()); + OSL_ASSERT(atd->pInterface != 0); + if (!t.is()) { + t = css::uno::TypeDescription(&atd->pInterface->aBase); + } + t.makeComplete(); + functionId = atd->pInterface->pMapMemberIndexToFunctionIndex[ + atd->aBase.nPosition]; + if (!inArguments.empty()) { // setter + ++functionId; + } + break; + } + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( + member.get()); + OSL_ASSERT(mtd->pInterface != 0); + if (!t.is()) { + t = css::uno::TypeDescription(&mtd->pInterface->aBase); + } + t.makeComplete(); + functionId = mtd->pInterface->pMapMemberIndexToFunctionIndex[ + mtd->aBase.nPosition]; + forceSynchronous = mtd->bOneWay && + functionId != SPECIAL_FUNCTION_ID_RELEASE; + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + OSL_ASSERT(functionId >= 0); + if (functionId > SAL_MAX_UINT16) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("function ID too large for URP")), + css::uno::Reference< css::uno::XInterface >()); + } + std::vector< unsigned char > buf; + bool newType = !(lastType_.is() && t.equals(lastType_)); + bool newOid = oid != lastOid_; + bool newTid = tid != lastTid_; + if (newType || newOid || newTid || forceSynchronous || functionId > 0x3FFF) + // > 14 bit function ID + { + Marshal::write8( + &buf, + (0xC0 | (newType ? 0x20 : 0) | (newOid ? 0x10 : 0) | + (newTid ? 0x08 : 0) | (functionId > 0xFF ? 0x04 : 0) | + (forceSynchronous ? 0x01 : 0))); + // bit 7: LONGHEADER, bit 6: REQUEST, bit 5: NEWTYPE, bit 4: NEWOID, + // bit 3: NEWTID, bit 2: FUNCTIONID16, bit 0: MOREFLAGS + if (forceSynchronous) { + Marshal::write8(&buf, 0xC0); // bit 7: MUSTREPLY, bit 6: SYNCHRONOUS + } + if (functionId <= 0xFF) { + Marshal::write8(&buf, static_cast< sal_uInt8 >(functionId)); + } else { + Marshal::write16(&buf, static_cast< sal_uInt16 >(functionId)); + } + if (newType) { + marshal_.writeType(&buf, t); + } + if (newOid) { + marshal_.writeOid(&buf, oid); + } + if (newTid) { + marshal_.writeTid(&buf, tid); + } + } else if (functionId <= 0x3F) { // <= 6 bit function ID + Marshal::write8(&buf, static_cast< sal_uInt8 >(functionId)); + // bit 7: !LONGHEADER, bit 6: !FUNCTIONID14 + } else { + Marshal::write8( + &buf, static_cast< sal_uInt8 >(0x40 | (functionId >> 8))); + // bit 7: !LONGHEADER, bit 6: FUNCTIONID14 + Marshal::write8(&buf, functionId & 0xFF); + } + if (currentContextMode) { + css::uno::UnoInterfaceReference cc(currentContext); + marshal_.writeValue( + &buf, + css::uno::TypeDescription( + cppu::UnoType< + css::uno::Reference< css::uno::XCurrentContext > >::get()), + BinaryAny( + css::uno::TypeDescription( + cppu::UnoType< + css::uno::Reference< + css::uno::XCurrentContext > >::get()), + &cc.m_pUnoI)); + } + switch (member.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + if (!inArguments.empty()) { // setter + OSL_ASSERT(inArguments.size() == 1); + marshal_.writeValue( + &buf, + css::uno::TypeDescription( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + member.get())-> + pAttributeTypeRef), + inArguments.front()); + } + break; + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( + member.get()); + std::vector< BinaryAny >::const_iterator i(inArguments.begin()); + for (sal_Int32 j = 0; j != mtd->nParams; ++j) { + if (mtd->pParams[j].bIn) { + marshal_.writeValue( + &buf, + css::uno::TypeDescription(mtd->pParams[j].pTypeRef), + *i++); + } + } + OSL_ASSERT(i == inArguments.end()); + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + sendMessage(buf); + lastType_ = t; + lastOid_ = oid; + lastTid_ = tid; +} + +void Writer::sendReply( + rtl::ByteSequence const & tid, + com::sun::star::uno::TypeDescription const & member, bool setter, + bool exception, BinaryAny const & returnValue, + std::vector< BinaryAny > const & outArguments) +{ + OSL_ASSERT(tid.getLength() != 0 && member.is() && member.get()->bComplete); + std::vector< unsigned char > buf; + bool newTid = tid != lastTid_; + Marshal::write8(&buf, 0x80 | (exception ? 0x20 : 0) | (newTid ? 0x08 : 0)); + // bit 7: LONGHEADER; bit 6: !REQUEST; bit 5: EXCEPTION; bit 3: NEWTID + if (newTid) { + marshal_.writeTid(&buf, tid); + } + if (exception) { + marshal_.writeValue( + &buf, + css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()), + returnValue); + } else { + switch (member.get()->eTypeClass) { + case typelib_TypeClass_INTERFACE_ATTRIBUTE: + if (!setter) { + marshal_.writeValue( + &buf, + css::uno::TypeDescription( + reinterpret_cast< + typelib_InterfaceAttributeTypeDescription * >( + member.get())-> + pAttributeTypeRef), + returnValue); + } + break; + case typelib_TypeClass_INTERFACE_METHOD: + { + typelib_InterfaceMethodTypeDescription * mtd = + reinterpret_cast< + typelib_InterfaceMethodTypeDescription * >( + member.get()); + marshal_.writeValue( + &buf, css::uno::TypeDescription(mtd->pReturnTypeRef), + returnValue); + std::vector< BinaryAny >::const_iterator i( + outArguments.begin()); + for (sal_Int32 j = 0; j != mtd->nParams; ++j) { + if (mtd->pParams[j].bOut) { + marshal_.writeValue( + &buf, + css::uno::TypeDescription(mtd->pParams[j].pTypeRef), + *i++); + } + } + OSL_ASSERT(i == outArguments.end()); + break; + } + default: + OSL_ASSERT(false); // this cannot happen + break; + } + } + sendMessage(buf); + lastTid_ = tid; + bridge_->decrementCalls(); +} + +void Writer::sendMessage(std::vector< unsigned char > const & buffer) { + std::vector< unsigned char > header; + if (buffer.size() > SAL_MAX_UINT32) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("message too large for URP")), + css::uno::Reference< css::uno::XInterface >()); + } + Marshal::write32(&header, static_cast< sal_uInt32 >(buffer.size())); + Marshal::write32(&header, 1); + OSL_ASSERT(!buffer.empty()); + unsigned char const * p = &buffer[0]; + std::vector< unsigned char >::size_type n = buffer.size(); + OSL_ASSERT(header.size() <= SAL_MAX_INT32 && SAL_MAX_INT32 <= SAL_MAX_SIZE); + sal_Size k = SAL_MAX_INT32 - header.size(); + if (n < k) { + k = static_cast< sal_Size >(n); + } + css::uno::Sequence< sal_Int8 > s( + static_cast< sal_Int32 >(header.size() + k)); + OSL_ASSERT(!header.empty()); + rtl_copyMemory( + s.getArray(), &header[0], static_cast< sal_Size >(header.size())); + for (;;) { + rtl_copyMemory(s.getArray() + s.getLength() - k, p, k); + try { + bridge_->getConnection()->write(s); + } catch (css::io::IOException & e) { + css::uno::Any exc(cppu::getCaughtException()); + throw css::lang::WrappedTargetRuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "Binary URP write raised IO exception: ")) + + e.Message), + css::uno::Reference< css::uno::XInterface >(), exc); + } + n = static_cast< std::vector< unsigned char >::size_type >(n - k); + if (n == 0) { + break; + } + p += k; + k = SAL_MAX_INT32; + if (n < k) { + k = static_cast< sal_Size >(n); + } + s.realloc(k); + } +} + +} diff --git a/binaryurp/source/writer.hxx b/binaryurp/source/writer.hxx new file mode 100644 index 000000000..fe5dba2cc --- /dev/null +++ b/binaryurp/source/writer.hxx @@ -0,0 +1,185 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_WRITER_HXX +#define INCLUDED_BINARYURP_SOURCE_WRITER_HXX + +#include "sal/config.h" + +#include <cstddef> +#include <deque> +#include <vector> + +#include "boost/noncopyable.hpp" +#include "osl/conditn.hxx" +#include "osl/mutex.hxx" +#include "osl/thread.hxx" +#include "rtl/byteseq.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "salhelper/simplereferenceobject.hxx" +#include "typelib/typedescription.hxx" +#include "uno/dispatcher.hxx" + +#include "binaryany.hxx" +#include "marshal.hxx" +#include "writerstate.hxx" + +namespace binaryurp { class Bridge; } + +namespace binaryurp { + +class Writer: + public osl::Thread, public salhelper::SimpleReferenceObject, + private boost::noncopyable +{ +public: + static void * operator new(std::size_t size) + { return Thread::operator new(size); } + + static void operator delete(void * pointer) + { Thread::operator delete(pointer); } + + explicit Writer(rtl::Reference< Bridge > const & bridge); + + // Only called from Bridge::reader_ thread, and only before Bridge::writer_ + // thread is unblocked: + void sendDirectRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type, + com::sun::star::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments); + + // Only called from Bridge::reader_ thread, and only before Bridge::writer_ + // thread is unblocked: + void sendDirectReply( + rtl::ByteSequence const & tid, + com::sun::star::uno::TypeDescription const & member, + bool exception, BinaryAny const & returnValue, + std::vector< BinaryAny > const & outArguments); + + void queueRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type, + com::sun::star::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments); + + void queueReply( + rtl::ByteSequence const & tid, + com::sun::star::uno::TypeDescription const & member, bool setter, + bool exception, BinaryAny const & returnValue, + std::vector< BinaryAny > const & outArguments, + bool setCurrentContextMode); + + void unblock(); + + void stop(); + +private: + virtual ~Writer(); + + virtual void SAL_CALL run(); + + virtual void SAL_CALL onTerminated(); + + void sendRequest( + rtl::ByteSequence const & tid, rtl::OUString const & oid, + com::sun::star::uno::TypeDescription const & type, + com::sun::star::uno::TypeDescription const & member, + std::vector< BinaryAny > const & inArguments, bool currentContextMode, + com::sun::star::uno::UnoInterfaceReference const & currentContext); + + void sendReply( + rtl::ByteSequence const & tid, + com::sun::star::uno::TypeDescription const & member, bool setter, + bool exception, BinaryAny const & returnValue, + std::vector< BinaryAny > const & outArguments); + + void sendMessage(std::vector< unsigned char > const & buffer); + + struct Item { + Item(); + + // Request: + Item( + rtl::ByteSequence const & theTid, rtl::OUString const & theOid, + com::sun::star::uno::TypeDescription const & theType, + com::sun::star::uno::TypeDescription const & theMember, + std::vector< BinaryAny > const & inArguments, + com::sun::star::uno::UnoInterfaceReference const & + theCurrentContext); + + // Reply: + Item( + rtl::ByteSequence const & theTid, + com::sun::star::uno::TypeDescription const & theMember, + bool theSetter, bool theException, BinaryAny const & theReturnValue, + std::vector< BinaryAny > const & outArguments, + bool theSetCurrentContextMode); + + bool request; + + rtl::ByteSequence tid; // request + reply + + rtl::OUString oid; // request + + com::sun::star::uno::TypeDescription type; // request + + com::sun::star::uno::TypeDescription member; // request + reply + + bool setter; // reply + + std::vector< BinaryAny > arguments; + // request: inArguments; reply: outArguments + + bool exception; // reply + + BinaryAny returnValue; // reply + + com::sun::star::uno::UnoInterfaceReference currentContext; // request + + bool setCurrentContextMode; // reply + }; + + rtl::Reference< Bridge > bridge_; + WriterState state_; + Marshal marshal_; + com::sun::star::uno::TypeDescription lastType_; + rtl::OUString lastOid_; + rtl::ByteSequence lastTid_; + osl::Condition unblocked_; + osl::Condition items_; + + osl::Mutex mutex_; + std::deque< Item > queue_; + bool stop_; +}; + +} + +#endif diff --git a/binaryurp/source/writerstate.hxx b/binaryurp/source/writerstate.hxx new file mode 100644 index 000000000..cbb0208ba --- /dev/null +++ b/binaryurp/source/writerstate.hxx @@ -0,0 +1,55 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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_BINARYURP_SOURCE_WRITERSTATE_HXX +#define INCLUDED_BINARYURP_SOURCE_WRITERSTATE_HXX + +#include "sal/config.h" + +#include "boost/noncopyable.hpp" +#include "rtl/byteseq.hxx" +#include "rtl/ustring.hxx" +#include "typelib/typedescription.hxx" + +#include "cache.hxx" + +namespace binaryurp { + +struct WriterState: private boost::noncopyable { + WriterState(): + typeCache(cache::size), oidCache(cache::size), tidCache(cache::size) {} + + Cache< com::sun::star::uno::TypeDescription > typeCache; + + Cache< rtl::OUString > oidCache; + + Cache< rtl::ByteSequence > tidCache; +}; + +} + +#endif diff --git a/bridges/inc/bridges/remote/bridgeimpl.hxx b/bridges/inc/bridges/remote/bridgeimpl.hxx deleted file mode 100644 index 511819d20..000000000 --- a/bridges/inc/bridges/remote/bridgeimpl.hxx +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_BRIDGEIMPL_HXX_ -#define _BRIDGES_REMOTE_BRIDGEIMPL_HXX_ -#include <osl/interlck.h> - -#include <uno/environment.h> - -#include <bridges/remote/context.h> -#include <bridges/remote/remote.h> - - -struct remote_BridgeImpl -{ - void (SAL_CALL * m_allThreadsAreGone ) ( uno_Environment * ); - requestClientSideDispatcher m_sendRequest; - oslInterlockedCount m_nRemoteThreads; - sal_Bool m_bDisposed; - sal_Bool m_bReleaseStubsCalled; -}; - -namespace bridges_remote { - - enum RemoteThreadCounter_HoldEnvWeak - { - RTC_HOLDENVWEAK = 0x1 - }; - - class RemoteThreadCounter - { - public: - // performance optimization. In some cases, it is not necessary to acquire the - // environment. - RemoteThreadCounter( uno_Environment *pEnvRemote, RemoteThreadCounter_HoldEnvWeak ) - : m_bReleaseEnvironment( sal_False ) - , m_pEnvRemote( pEnvRemote ) - { - remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext ); - osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) ); - } - - RemoteThreadCounter( uno_Environment *pEnvRemote ) - : m_bReleaseEnvironment( sal_True ) - , m_pEnvRemote( pEnvRemote ) - { - m_pEnvRemote->acquire( m_pEnvRemote ); - - remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext ); - osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) ); - } - - ~RemoteThreadCounter( ) - { - remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext ); - if( 0 == osl_decrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads)) && - pContext->m_pBridgeImpl->m_bDisposed && - ! pContext->m_pBridgeImpl->m_bReleaseStubsCalled ) - { - pContext->m_pBridgeImpl->m_allThreadsAreGone( m_pEnvRemote ); - } - if( m_bReleaseEnvironment ) - m_pEnvRemote->release( m_pEnvRemote ); - } - - sal_Bool m_bReleaseEnvironment; - uno_Environment *m_pEnvRemote; - }; -} - -#endif diff --git a/bridges/inc/bridges/remote/connection.h b/bridges/inc/bridges/remote/connection.h deleted file mode 100644 index 8aab73900..000000000 --- a/bridges/inc/bridges/remote/connection.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_CONNECTION_H_ -#define _BRIDGES_REMOTE_CONNECTION_H_ -#include <sal/types.h> - -/** Specfies a C-interface for a bidirectional bytestream, - which is used by a UNO remote environment. - */ -struct remote_Connection -{ - void ( SAL_CALL * acquire ) ( remote_Connection *); - - void ( SAL_CALL * release ) ( remote_Connection *); - - /** - reads nSize bytes from the connection. This method blocks, until - all bytes are available or an error occurs. - @return Number of bytes read. - If the return value is less than nSize, an unrecoverable - i/o error has occured or the connection was closed. - - */ - sal_Int32 (SAL_CALL * read)(remote_Connection *, sal_Int8 *pDest, sal_Int32 nSize ); - - /** - @return Number of bytes written. - if the return value is less than nSize an unrecoverable - i/o error has occured or the connection was closed. - */ - sal_Int32 (SAL_CALL * write)(remote_Connection *, const sal_Int8 *pSource, sal_Int32 nSize ); - - void ( SAL_CALL * flush ) ( remote_Connection * ); - - /** closes the connection. - Any read or write operation after this call shall not be served - anymore. Any ongoing read or write operation must return immeadiatly after this call. - The implementation should cope with multiple calls to this method. - */ - void (SAL_CALL * close) ( remote_Connection * ); -}; - -#endif diff --git a/bridges/inc/bridges/remote/context.h b/bridges/inc/bridges/remote/context.h deleted file mode 100644 index b1d1b4eda..000000000 --- a/bridges/inc/bridges/remote/context.h +++ /dev/null @@ -1,260 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BRIDGES_REMOTE_CONTEXT_H_ -#define _BRIDGES_REMOTE_CONTEXT_H_ -#include <osl/interlck.h> -#include <osl/conditn.h> - -#include <typelib/typedescription.h> - -#include <uno/environment.h> -#include <uno/any2.h> - - -/** Interface for refcounted contexts of uno-environments. - - Not all uno_Contexts need to be refcounted, in case they are, - they should be 'derived' from this struct. - This is used as a base class for the remote_Context. - @see uno_Environment - @see uno_getEnvironment() - @see remote_Context - */ -struct uno_Context -{ - /** increase the refcount of the context - */ - void (SAL_CALL * acquire)( uno_Context *pContext ); - - /** decrements the recount of the context. In case the recount drops to zero, - the context gets destroye. - */ - void (SAL_CALL * release)( uno_Context *pContext); - - /** Allows to query for a different interface of the uno_Context. - The result of the void pointer is unspecified and depends on the concrete context. - */ - void * (SAL_CALL *query ) ( uno_Context *pContext , rtl_uString *pId); -}; - -struct remote_Connection; -struct remote_Context; -struct remote_Interface; - - - -/** performs a query-interface for a certain interface via the remote connection ! - - @param pEnvRemote The environment, that shall perform the call. - @param ppRemoteI in/out parameter contains the interface returned by queryInterface - @param pOid the oid of the 'ghost' object on which the call must be done. - ***/ -typedef void ( SAL_CALL * remote_getInstanceFunc ) ( - uno_Environment *pEnvRemote, - remote_Interface **ppRemoteI, - rtl_uString *pOid, - typelib_TypeDescriptionReference *pInterfaceTypeRef, - uno_Any **ppException ); - - -/** refcounted C-interface, which provides object by name. - */ -struct remote_InstanceProvider -{ - void (SAL_CALL * acquire ) ( remote_InstanceProvider * pProvider ); - void (SAL_CALL * release ) ( remote_InstanceProvider * pProvider ); - void (SAL_CALL * getInstance ) ( remote_InstanceProvider * pProvider , - uno_Environment *pEnvRemote, - remote_Interface **ppRemoteI, - rtl_uString *pInstanceName, - typelib_InterfaceTypeDescription *pType, - uno_Any **ppException ); -}; - -/** refcounted C-interface, which allows to register a listener to an - remote bridge to be informed when the bridge gets disposed. - - @see remote_Context - */ -struct remote_DisposingListener -{ - void (SAL_CALL * acquire ) ( remote_DisposingListener * pProvider ); - void (SAL_CALL * release ) ( remote_DisposingListener * pProvider ); - void (SAL_CALL * disposing ) ( remote_DisposingListener * pProvider, - rtl_uString *pBridgeName ); -}; - - -/** - Try to get an existing context characterized by the pIdString. Each ID-String must - uniquely charcterize a certain connection. The context can't be retrieved via this - function anymore, after it got disposed. - - @return 0 when such a context does not exist, otherwise - a pointer to an acquired remote_Context. - **/ -extern "C" remote_Context * SAL_CALL -remote_getContext( rtl_uString *pIdString ); - -/** - Create an acquired remote context. The Context is weakly held by the context administration - and can be accessed later through remote_getContext() (using the same id-string). - - @param pIdString A string, that uniquely describes the connection. For e.g. a socket connection, - host and port of the local and remote host should be in the string. - - @param pDescription - Description of the connection, that may brought up to the user. - - @param pProtocol - The protocol, that the environment uses for - communicating with the remote process. - The format of the protocol string is : "protocolname,para1=para1value,..." - @return 0, when a context with this name already exists. - - @see remote_getContext() - @see remote_Context - */ -extern "C" remote_Context * SAL_CALL -remote_createContext( remote_Connection *pConnection, - rtl_uString *pIdStr, - rtl_uString *pDescription, - rtl_uString *pProtocol, - remote_InstanceProvider *); - -const sal_Int32 REMOTE_CONTEXT_CREATE = 1; -const sal_Int32 REMOTE_CONTEXT_DESTROY = 2; - -typedef void ( SAL_CALL * remote_contextListenerFunc ) ( - void *pThis, - sal_Int32 nRemoteContextMode, - rtl_uString *sName, - rtl_uString *sDescription - ); - -/** Registers a listener at the context administration, which allows to keep - track of existing remote connections. - @param pObject object which is handed to the listener function, when called. - */ -extern "C" void SAL_CALL -remote_addContextListener( remote_contextListenerFunc listener, void *pObject ); - - -/** Removes a listener from the context administration. - */ -extern "C" void SAL_CALL -remote_removeContextListener( remote_contextListenerFunc listener , void *pObject ); - -/** Allows to retrieve all existing context strings. - - @param pnStringCount out parameter. Contains the number of rtl_uStrings in the array - @param memAlloc a memory allocation function for the array of pointers to rtl_uStrings - - @return array of rtl strings. The caller must call release on all rtl_uString s and must free - the pointer array. - */ -extern "C" rtl_uString ** SAL_CALL -remote_getContextList( - sal_Int32 *pnStringCount, - void * ( SAL_CALL * memAlloc ) ( sal_Size nBytesToAlloc ) ); - - -struct remote_BridgeImpl; - -/** The context structure for a remote bridge. - - @see uno_getEnvironment() - */ -struct remote_Context -{ - struct uno_Context aBase; - - /** - These methods are implemented by context administration - */ - void ( SAL_CALL * addDisposingListener ) ( remote_Context *, - remote_DisposingListener * ); - void ( SAL_CALL * removeDisposingListener ) ( remote_Context *, - remote_DisposingListener * ); - /** - will be called by the environment when it gets disposed - */ - void ( SAL_CALL * dispose ) ( remote_Context * ); - - /** The method is set by the remote-environment during environment initialization. - @see remote_getInstanceFunc - */ - remote_getInstanceFunc getRemoteInstance; - - /** - The protocol, that the environment uses for communicating with the remote process. - The format of the protocol string is : "protocolname,para1=para1value,..." - The parameters are protocol dependend - */ - rtl_uString *m_pProtocol; - - /** - It may be the same as m_pName. - Livetime is handled by the context administration. - */ - rtl_uString *m_pDescription; - - /** - The name of this context at context administration. - A string, that uniquely describes this environment. - Livetime is handled by the context administration. - */ - rtl_uString *m_pName; - - /** The instance-provider, which is used to look up unknown object identifiers. - Is usually called on server side, when the first client request comes in. - Maybe 0. Livetime is handled by the context administration. - */ - remote_InstanceProvider *m_pInstanceProvider; - - /** - The connection of this context. - Livetime is handled by the context administration. - */ - remote_Connection *m_pConnection; - - /** - Here arbitrary data may be stored. It may be used by a connection - service to store environment specific data. The bridge does not - use it. - */ - void *m_pAdditionalInformation; - - /** - here the bridge stores its private per environment data. - */ - struct remote_BridgeImpl *m_pBridgeImpl; -}; - -#endif - diff --git a/bridges/inc/bridges/remote/counter.hxx b/bridges/inc/bridges/remote/counter.hxx deleted file mode 100644 index 48b011e42..000000000 --- a/bridges/inc/bridges/remote/counter.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_COUNTER_H_ -#define _BRIDGES_REMOTE_COUNTER_H_ -#include <stdio.h> -#if OSL_DEBUG_LEVEL > 1 -struct MyCounter -{ - MyCounter( sal_Char const *pName ) : - m_nCounter( 0 ), - m_pName ( pName ) - { - } - ~MyCounter() - { - if( m_nCounter ) { - printf( - "%s : %ld left\n", m_pName, - sal::static_int_cast< long >(m_nCounter) ); - } - } - void acquire() - { m_nCounter ++; } - void release() - { m_nCounter --; } - - - sal_Int32 m_nCounter; - sal_Char const *m_pName; -}; -#endif - -#endif diff --git a/bridges/inc/bridges/remote/helper.hxx b/bridges/inc/bridges/remote/helper.hxx deleted file mode 100644 index dd90f9065..000000000 --- a/bridges/inc/bridges/remote/helper.hxx +++ /dev/null @@ -1,68 +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 <bridges/remote/bridgeimpl.hxx> - -typedef void ( SAL_CALL * ReleaseRemoteCallbackFunc ) ( - remote_Interface *ppRemoteI, - rtl_uString *pOid, - typelib_TypeDescriptionReference *pTypeRef, - uno_Environment *pEnvRemote - ); - -typedef void ( SAL_CALL * remote_createStubFunc ) ( - remote_Interface **ppRemoteI, - rtl_uString *pOid , - typelib_TypeDescriptionReference *pTypeRef, - uno_Environment *pEnvRemote, - ReleaseRemoteCallbackFunc callback - ); -namespace bridges_remote -{ - - /** @param callback If the bridge implementation wants to handle the remote release call, - it can do it giving this callback. If callback == 0, the releaseRemote - method of the stub is called. - */ - void SAL_CALL remote_createStub ( - remote_Interface **ppRemoteI, - rtl_uString *pOid , - typelib_TypeDescriptionReference *pType, - uno_Environment *pEnvRemote, - ReleaseRemoteCallbackFunc callback ); - - void SAL_CALL remote_retrieveOidFromProxy( - remote_Interface *pRemtoeI, - rtl_uString **ppOid ); - - void SAL_CALL remote_sendQueryInterface( - uno_Environment *pEnvRemote, - remote_Interface **ppRemoteI, - rtl_uString *pOid , - typelib_TypeDescriptionReference *pType, - uno_Any **ppException - ); -} diff --git a/bridges/inc/bridges/remote/mapping.hxx b/bridges/inc/bridges/remote/mapping.hxx deleted file mode 100644 index 6e3858890..000000000 --- a/bridges/inc/bridges/remote/mapping.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_MAPPING_HXX_ -#define _BRIDGES_REMOTE_MAPPING_HXX_ - -#include <osl/interlck.h> -#include <rtl/ustring.hxx> - -#include <typelib/typedescription.h> - -#include <bridges/remote/remote.h> - -typedef struct _uno_Environment uno_Environment; - -namespace bridges_remote -{ - extern "C" typedef void SAL_CALL RemoteToUno( - uno_Mapping *pMapping, void **ppOut, void *pInterface, - typelib_InterfaceTypeDescription *pInterfaceTypeDescr ); - RemoteToUno remoteToUno; - - extern "C" typedef void SAL_CALL UnoToRemote( - uno_Mapping *pMapping, void **ppOut, void *pInterface, - typelib_InterfaceTypeDescription *pInterfaceTypeDescr ); - UnoToRemote unoToRemote; - - extern "C" typedef void SAL_CALL FreeRemoteMapping(uno_Mapping * mapping); - FreeRemoteMapping freeRemoteMapping; - - class RemoteMapping : - public remote_Mapping - { - public: - RemoteMapping( uno_Environment *pEnvUno , - uno_Environment *pEnvRemote, - uno_MapInterfaceFunc func , - const ::rtl::OUString sPurpose); - ~RemoteMapping(); - - oslInterlockedCount m_nRef; - ::rtl::OUString m_sPurpose; - }; - -} -#endif diff --git a/bridges/inc/bridges/remote/proxy.hxx b/bridges/inc/bridges/remote/proxy.hxx deleted file mode 100644 index 17c4d682a..000000000 --- a/bridges/inc/bridges/remote/proxy.hxx +++ /dev/null @@ -1,91 +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 <osl/interlck.h> - -#include <uno/environment.h> -#include <uno/dispatcher.h> -#include <uno/mapping.hxx> - -#include <bridges/remote/remote.h> - -namespace bridges_remote { - -extern "C" typedef void SAL_CALL FreeRemote2UnoProxy( - uno_ExtEnvironment * environment, void * proxy); -FreeRemote2UnoProxy freeRemote2UnoProxy; - -// private: -extern "C" typedef void SAL_CALL AcquireRemote2UnoProxy(uno_Interface *); -AcquireRemote2UnoProxy acquireRemote2UnoProxy; - -// private: -extern "C" typedef void SAL_CALL ReleaseRemote2UnoProxy(uno_Interface *); -ReleaseRemote2UnoProxy releaseRemote2UnoProxy; - -// private: -extern "C" typedef void SAL_CALL DispatchRemote2UnoProxy( - uno_Interface *, typelib_TypeDescription const *, void *, void **, - uno_Any **); -DispatchRemote2UnoProxy dispatchRemote2UnoProxy; - -extern "C" void SAL_CALL remote_release( void * ); - -class Remote2UnoProxy : - public uno_Interface -{ -public: - Remote2UnoProxy( - remote_Interface *pRemoteI, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pType , - uno_Environment *pEnvUno, - uno_Environment *pEnvRemote - ); - - ~Remote2UnoProxy(); - -private: - ::rtl::OUString m_sOid; - typelib_InterfaceTypeDescription *m_pType; - remote_Interface *m_pRemoteI; - uno_Environment *m_pEnvUno; - uno_Environment *m_pEnvRemote; - ::com::sun::star::uno::Mapping m_mapRemote2Uno; - ::com::sun::star::uno::Mapping m_mapUno2Remote; - - oslInterlockedCount m_nRef; - - friend void SAL_CALL acquireRemote2UnoProxy(uno_Interface *); - - friend void SAL_CALL releaseRemote2UnoProxy(uno_Interface *); - - friend void SAL_CALL dispatchRemote2UnoProxy( - uno_Interface *, typelib_TypeDescription const *, void *, void **, - uno_Any **); -}; - -} diff --git a/bridges/inc/bridges/remote/remote.h b/bridges/inc/bridges/remote/remote.h deleted file mode 100644 index 51773de01..000000000 --- a/bridges/inc/bridges/remote/remote.h +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_REMOTE_H -#define _BRIDGES_REMOTE_REMOTE_H -#include <uno/mapping.h> -#include <uno/any2.h> - -#include <typelib/typedescription.h> -#include <uno/environment.h> - -#define CORBA_STRING8_NAME "com.sun.star.corba.CorbaString8" -#define CORBA_STRING8_NAME_LENGTH (sizeof(CORBA_STRING8_NAME)-1) - -#define CORBA_UNION_NAME "com.sun.star.corba.CorbaUnion" -#define CORBA_UNION_NAME_LENGTH (sizeof(CORBA_UNION_NAME)-1) - -#define REMOTE_MARSHALED_MSGHDR_SIZE 12 -#define REMOTE_RELEASE_METHOD_INDEX 2 -#define REMOTE_RELEASE_METHOD_NAME "release" - -#define CURRENT_IIOP_PROTOCOL_MAJOR 1 -#define CURRENT_IIOP_PROTOCOL_MINOR 2 - -extern "C" { - -struct remote_Interface; - -/** @internal - */ -typedef void (SAL_CALL * remote_DispatchMethod)( - remote_Interface * pRemoteI, typelib_TypeDescription const * pMemberType, - void * pReturn, void * pArgs[], uno_Any ** ppException ); - -/** - @internal - */ -typedef void ( SAL_CALL * requestClientSideDispatcher ) ( - uno_Environment *pEnvRemote, - typelib_TypeDescription const * pMemberType, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pInterfaceType, - void *pReturn, - void *ppArgs[], - uno_Any **ppException ); - -/** The base class of an UNO interface in a remote environment. - */ -struct remote_Interface -{ - void (SAL_CALL * acquire)( remote_Interface * pInterface ); - - void (SAL_CALL * release)( remote_Interface * pInterface ); - - remote_DispatchMethod pDispatcher; -}; - -/** The mapping between an binary-c-uno and a remote environment. - @internal - */ -struct remote_Mapping -{ - uno_Mapping aBase; - uno_Environment *pEnvRemote; - uno_Environment *pEnvUno; -}; - -} - -#endif diff --git a/bridges/inc/bridges/remote/remote.hxx b/bridges/inc/bridges/remote/remote.hxx deleted file mode 100644 index 158aed550..000000000 --- a/bridges/inc/bridges/remote/remote.hxx +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_REMOTE_HXX_ -#define _BRIDGES_REMOTE_REMOTE_HXX_ -#include <list> - -#include <osl/mutex.hxx> -#include <osl/conditn.h> -#include <osl/interlck.h> - -#include <uno/environment.h> - -#include <bridges/remote/remote.h> -#include <bridges/remote/connection.h> - -#include <com/sun/star/uno/Sequence.hxx> - -namespace bridges_remote { - -extern "C" typedef void SAL_CALL AcquireRemote2RemoteStub( - remote_Interface * pThis); -AcquireRemote2RemoteStub acquireRemote2RemoteStub; - -extern "C" typedef void SAL_CALL FreeRemote2RemoteStub( - uno_ExtEnvironment * environment, void * stub); -FreeRemote2RemoteStub freeRemote2RemoteStub; - -class Remote2RemoteStub : - public remote_Interface -{ -public: - Remote2RemoteStub(rtl_uString *pOid, - typelib_InterfaceTypeDescription *pType, - uno_Environment *pEnvRemote, - requestClientSideDispatcher dispatch ); - ~Remote2RemoteStub(); - - void releaseRemote(); -public: - ::rtl::OUString m_sOid; - typelib_InterfaceTypeDescription *m_pType; - oslInterlockedCount m_nRef; - uno_Environment *m_pEnvRemote; - requestClientSideDispatcher m_dispatch; - oslInterlockedCount m_nReleaseRemote; -}; - -} -#endif diff --git a/bridges/inc/bridges/remote/stub.hxx b/bridges/inc/bridges/remote/stub.hxx deleted file mode 100644 index 53d9a68d9..000000000 --- a/bridges/inc/bridges/remote/stub.hxx +++ /dev/null @@ -1,64 +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 <bridges/remote/remote.hxx> - -#include <uno/dispatcher.h> -#include <uno/mapping.hxx> - -namespace bridges_remote { - -extern "C" typedef void SAL_CALL AcquireUno2RemoteStub( remote_Interface *pThis ); -AcquireUno2RemoteStub acquireUno2RemoteStub; - -extern "C" typedef void SAL_CALL FreeUno2RemoteStub( - uno_ExtEnvironment * environment, void * stub); -FreeUno2RemoteStub freeUno2RemoteStub; - -class Uno2RemoteStub : - public remote_Interface -{ -public: - Uno2RemoteStub( uno_Interface *pUnoI, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pType, - uno_Environment *pEnvUno, - uno_Environment *pEnvRemote ); - ~Uno2RemoteStub(); - -public: - ::rtl::OUString m_sOid; - typelib_InterfaceTypeDescription *m_pType; - uno_Interface *m_pUnoI; - oslInterlockedCount m_nRef; - - uno_Environment *m_pEnvUno; - uno_Environment *m_pEnvRemote; - ::com::sun::star::uno::Mapping m_mapRemote2Uno; - ::com::sun::star::uno::Mapping m_mapUno2Remote; -}; - -} diff --git a/bridges/inc/pch/precompiled_bridges.hxx b/bridges/inc/pch/precompiled_bridges.hxx index a7b437131..5610faa7a 100644 --- a/bridges/inc/pch/precompiled_bridges.hxx +++ b/bridges/inc/pch/precompiled_bridges.hxx @@ -38,8 +38,6 @@ #include "com/sun/star/bridge/XBridge.hpp" #include "com/sun/star/bridge/XBridgeFactory.hpp" #include "com/sun/star/bridge/XInstanceProvider.hpp" -#include "com/sun/star/bridge/XProtocolProperties.hdl" -#include "com/sun/star/bridge/XProtocolProperties.hpp" #include "com/sun/star/bridge/XUnoUrlResolver.hpp" #include "com/sun/star/connection/ConnectionSetupException.hpp" #include "com/sun/star/connection/NoConnectException.hpp" @@ -49,8 +47,6 @@ #include "com/sun/star/frame/XComponentLoader.hpp" #include "com/sun/star/io/XInputStream.hpp" #include "com/sun/star/io/XOutputStream.hpp" -#include "com/sun/star/lang/DisposedException.hdl" -#include "com/sun/star/lang/DisposedException.hpp" #include "com/sun/star/lang/IllegalArgumentException.hpp" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/XComponent.hpp" diff --git a/bridges/prj/build.lst b/bridges/prj/build.lst index 0e7979742..d6e6d864d 100644 --- a/bridges/prj/build.lst +++ b/bridges/prj/build.lst @@ -2,9 +2,6 @@ br bridges : cppuhelper jurt jvmaccess salhelper NULL br bridges usr1 - all br_mkout NULL br bridges\inc nmake - all br_inc NULL br bridges\unotypes nmake - all br_unotypes NULL -br bridges\source\remote\static nmake - all br_rem_static br_unotypes br_inc NULL -br bridges\source\remote\urp nmake - all br_rem_urp br_rem_static br_inc NULL -br bridges\source\remote\context nmake - all br_rcon br_unotypes br_inc NULL br bridges\source\cpp_uno\mingw_intel nmake - w br_gcc3i br_cppuno_shared br_unotypes br_inc NULL br bridges\source\cpp_uno\msvc_win32_intel nmake - w br_msci br_cppuno_shared br_unotypes br_inc NULL br bridges\source\cpp_uno\gcc3_linux_intel nmake - u br_gcc3li br_cppuno_shared br_unotypes br_inc NULL diff --git a/bridges/prj/d.lst b/bridges/prj/d.lst index 0b3dd9337..1ca453a83 100644 --- a/bridges/prj/d.lst +++ b/bridges/prj/d.lst @@ -1,16 +1,3 @@ -mkdir: %_DEST%\inc%_EXT%\bridges -mkdir: %_DEST%\inc%_EXT%\bridges\remote - -..\inc\bridges\remote\connection.h %_DEST%\inc%_EXT%\bridges\remote\connection.h -..\inc\bridges\remote\context.h %_DEST%\inc%_EXT%\bridges\remote\context.h -..\inc\bridges\remote\remote.h %_DEST%\inc%_EXT%\bridges\remote\remote.h - -..\%__SRC%\lib\irmcxt* %_DEST%\lib%_EXT%\* -..\%__SRC%\lib\librmcxt.*.* %_DEST%\lib%_EXT%\* -..\%__SRC%\bin\rmcxt*.dll %_DEST%\bin%_EXT%\* - -..\%__SRC%\lib\liburp_uno* %_DEST%\lib%_EXT%\liburp_uno* -..\%__SRC%\bin\urp_uno* %_DEST%\bin%_EXT%\urp_uno* ..\%__SRC%\lib\libjava_uno* %_DEST%\lib%_EXT%\libjava_uno* ..\%__SRC%\bin\java_uno* %_DEST%\bin%_EXT%\java_uno* ..\%__SRC%\class\java_uno*.jar %_DEST%\bin%_EXT%\java_uno*.jar @@ -21,8 +8,3 @@ mkdir: %_DEST%\inc%_EXT%\bridges\remote ..\%__SRC%\lib\libgcc3_uno.* %_DEST%\lib%_EXT%\libgcc3_uno.* ..\%__SRC%\bin\gcc3_uno.* %_DEST%\bin%_EXT%\gcc3_uno.* ..\%__SRC%\lib\libsunpro5_uno.* %_DEST%\lib%_EXT%\libsunpro5_uno.* - -..\%__SRC%\lib\rmcxt3.lib %_DEST%\lib%_EXT%\rmcxt.lib - - -linklib: librmcxt.*.* diff --git a/bridges/source/remote/context/context.cxx b/bridges/source/remote/context/context.cxx deleted file mode 100644 index 58b9dc1f7..000000000 --- a/bridges/source/remote/context/context.cxx +++ /dev/null @@ -1,484 +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_bridges.hxx" -#include <stdio.h> -#include <string.h> -#include <list> -#include <hash_map> -#include <utility> - -#include <osl/diagnose.h> -#include <osl/interlck.h> -#include <osl/mutex.hxx> - -#include "rtl/ustring.hxx" -#include "rtl/instance.hxx" - -#include <bridges/remote/context.h> -#include <bridges/remote/remote.h> -#include <bridges/remote/connection.h> -#include <bridges/remote/counter.hxx> - -using namespace ::std; -using namespace ::osl; -using namespace ::rtl; - -namespace { - -extern "C" typedef void * (SAL_CALL * MemAlloc)(sal_Size); - -} - -namespace remote_context -{ - -class remote_ContextImpl : - public remote_Context -{ -public: - remote_ContextImpl( remote_Connection *pConnection, - rtl_uString *pIdStr, - rtl_uString *pDescription, - rtl_uString *pProtocol, - remote_InstanceProvider *pProvider ); - ~remote_ContextImpl(); - - static void SAL_CALL thisAcquire( uno_Context * ); - static void SAL_CALL thisRelease( uno_Context * ); - static void * SAL_CALL thisQuery( uno_Context * , rtl_uString * ); - static void SAL_CALL thisAddDisposingListener( remote_Context * , remote_DisposingListener * ); - static void SAL_CALL thisRemoveDisposingListener( remote_Context *, remote_DisposingListener *); - static void SAL_CALL thisDispose( remote_Context *); -public: - oslInterlockedCount m_nRef; - sal_Bool m_bDisposed; - list < remote_DisposingListener * > m_lstListener; - Mutex m_mutex; -}; - - - - -struct equalOUString_Impl -{ - sal_Bool operator()(const OUString & s1, const OUString & s2) const - { return s1 == s2; } -}; - -struct hashOUString_Impl -{ - size_t operator()(const OUString & rName) const - { return rName.hashCode(); } -}; - -typedef hash_map -< - OUString, - void *, - hashOUString_Impl, - equalOUString_Impl -> -ContextMap; - -#if OSL_DEBUG_LEVEL > 1 -static MyCounter thisCounter( "DEBUG : Context" ); -#endif - -class ContextAdmin -{ -public: - // listener administration - void addContextListener( remote_contextListenerFunc listener , void *pObject ); - void removeContextListener( remote_contextListenerFunc listener , void *pObject ); - - void fire( sal_Int32 nRemoteContextMode, - rtl_uString *sName, - rtl_uString *sDescription ); - - // context administration - uno_Context *createAndRegisterContext( - remote_Connection *pConnection, - rtl_uString *pIdStr, - rtl_uString *pDescription, - rtl_uString *pProtocol, - remote_InstanceProvider *pInstanceProvider ); - - void revokeContext( uno_Context *pRemoteContext ); - - uno_Context *getContext( rtl_uString *pHost ); - - rtl_uString ** getConnectionList( - sal_Int32 *pnStringCount, MemAlloc memAlloc ); - -private: - ::osl::Mutex m_mutex; - - ContextMap m_mapContext; - - typedef std::list< std::pair< remote_contextListenerFunc, void * > > List; - List m_lstListener; -}; - -void ContextAdmin::addContextListener( remote_contextListenerFunc listener , void *pObject ) -{ - ::osl::MutexGuard guard( m_mutex ); - - m_lstListener.push_back( std::make_pair( listener, pObject ) ); -} - -void ContextAdmin::removeContextListener( remote_contextListenerFunc listener , void *pObject ) -{ - ::osl::MutexGuard guard( m_mutex ); - - for (List::iterator ii(m_lstListener.begin()); ii != m_lstListener.end(); - ++ii) - { - if (ii->first == listener && ii->second == pObject) { - m_lstListener.erase( ii ); - break; - } - } -} - -void ContextAdmin::fire( - sal_Int32 nRemoteContextMode, - rtl_uString *pName, - rtl_uString *sDescription ) -{ - List lst; - { - ::osl::MutexGuard guard( m_mutex ); - lst = m_lstListener; - } - for (List::iterator i(lst.begin()); i != lst.end(); ++i) { - (i->first)(i->second, nRemoteContextMode, pName, sDescription); - } -} - -uno_Context *ContextAdmin::createAndRegisterContext( remote_Connection *pConnection, - rtl_uString *pIdStr, - rtl_uString *pDescription, - rtl_uString *pProtocol, - remote_InstanceProvider *pInstanceProvider ) -{ - ::osl::MutexGuard guard( m_mutex ); - - uno_Context *pContext = getContext( pIdStr ); - if( pContext ) - { - pContext->release( pContext ); - return 0; - } - - remote_ContextImpl *p = new remote_ContextImpl( pConnection, - pIdStr, - pDescription, - pProtocol, - pInstanceProvider ); - - p->aBase.acquire( (uno_Context*) p ); - - m_mapContext[ OUString( pIdStr) ] = (void*) p; - - fire( REMOTE_CONTEXT_CREATE , pIdStr , pDescription ); - return ( uno_Context * )p; -} - - -void ContextAdmin::revokeContext( uno_Context *pRemoteContext ) -{ - ::osl::MutexGuard guard( m_mutex ); - - remote_ContextImpl *p = ( remote_ContextImpl * ) pRemoteContext; - - ContextMap::iterator ii = m_mapContext.find( p->m_pName ); - OSL_ASSERT( ii != m_mapContext.end() ); - m_mapContext.erase( ii ); - - fire( REMOTE_CONTEXT_DESTROY , p->m_pName , p->m_pDescription ); - -} - -uno_Context *ContextAdmin::getContext( rtl_uString *pHost ) -{ - ::osl::MutexGuard guard( m_mutex ); - - ContextMap::iterator ii = m_mapContext.find( OUString( (rtl_uString*)pHost ) ); - if( ii == m_mapContext.end() ) - { - return 0; - } - - uno_Context *p = ( uno_Context * ) (*ii).second; - p->acquire( p ); - return p; -} - - -rtl_uString ** ContextAdmin::getConnectionList( - sal_Int32 *pnStringCount, MemAlloc memAlloc ) -{ - ::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() ); - - sal_Int32 i = 0; - for( ContextMap::iterator ii = m_mapContext.begin() ; - ii != m_mapContext.end(); - ++ii, i++ ) - { - rtl_uString_assign( &( ppReturn[i] ), (*ii).first.pData ); - } - - return ppReturn; -} - - -struct theContextAdmin : public rtl::Static<ContextAdmin, theContextAdmin> {}; - -/***************************** - * remote_ContextImpl implementation - ****************************/ - - - -remote_ContextImpl::remote_ContextImpl( remote_Connection *pConnection , - rtl_uString *pIdStr, - rtl_uString *pDescription, - rtl_uString *pProtocol, - remote_InstanceProvider *pProvider ) : - m_nRef( 0 ), - m_bDisposed( sal_False ) -{ - m_pConnection = pConnection; - m_pConnection->acquire( m_pConnection ); - - m_pInstanceProvider = pProvider; - if( m_pInstanceProvider ) - { - m_pInstanceProvider->acquire( pProvider ); - } - - m_pName = pIdStr; - rtl_uString_acquire( m_pName ); - - m_pDescription = pDescription; - rtl_uString_acquire( m_pDescription ); - - m_pProtocol = pProtocol; - rtl_uString_acquire( pProtocol ); - - aBase.acquire = thisAcquire; - aBase.release = thisRelease; - addDisposingListener = thisAddDisposingListener; - removeDisposingListener = thisRemoveDisposingListener; - dispose = thisDispose; -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - -remote_ContextImpl::~remote_ContextImpl() -{ - // disposed must have been called - OSL_ASSERT( m_bDisposed ); - - rtl_uString_release( m_pName ); - rtl_uString_release( m_pDescription ); - rtl_uString_release( m_pProtocol ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif - -} - - -void remote_ContextImpl::thisAddDisposingListener( remote_Context *pRemoteC , - remote_DisposingListener *pListener ) -{ - remote_ContextImpl *pImpl = (remote_ContextImpl * ) pRemoteC; - - ::osl::MutexGuard guard( pImpl->m_mutex ); - - pListener->acquire( pListener ); - pImpl->m_lstListener.push_back( pListener ); -} - -void remote_ContextImpl::thisRemoveDisposingListener( remote_Context *pRemoteC, - remote_DisposingListener *pListener) -{ - remote_ContextImpl *pImpl = (remote_ContextImpl * ) pRemoteC; - MutexGuard guard( pImpl->m_mutex ); - - for( list< remote_DisposingListener * >::iterator ii = pImpl->m_lstListener.begin() ; - ii != pImpl->m_lstListener.end(); - ++ii ) - { - if( (*ii) == pListener ) - { - pImpl->m_lstListener.erase( ii ); - pListener->release( pListener ); - break; - } - } -} - -void remote_ContextImpl::thisDispose( remote_Context *pRemoteC ) -{ - remote_ContextImpl *pImpl = ( remote_ContextImpl * )pRemoteC; - - MutexGuard guard( pImpl->m_mutex ); - if( ! pImpl->m_bDisposed ) - { - pImpl->m_bDisposed = sal_True; - theContextAdmin::get().revokeContext( (uno_Context * ) pRemoteC ); - - if( pImpl->m_pInstanceProvider ) - { - pImpl->m_pInstanceProvider->release( pImpl->m_pInstanceProvider ); - pImpl->m_pInstanceProvider = 0; - } - - pImpl->m_pConnection->release( pImpl->m_pConnection ); - pImpl->m_pConnection = 0; - - list< remote_DisposingListener * > lst = pImpl->m_lstListener; - pImpl->m_lstListener.clear(); - - for( list < remote_DisposingListener * >::iterator ii = lst.begin(); - ii != lst.end(); - ++ii ) - { - (*ii)->disposing( (*ii) , pImpl->m_pName ); - (*ii)->release( (*ii) ); - } - - } -} - - - -void remote_ContextImpl::thisAcquire( uno_Context *pRemoteC ) -{ - remote_ContextImpl *p = SAL_REINTERPRET_CAST(remote_ContextImpl * ,pRemoteC ); - osl_incrementInterlockedCount( &(p->m_nRef) ); -} - -void remote_ContextImpl::thisRelease( uno_Context *pRemoteC ) -{ - remote_ContextImpl *p = SAL_REINTERPRET_CAST( remote_ContextImpl * , pRemoteC ); - if (! osl_decrementInterlockedCount( &(p->m_nRef) )) - { - // enshure, that this piece of code is not reentered - osl_incrementInterlockedCount( &(p->m_nRef) ); - - // dispose, if necessary - p->dispose( p ); - - // restore the counter - osl_decrementInterlockedCount( &(p->m_nRef) ); - - if( 0 == p->m_nRef ) - { - delete p; - } - else - { - // reanimated, but disposed ! - } - } -} - -void *remote_ContextImpl::thisQuery( uno_Context * , rtl_uString * ) -{ - return 0; -} - - -} // end namespace remote_context - - -using namespace remote_context; - -//----------------------- -// -// C-Interface -// -//----------------------- -extern "C" remote_Context * SAL_CALL -remote_getContext( rtl_uString *pIdString ) -{ - return (remote_Context *) theContextAdmin::get().getContext(pIdString); -} - - - -extern "C" remote_Context * SAL_CALL -remote_createContext( remote_Connection *pConnection, - rtl_uString *pIdStr, - rtl_uString *pDescription, - rtl_uString *pProtocol, - remote_InstanceProvider *pProvider ) -{ - remote_ContextImpl *p = (remote_ContextImpl * ) - theContextAdmin::get().createAndRegisterContext( - pConnection , - pIdStr , - pDescription, - pProtocol, - pProvider ); - - return (remote_Context * )p; -} - - -extern "C" void SAL_CALL -remote_addContextListener( remote_contextListenerFunc listener, void *pObject ) -{ - theContextAdmin::get().addContextListener( listener , pObject ); -} - -extern "C" void SAL_CALL -remote_removeContextListener( remote_contextListenerFunc listener , void *pObject ) -{ - theContextAdmin::get().removeContextListener( listener , pObject ); -} - -extern "C" rtl_uString ** SAL_CALL -remote_getContextList( sal_Int32 *pnStringCount, MemAlloc memAlloc ) -{ - return theContextAdmin::get().getConnectionList( pnStringCount , memAlloc ); -} diff --git a/bridges/source/remote/context/exports.dxp b/bridges/source/remote/context/exports.dxp deleted file mode 100644 index dcef3c369..000000000 --- a/bridges/source/remote/context/exports.dxp +++ /dev/null @@ -1,5 +0,0 @@ -remote_getContext -remote_createContext -remote_getContextList -remote_removeContextListener -remote_addContextListener
\ No newline at end of file diff --git a/bridges/source/remote/context/rmcxt.map b/bridges/source/remote/context/rmcxt.map deleted file mode 100755 index 182f6495e..000000000 --- a/bridges/source/remote/context/rmcxt.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - remote_getContext; - remote_createContext; - remote_getContextList; - remote_removeContextListener; - remote_addContextListener; - local: - *; -}; diff --git a/bridges/source/remote/idl/corba.idl b/bridges/source/remote/idl/corba.idl deleted file mode 100644 index 63f93283d..000000000 --- a/bridges/source/remote/idl/corba.idl +++ /dev/null @@ -1,88 +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. - * - ************************************************************************/ -module com -{ -module sun -{ -module star -{ - -module corba -{ - - // CosBridging module - typedef unsigned long ObjectSystemID; - typedef sequence< byte > OpaqueData; - - struct OneThreadID - { - ObjectSystemID objSysID; - OpaqueData threadID; - }; - - typedef sequence<OneThreadID> ThreadIDs; - - struct LogicalThreadID // Service context - { - ThreadIDs IDs; - }; - - struct CorbaString8 - { - string theString; - }; - - struct CorbaUnion - { - long dummy; - }; - - struct ObjectKey - { - CorbaString8 sOid; - CorbaString8 sType; - }; - - enum TCKind - { - tk_null, tk_void, - tk_short, tk_long, tk_ushort, tk_ulong, - tk_float, tk_double, tk_boolean, tk_char, - tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref, - tk_struct, tk_union, tk_enum, tk_string, - tk_sequence, tk_array, tk_alias, tk_except, - tk_longlong, tk_ulonglong, tk_longdouble, - tk_wchar, tk_wstring, tk_fixed, - tk_value, tk_value_box, - tk_native, - tk_abstract_interface - }; -}; - -}; -}; -}; diff --git a/bridges/source/remote/static/helper.cxx b/bridges/source/remote/static/helper.cxx deleted file mode 100644 index 2370a523d..000000000 --- a/bridges/source/remote/static/helper.cxx +++ /dev/null @@ -1,209 +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_bridges.hxx" -#include <rtl/alloc.h> -#include <osl/diagnose.h> - -#include <bridges/remote/helper.hxx> - -#include <bridges/remote/stub.hxx> -#include <bridges/remote/proxy.hxx> -#include <bridges/remote/remote.hxx> - -#include <com/sun/star/uno/Sequence.hxx> - -using namespace ::rtl; -using namespace ::com::sun::star::uno; - -namespace bridges_remote -{ - -void SAL_CALL remote_createStub ( - remote_Interface **ppRemoteI, - rtl_uString *pOid , - typelib_TypeDescriptionReference *pTypeRef, - uno_Environment *pEnvRemote, - ReleaseRemoteCallbackFunc releaseRemoteCallback ) -{ - typelib_TypeDescription *pType = 0; - typelib_typedescriptionreference_getDescription( &pType, pTypeRef ); - - (void) pEnvRemote->pExtEnv->getRegisteredInterface( - pEnvRemote->pExtEnv, - (void **)ppRemoteI, - pOid, - (typelib_InterfaceTypeDescription* )pType ); - - if( *ppRemoteI ) - { - if( (*ppRemoteI)->acquire == acquireRemote2RemoteStub ) { - - if( releaseRemoteCallback ) - { - // use the callback handler, the bridge wants to send the call immeadiatly - releaseRemoteCallback( *ppRemoteI , pOid, pTypeRef , pEnvRemote ); - } - else - { - ((::bridges_remote::Remote2RemoteStub *)*ppRemoteI)->releaseRemote(); - } - } - else - { - // Uno2RemoteStub - // no release necessary - } - } - else - { - remote_BridgeImpl *pImpl = ((remote_Context *)pEnvRemote->pContext)->m_pBridgeImpl; - *ppRemoteI = - new ::bridges_remote::Remote2RemoteStub( - pOid, - (typelib_InterfaceTypeDescription * ) pType, - pEnvRemote, - pImpl->m_sendRequest); - - // ppRemoteI may change during registration - pEnvRemote->pExtEnv->registerProxyInterface( - pEnvRemote->pExtEnv, - (void **) ppRemoteI, - freeRemote2RemoteStub, - pOid, - (typelib_InterfaceTypeDescription * ) pType ); - } - - typelib_typedescription_release( pType ); -} - -void SAL_CALL remote_sendQueryInterface( - uno_Environment *pEnvRemote, - remote_Interface **ppRemoteI, - rtl_uString *pOid , - typelib_TypeDescriptionReference *pTypeRef, - uno_Any **ppException - ) -{ - OSL_ASSERT( ppRemoteI ); - - typelib_InterfaceTypeDescription *pType = 0; - typelib_typedescriptionreference_getDescription( (typelib_TypeDescription ** )&pType, pTypeRef ); - - if( *ppRemoteI ) - { - (*ppRemoteI)->release( *ppRemoteI ); - (*ppRemoteI) = 0; - } - - remote_BridgeImpl *pImpl = ((remote_Context *)pEnvRemote->pContext)->m_pBridgeImpl; - - Type type = ::getCppuType( (Reference < XInterface > *)0 ); - - // get type for queryInterface - OUString sCompleteMethodName = type.getTypeName(); - sCompleteMethodName += OUString::createFromAscii("::queryInterface"); - - typelib_InterfaceMemberTypeDescription *pMemberType = 0; - typelib_typedescription_getByName( - (typelib_TypeDescription **) &pMemberType, - sCompleteMethodName.pData ); - - OSL_ASSERT( pMemberType ); - - uno_Any anyInterface; - anyInterface.pType = 0; - anyInterface.pData = 0; - - void *pReturn = &anyInterface; - void *ppArgs[1]; - - ppArgs[0] = 0; - typelib_TypeDescriptionReference *pRef = 0; - typelib_typedescriptionreference_new( &pRef , - pType->aBase.eTypeClass, - pType->aBase.pTypeName); - - ppArgs[0] = &pRef; - -// uno_Any anyException; -// uno_Any *pAnyException = &anyException; - - // do the queryInterface - pImpl->m_sendRequest( - pEnvRemote, - (typelib_TypeDescription * ) pMemberType, - pOid, - pType, - pReturn, - ppArgs, - ppException ); - - - // now release everything - typelib_typedescriptionreference_release( pRef ); - typelib_typedescription_release( (typelib_TypeDescription * ) pMemberType ); - - if( *ppException ) - { - *ppRemoteI = 0; - } - else - { - // set out parameter - if( typelib_TypeClass_INTERFACE == anyInterface.pType->eTypeClass ) - { - *ppRemoteI = ( remote_Interface * ) anyInterface.pReserved; - } - typelib_typedescriptionreference_release( anyInterface.pType ); - } - - typelib_typedescription_release( (typelib_TypeDescription * ) pType ); -} - - -void SAL_CALL remote_retrieveOidFromProxy( - remote_Interface *pRemoteI, - rtl_uString **ppOid ) -{ - if( pRemoteI->acquire == acquireRemote2RemoteStub ) - { - // Remote2RemoteStub - ::bridges_remote::Remote2RemoteStub *pStub = (::bridges_remote::Remote2RemoteStub * ) pRemoteI; - rtl_uString_newFromString( ppOid , pStub->m_sOid.pData ); - } - else - { - // Uno2RemoteStub - ::bridges_remote::Uno2RemoteStub *pStub = (::bridges_remote::Uno2RemoteStub * ) pRemoteI; - rtl_uString_newFromString( ppOid , pStub->m_sOid.pData ); - pRemoteI->acquire( pRemoteI ); - } -} - -} diff --git a/bridges/source/remote/static/mapping.cxx b/bridges/source/remote/static/mapping.cxx deleted file mode 100644 index 08c842252..000000000 --- a/bridges/source/remote/static/mapping.cxx +++ /dev/null @@ -1,218 +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_bridges.hxx" -#include <osl/diagnose.h> - -#include <bridges/remote/proxy.hxx> -#include <bridges/remote/stub.hxx> -#include <bridges/remote/counter.hxx> -#include <bridges/remote/mapping.hxx> - -using namespace bridges_remote; - -extern "C" { - -static void SAL_CALL thisAcquire( uno_Mapping *pMap ) -{ - RemoteMapping *p = SAL_REINTERPRET_CAST( RemoteMapping * , pMap ); - if( 1 == osl_incrementInterlockedCount( &(p->m_nRef) ) ) - { - if( remoteToUno == pMap->mapInterface ) - { - uno_registerMapping( &pMap , - freeRemoteMapping, - p->pEnvRemote , - p->pEnvUno , - p->m_sPurpose.pData ); - } - else - { - uno_registerMapping( &pMap , - freeRemoteMapping, - p->pEnvUno , - p->pEnvRemote , - p->m_sPurpose.pData ); - } - - } -} - -static void SAL_CALL thisRelease( uno_Mapping *pMap ) -{ - RemoteMapping *p = SAL_REINTERPRET_CAST( RemoteMapping * , pMap ); - if (! osl_decrementInterlockedCount( &(p->m_nRef) )) - { - uno_revokeMapping( pMap ); - } -} - -} - -namespace bridges_remote { - -void remoteToUno( uno_Mapping *pMapping, void **ppUnoI, void *pRemoteI, - typelib_InterfaceTypeDescription *pTypeDescr ) -{ - remote_Mapping *pRemoteMapping = ( remote_Mapping * ) pMapping; - - OSL_ASSERT( ppUnoI && pTypeDescr ); - if (*ppUnoI) - { - ((uno_Interface *)*ppUnoI)->release( (uno_Interface *)*ppUnoI ); - *ppUnoI = 0; - } - - if (pRemoteI && pTypeDescr) - { - // get object id of interface to be wrapped - rtl_uString * pOid = 0; - pRemoteMapping->pEnvRemote->pExtEnv->getObjectIdentifier( - pRemoteMapping->pEnvRemote->pExtEnv, - &pOid, - pRemoteI ); - - OSL_ASSERT(pOid); - if( ! pOid ) - { - return; - } - - // try to get any known interface from target environment - pRemoteMapping->pEnvUno->pExtEnv->getRegisteredInterface( - pRemoteMapping->pEnvUno->pExtEnv, - ppUnoI, - pOid, - pTypeDescr); - - if ( ! *ppUnoI) // already existing interface - { - // try to publish a new proxy; proxy may be exchanged during registration - *ppUnoI = new Remote2UnoProxy( - ( remote_Interface * ) pRemoteI, - pOid, - pTypeDescr , - pRemoteMapping->pEnvUno, - pRemoteMapping->pEnvRemote); - - pRemoteMapping->pEnvUno->pExtEnv->registerProxyInterface( - pRemoteMapping->pEnvUno->pExtEnv, - ppUnoI, - freeRemote2UnoProxy, - pOid, - pTypeDescr ); - - OSL_ASSERT( *ppUnoI ); - } - rtl_uString_release( pOid ); - } -} - -void unoToRemote( uno_Mapping *pMapping, void **ppRemoteI, void *pUnoI, - typelib_InterfaceTypeDescription *pTypeDescr ) -{ - remote_Mapping *pRemoteMapping = ( remote_Mapping * ) pMapping; - OSL_ASSERT( ppRemoteI && pTypeDescr ); - if (*ppRemoteI) - { - ((remote_Interface *)*ppRemoteI)->release( (remote_Interface *)*ppRemoteI); - *ppRemoteI = 0; - } - if (pUnoI && pTypeDescr) - { - // get object id of interface to be wrapped - rtl_uString * pOid = 0; - pRemoteMapping->pEnvUno->pExtEnv->getObjectIdentifier( - pRemoteMapping->pEnvUno->pExtEnv, - &pOid, - pUnoI ); - - OSL_ASSERT( pOid ); - if( ! pOid ) - { - return; - } - - pRemoteMapping->pEnvRemote->pExtEnv->getRegisteredInterface( - pRemoteMapping->pEnvRemote->pExtEnv, - (void**)ppRemoteI, - pOid, - pTypeDescr ); - - if( !*ppRemoteI ) - { - // try to publish a new proxy; - *ppRemoteI = new Uno2RemoteStub( - ( uno_Interface * ) pUnoI, - pOid, - pTypeDescr, - pRemoteMapping->pEnvUno, - pRemoteMapping->pEnvRemote ); - - // note : ppRemoteI may change during registration - pRemoteMapping->pEnvRemote->pExtEnv->registerProxyInterface( - pRemoteMapping->pEnvRemote->pExtEnv, - (void**) ppRemoteI, - freeUno2RemoteStub, - pOid, - pTypeDescr ); - } - - rtl_uString_release( pOid ); - } -} - -void freeRemoteMapping(uno_Mapping * mapping) { - delete reinterpret_cast< RemoteMapping * >(mapping); -} - -RemoteMapping::RemoteMapping( uno_Environment *pEnvUno_ , - uno_Environment *pEnvRemote_, - uno_MapInterfaceFunc func, - const ::rtl::OUString sPurpose) : - m_nRef( 1 ), - m_sPurpose( sPurpose ) -{ - pEnvUno = pEnvUno_; - pEnvRemote = pEnvRemote_; - - pEnvUno->acquire( pEnvUno ); - pEnvRemote->acquire( pEnvRemote ); - - aBase.mapInterface = func; - aBase.acquire = thisAcquire; - aBase.release = thisRelease; -} - -RemoteMapping::~RemoteMapping( ) -{ - pEnvUno->release( pEnvUno ); - pEnvRemote->release( pEnvRemote ); -} - -} diff --git a/bridges/source/remote/static/proxy.cxx b/bridges/source/remote/static/proxy.cxx deleted file mode 100644 index 8105427bd..000000000 --- a/bridges/source/remote/static/proxy.cxx +++ /dev/null @@ -1,338 +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_bridges.hxx" -#include <sal/alloca.h> -#include <bridges/remote/proxy.hxx> -#include <bridges/remote/context.h> - -#include <uno/data.h> -#include <uno/mapping.hxx> -#include <uno/environment.h> - -#include <com/sun/star/uno/Any.hxx> - -#include <bridges/remote/bridgeimpl.hxx> - -#include "remote_types.hxx" - -#if OSL_DEBUG_LEVEL > 1 -#include <bridges/remote/counter.hxx> -static MyCounter thisCounter( "DEBUG : Remote2UnoProxy"); -#endif - -using namespace ::bridges_remote; -using namespace ::com::sun::star::uno; - -extern "C" { - -void SAL_CALL remote_release( void *pRemoteI ) -{ - ((remote_Interface * )pRemoteI)->release( (remote_Interface * ) pRemoteI ); -} - -} - -namespace bridges_remote { - -void freeRemote2UnoProxy(uno_ExtEnvironment *, void * proxy) { - delete static_cast< Remote2UnoProxy * >(proxy); -} - -void acquireRemote2UnoProxy( uno_Interface *pThis ) -{ - Remote2UnoProxy *p = ( Remote2UnoProxy * ) pThis; - if( 1 == osl_incrementInterlockedCount( &(p->m_nRef) ) ) - { - p->m_pEnvUno->pExtEnv->registerProxyInterface( - p->m_pEnvUno->pExtEnv, - (void**)&pThis, - freeRemote2UnoProxy, - p->m_sOid.pData, - p->m_pType ); - OSL_ASSERT( (uno_Interface *)p == pThis ); - } -} - -void releaseRemote2UnoProxy( uno_Interface *pThis ) -{ - Remote2UnoProxy *p = ( Remote2UnoProxy * ) pThis; - if ( 0 == osl_decrementInterlockedCount( &(p->m_nRef) )) - { - p->m_pEnvUno->pExtEnv->revokeInterface( p->m_pEnvUno->pExtEnv, p ); - } -} - -void SAL_CALL dispatchRemote2UnoProxy( - uno_Interface * pUnoI, - typelib_TypeDescription const * pType, - void * pReturn, - void * ppArgs[], - uno_Any ** ppException ) -{ - Remote2UnoProxy *p = ( Remote2UnoProxy * ) pUnoI; - RemoteThreadCounter counter( p->m_pEnvRemote ); - - typelib_InterfaceMethodTypeDescription *pMethodType = 0; - typelib_InterfaceAttributeTypeDescription *pAttributeType = 0; - typelib_TypeDescription *pReturnType = 0; - typelib_TypeDescription **ppArgType = 0; - sal_Int32 nArgCount = 0; - sal_Bool *pbIsIn = 0; - sal_Bool *pbIsOut = 0; - sal_Bool *pbConversionNeeded = 0; - sal_Bool bConversionNeededForReturn = 0; - - //-------------------------------- - // Collect all needed types ! - //-------------------------------- - if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pType->eTypeClass ) - { - pAttributeType = ( typelib_InterfaceAttributeTypeDescription * ) pType; - if( pReturn ) - { - TYPELIB_DANGER_GET( &pReturnType , pAttributeType->pAttributeTypeRef ); - bConversionNeededForReturn = remote_relatesToInterface( pReturnType ); - } - else - { - nArgCount = 1; - ppArgType = (typelib_TypeDescription **) alloca( sizeof( void * ) ); - pbIsIn = ( sal_Bool * ) alloca( sizeof( sal_Bool ) ); - pbIsOut = ( sal_Bool * ) alloca( sizeof( sal_Bool ) ); - pbConversionNeeded = ( sal_Bool *) alloca( sizeof( sal_Bool ) ); - - pbIsIn[0] = sal_True; - pbIsOut[0] = sal_False; - ppArgType[0] = 0; - TYPELIB_DANGER_GET( &( ppArgType[0] ) , pAttributeType->pAttributeTypeRef ); - pbConversionNeeded[0] = remote_relatesToInterface( ppArgType[0] ); - - } - } - if( typelib_TypeClass_INTERFACE_METHOD == pType->eTypeClass ) - { - pMethodType = ( typelib_InterfaceMethodTypeDescription * ) pType; - TYPELIB_DANGER_GET( &pReturnType , pMethodType->pReturnTypeRef ); - bConversionNeededForReturn = remote_relatesToInterface( pReturnType ); - nArgCount = pMethodType->nParams; - ppArgType = (typelib_TypeDescription **) alloca( sizeof( void * ) * nArgCount ); - pbIsIn = (sal_Bool * ) alloca( sizeof( sal_Bool ) * nArgCount ); - pbIsOut = (sal_Bool * ) alloca( sizeof( sal_Bool ) * nArgCount ); - pbConversionNeeded = ( sal_Bool *) alloca( sizeof( sal_Bool ) * nArgCount ); - sal_Int32 i; - for( i = 0 ; i < nArgCount ; i ++ ) - { - ppArgType[i] = 0; - TYPELIB_DANGER_GET( & (ppArgType[i]) , pMethodType->pParams[i].pTypeRef ); - pbIsIn[i] = pMethodType->pParams[i].bIn; - pbIsOut[i] = pMethodType->pParams[i].bOut; - pbConversionNeeded[i] = remote_relatesToInterface( ppArgType[i] ); - } - } - - void *pRemoteReturn = 0; - if( pReturnType ) - { - if( bConversionNeededForReturn ) - { - pRemoteReturn = alloca( pReturnType->nSize ); - } - else - { - pRemoteReturn = pReturn; - } - } - - void ** ppRemoteArgs = 0; - if( nArgCount ) - { - ppRemoteArgs = (void**) alloca( sizeof( void * ) * nArgCount ); - } - - sal_Int32 i; - for( i = 0 ; i < nArgCount ; i ++ ) - { - if( pbConversionNeeded[i] ) - { - ppRemoteArgs[i] = alloca( ppArgType[i]->nSize ); - - if( pbIsIn[i] ) { - uno_copyAndConvertData( - ppRemoteArgs[i], - ppArgs[i], - ppArgType[i], - p->m_mapUno2Remote.get() ); - } - } - else - { - ppRemoteArgs[i] = ppArgs[i]; - } - } - - uno_Any any; - uno_Any *pAny = &any; - - p->m_pRemoteI->pDispatcher( p->m_pRemoteI, - pType, - pRemoteReturn, - ppRemoteArgs, - &pAny ); - - if( ! pAny ) - { - if( pReturn && bConversionNeededForReturn ) - { - uno_copyAndConvertData( - pReturn , - pRemoteReturn, - pReturnType, - p->m_mapRemote2Uno.get() ); - uno_destructData( pRemoteReturn , pReturnType , remote_release ); - } - - sal_Int32 j; - for( j = 0 ; j < nArgCount ; j ++ ) - { - if( pbConversionNeeded[j] ) - { - if( pbIsIn[j] ) { - if( pbIsOut[j] ) { - uno_destructData( ppArgs[j] , - ppArgType[j] , - 0 ); - uno_copyAndConvertData( ppArgs[j] , - ppRemoteArgs[j], - ppArgType[j], - p->m_mapRemote2Uno.get() ); - } - } - else // pure out - { - uno_copyAndConvertData( ppArgs[j] , - ppRemoteArgs[j], - ppArgType[j], - p->m_mapRemote2Uno.get() ); - } - uno_destructData( ppRemoteArgs[j], - ppArgType[j], - remote_release ); - } - } - *ppException = 0; - } - else - { - // ----------------------- - // an exception occured - // ----------------------- - typelib_TypeDescription *pAnyType = 0; - getCppuType( (::com::sun::star::uno::Any*) 0 ).getDescription( &pAnyType ); - uno_copyAndConvertData( *ppException , - pAny , - pAnyType, - p->m_mapRemote2Uno.get() ); - uno_destructData( pAny , pAnyType , remote_release ); - typelib_typedescription_release( pAnyType ); - - // destruct remote in parameters ( out parameters have not been constructed ) - for( i = 0 ; i < nArgCount ; i ++ ) - { - if( pbConversionNeeded[i] && pbIsIn[i] ) - { - uno_destructData( ppRemoteArgs[i], - ppArgType[i], - remote_release ); - } - } - } - - //-------------------------- - // release all acquired types - //-------------------------- - if( pReturnType ) - { - TYPELIB_DANGER_RELEASE( pReturnType ); - } - for( i = 0 ; i < nArgCount ; i ++ ) - { - TYPELIB_DANGER_RELEASE( ppArgType[ i] ); - } - -} - -Remote2UnoProxy::Remote2UnoProxy( remote_Interface *pRemoteI, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pType, - uno_Environment *pEnvUno, - uno_Environment *pEnvRemote ) : - m_sOid( pOid ), - m_pType( pType ), - m_pRemoteI( pRemoteI ), - m_pEnvUno( pEnvUno ), - m_pEnvRemote( pEnvRemote ), - m_mapRemote2Uno( pEnvRemote, pEnvUno ), - m_mapUno2Remote( pEnvUno , pEnvRemote ), - m_nRef( 1 ) -{ - typelib_typedescription_acquire( (typelib_TypeDescription * ) m_pType ); - m_pEnvUno->acquire( m_pEnvUno ); - m_pEnvRemote->acquire( m_pEnvRemote ); - - acquire = acquireRemote2UnoProxy; - release = releaseRemote2UnoProxy; - pDispatcher = dispatchRemote2UnoProxy; - - m_pEnvRemote->pExtEnv->registerInterface( - m_pEnvRemote->pExtEnv, - (void**)&m_pRemoteI, - m_sOid.pData, - m_pType ); - m_pRemoteI->acquire( m_pRemoteI ); - -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - -Remote2UnoProxy::~Remote2UnoProxy() -{ - // revoke external ref (oid) - m_pEnvRemote->pExtEnv->revokeInterface( m_pEnvRemote->pExtEnv , m_pRemoteI ); - - typelib_typedescription_release( (typelib_TypeDescription * )m_pType ); - m_pRemoteI->release( m_pRemoteI ); - m_pEnvUno->release( m_pEnvUno ); - m_pEnvRemote->release( m_pEnvRemote ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif -} - -} // end namespace bridge_remote diff --git a/bridges/source/remote/static/remote.cxx b/bridges/source/remote/static/remote.cxx deleted file mode 100644 index 66a80168d..000000000 --- a/bridges/source/remote/static/remote.cxx +++ /dev/null @@ -1,161 +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_bridges.hxx" -#include <bridges/remote/remote.hxx> -#include <bridges/remote/counter.hxx> - -#if OSL_DEBUG_LEVEL > 1 -static MyCounter thisCounter( "DEBUG : Remote2RemoteStub"); -#endif - -using namespace bridges_remote; - -extern "C" { - -static void SAL_CALL thisRelease( remote_Interface *pThis ) -{ - Remote2RemoteStub *p = ( Remote2RemoteStub * ) pThis; - if (! osl_decrementInterlockedCount( &(p->m_nRef) )) - { - p->m_pEnvRemote->pExtEnv->revokeInterface( p->m_pEnvRemote->pExtEnv, pThis ); - - } -} - -static void SAL_CALL thisDispatch( - remote_Interface * pRemoteI, - typelib_TypeDescription const * pMemberType, - void * pReturn, - void * pArgs[], - uno_Any ** ppException ) -{ - Remote2RemoteStub *pThis = ( Remote2RemoteStub * ) pRemoteI; - - pThis->m_dispatch( pThis->m_pEnvRemote, - pMemberType, - pThis->m_sOid.pData, - pThis->m_pType, - pReturn, - pArgs, - ppException ); -} - -} - -namespace bridges_remote { - -void acquireRemote2RemoteStub( remote_Interface *pThis ) -{ - Remote2RemoteStub *p = ( Remote2RemoteStub * ) pThis; - if( 1 == osl_incrementInterlockedCount( &(p->m_nRef) ) ) - { - p->m_pEnvRemote->pExtEnv->registerProxyInterface( - p->m_pEnvRemote->pExtEnv, - (void**)&pThis, - freeRemote2RemoteStub, - p->m_sOid.pData, - p->m_pType ); - OSL_ASSERT( (remote_Interface *)p == pThis ); - } -} - -void freeRemote2RemoteStub(uno_ExtEnvironment *, void * stub) { - delete static_cast< Remote2RemoteStub * >(stub); -} - -Remote2RemoteStub::Remote2RemoteStub( rtl_uString *pOid, - typelib_InterfaceTypeDescription *pType, - uno_Environment *pEnvRemote, - requestClientSideDispatcher dispatch ) : - m_sOid( pOid ), - m_pType( (typelib_InterfaceTypeDescription * ) pType ), - m_nRef( 1 ), - m_pEnvRemote( pEnvRemote ), - m_dispatch( dispatch ), - m_nReleaseRemote( 1 ) -{ - typelib_typedescription_acquire( ( typelib_TypeDescription * ) m_pType ); - m_pEnvRemote->acquire( m_pEnvRemote ); - - acquire = acquireRemote2RemoteStub; - release = thisRelease; - pDispatcher = thisDispatch; -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - -Remote2RemoteStub::~Remote2RemoteStub() -{ - - // send a release via the connection ! - sal_Bool bNeedsRelease = sal_False; - if( ! m_pType->aBase.bComplete ) - { - // m_pType may be exchanged during complete, so it needs to be acquired - // (MT : Another thread may use m_pType during e.g. dispatch ! ). - typelib_typedescription_acquire( (typelib_TypeDescription*)m_pType ); - bNeedsRelease = sal_True; - typelib_typedescription_complete( (typelib_TypeDescription **) &m_pType ); - } - - uno_Any any; - uno_Any *pAny = &any; - - typelib_TypeDescription *pReleaseMethod = 0; - typelib_typedescriptionreference_getDescription( - &pReleaseMethod , - m_pType->ppAllMembers[REMOTE_RELEASE_METHOD_INDEX] ); - for( int i = 0 ; i < m_nReleaseRemote ; i ++ ) - { - thisDispatch( this, - pReleaseMethod, - 0, - 0, - &pAny ); - } - typelib_typedescription_release( pReleaseMethod ); - if( bNeedsRelease ) - { - typelib_typedescription_release( (typelib_TypeDescription * ) m_pType ); - } - - typelib_typedescription_release( (typelib_TypeDescription * ) m_pType ); - m_pEnvRemote->release( m_pEnvRemote ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif -} - -void Remote2RemoteStub::releaseRemote() -{ - osl_incrementInterlockedCount( &m_nReleaseRemote ); -} - -} // end namespace bridges_remote diff --git a/bridges/source/remote/static/remote_types.cxx b/bridges/source/remote/static/remote_types.cxx deleted file mode 100644 index 42ebead66..000000000 --- a/bridges/source/remote/static/remote_types.cxx +++ /dev/null @@ -1,96 +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_bridges.hxx" -#include "remote_types.hxx" - -namespace bridges_remote { - -sal_Bool SAL_CALL remote_relatesToInterface2( typelib_TypeDescription * pTypeDescr ) -{ - switch (pTypeDescr->eTypeClass) - { - case typelib_TypeClass_SEQUENCE: - { - switch (((typelib_IndirectTypeDescription *)pTypeDescr)->pType->eTypeClass) - { - case typelib_TypeClass_SEQUENCE: - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - { - typelib_TypeDescription * pTD = 0; - TYPELIB_DANGER_GET( &pTD, ((typelib_IndirectTypeDescription *)pTypeDescr)->pType ); - sal_Bool bRel = remote_relatesToInterface( pTD ); - TYPELIB_DANGER_RELEASE( pTD ); - return bRel; - } - default: - break; - } - } - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - { - // ...optimized... to avoid getDescription() calls! - typelib_CompoundTypeDescription * pComp = (typelib_CompoundTypeDescription *)pTypeDescr; - typelib_TypeDescriptionReference ** pTypes = pComp->ppTypeRefs; - for ( sal_Int32 nPos = pComp->nMembers; nPos--; ) - { - switch (pTypes[nPos]->eTypeClass) - { - case typelib_TypeClass_INTERFACE: - case typelib_TypeClass_UNION: // might relate to interface - case typelib_TypeClass_ANY: // might relate to interface - return sal_True; - case typelib_TypeClass_SEQUENCE: - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - { - typelib_TypeDescription * pTD = 0; - TYPELIB_DANGER_GET( &pTD, pTypes[nPos] ); - sal_Bool bRel = remote_relatesToInterface( pTD ); - TYPELIB_DANGER_RELEASE( pTD ); - if (bRel) - return sal_True; - break; - } - default: - break; - } - } - if (pComp->pBaseTypeDescription) - return remote_relatesToInterface( (typelib_TypeDescription *)pComp->pBaseTypeDescription ); - break; - } - default: - OSL_ASSERT( 0 ); - } - return sal_False; -} - -} diff --git a/bridges/source/remote/static/remote_types.hxx b/bridges/source/remote/static/remote_types.hxx deleted file mode 100644 index 922640db5..000000000 --- a/bridges/source/remote/static/remote_types.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _BRIDGES_REMOTE_TYPES_HXX_ -#define _BRIDGES_REMOTE_TYPES_HXX_ - -#include <osl/diagnose.h> -#include <sal/types.h> -#include <typelib/typedescription.h> - -namespace bridges_remote -{ - -inline sal_Bool SAL_CALL remote_relatesToInterface( typelib_TypeDescription *pTypeDescr ); -sal_Bool SAL_CALL remote_relatesToInterface2( typelib_TypeDescription * pTypeDescr ); - - -/** Determines whether given type might relate or relates to an interface, - i.e. values of this type are interface or may contain interface(s).<br> - @param pTypeDescr type description of type - @return true if type might relate to an interface, false otherwise -*/ -inline sal_Bool SAL_CALL remote_relatesToInterface( typelib_TypeDescription * pTypeDescr ) -{ - switch (pTypeDescr->eTypeClass) - { - case typelib_TypeClass_SEQUENCE: - switch (((typelib_IndirectTypeDescription *)pTypeDescr)->pType->eTypeClass) - { - case typelib_TypeClass_INTERFACE: - case typelib_TypeClass_UNION: // might relate to interface - case typelib_TypeClass_ANY: // might relate to interface - return sal_True; - case typelib_TypeClass_SEQUENCE: - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - return remote_relatesToInterface2( pTypeDescr ); - default: - return sal_False; - } - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - return remote_relatesToInterface2( pTypeDescr ); - case typelib_TypeClass_UNION: // might relate to interface - case typelib_TypeClass_ANY: // might relate to interface - case typelib_TypeClass_INTERFACE: - return sal_True; - default: - return sal_False; - } -} - -/** Determines whether given type is a cpp simple type, e.g. int, enum.<br> - @param pTypeDescr type description of type - @return true if type is a cpp simple type, false otherwise -*/ -inline sal_Bool SAL_CALL remote_isSimpleType( typelib_TypeDescription * pTypeDescr ) -{ - return (pTypeDescr->eTypeClass <= typelib_TypeClass_ENUM && - pTypeDescr->eTypeClass != typelib_TypeClass_STRING && - pTypeDescr->eTypeClass != typelib_TypeClass_ANY && - pTypeDescr->eTypeClass != typelib_TypeClass_TYPE); -} - -} -#endif diff --git a/bridges/source/remote/static/stub.cxx b/bridges/source/remote/static/stub.cxx deleted file mode 100644 index 62e312c94..000000000 --- a/bridges/source/remote/static/stub.cxx +++ /dev/null @@ -1,336 +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_bridges.hxx" -#include <sal/alloca.h> -#include <osl/diagnose.h> - -#include <uno/data.h> -#include <uno/mapping.hxx> - -#include <bridges/remote/stub.hxx> -#include <bridges/remote/proxy.hxx> -#include <bridges/remote/context.h> -#include <bridges/remote/bridgeimpl.hxx> - -#include "remote_types.hxx" - -#if OSL_DEBUG_LEVEL > 1 -#include <bridges/remote/counter.hxx> -static MyCounter thisCounter( "DEBUG : Uno2RemoteStub"); -#endif - -using namespace ::com::sun::star::uno; -using namespace bridges_remote; - -extern "C" { - -void SAL_CALL thisRelease( remote_Interface *pThis ) -{ - Uno2RemoteStub *p = ( Uno2RemoteStub * ) pThis; - if (! osl_decrementInterlockedCount( &(p->m_nRef) )) - { - p->m_pEnvRemote->pExtEnv->revokeInterface( p->m_pEnvRemote->pExtEnv, pThis ); - } -} - -void SAL_CALL thisDispatch( - remote_Interface * pRemoteI, - typelib_TypeDescription const * pType, - void * pReturn, - void * ppArgs[], - uno_Any ** ppException ) -{ - Uno2RemoteStub *p = ( Uno2RemoteStub * ) pRemoteI; - - RemoteThreadCounter counter( p->m_pEnvRemote ); - - typelib_InterfaceMethodTypeDescription *pMethodType = 0; - typelib_InterfaceAttributeTypeDescription *pAttributeType = 0; - typelib_TypeDescription *pReturnType = 0; - typelib_TypeDescription **ppArgType = 0; - sal_Int32 nArgCount = 0; - sal_Bool *pbIsIn = 0; - sal_Bool *pbIsOut = 0; - sal_Bool bConversionNeededForReturn = sal_False; - sal_Bool *pbConversionNeeded = 0; - - sal_Int32 i; - //-------------------------------- - // Collect all needed types ! - //-------------------------------- - if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pType->eTypeClass ) - { - pAttributeType = ( typelib_InterfaceAttributeTypeDescription * ) pType; - if( pReturn ) - { - TYPELIB_DANGER_GET( &pReturnType , pAttributeType->pAttributeTypeRef ); - bConversionNeededForReturn = remote_relatesToInterface( pReturnType ); - } - else - { - nArgCount = 1; - ppArgType = (typelib_TypeDescription **) alloca( sizeof( void * ) ); - pbIsIn = ( sal_Bool * ) alloca( sizeof( sal_Bool ) ); - pbIsOut = ( sal_Bool * ) alloca( sizeof( sal_Bool ) ); - pbConversionNeeded = ( sal_Bool * ) alloca( sizeof( sal_Bool ) ); - pbIsIn[0] = sal_True; - pbIsOut[0] = sal_False; - ppArgType[0] = 0; - TYPELIB_DANGER_GET( &( ppArgType[0] ) , pAttributeType->pAttributeTypeRef ); - pbConversionNeeded[0] = remote_relatesToInterface( ppArgType[0] ); - } - } - if( typelib_TypeClass_INTERFACE_METHOD == pType->eTypeClass ) - { - pMethodType = ( typelib_InterfaceMethodTypeDescription * ) pType; - TYPELIB_DANGER_GET( &pReturnType , pMethodType->pReturnTypeRef ); - bConversionNeededForReturn = remote_relatesToInterface( pReturnType ); - nArgCount = pMethodType->nParams; - ppArgType = (typelib_TypeDescription **) alloca( sizeof( void * ) * nArgCount ); - pbIsIn = (sal_Bool * ) alloca( sizeof( sal_Bool ) * nArgCount ); - pbIsOut = (sal_Bool * ) alloca( sizeof( sal_Bool ) * nArgCount ); - pbConversionNeeded = ( sal_Bool * ) alloca( sizeof( sal_Bool ) * nArgCount ); - - for( i = 0 ; i < nArgCount ; i ++ ) - { - ppArgType[i] = 0; - TYPELIB_DANGER_GET( & (ppArgType[i]) , pMethodType->pParams[i].pTypeRef ); - pbIsIn[i] = pMethodType->pParams[i].bIn; - pbIsOut[i] = pMethodType->pParams[i].bOut; - pbConversionNeeded[i] = remote_relatesToInterface( ppArgType[i] ); - } - } - - // create Mapping - - void *pUnoReturn = 0; - void **ppUnoArgs = 0; - - if( pReturnType ) - { - if( bConversionNeededForReturn ) - { - pUnoReturn = alloca( pReturnType->nSize ); - } - else - { - pUnoReturn = pReturn; - } - } - - ppUnoArgs = (void **) alloca( nArgCount * sizeof( void * ) ); - for( i = 0 ; i < nArgCount ; i ++ ) - { - if( pbConversionNeeded[i] ) - { - ppUnoArgs[i] = alloca( ppArgType[i]->nSize ); - if( pbIsIn[i] ) - { - uno_copyAndConvertData( - ppUnoArgs[i], - ppArgs[i], - ppArgType[i], - p->m_mapRemote2Uno.get() - ); - } - } - else - { - ppUnoArgs[i] = ppArgs[i]; - } - } - - // do the call - uno_Any any; - uno_Any *pAny = &any; - - p->m_pUnoI->pDispatcher( p->m_pUnoI, - pType, - pUnoReturn, - ppUnoArgs, - &pAny); - - if( ! pAny ) - { - // ------------------ - // No Exception - // ------------------ - - // Map return value - if( pReturnType && bConversionNeededForReturn ) - { - uno_copyAndConvertData( - pReturn , - pUnoReturn, - pReturnType, - p->m_mapUno2Remote.get() ); - uno_destructData( pUnoReturn , pReturnType, 0 ); - } - - // map arguments - for( i = 0 ; i < nArgCount ; i ++ ) - { - if( pbConversionNeeded[i] ) - { - if( pbIsIn[i] ) { - if( pbIsOut[i] ) { - uno_destructData( - ppArgs[i] , - ppArgType[i] , - remote_release ); - uno_copyAndConvertData( ppArgs[i] , - ppUnoArgs[i], - ppArgType[i], - p->m_mapUno2Remote.get() ); - } - } - else // pure out - { - uno_copyAndConvertData( ppArgs[i] , - ppUnoArgs[i], - ppArgType[i], - p->m_mapUno2Remote.get() ); - } - uno_destructData( ppUnoArgs[i], - ppArgType[i], - 0 ); - } - } - *ppException = 0; - } - else - { - // ----------------------- - // an exception occured - // ----------------------- - typelib_TypeDescription *pAnyType = 0; - getCppuType( (Any*) 0 ).getDescription( &pAnyType ); - uno_copyAndConvertData( *ppException , - pAny , - pAnyType, - p->m_mapUno2Remote.get() ); - uno_destructData( pAny , pAnyType , 0 ); - typelib_typedescription_release( pAnyType ); - - // destruct uno in parameters ( out parameters have not been constructed ) - for( i = 0 ; i < nArgCount ; i ++ ) - { - if( pbConversionNeeded[i] && pbIsIn[i] ) - { - uno_destructData( ppUnoArgs[i], - ppArgType[i], - 0 ); - } - } - } - - //-------------------------- - // release all acquired types - //-------------------------- - if( pReturnType ) - { - TYPELIB_DANGER_RELEASE( pReturnType ); - } - for( i = 0 ; i < nArgCount ; i ++ ) - { - TYPELIB_DANGER_RELEASE( ppArgType[ i] ); - } -} - -} - -namespace bridges_remote { - -void acquireUno2RemoteStub( remote_Interface *pThis ) -{ - Uno2RemoteStub *p = ( Uno2RemoteStub * ) pThis; - if( 1 == osl_incrementInterlockedCount( &(p->m_nRef) ) ) - { - - p->m_pEnvRemote->pExtEnv->registerProxyInterface( - p->m_pEnvRemote->pExtEnv, - (void**)&pThis, - freeUno2RemoteStub, - p->m_sOid.pData, - p->m_pType ); - - OSL_ASSERT( (remote_Interface*) p == pThis ); - } -} - -void freeUno2RemoteStub(uno_ExtEnvironment *, void * stub) { - delete static_cast< Uno2RemoteStub * >(stub); -} - -Uno2RemoteStub::Uno2RemoteStub( uno_Interface *pUnoI, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pType, - uno_Environment *pEnvUno, - uno_Environment *pEnvRemote ) : - m_sOid( pOid ), - m_pType( pType ), - m_pUnoI( pUnoI ), - m_nRef( 1 ), - m_pEnvUno( pEnvUno ), - m_pEnvRemote( pEnvRemote ), - m_mapRemote2Uno( pEnvRemote, pEnvUno ), - m_mapUno2Remote( pEnvUno, pEnvRemote ) -{ - typelib_typedescription_acquire( (typelib_TypeDescription * )m_pType ); - m_pEnvUno->acquire( m_pEnvUno ); - m_pEnvRemote->acquire( m_pEnvRemote ); - - acquire = acquireUno2RemoteStub; - release = thisRelease; - pDispatcher = thisDispatch; - - m_pEnvUno->pExtEnv->registerInterface( m_pEnvUno->pExtEnv, - (void **)&m_pUnoI, - m_sOid.pData, - m_pType ); - m_pUnoI->acquire( m_pUnoI ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - -Uno2RemoteStub::~Uno2RemoteStub() -{ - m_pEnvUno->pExtEnv->revokeInterface( m_pEnvUno->pExtEnv , m_pUnoI ); - - typelib_typedescription_release( (typelib_TypeDescription * )m_pType ); - m_pUnoI->release( m_pUnoI ); - m_pEnvUno->release( m_pEnvUno ); - m_pEnvRemote->release( m_pEnvRemote ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif -} - -} // end namespace bridges_remote diff --git a/bridges/source/remote/urp/makefile.mk b/bridges/source/remote/urp/makefile.mk deleted file mode 100644 index eaa3f3a6f..000000000 --- a/bridges/source/remote/urp/makefile.mk +++ /dev/null @@ -1,78 +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. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=bridges -TARGET=urp_uno -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -SLOFILES= \ - $(SLO)$/urp_environment.obj \ - $(SLO)$/urp_marshal.obj \ - $(SLO)$/urp_unmarshal.obj \ - $(SLO)$/urp_dispatch.obj \ - $(SLO)$/urp_job.obj \ - $(SLO)$/urp_reader.obj \ - $(SLO)$/urp_writer.obj \ - $(SLO)$/urp_log.obj \ - $(SLO)$/urp_bridgeimpl.obj \ - $(SLO)$/urp_propertyobject.obj \ - $(SLO)$/urp_threadid.obj - -.IF "$(COM)"=="GCC" -NOOPTFILES= \ - $(SLO)$/urp_reader.obj -.ENDIF # "$(COM)"=="GCC" - -SHL1TARGET= $(TARGET) - -SHL1DEF=$(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP=..$/..$/bridge_exports.map -SHL1RPATH=URELIB - -SHL1STDLIBS=\ - $(SALLIB)\ - $(CPPULIB) - -SHL1LIBS=\ - $(SLB)$/$(TARGET).lib \ - $(SLB)$/bridges_remote_static.lib - -DEF1NAME= $(SHL1TARGET) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - diff --git a/bridges/source/remote/urp/urp_bridgeimpl.cxx b/bridges/source/remote/urp/urp_bridgeimpl.cxx deleted file mode 100644 index 67eb78ab9..000000000 --- a/bridges/source/remote/urp/urp_bridgeimpl.cxx +++ /dev/null @@ -1,250 +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_bridges.hxx" -#include <osl/thread.h> -#include <bridges/remote/helper.hxx> - -#include <algorithm> - -#include "urp_bridgeimpl.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; -namespace bridges_urp -{ - -template < class t > -inline t mymin( const t & val1, const t & val2 ) -{ - return val1 < val2 ? val1 : val2; -} - -/*********** - * urp_BridgeImpl - ***********/ -urp_BridgeImpl::urp_BridgeImpl( sal_Int32 nCacheSize , sal_uInt32 nInitialMarshalerSize ) : - m_blockMarshaler( this , nInitialMarshalerSize , ::bridges_remote::remote_retrieveOidFromProxy), - m_nMarshaledMessages( 0 ), - m_oidCacheOut( (sal_uInt16)nCacheSize ), - m_tidCacheOut( (sal_uInt16)nCacheSize ), - m_typeCacheOut( (sal_uInt16)nCacheSize ) -{ - m_pOidIn = new OUString[ nCacheSize ]; - m_pTidIn = new ByteSequence[ nCacheSize ]; - m_pTypeIn = new Type[ nCacheSize ]; - m_nRemoteThreads = 0; -} - -urp_BridgeImpl::~urp_BridgeImpl() -{ - delete [] m_pOidIn; - delete [] m_pTidIn; - delete [] m_pTypeIn; -} - - -void urp_BridgeImpl::applyProtocolChanges( const Properties &props ) -{ - if( m_properties.nTypeCacheSize != props.nTypeCacheSize ) - { - if( props.nTypeCacheSize == 0 ) - { - delete [] m_pTypeIn; - m_pTypeIn = 0; - } - else - { - Type *pNew = new Type[props.nTypeCacheSize]; - sal_Int32 i; - sal_Int32 iMin = mymin( m_properties.nTypeCacheSize , props.nTypeCacheSize ); - for( i = 0; i < iMin ; i ++ ) - { - pNew[i] = m_pTypeIn[i]; - } - delete [] m_pTypeIn; - m_pTypeIn = pNew; - } - OSL_ASSERT( props.nTypeCacheSize <= 0xffff ); - m_properties.nTypeCacheSize = props.nTypeCacheSize; - m_typeCacheOut.resize( (sal_uInt16)props.nTypeCacheSize ); - } - - if( m_properties.nOidCacheSize != props.nOidCacheSize ) - { - if( 0 == props.nOidCacheSize ) - { - delete [] m_pOidIn; - m_pOidIn = 0; - } - else - { - OUString *pNew = new OUString[props.nOidCacheSize]; - sal_Int32 i; - sal_Int32 iMin = mymin( m_properties.nOidCacheSize , props.nOidCacheSize ); - for( i = 0; i < iMin ; i ++ ) - { - pNew[i] = m_pOidIn[i]; - } - delete [] m_pOidIn; - m_pOidIn = pNew; - } - OSL_ASSERT( props.nOidCacheSize <= 0xffff ); - m_oidCacheOut.resize( (sal_uInt16)props.nOidCacheSize ); - m_properties.nOidCacheSize = props.nOidCacheSize; - } - - if( m_properties.nTidCacheSize != props.nTidCacheSize ) - { - if( 0 == props.nTidCacheSize ) - { - delete [] m_pTidIn; - m_pTidIn = 0; - } - else - { - ByteSequence *pNew = new ByteSequence[props.nTidCacheSize]; - sal_Int32 i; - sal_Int32 iMin = mymin( m_properties.nTidCacheSize , props.nTidCacheSize ); - for( i = 0; i < iMin ; i ++ ) - { - pNew[i] = m_pTidIn[i]; - } - delete [] m_pTidIn; - m_pTidIn = pNew; - } - OSL_ASSERT( props.nTidCacheSize <= 0xffff ); - m_tidCacheOut.resize( (sal_uInt16)props.nTidCacheSize ); - m_properties.nTidCacheSize = props.nTidCacheSize; - } - - if( m_properties.sVersion != props.sVersion ) - { - m_properties.sVersion = props.sVersion; - } - - if( m_properties.nFlushBlockSize != props.nFlushBlockSize ) - { - m_properties.nFlushBlockSize = props.nFlushBlockSize; - } - - if( m_properties.nOnewayTimeoutMUSEC != props.nOnewayTimeoutMUSEC ) - { - m_properties.nOnewayTimeoutMUSEC = props.nOnewayTimeoutMUSEC; - } - - if( props.bClearCache ) - { - if( m_properties.nTypeCacheSize ) - { - delete [] m_pTypeIn; - m_pTypeIn = new Type[m_properties.nTypeCacheSize]; - m_typeCacheOut.clear(); - } - m_lastInType = Type(); - m_lastOutType = Type(); - - if( m_properties.nOidCacheSize ) - { - delete [] m_pOidIn; - m_pOidIn = new OUString[ m_properties.nOidCacheSize]; - m_oidCacheOut.clear(); - } - m_lastOutOid = OUString(); - m_lastInOid = OUString(); - - if( m_properties.nTidCacheSize ) - { - delete [] m_pTidIn; - m_pTidIn = new ByteSequence[m_properties.nTidCacheSize]; - m_tidCacheOut.clear(); - } - m_lastInTid = ByteSequence(); - m_lastOutTid = ByteSequence(); - } - - if( m_properties.bNegotiate != props.bNegotiate ) - { - m_properties.bNegotiate = props.bNegotiate; - } - - if( m_properties.bForceSynchronous != props.bForceSynchronous ) - { - m_properties.bForceSynchronous = props.bForceSynchronous; - } - - m_properties.bCurrentContext = props.bCurrentContext; -} - -void urp_BridgeImpl::addError( char const *pError ) -{ - OUString message = OUString( RTL_CONSTASCII_USTRINGPARAM( "(tid=" ) ); - message += OUString::valueOf( (sal_Int32 ) osl_getThreadIdentifier( 0 ) ); - message += OUString::createFromAscii( ") " ); - message += OUString::createFromAscii( pError ); - MutexGuard guard( m_errorListMutex ); - m_lstErrors.push_back( message ); -} - -void urp_BridgeImpl::addError( const OUString & error ) -{ - OUString message = OUString( RTL_CONSTASCII_USTRINGPARAM( "(tid=" ) ); - message += OUString::valueOf( (sal_Int32 ) osl_getThreadIdentifier( 0 ) ); - message += OUString::createFromAscii( ") " ); - message += error; - MutexGuard guard( m_errorListMutex ); - m_lstErrors.push_back( message ); -} - -void urp_BridgeImpl::dumpErrors( FILE * f) -{ - MutexGuard guard( m_errorListMutex ); - for( ::std::list< OUString >::iterator ii = m_lstErrors.begin() ; - ii != m_lstErrors.end() ; - ++ii ) - { - OString o = OUStringToOString( *ii , RTL_TEXTENCODING_UTF8 ); - fprintf( f, "%s\n" , o.getStr() ); - } -} - -OUString urp_BridgeImpl::getErrorsAsString( ) -{ - MutexGuard guard( m_errorListMutex ); - OUString ret; - for( ::std::list< OUString >::iterator ii = m_lstErrors.begin() ; - ii != m_lstErrors.end() ; - ++ii ) - { - ret += *ii; - } - return ret; -} - -} diff --git a/bridges/source/remote/urp/urp_bridgeimpl.hxx b/bridges/source/remote/urp/urp_bridgeimpl.hxx deleted file mode 100644 index 16d9b1823..000000000 --- a/bridges/source/remote/urp/urp_bridgeimpl.hxx +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _URP_BRIDGEIMPL_HXX_ -#define _URP_BRIDGEIMPL_HXX_ - -#include <stdio.h> -#include <osl/mutex.hxx> -#include <osl/conditn.hxx> -#include <rtl/ustring.hxx> -#include <rtl/byteseq.hxx> - -#ifndef _UNO_THREADPOOL_H_ -#include <uno/threadpool.h> -#endif -#include <bridges/remote/bridgeimpl.hxx> - -#ifndef _URP_CACHE_HXX_ -#include "urp_cache.hxx" -#endif -#include "urp_marshal_decl.hxx" - -#ifndef _URP_REPLYCONTAINER_HXX_ -#include "urp_replycontainer.hxx" -#endif -#include "urp_property.hxx" - - -namespace bridges_urp -{ - -class PropertyObject; - -struct equalOUString -{ - sal_Int32 operator() ( const ::rtl::OUString &s1, const ::rtl::OUString &s2 ) const - { - return s1 == s2; - } -}; - -struct equalType -{ - sal_Int32 operator() ( const ::com::sun::star::uno::Type &t1, - const ::com::sun::star::uno::Type &t2 ) const - { - return t1 == t2; - } -}; - -class OWriterThread; -class OReaderThread; - -struct urp_BridgeImpl : - public remote_BridgeImpl -{ - urp_BridgeImpl( sal_Int32 nCacheSize , sal_uInt32 nInitialMarshalerSize ); - ~urp_BridgeImpl(); - - void applyProtocolChanges( const Properties & ); - - void startBlockBridge(); - void stopBlockBridge(); - void addError( char const *pError ); - void addError( const ::rtl::OUString &anError ); - void dumpErrors( FILE *f ); - ::rtl::OUString getErrorsAsString(); - - ::osl::Mutex m_marshalingMutex; - ::osl::Mutex m_disposingMutex; - ::osl::Mutex m_errorListMutex; - Marshal m_blockMarshaler; - sal_Int32 m_nMarshaledMessages; - - // Caches for vars, that go from local process to the remote process - Cache < ::rtl::OUString , equalOUString > m_oidCacheOut; - Cache < ::rtl::ByteSequence , EqualThreadId > m_tidCacheOut; - Cache < ::com::sun::star::uno::Type , equalType > m_typeCacheOut; - - ::com::sun::star::uno::Type m_lastOutType; - ::rtl::ByteSequence m_lastOutTid; - ::rtl::OUString m_lastOutOid; - - // Caches for vars, that come from the remote process to the local process - ::rtl::OUString *m_pOidIn; - ::rtl::ByteSequence *m_pTidIn; - ::com::sun::star::uno::Type *m_pTypeIn; - - ::com::sun::star::uno::Type m_lastInType; - ::rtl::ByteSequence m_lastInTid; - ::rtl::OUString m_lastInOid; - - urp_ClientJobContainer m_clientJobContainer; - - OWriterThread *m_pWriter; - OReaderThread *m_pReader; - ::rtl::OString m_sLogFileName; - FILE *m_pLogFile; - ::osl::Condition m_initialized; - ::osl::Condition m_cndWaitForThreads; - - struct Properties m_properties; - class PropertyObject *m_pPropertyObject; - ::std::list< ::rtl::OUString > m_lstErrors; - uno_ThreadPool m_hThreadPool; -}; - - -} -#endif diff --git a/bridges/source/remote/urp/urp_cache.h b/bridges/source/remote/urp/urp_cache.h deleted file mode 100644 index f3f840621..000000000 --- a/bridges/source/remote/urp/urp_cache.h +++ /dev/null @@ -1,57 +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. - * - ************************************************************************/ - - -namespace bridges_urp -{ - template < class t , class tequals > - class Cache - { - public: - inline Cache ( sal_uInt16 nMaxEntries ); - inline ~Cache(); - - // puts the value t into the cache. Returns then entry, - // that is used for this value. - inline sal_uInt16 put( const t & ); - - // lookup, if there is an entry for this value - // returns 0xffff, when value cannot be found in the list - inline sal_uInt16 seek( const t & ); - - // resizes the cache, conserving overlapping values - inline void resize( sal_uInt16 nNewMaxEntries ); - - // empties the cache - inline void clear(); - private: - t *m_pCache; - ::std::list< sal_uInt16 > m_lstLeastRecentlyUsed; - sal_uInt16 m_nMaxEntries; - sal_uInt16 m_nEntries; - }; -} diff --git a/bridges/source/remote/urp/urp_cache.hxx b/bridges/source/remote/urp/urp_cache.hxx deleted file mode 100644 index 957f650ec..000000000 --- a/bridges/source/remote/urp/urp_cache.hxx +++ /dev/null @@ -1,160 +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 <list> -#include <algorithm> -#include <rtl/ustring.hxx> - -#include "urp_threadid.hxx" -#include "urp_cache.h" - -namespace bridges_urp -{ - - template < class t , class tequals > - inline Cache< t , tequals >::Cache( sal_uInt16 nMaxEntries ) : - m_pCache( new t[nMaxEntries] ), - m_nMaxEntries( nMaxEntries ), - m_nEntries( 0 ) - { - - } - - template < class t , class tequals > - inline Cache< t , tequals >::~Cache( ) - { - delete [] m_pCache; - } - - - template < class t , class tequals > - inline sal_uInt16 Cache< t , tequals >::put( const t & value ) - { - if( ! m_nMaxEntries ) - { - return 0xffff; - } - sal_uInt16 nEntry = 0xffff; - if( m_nEntries < m_nMaxEntries ) - { - // cache has still empty places - m_pCache[m_nEntries] = value; - nEntry = m_nEntries; - m_nEntries ++; - - // add it to the cache - m_lstLeastRecentlyUsed.push_front( nEntry ); - } - else - { - // cache is full, remove an element and insert the new one - nEntry = m_lstLeastRecentlyUsed.back(); - m_lstLeastRecentlyUsed.pop_back(); - m_lstLeastRecentlyUsed.push_front( nEntry ); - - m_pCache[nEntry] = value; - } - return nEntry; - } - - template < class t , class tequals > - inline sal_uInt16 Cache< t , tequals >::seek( const t & value ) - { - for( ::std::list< sal_uInt16 >::iterator ii = m_lstLeastRecentlyUsed.begin() ; - ii != m_lstLeastRecentlyUsed.end() ; - ++ ii ) - { - if( value == m_pCache[*ii] ) - { - sal_uInt16 nEntry = *ii; - m_lstLeastRecentlyUsed.erase( ii ); - m_lstLeastRecentlyUsed.push_front( nEntry ); - return nEntry; - } - } - return 0xffff; - } - - // helper predicate for element removal - template < class t > - struct PredicateOverMax - { - t m_; - inline PredicateOverMax( const t &value ) : m_(value) - {} - sal_Int32 operator () ( const t &value ) const - { return value >= m_; } - }; - - template < class t, class tequals > - inline void Cache < t , tequals >::resize( sal_uInt16 nNewMaxEntries ) - { - if( 0 == nNewMaxEntries ) - { - m_lstLeastRecentlyUsed.clear(); - delete [] m_pCache; - m_pCache = 0; - m_nMaxEntries = 0; - } - else - { - // allocate - t *pNew = new t[nNewMaxEntries]; - sal_Int32 nMin = nNewMaxEntries < m_nMaxEntries ? nNewMaxEntries : m_nMaxEntries; - - // copy - for( sal_Int32 i = 0; i < nMin ; i ++ ) - { - pNew[i] = m_pCache[i]; - } - // delete - delete [] m_pCache; - - // assign - m_pCache = pNew; - - // remove overlapping lru cache entries - ::std::remove_if(m_lstLeastRecentlyUsed.begin(), - m_lstLeastRecentlyUsed.end(), - PredicateOverMax< sal_Int32 > ( nMin ) ); - } - m_nMaxEntries = nNewMaxEntries; - m_nEntries = m_nEntries < m_nMaxEntries ? - m_nEntries : m_nMaxEntries; - } - - template < class t, class tequals > - inline void Cache < t, tequals >:: clear() - { - for( sal_Int32 i = 0; i < m_nMaxEntries ; i ++ ) - { - m_pCache[i] = t(); - } - m_lstLeastRecentlyUsed.clear(); - m_nEntries = 0; - } -} diff --git a/bridges/source/remote/urp/urp_dispatch.cxx b/bridges/source/remote/urp/urp_dispatch.cxx deleted file mode 100644 index f0db93256..000000000 --- a/bridges/source/remote/urp/urp_dispatch.cxx +++ /dev/null @@ -1,116 +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_bridges.hxx" -#include <sal/alloca.h> -#include <osl/mutex.hxx> -#include <osl/diagnose.h> - -#include <rtl/alloc.h> -#include <rtl/ustrbuf.hxx> - -#include <uno/mapping.hxx> -#include <uno/threadpool.h> - -#include <bridges/remote/remote.h> -#include <bridges/remote/stub.hxx> -#include <bridges/remote/proxy.hxx> -#include <bridges/remote/remote.hxx> - -#include "urp_bridgeimpl.hxx" -#include "urp_marshal.hxx" -#include "urp_dispatch.hxx" -#include "urp_job.hxx" -#include "urp_writer.hxx" -#include "urp_log.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -namespace bridges_urp -{ - -void SAL_CALL urp_sendCloseConnection( uno_Environment *pEnvRemote ) -{ - remote_Context *pContext = (remote_Context *) pEnvRemote->pContext; - urp_BridgeImpl *pImpl = (urp_BridgeImpl*) ( pContext->m_pBridgeImpl ); - - { - MutexGuard guard( pImpl->m_marshalingMutex ); - - // send immediately - if( ! pImpl->m_blockMarshaler.empty() ) - { - pImpl->m_pWriter->touch( sal_True ); - } - - pImpl->m_pWriter->sendEmptyMessage(); - } -} -extern "C" void SAL_CALL urp_sendRequest( - uno_Environment *pEnvRemote, - typelib_TypeDescription const * pMemberType, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pInterfaceType, - void *pReturn, - void *ppArgs[], - uno_Any **ppException ) -{ - remote_Context *pContext = (remote_Context *) pEnvRemote->pContext; - urp_BridgeImpl *pImpl = (urp_BridgeImpl*) ( pContext->m_pBridgeImpl ); - pImpl->m_initialized.wait(); - urp_sendRequest_internal( - pEnvRemote, pMemberType, pOid, pInterfaceType, pReturn, ppArgs, - ppException ); -} -void SAL_CALL urp_sendRequest_internal( - uno_Environment *pEnvRemote, - typelib_TypeDescription const * pMemberType, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pInterfaceType, - void *pReturn, - void *ppArgs[], - uno_Any **ppException ) -{ - remote_Context *pContext = (remote_Context *) pEnvRemote->pContext; - urp_BridgeImpl *pImpl = (urp_BridgeImpl*) ( pContext->m_pBridgeImpl ); - - ClientJob job( - pEnvRemote, pContext, pImpl, pOid, pMemberType, pInterfaceType, pReturn, - ppArgs, ppException); - - if( job.pack() && ! job.isOneway() ) - { - job.wait(); - } -} - -} - - diff --git a/bridges/source/remote/urp/urp_dispatch.hxx b/bridges/source/remote/urp/urp_dispatch.hxx deleted file mode 100644 index d30ad7dba..000000000 --- a/bridges/source/remote/urp/urp_dispatch.hxx +++ /dev/null @@ -1,78 +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 <rtl/ustring.hxx> - -#include <typelib/typedescription.h> - -#include <uno/any2.h> - - -typedef struct _uno_Environment uno_Environment; -struct remote_Interface; - - - -namespace bridges_urp { - - const sal_uInt8 HDRFLAG_LONGHEADER = 0x80; - const sal_uInt8 HDRFLAG_REQUEST = 0x40; - const sal_uInt8 HDRFLAG_NEWTYPE = 0x20; - const sal_uInt8 HDRFLAG_NEWOID = 0x10; - const sal_uInt8 HDRFLAG_NEWTID = 0x08; - const sal_uInt8 HDRFLAG_LONGMETHODID = 0x04; - const sal_uInt8 HDRFLAG_IGNORECACHE = 0x02; - const sal_uInt8 HDRFLAG_MOREFLAGS = 0x01; - const sal_uInt8 HDRFLAG_MUSTREPLY = 0x80; - const sal_uInt8 HDRFLAG_SYNCHRONOUS = 0x40; - - const sal_uInt8 HDRFLAG_EXCEPTION = 0x20; - - void SAL_CALL urp_sendCloseConnection( uno_Environment *pEnvRemote ); - - extern "C" void SAL_CALL urp_sendRequest( - uno_Environment *pEnvRemote, - typelib_TypeDescription const * pMemberType, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pInterfaceType, - void *pReturn, - void *ppArgs[], - uno_Any **ppException - ); - - void SAL_CALL urp_sendRequest_internal( - uno_Environment *pEnvRemote, - typelib_TypeDescription const * pMemberType, - rtl_uString *pOid, - typelib_InterfaceTypeDescription *pInterfaceType, - void *pReturn, - void *ppArgs[], - uno_Any **ppException - ); - -} - diff --git a/bridges/source/remote/urp/urp_environment.cxx b/bridges/source/remote/urp/urp_environment.cxx deleted file mode 100644 index 501bda1df..000000000 --- a/bridges/source/remote/urp/urp_environment.cxx +++ /dev/null @@ -1,551 +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_bridges.hxx" - -#include <stdio.h> - -#include <osl/interlck.h> -#include <osl/diagnose.h> -#include <osl/conditn.h> -#include <osl/mutex.hxx> -#include <osl/process.h> - -#include <rtl/alloc.h> -#include <rtl/uuid.h> -#include <rtl/unload.h> - -#include <uno/environment.h> -#include <uno/lbnames.h> -#include <uno/mapping.hxx> -#include <uno/threadpool.h> - -#include <com/sun/star/uno/Sequence.hxx> - -#include <bridges/remote/proxy.hxx> -#include <bridges/remote/stub.hxx> -#include <bridges/remote/context.h> -#include <bridges/remote/mapping.hxx> -#include <bridges/remote/counter.hxx> -#include <bridges/remote/bridgeimpl.hxx> -#include <bridges/remote/helper.hxx> - -#include "urp_bridgeimpl.hxx" -#include "urp_writer.hxx" -#include "urp_reader.hxx" -#include "urp_dispatch.hxx" -#include "urp_log.hxx" -#include "urp_propertyobject.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -namespace bridges_urp -{ -rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; - -// static void dumpProperties( struct Properties *p ) -// { -// fprintf( stderr , "FlushBlockSize : %d\n" , p->nFlushBlockSize ); -// fprintf( stderr , "OnewayTimeoutMUSEC : %d\n" , p->nOnewayTimeoutMUSEC ); -// fprintf( stderr , "OidCacheSize : %d\n" , p->nOidCacheSize ); -// fprintf( stderr , "TypeCacheSize : %d\n" , p->nTypeCacheSize ); -// fprintf( stderr , "TidCacheSize : %d\n" , p->nTidCacheSize ); -// OString o = OUStringToOString( p->sSupportedVersions , RTL_TEXTENCODING_ASCII_US ); -// fprintf( stderr , "SupportedVersions : %s\n" , o.pData->buffer ); -// o = OUStringToOString( p->sVersion , RTL_TEXTENCODING_ASCII_US ); -// fprintf( stderr , "Version : %s\n" , o.pData->buffer ); -// fprintf( stderr , "SupportsMultipleSynchronous : %d\n" , p->bSupportsMultipleSynchronous ); -// fprintf( stderr , "SupportsMustReply : %d\n" , p->bSupportsMustReply ); -// fprintf( stderr , "SupportsSynchronous : %d\n" , p->bSupportsSynchronous ); -// } - -// PropertySetterThread -//------------------------------------ -class PropertySetterThread : public ::osl::Thread -{ - urp_BridgeImpl *m_pImpl; - ::rtl::OUString m_sProps; - uno_Environment *m_pEnvRemote; -public: - PropertySetterThread( uno_Environment *pEnvRemote, - urp_BridgeImpl *pImpl, - const ::rtl::OUString & props ) - : m_pImpl( pImpl ) - , m_sProps( props ) - , m_pEnvRemote( pEnvRemote ) - { - if (m_sProps.getLength() > 0) { - m_sProps += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(",")); - } - m_sProps += rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("CurrentContext=")); - // hold the environment in case all references are released before this - // thread terminates - m_pEnvRemote->acquire( pEnvRemote ); - } - ~PropertySetterThread() - { - m_pEnvRemote->release( m_pEnvRemote ); - } - - virtual void SAL_CALL run() - { - for (;;) - { - switch ( m_pImpl->m_pPropertyObject->localRequestChange( ) ) - { - case 1: - sal_Bool bExceptionThrown; - m_pImpl->m_pPropertyObject->localCommitChange( m_sProps , &bExceptionThrown ); - OSL_ENSURE( !bExceptionThrown, "properties were not set\n" ); - goto done; - case 0: - OSL_TRACE( "urp-bridge : remote-counterpart won the changing-the-protocol-race\n" ); - goto done; - } - } - done: - m_pImpl->m_initialized.set(); - } - virtual void SAL_CALL onTerminated() - { - delete this; - } -}; -//------------------------------------ - - -void test_cache() -{ - OUString a = OUString( RTL_CONSTASCII_USTRINGPARAM( "a" ) ); - OUString b = OUString( RTL_CONSTASCII_USTRINGPARAM( "b" ) ); - OUString c = OUString( RTL_CONSTASCII_USTRINGPARAM( "c" ) ); - Cache < OUString , equalOUString > cache ( 2 ); - - sal_Int32 n = cache.put( a ); - if (cache.seek( a ) != n) - { - OSL_ASSERT( false ); - } - OSL_ASSERT( 0 == n ); - - n = cache.put( b ); - OSL_ASSERT( 1 == n ); - - cache.put( c ); - - OSL_ASSERT( 0xffff == cache.seek( a ) ); - OSL_ASSERT( 1 == cache.seek( b ) ); - OSL_ASSERT( 0 == cache.seek( c ) ); - - OSL_ASSERT( 1 == cache.put( a ) ); - OSL_ASSERT( 0xffff == cache.seek( b) ); - OSL_ASSERT( 1 == cache.seek( a ) ); - OSL_ASSERT( 0 == cache.seek( c ) ); -} - -/******************* - * Are we within thread, that calls destructors of static objects ? - *******************/ -sal_Bool g_bStaticDestructorsCalled = sal_False; -struct StaticSingleton -{ - ~StaticSingleton() - { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - g_bStaticDestructorsCalled = sal_True; - } -}; -StaticSingleton singleton; - -#if OSL_DEBUG_LEVEL > 1 -static MyCounter thisCounter( "Remote Environment" ); -#endif - -void SAL_CALL allThreadsAreGone( uno_Environment * pEnvRemote ) -{ - remote_Context *pContext = (remote_Context *) pEnvRemote->pContext; - urp_BridgeImpl *pImpl = ( urp_BridgeImpl *) pContext->m_pBridgeImpl; - - // if the current thread is not the writer thread, the writer thread - // object is not destroyed up to now, though it may already have run out. - // In both cases, it must be safe to cal pImpl->m_pWriter->getIdentifier() - OSL_ASSERT( pImpl->m_pWriter ); - if( pImpl->m_pWriter->getIdentifier() == osl_getThreadIdentifier(0) ) - { - // This is the writer thread. It has done some release calls, - // and is now the last one, that was active. Because the writer - // thread holds the environment weakly, there may also be a thread within - // the dispose of the bridge ( because the enviroment may have a refcount == 0 ). - // However, this thread MUST wait for the writer thread, so it is perfectly ok, - // not to set m_cndWaitForThreads. ( The check for m_nRemoteThreads is done - // after the join of the writer thread ). - } - else - { - pImpl->m_cndWaitForThreads.set(); - } - -} - -void SAL_CALL releaseStubs( uno_Environment *pEnvRemote ) -{ - - ((remote_Context * ) pEnvRemote->pContext )->m_pBridgeImpl->m_bReleaseStubsCalled = sal_True; - - remote_Interface **ppInterfaces = 0; - sal_Int32 nCount; - pEnvRemote->pExtEnv->getRegisteredInterfaces( pEnvRemote->pExtEnv, - (void***)&ppInterfaces, - &nCount, - rtl_allocateMemory ); - - sal_Int32 i; - for( i = 0 ; i < nCount ; i ++ ) - { - if( ppInterfaces[i]->acquire == bridges_remote::acquireUno2RemoteStub ) - { - // these are freed by the environment, so no release necessary - pEnvRemote->pExtEnv->revokeInterface( pEnvRemote->pExtEnv, ppInterfaces[i] ); - } - else - { - ppInterfaces[i]->release( ppInterfaces[i] ); - } - } - - rtl_freeMemory( (void*) ppInterfaces ); -} - -} // end namespace bridges_urp - -using namespace bridges_urp; - -extern "C" { - -static void SAL_CALL RemoteEnvironment_thisDispose( uno_Environment *pEnvRemote ) -{ - remote_Context *pContext = (remote_Context *) pEnvRemote->pContext; - urp_BridgeImpl *pImpl = ( urp_BridgeImpl *) pContext->m_pBridgeImpl; - - ::osl::ClearableMutexGuard guard( pImpl->m_disposingMutex ); - if( pContext->m_pBridgeImpl->m_bDisposed && - ( ! pImpl->m_pReader || - osl_getThreadIdentifier(0) == - (oslThreadIdentifier) pImpl->m_pReader->getIdentifier() ) ) - { - return; - } - // in case, that the static destructors already have been called, no - // tiding up is done. - bool tidyUp; - { - ::osl::MutexGuard guard2( ::osl::Mutex::getGlobalMutex() ); - tidyUp = ! g_bStaticDestructorsCalled && - ! pContext->m_pBridgeImpl->m_bDisposed; - } - if( tidyUp ) - { - // TODO : not threadsafe - // synchronization with dispatch methods needed ! - - pImpl->m_bDisposed = sal_True; - - - // close the connection - uno_threadpool_dispose( pImpl->m_hThreadPool ); - pImpl->m_pWriter->abortThread(); - pContext->m_pConnection->close( pContext->m_pConnection ); - - if( osl_getThreadIdentifier(0) == - (oslThreadIdentifier) pImpl->m_pReader->getIdentifier() ) - { - // This is the reader thread. Let the thread destroy itself - // the reader thread object must also release the connection at this stage ! - pImpl->m_pReader->destroyYourself(); - pImpl->m_pReader = 0; - } - else - { - // wait for the reader thread - // the reader thread object must also release the connection, - // when terminating !!!! - pImpl->m_pReader->join(); - } - - // wait for the writer thread - pImpl->m_pWriter->join(); - - // now let the context go ! - pContext->dispose( pContext ); - - if( 0 != pImpl->m_nRemoteThreads ) - { - // Wait for all threads - guard.clear(); - pImpl->m_cndWaitForThreads.wait(); - OSL_ASSERT( ! pImpl->m_nRemoteThreads ); - } - else - { - guard.clear(); - } -#ifdef BRIDGES_URP_PROT - if( pImpl->m_pLogFile ) - { - fclose( pImpl->m_pLogFile ); - pImpl->m_pLogFile = 0; - } -#endif -#if OSL_DEBUG_LEVEL > 1 - pImpl->dumpErrors( stderr ); -#endif - - // destroy the threads - delete pImpl->m_pWriter; - pImpl->m_pWriter = 0; - - if( pImpl->m_pReader != 0 ) - { - // This is not the reader thread, so the thread object is deleted - delete pImpl->m_pReader; - pImpl->m_pReader = 0; - } - - bool bReleaseStubs = false; - { - ::osl::MutexGuard guard2( ::osl::Mutex::getGlobalMutex() ); - bReleaseStubs = !g_bStaticDestructorsCalled; - } - if( bReleaseStubs ) - { - releaseStubs( pEnvRemote ); - } - } -} - -static void SAL_CALL RemoteEnvironment_thisDisposing( - uno_Environment *pEnvRemote ) -{ - remote_Context *pContext = (remote_Context * )pEnvRemote->pContext; - urp_BridgeImpl *pImpl = ((urp_BridgeImpl*) pContext->m_pBridgeImpl); - - { - ::osl::ClearableMutexGuard guard( pImpl->m_disposingMutex ); - if( ! pImpl->m_bDisposed ) - { - guard.clear(); - urp_sendCloseConnection( pEnvRemote ); - RemoteEnvironment_thisDispose( pEnvRemote ); - } - } - pImpl->m_pPropertyObject->thisRelease(); - pImpl->m_pPropertyObject = 0; - - uno_threadpool_destroy( pImpl->m_hThreadPool ); - - delete pImpl; - pContext->aBase.release( (uno_Context * ) pContext ); - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif -} - -static void SAL_CALL RemoteEnvironment_thisComputeObjectIdentifier( - uno_ExtEnvironment *, rtl_uString **, void *) -{ - OSL_ENSURE( 0, "RemoteEnvironment_thisComputeObjectIdentifier should never be called" ); -} - -static void SAL_CALL RemoteEnvironment_thisAcquireInterface( - uno_ExtEnvironment *, void *pInterface ) -{ - ((remote_Interface *)pInterface)->acquire( ( remote_Interface *) pInterface ); -} - -static void SAL_CALL RemoteEnvironment_thisReleaseInterface( - uno_ExtEnvironment *, void *pInterface ) -{ - ((remote_Interface *)pInterface)->release( ( remote_Interface *) pInterface ); -} - -//################################################################################################## -void SAL_CALL uno_initEnvironment( uno_Environment * pEnvRemote ) -{ - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - // set C-virtual methods - pEnvRemote->environmentDisposing = RemoteEnvironment_thisDisposing; - pEnvRemote->pExtEnv->computeObjectIdentifier = RemoteEnvironment_thisComputeObjectIdentifier; - pEnvRemote->pExtEnv->acquireInterface = RemoteEnvironment_thisAcquireInterface; - pEnvRemote->pExtEnv->releaseInterface = RemoteEnvironment_thisReleaseInterface; - pEnvRemote->dispose = RemoteEnvironment_thisDispose; - - remote_Context *pContext = ( remote_Context * ) pEnvRemote->pContext; - pContext->aBase.acquire( ( uno_Context * ) pContext ); - pContext->getRemoteInstance = ::bridges_remote::remote_sendQueryInterface; - - // Initialize impl struct urp_BridgeImpl - urp_BridgeImpl *pImpl = new ::bridges_urp::urp_BridgeImpl( 256, 8192 ); - pContext->m_pBridgeImpl = pImpl; - - // Initialize threadpool - pImpl->m_hThreadPool = uno_threadpool_create(); - - // take the bridgepointer as id - pImpl->m_properties.seqBridgeID = ByteSequence( (sal_Int8*)&pEnvRemote , sizeof( pEnvRemote ) ); - - pImpl->m_allThreadsAreGone = allThreadsAreGone; - pImpl->m_sendRequest = urp_sendRequest; - pImpl->m_nRemoteThreads = 0; - pImpl->m_bDisposed = sal_False; - pImpl->m_bReleaseStubsCalled = sal_False; - - pImpl->m_pPropertyObject = new PropertyObject( &(pImpl->m_properties ), pEnvRemote, pImpl ); - pImpl->m_pPropertyObject->thisAcquire(); - - OUString sProtocolProperties; - if( pContext->m_pProtocol->length > 3 ) - { - sProtocolProperties = OUString( pContext->m_pProtocol ).copy( 4, pContext->m_pProtocol->length-4); - } - if( sProtocolProperties.getLength() ) - { - struct Properties props = pImpl->m_properties; - assignFromStringToStruct( sProtocolProperties , &props ); - if( ! props.bNegotiate ) - { - // no negotiation takes place, the creator of the bridge knows the parameter - // of the other side ! - pImpl->applyProtocolChanges( props ); - sProtocolProperties = OUString(); - } - } - -#ifdef BRIDGES_URP_PROT - char *p = getenv( "PROT_REMOTE" ); - pImpl->m_pLogFile = 0; - if( p ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - static int counter; - oslProcessInfo data; - data.Size = sizeof( data ); - osl_getProcessInfo( 0 , osl_Process_HEAPUSAGE | osl_Process_IDENTIFIER , &data ); - OString s(p); - s += "_pid"; - s += OString::valueOf( (sal_Int32) data.Ident ); - s += "_"; - s += OString::valueOf( (sal_Int32) counter ); - pImpl->m_sLogFileName = s; - // clear the file - FILE *f = fopen( s.getStr() , "w" ); - OSL_ASSERT( f ); - if( getenv( "PROT_REMOTE_FAST") ) - { - pImpl->m_pLogFile = f; - } - else - { - fclose( f ); - } - counter++; - } -#endif - - // start reader and writer threads - pImpl->m_pWriter = new ::bridges_urp::OWriterThread( pContext->m_pConnection , pImpl, - pEnvRemote); - pImpl->m_pWriter->create(); - - pImpl->m_pReader = new ::bridges_urp::OReaderThread( pContext->m_pConnection , - pEnvRemote, - pImpl->m_pWriter ); - pImpl->m_pReader->create(); - - PropertySetterThread *pPropsSetterThread = - new PropertySetterThread( pEnvRemote, pImpl , sProtocolProperties ); - pPropsSetterThread->create(); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - - -//################################################################################################## -void SAL_CALL uno_ext_getMapping( - uno_Mapping ** ppMapping, - uno_Environment * pFrom, - uno_Environment * pTo ) -{ - OSL_ASSERT( ppMapping && pFrom && pTo ); - if (ppMapping && pFrom && pTo) - { - if (*ppMapping) - ((*ppMapping)->release)( *ppMapping ); - bridges_remote::RemoteMapping * pMapping = 0; - - ::rtl::OUString sFromName = pFrom->pTypeName; - ::rtl::OUString sToName = pTo->pTypeName; - ::rtl::OUString sUno = OUString::createFromAscii( UNO_LB_UNO ); - ::rtl::OUString sRemote = OUString::createFromAscii( "urp" ); - if ( sFromName.equalsIgnoreAsciiCase( sRemote ) && - sToName.equalsIgnoreAsciiCase( sUno ) ) - { - pMapping = new bridges_remote::RemoteMapping( pTo, /* Uno */ - pFrom, /*remote*/ - bridges_remote::remoteToUno, - OUString() ); - } - else if ( sFromName.equalsIgnoreAsciiCase( sUno ) && - sToName.equalsIgnoreAsciiCase( sRemote ) ) - { - pMapping = new bridges_remote::RemoteMapping( pFrom , - pTo , - bridges_remote::unoToRemote, - OUString() ); - } - - *ppMapping = (uno_Mapping * )pMapping; - OUString dummy; - uno_registerMapping( ppMapping , - bridges_remote::freeRemoteMapping, - pFrom , - pTo , - dummy.pData ); - } -} - -sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) -{ - return g_moduleCount.canUnload( &g_moduleCount , pTime ); -} - -} diff --git a/bridges/source/remote/urp/urp_job.cxx b/bridges/source/remote/urp/urp_job.cxx deleted file mode 100644 index e8ea104b7..000000000 --- a/bridges/source/remote/urp/urp_job.cxx +++ /dev/null @@ -1,939 +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_bridges.hxx" -#include <string.h> -#include <stdio.h> -#include <osl/diagnose.h> -#include <osl/mutex.hxx> - -#include <rtl/alloc.h> -#include <rtl/ustrbuf.hxx> - -#include <uno/current_context.h> -#include <uno/current_context.hxx> -#include <uno/threadpool.h> - -#include <bridges/cpp_uno/type_misc.hxx> -#include <bridges/remote/proxy.hxx> - -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/XCurrentContext.hpp> -#include <com/sun/star/lang/DisposedException.hpp> - -#include "urp_job.hxx" -#include "urp_bridgeimpl.hxx" -#include "urp_writer.hxx" -#include "urp_dispatch.hxx" -#include "urp_log.hxx" -#include "urp_marshal.hxx" -#include "urp_propertyobject.hxx" -#include "urp_reader.hxx" - -using namespace ::std; -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -using namespace bridges_urp; - -extern "C" { - -static void SAL_CALL doit(void * job) { - ServerMultiJob * p = static_cast< ServerMultiJob * >(job); - p->execute(); - delete p; -} - -} - -namespace bridges_urp -{ - static sal_Bool isDisposedExceptionDescriptionAvail( const Type &type ) - { - static sal_Bool bInit; - static sal_Bool bReturn; - // we don't care for thread safety here, as both threads must come - // to the same result - if( ! bInit ) - { - typelib_TypeDescription *pTD = 0; - typelib_typedescriptionreference_getDescription( & pTD, type.getTypeLibType() ); - if( pTD ) - { - bReturn = sal_True; - typelib_typedescription_release( pTD ); - } - else - { - bReturn = sal_False; - } - bInit = sal_True; - } - return bReturn; - } - - //-------------------------------------------------------------------------------------- - static void prepareRuntimeExceptionClientSide( uno_Any **ppException , const OUString &s) - { - com::sun::star::lang::DisposedException exception( s , Reference< XInterface > () ); - Type type = ::getCppuType( &exception ); - if( !isDisposedExceptionDescriptionAvail( type ) ) - { - // if it is not available (probably missing type library), - // then we are satisfied with throwing a normal runtime exception, - // for which cppu provides a static description - type = getCppuType( ( RuntimeException * ) 0 ); - } - uno_type_any_construct( *ppException , &exception , type.getTypeLibType() , 0 ); - } - - - Job::Job( uno_Environment *pEnvRemote, - remote_Context *pContext, - sal_Sequence *pTid, - struct urp_BridgeImpl *pBridgeImpl, - Unmarshal *pUnmarshal ) - : m_pContext( pContext ) - , m_pUnmarshal( pUnmarshal ) - , m_pBridgeImpl( pBridgeImpl ) - , m_pTid( pTid ) - , m_counter( pEnvRemote ) - { - if ( m_pContext ) - { - m_pContext->aBase.acquire( &m_pContext->aBase ); - } - if( m_pTid ) - rtl_byte_sequence_acquire( pTid ); - } - - Job::~Job() - { - if( m_pTid ) - rtl_byte_sequence_release( m_pTid ); - if ( m_pContext ) - { - m_pContext->aBase.release( &m_pContext->aBase ); - } - } - - - - - //-------------------------------------------------------------------------------------- - sal_Bool ClientJob::extract( ) - { - sal_Bool bReturn = sal_True; - //------------------------------- - // Handle the reply, unpack data - //------------------------------- - if( m_bExceptionOccured ) - { - bReturn = m_pUnmarshal->unpackAny( *m_ppException ); - } - else - { - //--------------------------------- - // alles ist gut - //--------------------------------- - if( m_pMethodType ) - { - if( m_pMethodType->pReturnTypeRef->eTypeClass != typelib_TypeClass_VOID ) - { - typelib_TypeDescription *pType = 0; - TYPELIB_DANGER_GET( &pType , m_pMethodType->pReturnTypeRef ); - bReturn = m_pUnmarshal->unpack( m_pReturn , pType ) && bReturn; - TYPELIB_DANGER_RELEASE( pType ); - } - - // out parameters - sal_Int32 i; - for( i = 0 ; i < m_pMethodType->nParams ; i ++ ) - { - if( m_pMethodType->pParams[i].bOut ) - { - typelib_TypeDescription *pType = 0; - TYPELIB_DANGER_GET( &pType , m_pMethodType->pParams[i].pTypeRef ); - if( m_pMethodType->pParams[i].bIn ) - { - uno_destructData( m_ppArgs[i] , pType , ::bridges_remote::remote_release ); - } - bReturn = m_pUnmarshal->unpack( m_ppArgs[i] , pType ) && bReturn; - TYPELIB_DANGER_RELEASE( pType ); - } - } - } - else if( m_pAttributeType && m_pReturn ) - { - typelib_TypeDescription *pType = 0; - TYPELIB_DANGER_GET( &pType , m_pAttributeType->pAttributeTypeRef ); - bReturn = m_pUnmarshal->unpack( m_pReturn , pType ) && bReturn; - TYPELIB_DANGER_RELEASE( pType ); - } - else if( m_pAttributeType && m_ppArgs ) - { - // nothing to do - } - else - { - OSL_ASSERT( 0 ); - } - } - return bReturn; - } - - //------------------------------------------------------------------------------------------- - void ClientJob::initiate() - { - uno_threadpool_putJob( m_pBridgeImpl->m_hThreadPool, m_pTid , this, 0, sal_False); - } - - //-------------------------------------------------------------------------------------------- - sal_Bool ClientJob::pack() - { - sal_Bool bSuccess = sal_True; - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - - if( m_pMethodType && - REMOTE_RELEASE_METHOD_INDEX == m_pMethodType->aBase.nPosition && - ! m_pBridgeImpl->m_bDisposed && - m_pBridgeImpl->m_pWriter->getIdentifier() != ::osl::Thread::getCurrentIdentifier() ) - { - // all release calls are delegated to the writer thread to avoid - // multiple synchron calls with the same thread id and reentrant - // marshaling (in case during destruction of parameters a release is - // invoked ). - m_pBridgeImpl->m_pWriter->insertReleaseRemoteCall( - m_pOid, m_pInterfaceType->aBase.pWeakRef ); - - // No waiting, please - return sal_False; - } - else if ( m_pMethodType && - REMOTE_RELEASE_METHOD_INDEX == m_pMethodType->aBase.nPosition && - m_pBridgeImpl->m_bDisposed ) - { - // no exception for release calls ! - return sal_False; - } - else if( m_pBridgeImpl->m_bDisposed ) - { - OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "URP-Bridge: disposed" ) ); - buf.append( m_pBridgeImpl->getErrorsAsString() ); - prepareRuntimeExceptionClientSide( m_ppException , buf.makeStringAndClear() ); - return sal_False; - } - - // build up the flag byte - sal_Bool bType = sal_False, bOid = sal_False, bTid = sal_False; - sal_uInt8 nFlags = 0; - if( m_pBridgeImpl->m_lastOutType.getTypeLibType() != m_pInterfaceType->aBase.pWeakRef && - ! typelib_typedescriptionreference_equals( - m_pBridgeImpl->m_lastOutType.getTypeLibType(), m_pInterfaceType->aBase.pWeakRef ) ) - { - //new type - nFlags = nFlags | HDRFLAG_NEWTYPE; - bType = sal_True; - } - if( m_pBridgeImpl->m_lastOutOid.pData != m_pOid && - rtl_ustr_compare_WithLength( m_pBridgeImpl->m_lastOutOid.pData->buffer, - m_pBridgeImpl->m_lastOutOid.pData->length, - m_pOid->buffer, - m_pOid->length ) ) - { - //new object id - nFlags = nFlags | HDRFLAG_NEWOID; - bOid = sal_True; - } - if( m_pBridgeImpl->m_lastOutTid.getHandle() != m_pTid && - !(m_pBridgeImpl->m_lastOutTid == *(ByteSequence*) &(m_pTid) ) ) - { - // new threadid - nFlags = nFlags | HDRFLAG_NEWTID; - bTid = sal_True; - } - - if( m_bCallingConventionForced ) - { - nFlags = nFlags | HDRFLAG_MOREFLAGS; - } -#ifdef BRIDGES_URP_PROT - sal_Int32 nLogStart = m_pBridgeImpl->m_blockMarshaler.getPos(); -#endif - // Short request headers can only handle 14-bit method IDs, so - // unconditionally use a long header for method IDs that are too large: - if( nFlags || m_nMethodIndex >= 0xC000 ) - { - // the flag byte is needed + request - nFlags = nFlags | HDRFLAG_LONGHEADER | HDRFLAG_REQUEST; // - - // as long as we do not have customized calls, no MOREFLAGS must be set - if( m_nMethodIndex >= 0x100 ) - { - nFlags = nFlags | HDRFLAG_LONGMETHODID; - } - m_pBridgeImpl->m_blockMarshaler.packInt8( &nFlags ); - - if( nFlags & HDRFLAG_MOREFLAGS ) - { - sal_uInt8 nMoreFlags = 0; - if( ! m_bOneway ) - { - nMoreFlags = HDRFLAG_SYNCHRONOUS |HDRFLAG_MUSTREPLY; - } - m_pBridgeImpl->m_blockMarshaler.packInt8( &nMoreFlags ); - } - if( nFlags & HDRFLAG_LONGMETHODID ) - { - sal_uInt16 nMethod = (sal_uInt16 ) m_nMethodIndex; - m_pBridgeImpl->m_blockMarshaler.packInt16( &nMethod ); - } - else - { - sal_uInt8 nMethod = (sal_uInt8) m_nMethodIndex; - m_pBridgeImpl->m_blockMarshaler.packInt8( &nMethod ); - } - } - else - { - // no flag byte needed, simply marshal the method index - if( m_nMethodIndex >= 64 ) - { - sal_uInt16 nMethod = ( sal_uInt16 ) m_nMethodIndex; - nMethod = nMethod | 0x4000; - m_pBridgeImpl->m_blockMarshaler.packInt16( &nMethod ); - } - else - { - sal_uInt8 nMethod = (sal_uInt8 ) m_nMethodIndex; - m_pBridgeImpl->m_blockMarshaler.packInt8( &nMethod ); - } - } - - // marshal type,oid,tid - if( bType ) - { - m_pBridgeImpl->m_lastOutType = m_pInterfaceType->aBase.pWeakRef; - m_pBridgeImpl->m_blockMarshaler.packType( &(m_pBridgeImpl->m_lastOutType) ); - } - if( bOid ) - { - m_pBridgeImpl->m_lastOutOid = *(OUString *)&m_pOid; - m_pBridgeImpl->m_blockMarshaler.packOid( m_pBridgeImpl->m_lastOutOid ); - } - if( bTid ) - { - m_pBridgeImpl->m_lastOutTid = *(ByteSequence*)&(m_pTid); - m_pBridgeImpl->m_blockMarshaler.packTid( m_pBridgeImpl->m_lastOutTid ); - } - - if ( m_pBridgeImpl->m_properties.bCurrentContext - && m_nMethodIndex != REMOTE_RELEASE_METHOD_INDEX - && m_pContext != 0 ) - { - void * pCc = 0; - rtl::OUString aEnvName( RTL_CONSTASCII_USTRINGPARAM( "urp" ) ); - bSuccess = bSuccess && uno_getCurrentContext( - &pCc, aEnvName.pData, m_pContext ); - typelib_TypeDescription * pType = 0; - TYPELIB_DANGER_GET( - &pType, XCurrentContext::static_type().getTypeLibType() ); - bSuccess = bSuccess && m_pBridgeImpl->m_blockMarshaler.pack( - &pCc, pType ); - TYPELIB_DANGER_RELEASE( pType ); - if ( pCc ) - { - remote_Interface * p = static_cast< remote_Interface * >( pCc ); - p->release( p ); - } - } - - // marshal arguments ! -#ifdef BRIDGES_URP_PROT - sal_Int32 nLogHeader = m_pBridgeImpl->m_blockMarshaler.getPos(); -#endif - if( m_pMethodType ) - { - sal_Int32 i; - for( i = 0 ; i < m_pMethodType->nParams ; i ++ ) - { - if( m_pMethodType->pParams[i].bIn ) - { - typelib_TypeDescription *pType = 0; - TYPELIB_DANGER_GET( &pType , m_pMethodType->pParams[i].pTypeRef ); - if( pType ) - { - bSuccess = - bSuccess && m_pBridgeImpl->m_blockMarshaler.pack( m_ppArgs[i] , pType ); - TYPELIB_DANGER_RELEASE( pType ); - } - else - { - bSuccess = sal_False; - OUStringBuffer buffer( 128 ); - buffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "no typedescription available for type" ) ); - buffer.append( m_pMethodType->pParams[i].pTypeRef->pTypeName ); - m_pBridgeImpl->addError( buffer.makeStringAndClear() ); - } - } - } - } - else if( m_pAttributeType && m_pReturn ) - { - // nothing to do ! - } - else if( m_pAttributeType && m_ppArgs ) - { - typelib_TypeDescription *pType = 0; - TYPELIB_DANGER_GET( &pType , m_pAttributeType->pAttributeTypeRef ); - if( pType ) - { - bSuccess = bSuccess && m_pBridgeImpl->m_blockMarshaler.pack( m_ppArgs[0] , pType ); - TYPELIB_DANGER_RELEASE( pType ); - } - else - { - bSuccess = sal_False; - OUStringBuffer buffer( 128 ); - buffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "no typedescription available for type" ) ); - buffer.append( m_pAttributeType->pAttributeTypeRef->pTypeName ); - m_pBridgeImpl->addError( buffer.makeStringAndClear() ); - } - } - else - { - OSL_ASSERT( 0 ); - } - -#ifdef BRIDGES_URP_PROT - urp_logCall( m_pBridgeImpl, m_pBridgeImpl->m_blockMarshaler.getPos() - nLogStart, - m_pBridgeImpl->m_blockMarshaler.getPos() - nLogHeader, ! m_bOneway, - m_pMethodType ? m_pMethodType->aBase.pMemberName : - m_pAttributeType->aBase.pMemberName ); -#endif - - if( bSuccess ) - { - if( ! m_bOneway ) - { - uno_threadpool_attach( m_pBridgeImpl->m_hThreadPool ); - m_pBridgeImpl->m_clientJobContainer.add( *(ByteSequence*)&(m_pTid), this ); - } - - m_pBridgeImpl->m_nMarshaledMessages ++; - //--------------------------- - // Inform the writer thread, that there is some work to do - //--------------------------- - m_pBridgeImpl->m_pWriter->touch( ! m_bOneway ); - - if( m_bOneway ) - { - *m_ppException = 0; - } - } - else - { - // Something went wrong during packing, which means, that the caches may not be in sync - // anymore. So we have no other choice than to dispose the environment. - m_pEnvRemote->dispose( m_pEnvRemote ); - OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Error during marshaling " ) ); - if( m_pMethodType ) - { - buf.append( m_pMethodType->aBase.aBase.pTypeName ); - } - else if( m_pAttributeType ) - { - buf.append( m_pAttributeType->aBase.aBase.pTypeName ); - } - buf.appendAscii( "\n" ); - buf.append( m_pBridgeImpl->getErrorsAsString() ); - prepareRuntimeExceptionClientSide( m_ppException , buf.makeStringAndClear() ); - } - return bSuccess; - // release the guard - } - - //------------------------------------------------------------------------------------ - void ClientJob::wait() - { - //--------------------------- - // Wait for the reply - //--------------------------- - void * pDisposeReason = 0; - - uno_threadpool_enter(m_pBridgeImpl->m_hThreadPool, &pDisposeReason ); - - if( ! pDisposeReason ) - { - // thread has been disposed ! - // avoid leak due continous calling on a disposed reference. The - // reply may or may not be within the container. If the reader thread - // got into problems during unmarshaling the reply for this request, - // it won't be in the container anymore, but it is eiterway safe to call - // the method - ClientJob *pJob = - m_pBridgeImpl->m_clientJobContainer.remove( *(ByteSequence*) &m_pTid ); - if( pJob != this ) - { - // this is not our job, it is probably one of the callstack below, so - // push it back - m_pBridgeImpl->m_clientJobContainer.add( *(ByteSequence*) &m_pTid , pJob ); - } - - OUStringBuffer sMessage( 256 ); - sMessage.appendAscii( RTL_CONSTASCII_STRINGPARAM( "URP_Bridge : disposed\n" ) ); - sMessage.append( m_pBridgeImpl->getErrorsAsString() ); - prepareRuntimeExceptionClientSide( m_ppException, sMessage.makeStringAndClear() ); - m_bExceptionOccured = sal_True; - } - else - { - OSL_ASSERT( pDisposeReason == (void*)this ); - } - if( !m_bExceptionOccured ) - { - *m_ppException = 0; - } - uno_threadpool_detach( m_pBridgeImpl->m_hThreadPool ); - } - - //------------------------------------------------------------------------------------ - // ServerMultiJob - //------------------------------------------------------------------------------------ - ServerMultiJob::ServerMultiJob( - uno_Environment *pEnvRemote, - remote_Context *pContext, - sal_Sequence *pTid, - struct urp_BridgeImpl *pBridgeImpl, - Unmarshal *pUnmarshal, - sal_Int32 nMaxMessages ) - : Job( pEnvRemote, pContext, pTid, pBridgeImpl, pUnmarshal ) - , m_pEnvRemote( pEnvRemote ) - , m_nCalls( 0 ) - , m_nMaxMessages( nMaxMessages ) - , m_nCurrentMemPosition( 0 ) - { - m_pEnvRemote->acquire( m_pEnvRemote ); - m_nCurrentMemSize = MULTIJOB_STANDARD_MEMORY_SIZE + m_nMaxMessages * ( - MULTIJOB_PER_CALL_MEMORY_SIZE + sizeof(ServerJobEntry) + sizeof(MemberTypeInfo) ); - m_pCurrentMem = ( sal_Int8 * ) rtl_allocateMemory( m_nCurrentMemSize ); - m_aEntries = ( ServerJobEntry * ) getHeap( m_nMaxMessages * sizeof( ServerJobEntry ) ); - m_aTypeInfo = ( MemberTypeInfo * ) getHeap( m_nMaxMessages * sizeof( MemberTypeInfo ) ); - } - - ServerMultiJob::~ServerMultiJob() - { - sal_Int32 i; - for( i = 0 ; i < m_nCalls ; i ++ ) - { - struct MemberTypeInfo *const pMTI = &( m_aTypeInfo[i] ); - struct ServerJobEntry *const pSJE = &( m_aEntries[i] ); - - if( pSJE->m_pRemoteI ) - pSJE->m_pRemoteI->release( pSJE->m_pRemoteI ); - - if( pSJE->m_pOid ) - rtl_uString_release( pSJE->m_pOid ); - - if( pSJE->m_pInterfaceTypeRef ) - typelib_typedescriptionreference_release( pSJE->m_pInterfaceTypeRef ); - - if( pMTI->m_pInterfaceType ) - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *)pMTI->m_pInterfaceType ); - - for( sal_Int32 iArgs = 0 ; iArgs < pMTI->m_nArgCount ; iArgs ++ ) - { - if( pMTI->m_ppArgType[iArgs] ) - TYPELIB_DANGER_RELEASE( pMTI->m_ppArgType [iArgs] ); - } - if( pMTI->m_pReturnType ) - TYPELIB_DANGER_RELEASE( pMTI->m_pReturnType ); - - if( pMTI->m_pMethodType ) - typelib_typedescription_release( (typelib_TypeDescription*)pMTI->m_pMethodType ); - if( pMTI->m_pAttributeType ) - typelib_typedescription_release( (typelib_TypeDescription*)pMTI->m_pAttributeType ); - } - - rtl_freeMemory( m_pCurrentMem ); - for( list< sal_Int8 *>::iterator ii = m_lstMem.begin() ; ii != m_lstMem.end() ; ++ii ) - rtl_freeMemory( *ii ); - - if( m_pEnvRemote ) - m_pEnvRemote->release( m_pEnvRemote ); - } - - //------------------------------------------------------------------------------------- - void ServerMultiJob::execute() - { - Reference< XCurrentContext > xOldCc; - bool bHasOldCc = false; - for( sal_Int32 i = 0; i < m_nCalls ; i ++ ) - { - struct MemberTypeInfo * const pMTI = &( m_aTypeInfo[i] ); - struct ServerJobEntry * const pSJE = &( m_aEntries[i] ); - - if ( pSJE->m_bHasCurrentContext ) - { - if ( !bHasOldCc ) - { - xOldCc = com::sun::star::uno::getCurrentContext(); - bHasOldCc = true; - } - rtl::OUString aEnvName( RTL_CONSTASCII_USTRINGPARAM( "urp" ) ); - if ( !uno_setCurrentContext( - pSJE->m_pCurrentContext, aEnvName.pData, m_pContext ) ) - { - throw RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "fatal: uno_setCurrentContext failed" ) ), - Reference< XInterface >() ); - } - if ( pSJE->m_pCurrentContext ) - { - pSJE->m_pCurrentContext->release( pSJE->m_pCurrentContext ); - } - } - - if( ! pSJE->m_pRemoteI ) - { - // ------------------- - // Initial object ? - // ------------------ - // be robust : Sending a release on a not constructed object - // provokes an segfault. Make sure, the call - // is not a release call. - remote_Context *pRemoteC = ((remote_Context*)m_pEnvRemote->pContext); - - if( ! pMTI->m_bIsReleaseCall && pRemoteC->m_pInstanceProvider ) - { - pSJE->m_pException = &(pSJE->m_exception); - - pRemoteC->m_pInstanceProvider->getInstance( - pRemoteC->m_pInstanceProvider, - m_pEnvRemote, - &(pSJE->m_pRemoteI), - pSJE->m_pOid, - pMTI->m_pInterfaceType, - &(pSJE->m_pException)); - } - else - { - prepareRuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "urp: No instance provider set")),i); - } - } - - if( pSJE->m_pException ) - { - // errors during extracting, do nothing - } - else if( ! pSJE->m_pRemoteI ) - { - // May only occur during the queryInterface call on the initial object !!! - // construct the return value - uno_type_any_construct( (uno_Any*) pSJE->m_pReturn , 0 , 0 , 0 ); - } - else - { - pSJE->m_pException = &(pSJE->m_exception ); - - if( pMTI->m_bIsReleaseCall ) - { - pSJE->m_pRemoteI->release( pSJE->m_pRemoteI ); - pSJE->m_pException = 0; - } - else - { - pSJE->m_pRemoteI->pDispatcher( - pSJE->m_pRemoteI, - pMTI->m_pMethodType ? (typelib_TypeDescription*) pMTI->m_pMethodType : - (typelib_TypeDescription*) pMTI->m_pAttributeType, - pSJE->m_pReturn, - pSJE->m_ppArgs, - &(pSJE->m_pException) ); - } - } - if( pSJE->m_pRemoteI ) - { - /** - Do the release here, in case of ForceSynchronous=1, calls - originated by the destructor of an UNO object must be sent BEFORE the - release returns ( otherwise we don't own the thread anymore ! ) - */ - pSJE->m_pRemoteI->release( pSJE->m_pRemoteI ); - pSJE->m_pRemoteI = 0; - } - - // now destruct parameters and marshal replies - // Note : when call is synchron => m_nCalls == 1 - if( pMTI->m_bIsOneway ) - { - // Oneway call, destruct in parameters - for( sal_Int32 j = 0 ; j < pMTI->m_pMethodType->nParams ; j ++ ) - { - // usually all parameters must be in parameters, but to be robust ... - if( pMTI->m_pbIsIn[j] && !cppu_isSimpleType( pMTI->m_ppArgType[j] ) ) - { - uno_destructData( pSJE->m_ppArgs[j] , pMTI->m_ppArgType[j] , 0 ); - } - } - - if( pSJE->m_pException ) - { - uno_any_destruct( pSJE->m_pException, ::bridges_remote::remote_release ); - } - - } - else - { - // synchron, get the mutex to marshal reply and send immeadiatly - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - - sal_Bool bTid = sal_False; - sal_uInt8 nFlags = HDRFLAG_LONGHEADER; - ByteSequence tid = m_pTid; - if( !( tid == m_pBridgeImpl->m_lastOutTid ) || pSJE->m_bIgnoreCache ) - { - // new threadid - nFlags = nFlags | HDRFLAG_NEWTID; - bTid = sal_True; - } - - if( pSJE->m_pException ) - { - nFlags = nFlags | HDRFLAG_EXCEPTION; - } -#ifdef BRIDGES_URP_PROT - sal_Int32 nLogStart = m_pBridgeImpl->m_blockMarshaler.getPos(); -#endif - m_pBridgeImpl->m_blockMarshaler.packInt8( &nFlags ); - - if( bTid ) - { - if( ! pSJE->m_bIgnoreCache ) - { - m_pBridgeImpl->m_lastOutTid = tid; - } - m_pBridgeImpl->m_blockMarshaler.packTid( tid , pSJE->m_bIgnoreCache ); - } - -#ifdef BRIDGES_URP_PROT - sal_Int32 nLogHeader = m_pBridgeImpl->m_blockMarshaler.getPos(); -#endif - - if( pSJE->m_pException ) - { - //-------------------- - // an exception was thrown - //-------------------- - m_pBridgeImpl->m_blockMarshaler.packAny( &(pSJE->m_exception) ); - uno_any_destruct( &(pSJE->m_exception) , ::bridges_remote::remote_release ); - - // destroy in parameters - for( sal_Int32 j = 0 ; j < pMTI->m_nArgCount ; j ++ ) - { - if( pMTI->m_pbIsIn[j] && ! cppu_isSimpleType( pMTI->m_ppArgType[j] )) - { - uno_destructData( pSJE->m_ppArgs[j] , pMTI->m_ppArgType[j] , - ::bridges_remote::remote_release ); - } - } - } - else - { - //--------------------------- - // alles ist gut ... - //-------------------------- - if( pMTI->m_pReturnType ) - { - m_pBridgeImpl->m_blockMarshaler.pack( - pSJE->m_pReturn, pMTI->m_pReturnType ); - if( ! cppu_isSimpleType( pMTI->m_pReturnType ) ) - { - uno_destructData( pSJE->m_pReturn , pMTI->m_pReturnType , - ::bridges_remote::remote_release ); - } - } - for( sal_Int32 j = 0 ; j < pMTI->m_nArgCount ; j ++ ) - { - if( pMTI->m_pbIsOut[j] ) - { - m_pBridgeImpl->m_blockMarshaler.pack( - pSJE->m_ppArgs[j] , pMTI->m_ppArgType[j] ); - } - if( ! cppu_isSimpleType( pMTI->m_ppArgType[j] ) ) - { - uno_destructData( pSJE->m_ppArgs[j], pMTI->m_ppArgType[j] , - ::bridges_remote::remote_release ); - } - } - } - -#ifdef BRIDGES_URP_PROT - { - typelib_InterfaceMemberTypeDescription *pMemberType = - pMTI->m_pMethodType ? - (typelib_InterfaceMemberTypeDescription*)pMTI->m_pMethodType : - (typelib_InterfaceMemberTypeDescription*)pMTI->m_pAttributeType; - - urp_logReplying( m_pBridgeImpl , - m_pBridgeImpl->m_blockMarshaler.getPos() - nLogStart, - m_pBridgeImpl->m_blockMarshaler.getPos() - nLogHeader, - pMemberType->pMemberName ); - } -#endif - - m_pBridgeImpl->m_nMarshaledMessages ++; - // put it on the wire - m_pBridgeImpl->m_pWriter->touch( sal_True ); - } // MutexGuard marshalingMutex - } - if ( bHasOldCc ) - { - if ( !com::sun::star::uno::setCurrentContext( xOldCc ) ) - { - throw RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "fatal: com::sun::star::uno::setCurrentContext" - " failed" ) ), - Reference< XInterface >() ); - } - } - } - - //------------------------------------------------------------------------------------- - void ServerMultiJob::prepareRuntimeException( const OUString & sMessage , sal_Int32 nCall ) - { - // ------------------------------- - // Construct the DisposedException - // ------------------------------- - com::sun::star::lang::DisposedException exception( sMessage , Reference< XInterface > () ); - Type type = getCppuType( &exception ); - if( !isDisposedExceptionDescriptionAvail( type ) ) - { - // if it is not available (probably missing type library), - // then we are satisfied with throwing a normal runtime exception, - // for which cppu provides a static description - type = getCppuType( ( RuntimeException * ) 0 ); - } - - m_aEntries[nCall].m_pException = &(m_aEntries[nCall].m_exception); - uno_type_any_construct( m_aEntries[nCall].m_pException , &exception , type.getTypeLibType() , 0 ); - } - - //------------------------------------------------------------------------------------- - void ServerMultiJob::initiate() - { - uno_threadpool_putJob( - m_pBridgeImpl->m_hThreadPool, - m_pTid, - this, - doit, - m_aTypeInfo[0].m_bIsOneway ); - } - - - //------------------------------------------------------------------------------------- - sal_Bool ServerMultiJob::extract() - { - sal_Bool bContinue = sal_True; - struct MemberTypeInfo * const pMTI = &(m_aTypeInfo[m_nCalls]); - struct ServerJobEntry * const pSJE = &(m_aEntries[m_nCalls]); - - pSJE->m_pException = 0; - pSJE->m_ppArgs = 0; - pSJE->m_pReturn = 0; - pMTI->m_pReturnType = 0; - - if( pMTI->m_nArgCount ) - { - pMTI->m_ppArgType = - ( typelib_TypeDescription ** ) getHeap( sizeof(void*) * pMTI->m_nArgCount ); - pSJE->m_ppArgs = (void**) getHeap( sizeof( void * ) * pMTI->m_nArgCount ); - pMTI->m_pbIsIn = (sal_Bool *) getHeap( sizeof( sal_Bool ) * pMTI->m_nArgCount ); - pMTI->m_pbIsOut = (sal_Bool *) getHeap( sizeof( sal_Bool ) * pMTI->m_nArgCount ); - } - if( pMTI->m_pMethodType && - pMTI->m_pMethodType->pReturnTypeRef->eTypeClass != typelib_TypeClass_VOID ) - { - TYPELIB_DANGER_GET( &(pMTI->m_pReturnType), pMTI->m_pMethodType->pReturnTypeRef ); - } - else if( pMTI->m_pAttributeType && ! pMTI->m_nArgCount ) - { - TYPELIB_DANGER_GET( &(pMTI->m_pReturnType) , pMTI->m_pAttributeType->pAttributeTypeRef ); - } - - // normal method - if( pMTI->m_pMethodType ) - { - for( sal_Int32 i = 0 ; i < pMTI->m_nArgCount ; i ++ ) - { - pMTI->m_ppArgType[i] = 0; - TYPELIB_DANGER_GET( & ( pMTI->m_ppArgType[i] ) , pMTI->m_pMethodType->pParams[i].pTypeRef); - pMTI->m_pbIsIn[i] = pMTI->m_pMethodType->pParams[i].bIn; - pMTI->m_pbIsOut[i] = pMTI->m_pMethodType->pParams[i].bOut; - - pSJE->m_ppArgs[i] = getHeap( pMTI->m_ppArgType[i]->nSize ); - if( pMTI->m_pbIsIn[i] ) - { - // everything needs to be constructed - bContinue = m_pUnmarshal->unpack( - pSJE->m_ppArgs[i], pMTI->m_ppArgType[i] ) && bContinue; - } - } - } - else if( pMTI->m_nArgCount ) - { - // set attribut - pMTI->m_ppArgType[0] = 0; - pMTI->m_pbIsIn[0] = sal_True; - pMTI->m_pbIsOut[0] = sal_False; - TYPELIB_DANGER_GET( - & ( pMTI->m_ppArgType[0] ) , pMTI->m_pAttributeType->pAttributeTypeRef ); - pSJE->m_ppArgs[0] = getHeap( pMTI->m_ppArgType[0]->nSize ); - bContinue = m_pUnmarshal->unpack( - pSJE->m_ppArgs[0], pMTI->m_ppArgType[0] ) && bContinue; - } - - if( pMTI->m_pReturnType ) - { - pSJE->m_pReturn = getHeap( pMTI->m_pReturnType->nSize ); - } - - m_nCalls ++; - return bContinue; - } -} - - diff --git a/bridges/source/remote/urp/urp_job.hxx b/bridges/source/remote/urp/urp_job.hxx deleted file mode 100644 index f1829f7ff..000000000 --- a/bridges/source/remote/urp/urp_job.hxx +++ /dev/null @@ -1,379 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _URP_JOB_HXX_ -#define _URP_JOB_HXX_ -#include <list> -#include <typelib/typedescription.hxx> -#include <uno/any2.h> -#include <uno/environment.h> -#include <uno/threadpool.h> -#include "urp_threadid.hxx" -#include "urp_unmarshal.hxx" -#include "urp_bridgeimpl.hxx" - - -namespace bridges_urp -{ -const sal_Int32 MULTIJOB_STANDARD_MEMORY_SIZE = 1024; -const sal_Int32 MULTIJOB_PER_CALL_MEMORY_SIZE = 96; - -class Unmarshal; -struct urp_BridgeImpl; - -template < class t > -inline t mymax( const t &t1 , const t &t2 ) -{ - return t1 > t2 ? t1 : t2; -} - -class Job -{ -public: - Job( uno_Environment *pEnvRemote, - remote_Context *pContext, - sal_Sequence *pTid, - struct urp_BridgeImpl *pBridgeImpl, - Unmarshal *pUnmarshal ); - - Job( uno_Environment *pEnvRemote, - remote_Context *pContext, - struct urp_BridgeImpl *pBridgeImpl, - ::bridges_remote::RemoteThreadCounter_HoldEnvWeak value ) - : m_pContext( pContext ) - , m_pBridgeImpl( pBridgeImpl ) - , m_pTid( 0 ) - , m_counter( pEnvRemote , value ) - { - if ( m_pContext ) - { - m_pContext->aBase.acquire( &m_pContext->aBase ); - } - } - - ~Job(); - -public: - remote_Context *m_pContext; - Unmarshal *m_pUnmarshal; - struct urp_BridgeImpl *m_pBridgeImpl; - sal_Sequence *m_pTid; - ::bridges_remote::RemoteThreadCounter m_counter; -}; - -class ClientJob : private Job -{ -public: - // pContext is null for bridge-internal UrpProtocolProperties requests - inline ClientJob( uno_Environment *pEnvRemote, // weak ! - remote_Context *pContext, - struct urp_BridgeImpl *pBridgeImpl, - rtl_uString *pOid, // weak - typelib_TypeDescription const * pMemberType, // weak - typelib_InterfaceTypeDescription *pInterfaceType, // weak - void *pReturn, - void *ppArgs[], - uno_Any **ppException ); - - // ~ClientJob - // no release for method type and attribute type necessary, because - // it was acquired by the caller of urp_sendRequest. The lifetime - // of the ClientJob object is always shorter than the urp_sendRequest call. - inline ~ClientJob() - { - if( m_bReleaseForTypeDescriptionNecessary ) - typelib_typedescription_release( (typelib_TypeDescription*) m_pInterfaceType ); - uno_releaseIdFromCurrentThread(); - } - - sal_Bool pack(); - void wait(); - sal_Bool extract( ); - void initiate(); - - inline void setBridgePropertyCall() - { m_bBridgePropertyCall = sal_True; } - inline sal_Bool isBridgePropertyCall() - { return m_bBridgePropertyCall; } - inline sal_Bool isOneway() - { return m_bOneway; } - - inline void setUnmarshal( Unmarshal *p ) - { m_pUnmarshal = p; } -public: - typelib_InterfaceMethodTypeDescription *m_pMethodType; - typelib_InterfaceAttributeTypeDescription *m_pAttributeType; - sal_Bool m_bExceptionOccured; - -private: - void **m_ppArgs; - void *m_pReturn; - typelib_InterfaceTypeDescription *m_pInterfaceType; - sal_Bool m_bReleaseForTypeDescriptionNecessary; - - uno_Any **m_ppException; - sal_Bool m_bOneway; - sal_Bool m_bBridgePropertyCall; - sal_uInt16 m_nMethodIndex; - uno_Environment *m_pEnvRemote; - rtl_uString *m_pOid; - sal_Bool m_bCallingConventionForced; -}; - -struct MemberTypeInfo -{ - typelib_InterfaceTypeDescription *m_pInterfaceType; - typelib_InterfaceMethodTypeDescription *m_pMethodType; - typelib_InterfaceAttributeTypeDescription *m_pAttributeType; - sal_Int32 m_nArgCount; - sal_Bool m_bIsReleaseCall; - sal_Bool *m_pbIsIn; - sal_Bool *m_pbIsOut; - sal_Bool m_bIsOneway; - typelib_TypeDescription *m_pReturnType; - typelib_TypeDescription **m_ppArgType; -}; - - -struct ServerJobEntry -{ - rtl_uString *m_pOid; - remote_Interface *m_pRemoteI; - typelib_TypeDescriptionReference *m_pInterfaceTypeRef; - void **m_ppArgs; - void *m_pReturn; - uno_Any m_exception; - uno_Any *m_pException; - remote_Interface *m_pCurrentContext; - sal_Bool m_bHasCurrentContext; - sal_Bool m_bIgnoreCache; -}; - -class ServerMultiJob : private Job -{ -public: - ServerMultiJob( uno_Environment *pEnvRemote, - remote_Context *pContext, - sal_Sequence *pTid, - struct urp_BridgeImpl *pBridgeImpl, - Unmarshal *pUnmarshal, - sal_Int32 nMaxMessages ); - ~ServerMultiJob(); -public: - sal_Bool extract( ); - void initiate(); - void execute(); - -public: - // setMethodType or setAttributeType MUST be called before extract - inline void setMethodType( - typelib_InterfaceMethodTypeDescription *pMethodType, - sal_Bool bIsReleaseCall, - sal_Bool bIsOneway ) - { - m_aTypeInfo[m_nCalls].m_pMethodType = pMethodType; - m_aTypeInfo[m_nCalls].m_pAttributeType = 0; - m_aTypeInfo[m_nCalls].m_nArgCount = pMethodType->nParams; - m_aTypeInfo[m_nCalls].m_bIsReleaseCall = bIsReleaseCall; - m_aTypeInfo[m_nCalls].m_bIsOneway = bIsOneway; - } - - inline void setAttributeType( - typelib_InterfaceAttributeTypeDescription *pAttributeType, sal_Bool bIsSetter, sal_Bool bIsOneway ) - { - m_aTypeInfo[m_nCalls].m_pAttributeType = pAttributeType; - m_aTypeInfo[m_nCalls].m_pMethodType = 0; - m_aTypeInfo[m_nCalls].m_nArgCount = bIsSetter ? 1 : 0; - m_aTypeInfo[m_nCalls].m_bIsReleaseCall = sal_False; - m_aTypeInfo[m_nCalls].m_bIsOneway = bIsOneway; - } - - inline void setType( typelib_TypeDescriptionReference *pTypeRef ) - { - m_aEntries[m_nCalls].m_pInterfaceTypeRef = pTypeRef; - typelib_typedescriptionreference_acquire( m_aEntries[m_nCalls].m_pInterfaceTypeRef ); - TYPELIB_DANGER_GET( - (typelib_TypeDescription ** )&(m_aTypeInfo[m_nCalls].m_pInterfaceType) , - pTypeRef ); - } - // setOid or setInterface MUST be called before extract - inline void setOid( rtl_uString *pOid ) - { - m_aEntries[m_nCalls].m_pOid = pOid; - rtl_uString_acquire( m_aEntries[m_nCalls].m_pOid ); - m_aEntries[m_nCalls].m_pRemoteI = 0; - } - - // setOid or setInterface MUST be called - inline void setInterface( remote_Interface *pRemoteI ) - { - m_aEntries[m_nCalls].m_pRemoteI = pRemoteI; - pRemoteI->acquire( pRemoteI ); - m_aEntries[m_nCalls].m_pOid = 0; - } - - inline void setCurrentContext( - bool bHasCurrentContext, remote_Interface *pCurrentContext ) - { - m_aEntries[m_nCalls].m_pCurrentContext = pCurrentContext; - m_aEntries[m_nCalls].m_bHasCurrentContext = bHasCurrentContext; - } - - inline void setIgnoreCache( sal_Bool bIgnoreCache ) - { - m_aEntries[m_nCalls].m_bIgnoreCache = bIgnoreCache; - } - - inline sal_Bool isFull() - { return m_nCalls >= m_nMaxMessages; } - - inline sal_Int8 *getHeap( sal_Int32 nSizeToAlloc ) - { - if( nSizeToAlloc + m_nCurrentMemPosition > m_nCurrentMemSize ) - { - m_lstMem.push_back( m_pCurrentMem ); - m_nCurrentMemSize = mymax( nSizeToAlloc , MULTIJOB_STANDARD_MEMORY_SIZE ) + - (m_nMaxMessages -m_nCalls)*MULTIJOB_PER_CALL_MEMORY_SIZE; - m_pCurrentMem = (sal_Int8*) rtl_allocateMemory( m_nCurrentMemSize ); - m_nCurrentMemPosition = 0; - } - sal_Int8 *pHeap = m_pCurrentMem + m_nCurrentMemPosition; - m_nCurrentMemPosition += nSizeToAlloc; - - // care for alignment - if( m_nCurrentMemPosition & 0x7 ) - { - m_nCurrentMemPosition = ( ((sal_uInt32)m_nCurrentMemPosition) & ( 0xffffffff - 0x7 )) + 8; - } - return pHeap; - } - void prepareRuntimeException( const ::rtl::OUString &sMessage, sal_Int32 nCall ); - -private: - uno_Environment *m_pEnvRemote; - sal_Int32 m_nCalls; - sal_Int32 m_nMaxMessages; - - ServerJobEntry *m_aEntries; - MemberTypeInfo *m_aTypeInfo; - - sal_Int8 *m_pCurrentMem; - sal_Int32 m_nCurrentMemSize; - sal_Int32 m_nCurrentMemPosition; - - // list of memory pointers, that must be freed - ::std::list< sal_Int8 * > m_lstMem; -}; - - - -//--------------------------------------------------------------------------------------------- -inline ClientJob::ClientJob( - uno_Environment *pEnvRemote, - remote_Context *pContext, - struct urp_BridgeImpl *pBridgeImpl, - rtl_uString *pOid, - typelib_TypeDescription const * pMemberType, - typelib_InterfaceTypeDescription *pInterfaceType, - void *pReturn, - void *ppArgs[], - uno_Any **ppException ) - : Job( - pEnvRemote, pContext, pBridgeImpl, ::bridges_remote::RTC_HOLDENVWEAK ) - , m_bExceptionOccured( false ) - , m_ppArgs( ppArgs ) - , m_pReturn( pReturn ) - , m_pInterfaceType( pInterfaceType ) // weak - , m_bReleaseForTypeDescriptionNecessary( sal_False ) - , m_ppException( ppException ) - , m_bBridgePropertyCall( sal_False ) - , m_pEnvRemote( pEnvRemote ) // weak - , m_pOid( pOid ) // weak - , m_bCallingConventionForced( sal_False ) -{ - uno_getIdOfCurrentThread( &m_pTid ); - - if( typelib_TypeClass_INTERFACE_METHOD == pMemberType->eTypeClass ) - { - m_pMethodType = ( typelib_InterfaceMethodTypeDescription * ) pMemberType; - m_pAttributeType = 0; - } - else if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pMemberType->eTypeClass ) - { - m_pAttributeType = ( typelib_InterfaceAttributeTypeDescription * ) pMemberType; - m_pMethodType = 0; - } - else - { - OSL_ASSERT( ! "wrong member type" ); - } - - // calculate method index - if( ! m_pInterfaceType->aBase.bComplete ) - { - // must be acquired because typedescription may be exchanged - typelib_typedescription_acquire((typelib_TypeDescription*) m_pInterfaceType ); - m_bReleaseForTypeDescriptionNecessary = sal_True; - typelib_typedescription_complete( (typelib_TypeDescription ** ) &m_pInterfaceType ); - } - m_nMethodIndex = (sal_uInt16) m_pInterfaceType->pMapMemberIndexToFunctionIndex[ - ((typelib_InterfaceMemberTypeDescription*)pMemberType)->nPosition ]; - - if( m_pAttributeType && m_ppArgs ) - { - // setter - m_nMethodIndex ++; - } - - if( typelib_TypeClass_INTERFACE_METHOD == pMemberType->eTypeClass ) - { -// if( (( typelib_InterfaceMemberTypeDescription * ) pMemberType)->nPosition -// == REMOTE_RELEASE_METHOD_INDEX ) -// { -// m_bOneway = sal_True; -// } -// else - if( pBridgeImpl->m_properties.bForceSynchronous ) - { - m_bOneway = sal_False; - if( (( typelib_InterfaceMethodTypeDescription * ) pMemberType)->bOneWay ) - { - m_bCallingConventionForced = sal_True; - } - } - else - { - m_bOneway = (( typelib_InterfaceMethodTypeDescription * ) pMemberType)->bOneWay; - } - } - else - { - m_bOneway = sal_False; - } -} - -} -#endif diff --git a/bridges/source/remote/urp/urp_log.cxx b/bridges/source/remote/urp/urp_log.cxx deleted file mode 100644 index 842573f59..000000000 --- a/bridges/source/remote/urp/urp_log.cxx +++ /dev/null @@ -1,147 +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_bridges.hxx" -#include <osl/time.h> -#include "urp_bridgeimpl.hxx" -#include "urp_log.hxx" - -using namespace ::rtl; -using namespace ::osl; -namespace bridges_urp -{ -#ifdef BRIDGES_URP_PROT - Mutex g_logFileMutex; - - class FileAccess - { - public: - FileAccess( urp_BridgeImpl *pBridgeImpl_ ) : - pBridgeImpl( pBridgeImpl_ ), - guard( g_logFileMutex ) - { - if( pBridgeImpl->m_pLogFile ) - { - f = pBridgeImpl->m_pLogFile; - } - else - { - f = fopen( pBridgeImpl->m_sLogFileName.getStr() , "a" ); - } - } - ~FileAccess() - { - if( ! pBridgeImpl->m_pLogFile ) - { - fclose( f ); - } - } - FILE *getFile() - { - return f; - } - private: - urp_BridgeImpl *pBridgeImpl; - MutexGuard guard; - FILE *f; - }; - - void urp_logCall( urp_BridgeImpl *pBridgeImpl, sal_Int32 nSize, sal_Int32 nUseData, sal_Bool bSynchron , - const ::rtl::OUString &sMethodName ) - { - if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) - { - OString sOperation = OUStringToOString( sMethodName,RTL_TEXTENCODING_ASCII_US ); - - FileAccess access( pBridgeImpl ); - fprintf( access.getFile() , - "%06u: calling [size=%d(usedata=%d)] [synchron=%d] [name=%s]\n" , - static_cast< unsigned int > (osl_getGlobalTimer()), - static_cast< int > (nSize), - static_cast< int > (nUseData), - bSynchron, sOperation.pData->buffer ); - } - } - - void urp_logServingRequest( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nSize, sal_Int32 nUseData, sal_Bool bSynchron , - const ::rtl::OUString &sMethodName ) - { - if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) - { - OString sOperation = OUStringToOString( sMethodName,RTL_TEXTENCODING_ASCII_US ); - - FileAccess access( pBridgeImpl ); - fprintf( - access.getFile(), - "%06u: serving request [size=%d(usedata=%d)] [synchron=%d] [name=%s]\n", - static_cast< unsigned int > (osl_getGlobalTimer()), - static_cast< int > (nSize), - static_cast< int > (nUseData), - bSynchron, - sOperation.pData->buffer - ); - } - } - - void urp_logGettingReply( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nSize, sal_Int32 nUseData, - const ::rtl::OUString &sMethodName ) - { - if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) - { - OString sOperation = OUStringToOString( sMethodName,RTL_TEXTENCODING_ASCII_US ); - FileAccess access( pBridgeImpl ); - fprintf( access.getFile(), - "%06u: getting reply [size=%d(usedata=%d)][name=%s]\n" , - static_cast< unsigned int > (osl_getGlobalTimer()), - static_cast< int > (nSize), - static_cast< int > (nUseData), - sOperation.pData->buffer); - } - } - - void urp_logReplying( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nSize , sal_Int32 nUseData, - const ::rtl::OUString &sMethodName ) - { - if( pBridgeImpl->m_sLogFileName.getLength() && getenv( "PROT_REMOTE_ACTIVATE" ) ) - { - OString sOperation = OUStringToOString(sMethodName,RTL_TEXTENCODING_ASCII_US); - - FileAccess access( pBridgeImpl ); - fprintf( access.getFile(), - "%06u: replying [size=%d(usedata=%d)] [name=%s]\n", - static_cast< unsigned int > (osl_getGlobalTimer()), - static_cast< int > (nSize), - static_cast< int > (nUseData), - sOperation.pData->buffer); - } - } -#endif -} diff --git a/bridges/source/remote/urp/urp_log.hxx b/bridges/source/remote/urp/urp_log.hxx deleted file mode 100644 index b8a1acba9..000000000 --- a/bridges/source/remote/urp/urp_log.hxx +++ /dev/null @@ -1,50 +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. - * - ************************************************************************/ -namespace bridges_urp -{ -#ifdef DBG_UTIL -#define BRIDGES_URP_PROT -#endif - -#ifdef BRIDGES_URP_PROT - void urp_logCall( urp_BridgeImpl *pBridgeImpl , - sal_Int32 nSize, sal_Int32 nUseData, sal_Bool bSynchron , - const ::rtl::OUString &sMethodName ); - - void urp_logServingRequest( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nSize, sal_Int32 nUseData, sal_Bool bSynchron , - const ::rtl::OUString &sMethodName ); - - void urp_logGettingReply( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nSize, sal_Int32 nUseData, - const ::rtl::OUString &sMethodName ); - - void urp_logReplying( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nSize , sal_Int32 nUseData, - const ::rtl::OUString &sMethodName ); -#endif -} diff --git a/bridges/source/remote/urp/urp_marshal.cxx b/bridges/source/remote/urp/urp_marshal.cxx deleted file mode 100644 index 7e712fb1c..000000000 --- a/bridges/source/remote/urp/urp_marshal.cxx +++ /dev/null @@ -1,235 +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_bridges.hxx" -#include <string.h> -#include <osl/diagnose.h> -#include <rtl/alloc.h> - -#include <uno/any2.h> -#include <uno/sequence2.h> - -#include "urp_marshal.hxx" - -using namespace ::rtl; - -using namespace ::com::sun::star::uno; - -namespace bridges_urp { - -static int g_nDetectLittleEndian = 1; -char g_bMarshalSystemIsLittleEndian = ((char*)&g_nDetectLittleEndian)[0]; - -Marshal::Marshal( urp_BridgeImpl *pBridgeImpl, - sal_Int32 nBufferSize, - urp_extractOidCallback callback) : - m_nBufferSize( nBufferSize ), - m_base( (sal_Int8*)rtl_allocateMemory( nBufferSize ) ), - m_pos( m_base + 2*sizeof( sal_Int32 ) ), - m_pBridgeImpl( pBridgeImpl ), - m_callback( callback ) -{} - -Marshal::~Marshal( ) -{ - rtl_freeMemory( m_base ); -} - -void Marshal::packOid( const ::rtl::OUString & oid ) -{ - sal_uInt16 nIndex; - if( oid.getLength() ) - { - nIndex = m_pBridgeImpl->m_oidCacheOut.seek( oid ); - if( 0xffff == nIndex ) - { - nIndex = m_pBridgeImpl->m_oidCacheOut.put( oid ); - packString( (void*)(&oid.pData) ); - } - else - { - OUString dummy; - packString( &dummy ); - } - } - else - { - // null reference - nIndex = 0xffff; - OUString dummy; - packString( &dummy ); - } - packInt16( &nIndex ); -} - -void Marshal::packTid( const ByteSequence & threadId, sal_Bool bIgnoreCache ) -{ - - sal_uInt16 nIndex = 0xffff; - if( ! bIgnoreCache ) - { - nIndex = m_pBridgeImpl->m_tidCacheOut.seek( threadId ); - } - - if( 0xffff == nIndex ) - { - if( ! bIgnoreCache ) - { - nIndex = m_pBridgeImpl->m_tidCacheOut.put( threadId ); - } - packByteSequence( (sal_Int8*) threadId.getConstArray() ,threadId.getLength()); - } - else - { - packByteSequence( 0 , 0 ); - } - packInt16( &nIndex ); -} - - -void Marshal::packType( void *pSource ) -{ - typelib_TypeDescriptionReference *pRef = - *(typelib_TypeDescriptionReference ** ) pSource; - - OSL_ASSERT( pRef ); - - sal_uInt8 nTypeClass = ( sal_uInt8 ) pRef->eTypeClass; - - if( nTypeClass <= /* any*/ 14 ) - { - packInt8( (sal_Int8*)&nTypeClass ); - } - else - { - OUString sTypeName; - sal_uInt16 nIndex = 0xffff; - - nIndex = m_pBridgeImpl->m_typeCacheOut.seek( *(Type*)&pRef ); - if( 0xffff == nIndex ) - { - // put it into the cache - nIndex = m_pBridgeImpl->m_typeCacheOut.put( *(Type*)&pRef ); - sTypeName = pRef->pTypeName; - nTypeClass = nTypeClass | 0x80; - } - packInt8( &nTypeClass ); - packInt16( &nIndex ); - if( 0x80 & nTypeClass ) - { - packString( &sTypeName ); - } - } -} - -sal_Bool Marshal::packRecursive( void *pSource , typelib_TypeDescription *pType ) -{ - sal_Bool bSuccess = sal_True; - switch( pType->eTypeClass ) - { - case typelib_TypeClass_EXCEPTION: - case typelib_TypeClass_STRUCT: - { - typelib_CompoundTypeDescription * pCompType = (typelib_CompoundTypeDescription*)pType; - - if (pCompType->pBaseTypeDescription) - { - bSuccess = pack( pSource , (typelib_TypeDescription*) pCompType->pBaseTypeDescription ); - } - - // then construct members - typelib_TypeDescriptionReference ** ppTypeRefs = pCompType->ppTypeRefs; - sal_Int32 * pMemberOffsets = pCompType->pMemberOffsets; - sal_Int32 nDescr = pCompType->nMembers; - - for ( sal_Int32 nPos = 0; nPos < nDescr; ++nPos ) - { - typelib_TypeDescription * pMemberType = 0; - TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[nPos] ); - if( pMemberType ) - { - bSuccess = bSuccess && pack( (char*)pSource + pMemberOffsets[nPos] , pMemberType ); - TYPELIB_DANGER_RELEASE( pMemberType ); - } - else - { - OUStringBuffer buf( 64 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("Couldn't get typedescription for type ")); - buf.append( ppTypeRefs[nPos]->pTypeName ); - m_pBridgeImpl->addError( buf.makeStringAndClear() ); - bSuccess = sal_False; - } - } - break; - } - case typelib_TypeClass_SEQUENCE: - { - typelib_IndirectTypeDescription *pIndirectType = - ( typelib_IndirectTypeDescription* ) pType; - - const sal_Int32 nElements = (*(uno_Sequence **)pSource)->nElements; - char * pSourceElements = (char *)(*(uno_Sequence **)pSource)->elements; - - if( typelib_TypeClass_BYTE == pIndirectType->pType->eTypeClass ) - { - // Byte sequences are optimized - packByteSequence( (sal_Int8*)pSourceElements , nElements ); - } - else - { - typelib_TypeDescription *pElementType = 0; - TYPELIB_DANGER_GET( &pElementType, pIndirectType->pType ); - if( pElementType ) - { - const sal_Int32 nElementSize = pElementType->nSize; - - packCompressedSize( nElements ); - for ( sal_Int32 i = 0 ; i < nElements; i++ ) - { - bSuccess = bSuccess && pack( pSourceElements + (nElementSize*i) , pElementType ); - } - TYPELIB_DANGER_RELEASE( pElementType ); - } - else - { - bSuccess = sal_False; - OUStringBuffer buf( 64 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("Couldn't get typedescription for type ")); - buf.append( pIndirectType->pType->pTypeName ); - m_pBridgeImpl->addError( buf.makeStringAndClear() ); - } - } - break; - } - default: - OSL_ASSERT( 0 ); - } - return bSuccess; -} - -} // end namespace bridges diff --git a/bridges/source/remote/urp/urp_marshal.hxx b/bridges/source/remote/urp/urp_marshal.hxx deleted file mode 100644 index 0a0447a47..000000000 --- a/bridges/source/remote/urp/urp_marshal.hxx +++ /dev/null @@ -1,343 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _URP_MARSHAL_HXX_ -#define _URP_MARSHAL_HXX_ -#include <rtl/ustrbuf.hxx> -#include <rtl/byteseq.hxx> -#include <com/sun/star/uno/Type.hxx> -#include "urp_bridgeimpl.hxx" -#include "urp_marshal_decl.hxx" - -#include <string.h> - -struct remote_Interface; - -namespace bridges_urp -{ - // methods for accessing marshaling buffer - inline void Marshal::finish( sal_Int32 nMessageCount ) - { - sal_Int32 nSize = getSize() - 2*sizeof( sal_Int32 ); - - // save the state - sal_Int8 *pos = m_pos; - m_pos = m_base; - packInt32( &nSize ); - packInt32( &nMessageCount ); - - // reset the state - m_pos = pos; - } - - inline void Marshal::restart() - { - m_pos = m_base + 2*sizeof( sal_Int32 ); - } - - inline sal_Int8 *Marshal::getBuffer() - { - return m_base; - } - - inline sal_Bool Marshal::empty() const - { - return ( m_pos - m_base ) == 2*sizeof( sal_Int32 ); - } - - inline sal_Int32 Marshal::getSize() - { - return ((sal_Int32) (m_pos - m_base)); - } - - inline void Marshal::ensureAdditionalMem( sal_Int32 nMemToAdd ) - { - sal_Int32 nDiff = m_pos - m_base; - if( nDiff + nMemToAdd > m_nBufferSize ) - { - m_nBufferSize = m_nBufferSize * 2 > nDiff + nMemToAdd ? - m_nBufferSize* 2 : - nDiff + nMemToAdd; - - m_base = ( sal_Int8 * ) rtl_reallocateMemory( m_base , m_nBufferSize ); - m_pos = m_base + nDiff; - } - } - - // marshaling methods - inline void Marshal::packInt8( void *pSource ) - { - ensureAdditionalMem( 1 ); - *m_pos = *((sal_Int8*) pSource ); - m_pos++; - } - - inline void Marshal::packInt16( void *pSource ) - { - ensureAdditionalMem( 2 ); - if( isSystemLittleEndian() ) - { - m_pos[0] = ((unsigned char *)pSource)[1]; - m_pos[1] = ((unsigned char *)pSource)[0]; - } - else - { - m_pos[1] = ((unsigned char *)pSource)[1]; - m_pos[0] = ((unsigned char *)pSource)[0]; - } - m_pos +=2; - } - - inline void Marshal::packByteSequence( sal_Int8 *pData , sal_Int32 nLength ) - { - packCompressedSize( nLength ); - - ensureAdditionalMem( nLength ); - memcpy( m_pos , pData , nLength ); - m_pos += nLength; - } - - inline void Marshal::packString( void *pSource ) - { - rtl_uString *p = *( rtl_uString ** ) pSource; - - // to be optimized ! - // static buffer in marshal - ::rtl::OString o = ::rtl::OUStringToOString( p , RTL_TEXTENCODING_UTF8 ); - sal_Int32 nLength = o.pData->length; - packCompressedSize( nLength ); - - ensureAdditionalMem( nLength ); - - memcpy( m_pos , o.pData->buffer , nLength ); - m_pos += nLength; - } - - inline sal_Bool Marshal::packAny( void *pSource ) - { - sal_Bool bSuccess = sal_True; - uno_Any *pAny = (uno_Any * ) pSource; - - // pack the type - packType( &( pAny->pType ) ); - // pack the value - typelib_TypeDescription *pType = 0; - TYPELIB_DANGER_GET( &pType, pAny->pType ); - if( pType ) - { - pack( pAny->pData , pType ); - TYPELIB_DANGER_RELEASE( pType ); - } - else - { - rtl::OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("couldn't get typedescription for type " ) ); - buf.append( pAny->pType->pTypeName ); - m_pBridgeImpl->addError( buf.makeStringAndClear() ); - bSuccess = sal_False; - } - return bSuccess; - } - - inline void Marshal::packInt32( void *pSource ) - { - ensureAdditionalMem( 4 ); - if( isSystemLittleEndian() ) - { - m_pos[0] = ((unsigned char *)pSource)[3]; - m_pos[1] = ((unsigned char *)pSource)[2]; - m_pos[2] = ((unsigned char *)pSource)[1]; - m_pos[3] = ((unsigned char *)pSource)[0]; - } - else { - m_pos[3] = ((unsigned char *)pSource)[3]; - m_pos[2] = ((unsigned char *)pSource)[2]; - m_pos[1] = ((unsigned char *)pSource)[1]; - m_pos[0] = ((unsigned char *)pSource)[0]; - } - m_pos +=4; - } - - inline void Marshal::packCompressedSize( sal_Int32 nSize ) - { - ensureAdditionalMem( 5 ); - - if( nSize < 0xff ) - { - *((sal_uInt8*)m_pos) = (sal_uInt8) nSize; - m_pos ++; - } - else - { - *((sal_uInt8*)m_pos) = 0xff; - m_pos ++; - packInt32( &nSize ); - } - } - - inline sal_Bool Marshal::pack( void *pSource , typelib_TypeDescription *pType ) - { - sal_Bool bSuccess = sal_True; - switch( pType->eTypeClass ) - { - case typelib_TypeClass_BYTE: - { - packInt8( pSource ); - break; - } - case typelib_TypeClass_BOOLEAN: - { - ensureAdditionalMem( 1 ); - *m_pos = ( *((sal_Bool*) pSource ) ) ? 1 : 0; - m_pos++; - break; - } - - case typelib_TypeClass_CHAR: - case typelib_TypeClass_SHORT: - case typelib_TypeClass_UNSIGNED_SHORT: - { - packInt16( pSource ); - break; - } - case typelib_TypeClass_ENUM: - case typelib_TypeClass_LONG: - case typelib_TypeClass_UNSIGNED_LONG: - case typelib_TypeClass_FLOAT: - { - packInt32( pSource ); - break; - } - case typelib_TypeClass_DOUBLE: - case typelib_TypeClass_HYPER: - case typelib_TypeClass_UNSIGNED_HYPER: - { - ensureAdditionalMem( 8 ); - if( isSystemLittleEndian() ) - { - m_pos[0] = ((unsigned char *)pSource)[7]; - m_pos[1] = ((unsigned char *)pSource)[6]; - m_pos[2] = ((unsigned char *)pSource)[5]; - m_pos[3] = ((unsigned char *)pSource)[4]; - m_pos[4] = ((unsigned char *)pSource)[3]; - m_pos[5] = ((unsigned char *)pSource)[2]; - m_pos[6] = ((unsigned char *)pSource)[1]; - m_pos[7] = ((unsigned char *)pSource)[0]; - } - else - { - m_pos[7] = ((unsigned char *)pSource)[7]; - m_pos[6] = ((unsigned char *)pSource)[6]; - m_pos[5] = ((unsigned char *)pSource)[5]; - m_pos[4] = ((unsigned char *)pSource)[4]; - m_pos[3] = ((unsigned char *)pSource)[3]; - m_pos[2] = ((unsigned char *)pSource)[2]; - m_pos[1] = ((unsigned char *)pSource)[1]; - m_pos[0] = ((unsigned char *)pSource)[0]; - } - m_pos += 8; - break; - } - - case typelib_TypeClass_STRING: - { - packString( pSource ); - break; - } - case typelib_TypeClass_TYPE: - { - packType( pSource ); - break; - } - case typelib_TypeClass_ANY: - { - bSuccess = packAny( pSource ); - break; - } - case typelib_TypeClass_TYPEDEF: - { - bSuccess = sal_False; - m_pBridgeImpl->addError( "can't handle typedef typedescriptions" ); - break; - } - case typelib_TypeClass_INTERFACE: - { - remote_Interface *pRemoteI = *( remote_Interface ** )pSource; - - ::rtl::OUString sOid; - sal_uInt16 nIndex = 0xffff; - if( pRemoteI ) - { - m_callback( pRemoteI , &(sOid.pData) ); - - nIndex = m_pBridgeImpl->m_oidCacheOut.seek( sOid ); - if( 0xffff == nIndex ) - { - nIndex = m_pBridgeImpl->m_oidCacheOut.put( sOid ); - } - else - { - // cached ! - sOid = ::rtl::OUString(); - } - } - packString( &sOid ); - packInt16( &nIndex ); - break; - } - case typelib_TypeClass_VOID: - { - // do nothing - break; - } - case typelib_TypeClass_EXCEPTION: - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_SEQUENCE: - { - bSuccess = packRecursive( pSource, pType ); - break; - } - default: - { - bSuccess = sal_False; - rtl::OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "can't handle values with typeclass " ) ); - buf.append( (sal_Int32 ) pType->eTypeClass , 10 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ); - buf.append( pType->pTypeName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ")" ) ); - m_pBridgeImpl->addError( buf.makeStringAndClear() ); - break; - } - } - return bSuccess; - } -} - - - -#endif - diff --git a/bridges/source/remote/urp/urp_marshal_decl.hxx b/bridges/source/remote/urp/urp_marshal_decl.hxx deleted file mode 100644 index 7a933f93f..000000000 --- a/bridges/source/remote/urp/urp_marshal_decl.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _URP_MARSHAL_DECL_HXX_ -#define _URP_MARSHAL_DECL_HXX_ - -#include <rtl/ustring.hxx> -#include <rtl/byteseq.hxx> - -#include <com/sun/star/uno/Type.hxx> - -namespace bridges_urp -{ - struct urp_BridgeImpl; - - typedef void - ( SAL_CALL * urp_extractOidCallback )( remote_Interface *pRemoteI, rtl_uString **ppOid ); - - extern char g_bMarshalSystemIsLittleEndian; - class Marshal - { - public: - Marshal( /* cache access */ struct urp_BridgeImpl *, - sal_Int32 m_nBufferSize, - urp_extractOidCallback callback = 0 - ); - ~Marshal( ); - - inline sal_Bool pack( void *pSource , typelib_TypeDescription *pType ); - - sal_Bool packRecursive( void *pSource, typelib_TypeDescription *pType ); - - void packTid( const ::rtl::ByteSequence &id, sal_Bool bIgnoreCache = sal_False ); - void packOid( const ::rtl::OUString &oid ); - void packType( void *pSource ); - - inline void packCompressedSize( sal_Int32 nSize ); - inline void packInt8( void *pSource ); - inline void packInt16( void *pSource ); - inline void packInt32( void *pSource ); - inline void packString( void *pSource ); - inline sal_Bool packAny( void *pSource ); - inline void packByteSequence( sal_Int8 *pBuffer , sal_Int32 nSize ); - - // can be called during marshaling, but not between - // finish and restart - // returns true, when nothing has been marshaled - inline sal_Bool empty() const; - - // stops marshaling, inserts size in front of the buffer - // getStart and getSize can now be called - inline void finish( sal_Int32 nMessageCount ); - - // must be called after finish. After calling restart, - // a new marshalling session is started invalidating - // the previous bufer - inline void restart(); - - // is only valid, after finish has been called. - // valid until destructed. - inline sal_Int8 *getBuffer(); - - // is only valid, after finish has been called. - // valid until destructed. - inline sal_Int32 getSize(); - - inline sal_Int32 getPos() - { return m_pos - m_base; } - - inline sal_Bool isSystemLittleEndian() - { return g_bMarshalSystemIsLittleEndian; } - - private: - inline void ensureAdditionalMem( sal_Int32 nMemToAdd ); - sal_Int32 m_nBufferSize; - sal_Int8 *m_base; - sal_Int8 *m_pos; - struct urp_BridgeImpl *m_pBridgeImpl; - urp_extractOidCallback m_callback; - }; -} -#endif diff --git a/bridges/source/remote/urp/urp_property.hxx b/bridges/source/remote/urp/urp_property.hxx deleted file mode 100644 index 779f76f57..000000000 --- a/bridges/source/remote/urp/urp_property.hxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _URP_PROPERTY_HXX_ -#define _URP_PROPERTY_HXX_ -#ifndef _BRIDGES_REMOTE_REMOTE_H_ -#include <bridges/remote/remote.h> -#endif -#include <rtl/ustring.hxx> -#include <rtl/byteseq.hxx> - -namespace bridges_urp -{ - struct Properties - { - ::rtl::ByteSequence seqBridgeID; - sal_Int32 nTypeCacheSize; - sal_Int32 nOidCacheSize; - sal_Int32 nTidCacheSize; - ::rtl::OUString sSupportedVersions; - ::rtl::OUString sVersion; - sal_Int32 nFlushBlockSize; - sal_Int32 nOnewayTimeoutMUSEC; - sal_Bool bSupportsMustReply; - sal_Bool bSupportsSynchronous; - sal_Bool bSupportsMultipleSynchronous; - sal_Bool bClearCache; - sal_Bool bNegotiate; - sal_Bool bForceSynchronous; - sal_Bool bCurrentContext; - - inline Properties() - : nTypeCacheSize( 256 ) - , nOidCacheSize( 256 ) - , nTidCacheSize( 256 ) - , sSupportedVersions( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "1.0" ) ) ) - , sVersion( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "1.0" ))) - , nFlushBlockSize( 4*1024 ) - , nOnewayTimeoutMUSEC( 10000 ) - , bSupportsMustReply( sal_False ) - , bSupportsSynchronous( sal_False ) - , bSupportsMultipleSynchronous( sal_False ) - , bClearCache( sal_False ) - , bNegotiate( sal_True ) - , bForceSynchronous( sal_True ) - , bCurrentContext( sal_False ) - {} - - inline Properties & SAL_CALL operator = ( const Properties &props ) - { - seqBridgeID = props.seqBridgeID; - nTypeCacheSize = props.nTypeCacheSize; - nOidCacheSize = props.nOidCacheSize; - nTidCacheSize = props.nTidCacheSize; - sSupportedVersions = props.sSupportedVersions; - sVersion = props.sVersion; - nFlushBlockSize = props.nFlushBlockSize; - nOnewayTimeoutMUSEC = props.nOnewayTimeoutMUSEC; - bSupportsMustReply = props.bSupportsMustReply; - bSupportsSynchronous = props.bSupportsSynchronous; - bSupportsMultipleSynchronous = props.bSupportsMultipleSynchronous; - bClearCache = props.bClearCache; - bNegotiate = props.bNegotiate; - bForceSynchronous = props.bForceSynchronous; - bCurrentContext = props.bCurrentContext; - return *this; - } - }; -} // end namespace bridges_urp -#endif diff --git a/bridges/source/remote/urp/urp_propertyobject.cxx b/bridges/source/remote/urp/urp_propertyobject.cxx deleted file mode 100644 index 654df569d..000000000 --- a/bridges/source/remote/urp/urp_propertyobject.cxx +++ /dev/null @@ -1,793 +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_bridges.hxx" -#include <stdlib.h> -#include <osl/diagnose.h> - -#include <rtl/random.h> - -#include <uno/data.h> - -#include "com/sun/star/bridge/InvalidProtocolChangeException.hpp" -#include <com/sun/star/bridge/XProtocolProperties.hpp> - -#include "urp_propertyobject.hxx" -#include "urp_dispatch.hxx" -#include "urp_bridgeimpl.hxx" -#include "urp_job.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::uno; - -using namespace bridges_urp; - -extern "C" { - -static void SAL_CALL staticAcquire( remote_Interface *pRemoteI ) -{ - PropertyObject *pProperties = (PropertyObject *) pRemoteI; - pProperties->thisAcquire(); -} - -static void SAL_CALL staticRelease( remote_Interface *pRemoteI ) -{ - PropertyObject *pProperties = (PropertyObject *) pRemoteI; - pProperties->thisRelease(); -} - -static void SAL_CALL staticDispatch( - remote_Interface * pRemoteI, typelib_TypeDescription const * pMemberType, - void * pReturn, void * pArgs[], uno_Any ** ppException ) -{ - PropertyObject *pProperties = (PropertyObject *) pRemoteI; - pProperties->thisDispatch( pMemberType, pReturn, pArgs, ppException ); -} - -} - -namespace bridges_urp -{ -// some nice constants .... -static const sal_Int32 METHOD_QUERY_INTERFACE = 0; -static const sal_Int32 METHOD_GET_PROPERTIES = 3; -static const sal_Int32 METHOD_REQUEST_CHANGE = 4; -static const sal_Int32 METHOD_COMMIT_CHANGE = 5; - -static const sal_Int32 PROPERTY_BRIDGEID = 0; -static const sal_Int32 PROPERTY_TYPECACHESIZE = 1; -static const sal_Int32 PROPERTY_OIDCACHESIZE = 2; -static const sal_Int32 PROPERTY_TIDCACHESIZE = 3; -static const sal_Int32 PROPERTY_SUPPORTEDVERSIONS = 4; -static const sal_Int32 PROPERTY_VERSION =5; -static const sal_Int32 PROPERTY_FLUSHBLOCKSIZE = 6; -static const sal_Int32 PROPERTY_ONEWAYTIMEOUT_MUSEC = 7; -static const sal_Int32 PROPERTY_SUPPORTSMUSTREPLY = 8; -static const sal_Int32 PROPERTY_SUPPERTSSYNCHRONOUS = 9; -static const sal_Int32 PROPERTY_SUPPORTSMULTIPLESYNCHRONOUS = 10; -static const sal_Int32 PROPERTY_CLEARCACHE = 11; -static const sal_Int32 PROPERTY_NEGOTIATE = 12; -static const sal_Int32 PROPERTY_FORCESYNCHRONOUS = 13; -static const sal_Int32 PROPERTY_CURRENTCONTEXT = 14; - -static const sal_Int32 MAX_PROPERTIES = PROPERTY_CURRENTCONTEXT +1; - -const sal_Char *g_aPropertyName[] = -{ - "BridgeId", - "TypeCacheSize", - "OidCacheSize", - "TidCacheSize", - "SupportedVersion", - "Version", - "FlushBlockSize", - "OnewayTimeoutMUSEC", - "SupportsMustReply", - "SupportsSynchronous", - "SupportsMultipleSynchronous", - "ClearCache", - "Negotiate", - "ForceSynchronous", - "CurrentContext" -}; - -// nice little helper functions for conversion -template< class t > -void assignToIdl( ProtocolProperty *pIdl, sal_Int32 nIndex, const t &value ) -{ - pIdl->Name = OUString::createFromAscii( g_aPropertyName[nIndex] ); - ( *(::com::sun::star::uno::Any *)&(pIdl->Value) ) <<= value; -} - -template< class t > -void assignFromIdl( t * p, const ProtocolProperty & property ) -{ - property.Value >>=*p; -} - -static sal_Int32 getIndexFromIdl( const ProtocolProperty & property ) -{ - sal_Int32 nResult = -1; - for( sal_Int32 i = 0 ; i < MAX_PROPERTIES ; i ++ ) - { - if( 0 == property.Name.compareToAscii( g_aPropertyName[i] ) ) - { - nResult = i; - break; - } - } - return nResult; -} - -static sal_Int32 getIndexFromString( const OUString & property ) -{ - sal_Int32 nResult = -1; - for( sal_Int32 i = 0 ; i < MAX_PROPERTIES ; i ++ ) - { - if( 0 == property.compareToAscii( g_aPropertyName[i] ) ) - { - nResult = i; - break; - } - } - return nResult; -} - -static sal_Bool assignFromIdlToStruct( Properties *pProps, const ProtocolProperty &idl ) -{ - sal_Bool bReturn = sal_True; - - sal_Int32 nIndex = getIndexFromIdl( idl ); - if( nIndex >= 0 ) - { - switch( nIndex ) - { - case PROPERTY_SUPPORTSMULTIPLESYNCHRONOUS: - assignFromIdl( &(pProps->bSupportsMultipleSynchronous) , idl ); - break; - case PROPERTY_SUPPERTSSYNCHRONOUS: - assignFromIdl( &(pProps->bSupportsMustReply) , idl ); - break; - case PROPERTY_SUPPORTSMUSTREPLY: - assignFromIdl( &(pProps->bSupportsSynchronous) , idl ); - break; - case PROPERTY_ONEWAYTIMEOUT_MUSEC: - assignFromIdl( &(pProps->nOnewayTimeoutMUSEC) , idl ); - break; - case PROPERTY_BRIDGEID: - assignFromIdl( (Sequence< sal_Int8 > * )&(pProps->seqBridgeID), idl ); - break; - case PROPERTY_TYPECACHESIZE: - assignFromIdl( &(pProps->nTypeCacheSize) , idl ); - break; - case PROPERTY_OIDCACHESIZE: - assignFromIdl( &(pProps->nOidCacheSize) , idl ); - break; - case PROPERTY_TIDCACHESIZE: - assignFromIdl( &(pProps->nTidCacheSize), idl ); - break; - case PROPERTY_SUPPORTEDVERSIONS: - assignFromIdl( &(pProps->sSupportedVersions) , idl ); - break; - case PROPERTY_VERSION: - assignFromIdl( &(pProps->sVersion) , idl ); - break; - case PROPERTY_FLUSHBLOCKSIZE: - assignFromIdl( &(pProps->nFlushBlockSize) ,idl ); - break; - case PROPERTY_CLEARCACHE: - assignFromIdl( &(pProps->bClearCache) ,idl ); - break; - case PROPERTY_NEGOTIATE: - assignFromIdl( &(pProps->bNegotiate) ,idl ); - break; - case PROPERTY_FORCESYNCHRONOUS: - assignFromIdl( &(pProps->bForceSynchronous) ,idl ); - break; - case PROPERTY_CURRENTCONTEXT: - pProps->bCurrentContext = true; - break; - default: - bReturn = sal_False; - } - } - else - { - bReturn = sal_False; - } - return bReturn; -} - -static void extractTokens( - const ::rtl::OUString &sProps , ::std::list< OUString > &lst ) -{ - sal_Int32 nNext = 0; - while ( sal_True ) - { - sal_Int32 nStart = nNext; - nNext = sProps.indexOf( ',' , nNext ); - if( -1 == nNext ) - { - lst.push_back( sProps.copy( nStart, sProps.getLength() - nStart ) ); - break; - } - lst.push_back( sProps.copy( nStart , nNext - nStart ) ); - nNext ++; - } -} - - -static void assignFromStringToPropSeq( const OUString &sProps, uno_Sequence **ppPropertySeq) -{ - ::std::list< OUString > lst; - extractTokens( sProps , lst ); - - typelib_TypeDescription *pSequenceType = 0; - getCppuType( (Sequence< ProtocolProperty > *)0).getDescription( &pSequenceType ); - uno_Sequence *pSeq = 0; - uno_sequence_construct( &pSeq , pSequenceType , 0, lst.size() , 0 ); - ProtocolProperty *pElements = (ProtocolProperty * ) pSeq->elements; - - sal_Int32 i = 0; - for( ::std::list< OUString >::iterator ii = lst.begin() ; ii != lst.end() ; ++ ii, i++ ) - { - sal_Int32 nAssign = (*ii).indexOf( '=' ); - if( -1 == nAssign ) - { - OString o = OUStringToOString( *ii, RTL_TEXTENCODING_ASCII_US ); - OSL_ENSURE( !"wrong protocol propertyt format, ignored", o.getStr() ); - } - OUString sPropName = (*ii).copy( 0, nAssign ); - OUString sValue = (*ii).copy( nAssign +1, (*ii).getLength() - nAssign -1 ); - - sal_Int32 nIndex = getIndexFromString( sPropName ); - if( -1 == nIndex ) - { - OString o = OUStringToOString( sPropName , RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE( !"unknown protocol property, ignored", o.getStr() ); - } - switch( nIndex ) - { - // voids - case PROPERTY_CURRENTCONTEXT: - pElements[i].Name = OUString::createFromAscii( - g_aPropertyName[nIndex] ); - break; - // bools - case PROPERTY_CLEARCACHE: - case PROPERTY_NEGOTIATE: - case PROPERTY_FORCESYNCHRONOUS: - { - sal_Bool bClearCache = (sal_Bool ) sValue.toInt32(); - assignToIdl( &(pElements[i]) , nIndex , bClearCache ); - break; - } - // ints - case PROPERTY_TYPECACHESIZE: - case PROPERTY_OIDCACHESIZE: - case PROPERTY_TIDCACHESIZE: - case PROPERTY_FLUSHBLOCKSIZE: - case PROPERTY_ONEWAYTIMEOUT_MUSEC: - { - sal_Int32 nValue = sValue.toInt32(); - assignToIdl( &(pElements[i]) , nIndex , nValue ); - break; - } - - // strings - case PROPERTY_VERSION: - assignToIdl( &(pElements[i]) , nIndex , sValue ); - break; - default: - OString o = OUStringToOString( sPropName, RTL_TEXTENCODING_ASCII_US ); - OSL_ENSURE( !"readonly protocol property, ignored" , o.getStr() ); - } - } - *ppPropertySeq = pSeq; - typelib_typedescription_release( pSequenceType ); -} - -static void assignFromPropSeqToStruct( uno_Sequence *pSeq , struct Properties *pProps ) -{ - sal_Int32 i; - ProtocolProperty *pElements = (ProtocolProperty *)pSeq->elements; - for( i = 0 ; i < pSeq->nElements ; i ++ ) - { - assignFromIdlToStruct( pProps , pElements[i] ); - } -} - -void assignFromStringToStruct( const OUString & sProps , struct Properties *pProps ) -{ - uno_Sequence *pSeq = 0; - assignFromStringToPropSeq( sProps , &pSeq ); - assignFromPropSeqToStruct( pSeq , pProps ); - uno_type_destructData( &pSeq, getCppuType( (Sequence< ProtocolProperty > *)0).getTypeLibType(),0); -} - - -//---------------------------------------------------------------------------------------------- -// PropertyObject implementation -PropertyObject::PropertyObject( - struct Properties *pLocalSetting , uno_Environment *pEnvRemote, urp_BridgeImpl *pImpl ) - : m_commitChangeCondition( osl_createCondition() ) - , m_nRefCount( 0 ) - , m_pBridgeImpl( pImpl ) - , m_pLocalSetting( pLocalSetting ) - , m_pEnvRemote( pEnvRemote ) - , m_bRequestChangeHasBeenCalled( sal_False ) - , m_bServerWaitingForCommit( sal_False ) - , m_bApplyProperties( sal_False ) -{ - acquire = staticAcquire; - release = staticRelease; - pDispatcher = staticDispatch; -} - -PropertyObject::~PropertyObject() -{ - osl_destroyCondition( m_commitChangeCondition ); -} - -void SAL_CALL PropertyObject::thisDispatch( - typelib_TypeDescription const * pMemberType, void * pReturn, void * ppArgs[], - uno_Any ** ppException ) -{ - OSL_ASSERT( pMemberType->eTypeClass == typelib_TypeClass_INTERFACE_METHOD ); - - typelib_InterfaceMethodTypeDescription *pMethodType = - ( typelib_InterfaceMethodTypeDescription * ) pMemberType; - - switch( pMethodType->aBase.nPosition ) - { - case METHOD_QUERY_INTERFACE: - OSL_ENSURE( 0 , "not implemented yet !" ); - break; - case METHOD_GET_PROPERTIES: - { - implGetProperties( (uno_Sequence **) pReturn ); - *ppException = 0; - break; - } - case METHOD_COMMIT_CHANGE: - { - implCommitChange( *(uno_Sequence ** ) ppArgs[0] , ppException ); - break; - } - case METHOD_REQUEST_CHANGE: - { - *(sal_Int32 *) pReturn = implRequestChange( *(sal_Int32 *)ppArgs[0], ppException ); - break; - } - default: - OSL_ENSURE( 0 , "unkown method !" ); - } -} - -void SAL_CALL PropertyObject::localGetPropertiesFromRemote( struct Properties *pR ) -{ - OUString oid = OUString::createFromAscii( g_NameOfUrpProtocolPropertiesObject ); - - typelib_TypeDescription *pInterfaceType = 0; - getCppuType( (Reference< XProtocolProperties > *) 0 ).getDescription( &pInterfaceType ); - - if( !pInterfaceType->bComplete ) - { - typelib_typedescription_complete( &pInterfaceType ); - } - - typelib_TypeDescription *pMethodType = 0; - typelib_typedescriptionreference_getDescription( - &pMethodType, - ((typelib_InterfaceTypeDescription*) pInterfaceType)->ppAllMembers[METHOD_GET_PROPERTIES] ); - - - uno_Sequence *pResult = 0; - uno_Any exception; - uno_Any *pException = &exception; - urp_sendRequest( m_pEnvRemote, - pMethodType, - oid.pData, - (typelib_InterfaceTypeDescription*) pInterfaceType, - &pResult, - 0, - &pException ); - - if( pException ) - { - OSL_ENSURE( 0 , "remote urp-bridge doesn't support property-object" ); - uno_any_destruct( pException , 0 ); - return; - } - - ProtocolProperty *pP = (ProtocolProperty * ) pResult->elements; - for( sal_Int32 i = 0; i < pResult->nElements ; i ++ ) - { - if( ! assignFromIdlToStruct( pR , pP[i] ) ) - { - OSL_ENSURE( 0 , "unknown property !!!!" ); - } - } - - typelib_typedescription_release( pInterfaceType ); - typelib_typedescription_release( pMethodType ); -} - - -// implementation for call from remote -void SAL_CALL PropertyObject::implGetProperties( uno_Sequence **ppReturnValue ) -{ - typelib_TypeDescription *pElementType= 0; - getCppuType( (Sequence< ProtocolProperty > *)0).getDescription( &pElementType ); - - OSL_ENSURE( pElementType , "Couldn't get property type" ); - - *ppReturnValue = 0; - uno_sequence_construct( ppReturnValue , pElementType , 0, MAX_PROPERTIES , 0 ); - ProtocolProperty *pElements = (ProtocolProperty * ) ( *ppReturnValue )->elements; - Properties *pP = m_pLocalSetting; - - assignToIdl( &(pElements[PROPERTY_BRIDGEID]),PROPERTY_BRIDGEID, *(Sequence< sal_Int8 > *)&(pP->seqBridgeID) ); - assignToIdl( &(pElements[PROPERTY_TYPECACHESIZE]),PROPERTY_TYPECACHESIZE,pP->nTypeCacheSize ); - assignToIdl( &(pElements[PROPERTY_OIDCACHESIZE]),PROPERTY_OIDCACHESIZE, pP->nOidCacheSize ); - assignToIdl( &(pElements[PROPERTY_TIDCACHESIZE]),PROPERTY_TIDCACHESIZE, pP->nTidCacheSize ); - assignToIdl( &(pElements[PROPERTY_SUPPORTEDVERSIONS]),PROPERTY_SUPPORTEDVERSIONS, pP->sSupportedVersions ); - assignToIdl( &(pElements[PROPERTY_VERSION]),PROPERTY_VERSION, pP->sVersion ); - assignToIdl( &(pElements[PROPERTY_FLUSHBLOCKSIZE]), PROPERTY_FLUSHBLOCKSIZE,pP->nFlushBlockSize ); - assignToIdl( &(pElements[PROPERTY_ONEWAYTIMEOUT_MUSEC]), PROPERTY_ONEWAYTIMEOUT_MUSEC, pP->nOnewayTimeoutMUSEC ); - assignToIdl( &(pElements[PROPERTY_SUPPORTSMUSTREPLY]), PROPERTY_SUPPORTSMUSTREPLY, pP->bSupportsMustReply ); - assignToIdl( &(pElements[PROPERTY_SUPPERTSSYNCHRONOUS]), PROPERTY_SUPPERTSSYNCHRONOUS, pP->bSupportsSynchronous ); - assignToIdl( &(pElements[PROPERTY_SUPPORTSMULTIPLESYNCHRONOUS]), PROPERTY_SUPPORTSMULTIPLESYNCHRONOUS, pP->bSupportsMultipleSynchronous ); - assignToIdl( &(pElements[PROPERTY_CLEARCACHE]), PROPERTY_CLEARCACHE, pP->bClearCache ); - - typelib_typedescription_release( pElementType ); -} - -//---------------------------------------------------------------------------------------------- -sal_Int32 SAL_CALL PropertyObject::localRequestChange( ) -{ - sal_Int32 nResult = 0; - sal_Bool bCall = sal_True; - - // disallow marshaling NOW ! - ClearableMutexGuard marshalingGuard( m_pBridgeImpl->m_marshalingMutex ); - { - MutexGuard guard( m_mutex ); - if( m_bRequestChangeHasBeenCalled || m_bServerWaitingForCommit ) - { - // another transaction is already underway - // try again later ! - bCall = sal_False; - } - m_bRequestChangeHasBeenCalled = sal_True; - - if( bCall ) - { - // calulate random number - rtlRandomPool pool = rtl_random_createPool (); - rtl_random_getBytes( pool , &m_nRandomNumberOfRequest, sizeof( m_nRandomNumberOfRequest ) ); - rtl_random_destroyPool( pool ); - } - } - - if( bCall ) - { - OUString oid = OUString::createFromAscii( g_NameOfUrpProtocolPropertiesObject ); - - // gather types for calling - typelib_TypeDescription *pInterfaceType = 0; - getCppuType( (Reference< XProtocolProperties > *) 0 ).getDescription( &pInterfaceType ); - - if( !pInterfaceType->bComplete ) - { - typelib_typedescription_complete( &pInterfaceType ); - } - - typelib_TypeDescription *pMethodType = 0; - typelib_typedescriptionreference_getDescription( - &pMethodType, - ((typelib_InterfaceTypeDescription*) pInterfaceType)->ppAllMembers[METHOD_REQUEST_CHANGE] ); - - void *pArg1 = &m_nRandomNumberOfRequest; - void **ppArgs = &pArg1; - - uno_Any exception; - uno_Any *pException = &exception; - - ClientJob job( m_pEnvRemote, - 0, - m_pBridgeImpl, - oid.pData, - pMethodType, - (typelib_InterfaceTypeDescription*) pInterfaceType, - &nResult, - ppArgs, - &pException ); - - // put the call on the line ! - sal_Bool bSuccess = job.pack(); - - // now allow writing on wire again. - // NOTE : this has been locked, because it is inevitable to set m_bRequestChangeHasBeenCalled - // and call requestChange in an atomar operation. Otherwise, implRequestChange may be called - // inbetween and reply, before the request is put on the wire. This certainly would - // be confusing for the remote counterpart ! - marshalingGuard.clear(); - - // wait for the reply ... - if( bSuccess ) - { - job.wait(); - - if( pException ) - { - // the object is unknown on the other side. - uno_any_destruct( pException , 0 ); - nResult = 0; - } - } - else - { - nResult = 0; - } - typelib_typedescription_release( pInterfaceType ); - typelib_typedescription_release( pMethodType ); - } - - { - MutexGuard guard( m_mutex ); - m_bRequestChangeHasBeenCalled = sal_False; - m_bServerWaitingForCommit = ( 0 == nResult ); - } - return nResult; -} - -// implementation for call from remote -sal_Int32 SAL_CALL PropertyObject::implRequestChange( sal_Int32 nRandomNumber, uno_Any **ppException ) -{ - sal_Int32 nResult = 0; - MutexGuard guard( m_mutex ); - if( m_bRequestChangeHasBeenCalled ) - { - // this side has also called requestChange, now negotiate, which side is allowed - // to commit the change ! - if( m_nRandomNumberOfRequest > nRandomNumber ) - { - // this side may commit !!!! - nResult = 0; - } - else if( m_nRandomNumberOfRequest == nRandomNumber ) - { - // sorry, try again ! - nResult = -1; - } - else if( m_nRandomNumberOfRequest < nRandomNumber ) - { - // the other side may commit ! - nResult = 1; - // m_bServerWaitingForCommit will be set by localRequestChange - } - } - else - { - // This side has NOT called requestChange, so the other side may commit - nResult = 1; - m_bServerWaitingForCommit = sal_True; - } - - *ppException = 0; - return nResult; -} - - - -void SAL_CALL PropertyObject::localCommitChange( const ::rtl::OUString &sProps , sal_Bool *pbExceptionThrown ) -{ - // lock the bridge NOW ! - // NOTE: it is not allowed for other threads to call, when a commit change is underway. - // The remote counterpart cannot if the call following the commit already uses - // the new properties or not. - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - - OUString oid = OUString::createFromAscii( g_NameOfUrpProtocolPropertiesObject ); - - osl_resetCondition( m_commitChangeCondition ); - - Properties props = *m_pLocalSetting; - - typelib_TypeDescription *pInterfaceType = 0; - getCppuType( (Reference< XProtocolProperties > *) 0 ).getDescription( &pInterfaceType ); - - if( !pInterfaceType->bComplete ) - { - typelib_typedescription_complete( &pInterfaceType ); - } - - typelib_TypeDescription *pMethodType = 0; - typelib_typedescriptionreference_getDescription( - &pMethodType, - ((typelib_InterfaceTypeDescription*) pInterfaceType)->ppAllMembers[METHOD_COMMIT_CHANGE] ); - -// typelib_TypeDescription *pSequenceType= 0; - - - // extract name/value pairs - uno_Sequence *pSeq = 0; - assignFromStringToPropSeq( sProps, &pSeq ); - assignFromPropSeqToStruct( pSeq , &props ); -// ::std::list< OUString > lst; -// extractTokens( sProps , lst ); - -// getCppuType( (Sequence< ProtocolProperty > *)0).getDescription( &pSequenceType ); -// uno_sequence_construct( &pSeq , pSequenceType , 0, lst.size() , 0 ); -// ProtocolProperty *pElements = (ProtocolProperty * ) pSeq->elements; - -// sal_Int32 i = 0; -// for( ::std::list< OUString >::iterator ii = lst.begin() ; ii != lst.end() ; ++ ii, i++ ) -// { -// sal_Int32 nAssign = (*ii).indexOf( '=' ); -// if( -1 == nAssign ) -// { -// OString o = OUStringToOString( *ii, RTL_TEXTENCODING_ASCII_US ); -// OSL_ENSURE( !"wrong protocol propertyt format, ignored", o.getStr() ); -// } -// OUString sPropName = (*ii).copy( 0, nAssign ); -// OUString sValue = (*ii).copy( nAssign +1, (*ii).getLength() - nAssign -1 ); - -// sal_Int32 nIndex = getIndexFromString( sPropName ); -// if( -1 == nIndex ) -// { -// OString o = OUStringToOString( sPropName , RTL_TEXTENCODING_ASCII_US); -// OSL_ENSURE( !"unknown protocol property, ignored", o.getStr() ); -// } -// switch( nIndex ) -// { -// // bools -// case PROPERTY_CLEARCACHE: -// { -// sal_Bool bClearCache = (sal_Bool ) sValue.toInt32(); -// assignToIdl( &(pElements[i]) , nIndex , bClearCache ); -// break; -// } -// // ints -// case PROPERTY_TYPECACHESIZE: -// case PROPERTY_OIDCACHESIZE: -// case PROPERTY_TIDCACHESIZE: -// case PROPERTY_FLUSHBLOCKSIZE: -// case PROPERTY_ONEWAYTIMEOUT_MUSEC: -// { -// sal_Int32 nValue = sValue.toInt32(); -// assignToIdl( &(pElements[i]) , nIndex , nValue ); -// break; -// } - -// // strings -// case PROPERTY_VERSION: -// assignToIdl( &(pElements[i]) , nIndex , sValue ); -// break; -// default: -// OString o = OUStringToOString( sPropName, RTL_TEXTENCODING_ASCII_US ); -// OSL_ENSURE( !"readonly protocol property, ignored" , o.getStr() ); -// } -// assignFromIdlToStruct( &props, pElements[i] ); -// } - - void *pArg1 = &pSeq; - uno_Any exception; - uno_Any *pException = &exception; - - ClientJob job( m_pEnvRemote, - 0, - m_pBridgeImpl, - oid.pData, - pMethodType, - (typelib_InterfaceTypeDescription*) pInterfaceType, - 0, - &pArg1, - &pException ); - job.setBridgePropertyCall(); - if( job.pack() ) - { - job.wait(); - } - else - { - OSL_ASSERT( pException != NULL ); - } - - ::uno_type_destructData( - &pSeq, getCppuType( (Sequence< ProtocolProperty > *)0).getTypeLibType(), 0 ); - - *pbExceptionThrown = pException ? sal_True : sal_False; - - if( pException ) - { - OString o = OUStringToOString( ((com::sun::star::uno::Exception*)pException->pData)->Message, - RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE( !"exception thrown during calling on PropertyObject",o.getStr() ); - uno_any_destruct( pException , 0 ); - } - else - { - m_pBridgeImpl->applyProtocolChanges( props ); - m_bServerWaitingForCommit = sal_False; - m_bApplyProperties = sal_False; - } - - // let the reader thread go ... - osl_setCondition( m_commitChangeCondition ); - - typelib_typedescription_release( pMethodType ); - typelib_typedescription_release( pInterfaceType ); -} - -void SAL_CALL PropertyObject::implCommitChange( uno_Sequence *pSequence, uno_Any **ppException ) -{ - MutexGuard guard( m_mutex ); - m_propsToBeApplied = *m_pLocalSetting; - - ProtocolProperty *pP = (ProtocolProperty * ) pSequence->elements; - for( sal_Int32 i = 0; i < pSequence->nElements ; i ++ ) - { - if( ! assignFromIdlToStruct( &m_propsToBeApplied , pP[i] ) ) - { - InvalidProtocolChangeException exception; - Type type = getCppuType( &exception ); - exception.Message = OUString::createFromAscii( "urp: unknown Property " ); - exception.Message += pP[i].Name; - exception.invalidProperty = pP[i]; - exception.reason = 1; - - uno_type_any_construct( *ppException, &exception, type.getTypeLibType() , 0 ); - - m_bApplyProperties = sal_False; - m_bServerWaitingForCommit = sal_False; - return; - } - } - - m_bApplyProperties = sal_True; - *ppException = 0; -} - -Properties SAL_CALL PropertyObject::getCommitedChanges() -{ - MutexGuard guard( m_mutex ); - OSL_ASSERT( m_bApplyProperties ); - m_bApplyProperties = sal_False; - m_bServerWaitingForCommit = sal_False; - return m_propsToBeApplied; -} - -void SAL_CALL PropertyObject::waitUntilChangesAreCommitted() -{ - osl_waitCondition( m_commitChangeCondition , 0 ); -} -} diff --git a/bridges/source/remote/urp/urp_propertyobject.hxx b/bridges/source/remote/urp/urp_propertyobject.hxx deleted file mode 100644 index 96825b5c7..000000000 --- a/bridges/source/remote/urp/urp_propertyobject.hxx +++ /dev/null @@ -1,108 +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 <osl/interlck.h> -#include <osl/mutex.hxx> - -#ifndef _OSL_CONDITN_H_ -#include <osl/conditn.h> -#endif -#include <rtl/string.hxx> -#include <uno/sequence2.h> - -#ifndef _BRIDGES_REMOTE_REMOTE_H_ -#include <bridges/remote/remote.h> -#endif -#include "urp_property.hxx" - -namespace bridges_urp { - -struct urp_BridgeImpl; -const sal_Char g_NameOfUrpProtocolPropertiesObject[] = "UrpProtocolProperties"; - -// helper functions -void assignFromStringToStruct( const ::rtl::OUString & sProps , struct Properties *pProps ); - -class PropertyObject : public remote_Interface -{ -private: - ::osl::Mutex m_mutex; - oslCondition m_commitChangeCondition; - oslInterlockedCount m_nRefCount; - urp_BridgeImpl *m_pBridgeImpl; - struct Properties *m_pLocalSetting; - struct Properties m_propsToBeApplied; - - uno_Environment *m_pEnvRemote; - sal_Int32 m_nRandomNumberOfRequest; - sal_Bool m_bRequestChangeHasBeenCalled; - sal_Bool m_bServerWaitingForCommit; - sal_Bool m_bApplyProperties; - -public: - PropertyObject( - struct Properties *pLocalSetting , uno_Environment *pEnvRemote, urp_BridgeImpl *pImpl ); - ~PropertyObject(); - - void SAL_CALL thisAcquire( ) - { - osl_incrementInterlockedCount( &m_nRefCount ); - } - - void SAL_CALL thisRelease() - { - if( ! osl_decrementInterlockedCount( &m_nRefCount ) ) - { - delete this; - } - } - - void SAL_CALL thisDispatch( typelib_TypeDescription const * pMemberType, - void * pReturn, - void * pArgs[], - uno_Any ** ppException ); - -public: // local - sal_Int32 SAL_CALL localRequestChange( ); - void SAL_CALL localCommitChange( const ::rtl::OUString &properties, sal_Bool *pbExceptionThrown ); - void SAL_CALL localGetPropertiesFromRemote( struct Properties * ); - - // returns 0, if nothing was commited. - inline sal_Bool SAL_CALL changesHaveBeenCommited() - { return m_bApplyProperties; } - Properties SAL_CALL getCommitedChanges(); - - void SAL_CALL waitUntilChangesAreCommitted(); - -protected: - // these methods are called by thisDispatch - void SAL_CALL implGetProperties( uno_Sequence **ppReturnValue ); - sal_Int32 SAL_CALL implRequestChange( sal_Int32 nRandomNumber, uno_Any **ppException ); - void SAL_CALL implCommitChange( uno_Sequence *seqOfProperties, uno_Any **ppException ); -}; - -} diff --git a/bridges/source/remote/urp/urp_reader.cxx b/bridges/source/remote/urp/urp_reader.cxx deleted file mode 100644 index 287b1ef0c..000000000 --- a/bridges/source/remote/urp/urp_reader.cxx +++ /dev/null @@ -1,832 +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_bridges.hxx" -#include <string.h> - -#include <osl/diagnose.h> -#include <rtl/ustrbuf.hxx> - -#include <bridges/remote/connection.h> -#include <bridges/remote/counter.hxx> -#include <bridges/remote/context.h> -#include <bridges/remote/helper.hxx> - -#include <com/sun/star/uno/XCurrentContext.hpp> -#include <uno/environment.h> - -#include "urp_reader.hxx" -#include "urp_writer.hxx" -#include "urp_dispatch.hxx" -#include "urp_job.hxx" -#include "urp_bridgeimpl.hxx" -#include "urp_log.hxx" -#include "urp_propertyobject.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -#if OSL_DEBUG_LEVEL > 1 -static MyCounter thisCounter( "DEBUG : ReaderThread" ); -#endif - -namespace bridges_urp -{ - - /** - * This callback is used to ensure, that the release call is sent for the correct type. - * - ***/ - void SAL_CALL urp_releaseRemoteCallback ( - remote_Interface *, rtl_uString *pOid, - typelib_TypeDescriptionReference *pTypeRef, uno_Environment *pEnvRemote ) - { - remote_Context *pContext = (remote_Context *) pEnvRemote->pContext; - urp_BridgeImpl *pImpl = (urp_BridgeImpl*) ( pContext->m_pBridgeImpl ); - - pImpl->m_pWriter->insertReleaseRemoteCall( pOid , pTypeRef ); - } - - - struct MessageFlags - { - sal_uInt16 nMethodId; - sal_Bool bRequest; - sal_Bool bType; - sal_Bool bOid; - sal_Bool bTid; - sal_Bool bException; - sal_Bool bMustReply; - sal_Bool bSynchronous; - sal_Bool bMoreFlags; - sal_Bool bIgnoreCache; - sal_Bool bBridgePropertyCall; - ///-------------------------- - inline MessageFlags() - { - bTid = sal_False; - bOid = sal_False; - bType = sal_False; - bException = sal_False; - bMoreFlags = sal_False; - bIgnoreCache = sal_False; - bBridgePropertyCall = sal_False; - } - //--------------------------- - }; // end struct MessageFlags - -inline sal_Bool OReaderThread::getMemberTypeDescription( - typelib_InterfaceAttributeTypeDescription **ppAttributeType, - typelib_InterfaceMethodTypeDescription **ppMethodType, - sal_Bool *pbIsSetter, - sal_uInt16 nMethodId , - typelib_TypeDescriptionReference * pITypeRef ) -{ - if( pITypeRef->eTypeClass != typelib_TypeClass_INTERFACE ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "interface type is not of typeclass interface (" ); - sMessage.append( (sal_Int32) pITypeRef->eTypeClass ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - OSL_ENSURE( 0 , "type is not an interface" ); - return sal_False; - } - - typelib_InterfaceTypeDescription *pInterfaceType = 0; - TYPELIB_DANGER_GET( - (typelib_TypeDescription **)&pInterfaceType , pITypeRef ); - if( ! pInterfaceType ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "No typedescription can be retrieved for type " ); - sMessage.append( OUString( pITypeRef->pTypeName ) ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - OSL_ENSURE( 0 , "urp: unknown type " ); - return sal_False; - } - - if( ! pInterfaceType->aBase.bComplete ) - { - typelib_typedescription_complete( (typelib_TypeDescription **) &pInterfaceType ); - } - - if ( nMethodId >= pInterfaceType->nMapFunctionIndexToMemberIndex ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "vtable out of range for type " ); - sMessage.append( OUString( pITypeRef->pTypeName ) ); - sMessage.appendAscii( " (" ); - sMessage.append( (sal_Int32) nMethodId ); - sMessage.appendAscii( " )" ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - - OSL_ENSURE( 0 , "vtable index out of range" ); - return sal_False; - } - - sal_Int32 nMemberIndex = pInterfaceType->pMapFunctionIndexToMemberIndex[ nMethodId ]; - - if( !( pInterfaceType->nAllMembers > nMemberIndex && nMemberIndex >= 0 ) ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "vtable out of range for type " ); - sMessage.append( OUString( pITypeRef->pTypeName ) ); - sMessage.appendAscii( " (" ); - sMessage.append( (sal_Int32) nMethodId ); - sMessage.appendAscii( " )" ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - - OSL_ENSURE( 0 , "vtable index out of range" ); - return sal_False; - } - - typelib_InterfaceMemberTypeDescription *pMemberType = 0; - typelib_typedescriptionreference_getDescription( - (typelib_TypeDescription **) &pMemberType,pInterfaceType->ppAllMembers[nMemberIndex]); - - if(! pMemberType ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "unknown method type description for type" ); - sMessage.append( OUString( pITypeRef->pTypeName ) ); - sMessage.appendAscii( " (" ); - sMessage.append( (sal_Int32) nMethodId ); - sMessage.appendAscii( " )" ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - - OSL_ENSURE( 0 , "unknown method type description" ); - return sal_False; - } - - if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pMemberType->aBase.eTypeClass ) - { - // Note: pMapMemberIndexToFunctionIndex always contains the function - // index of the attribute getter! setter function index is getter index - // + 1. - *ppAttributeType = (typelib_InterfaceAttributeTypeDescription *) pMemberType; - *pbIsSetter = ! ( - pInterfaceType->pMapMemberIndexToFunctionIndex[nMemberIndex] == nMethodId ); - } - else - { - *ppMethodType = (typelib_InterfaceMethodTypeDescription *) pMemberType; - } - - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription * )pInterfaceType ); - return sal_True; -} - -OReaderThread::OReaderThread( remote_Connection *pConnection, - uno_Environment *pEnvRemote, - OWriterThread * pWriterThread ) : - m_pConnection( pConnection ), - m_pEnvRemote( pEnvRemote ), - m_pWriterThread( pWriterThread ), - m_bDestroyMyself( sal_False ), - m_bContinue( sal_True ), - m_pBridgeImpl((struct urp_BridgeImpl*) - ((remote_Context *)pEnvRemote->pContext)->m_pBridgeImpl ), - m_unmarshal( m_pBridgeImpl, m_pEnvRemote, ::bridges_remote::remote_createStub ) -{ - m_pEnvRemote->acquireWeak( m_pEnvRemote ); - m_pConnection->acquire( m_pConnection ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - - -OReaderThread::~OReaderThread( ) -{ - m_pEnvRemote->releaseWeak( m_pEnvRemote ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif -} - -// may only be called in the callstack of this thread !!!!! -// run() -> dispose() -> destroyYourself() -void OReaderThread::destroyYourself() -{ - m_bDestroyMyself = sal_True; - m_pConnection->release( m_pConnection ); - m_pConnection = 0; - m_bContinue = sal_False; -} - -void OReaderThread::onTerminated() -{ - if( m_bDestroyMyself ) - { - delete this; - } -} - - -void OReaderThread::disposeEnvironment() -{ - struct remote_Context *pContext = - ( struct remote_Context * ) m_pEnvRemote->pContext; - m_bContinue = sal_False; - if( ! pContext->m_pBridgeImpl->m_bDisposed ) - { - uno_Environment *pEnvRemote = 0; - m_pEnvRemote->harden( &pEnvRemote , m_pEnvRemote ); - if( pEnvRemote ) - { - pEnvRemote->dispose( m_pEnvRemote ); - pEnvRemote->release( m_pEnvRemote ); - } - else - { - // environment has been disposed eitherway ! - } - } -} - -inline sal_Bool OReaderThread::readBlock( sal_Int32 *pnMessageCount ) -{ - m_unmarshal.setSize( 8 ); - if( 8 != m_pConnection->read( m_pConnection , m_unmarshal.getBuffer(), 8 ) ) - { - OUString s( RTL_CONSTASCII_USTRINGPARAM( "Unexpected connection closure" ) ); - m_pBridgeImpl->addError( s ); - return sal_False; - } - - sal_Int32 nSize; - m_unmarshal.unpackInt32( &nSize ); - m_unmarshal.unpackInt32( pnMessageCount ); - - if( nSize < 0 ) - { - // buffer too big - // no exception can be thrown, because there is no thread id, which could be - // used. -> terminate ! - OUStringBuffer s; - s.appendAscii( "Packet-size too big (" ); - s.append( (sal_Int64) (sal_uInt32 ) nSize ); - s.append( sal_Unicode( ')' ) ); - m_pBridgeImpl->addError( s.makeStringAndClear() ); - OSL_ENSURE( 0 , "urp bridge: Packet-size too big" ); - return sal_False; - } - - if( 0 == nSize ) - { - // normal termination ! - return sal_False; - } - - // allocate the necessary memory - if( ! m_unmarshal.setSize( nSize ) ) - { - OUStringBuffer s; - s.appendAscii( "Packet-size too big, couln't allocate necessary memory (" ); - s.append( (sal_Int64) (sal_uInt32 ) nSize ); - s.append( sal_Unicode( ')' ) ); - m_pBridgeImpl->addError( s.makeStringAndClear() ); - OSL_ENSURE( 0 , "urp bridge: messages size too large, terminating connection" ); - return sal_False; - } - - sal_Int32 nRead = m_pConnection->read( m_pConnection , m_unmarshal.getBuffer() , nSize ); - - if( nSize != nRead ) - { - OUStringBuffer s; - s.appendAscii( "Unexpected connection closure, inconsistent packet (" ); - s.append( (sal_Int64) (sal_uInt32 ) nSize ); - s.appendAscii( " asked, " ); - s.append( (sal_Int64) (sal_uInt32 ) nRead ); - s.appendAscii( " got )" ); - m_pBridgeImpl->addError( s.makeStringAndClear() ); - // couldn't get the asked amount of bytes, quit - // should only occur, when the environment has already been disposed - OSL_ENSURE( m_pBridgeImpl->m_bDisposed , "urp bridge: inconsistent packet, terminating connection." ); - return sal_False; - } - return sal_True; -} - -inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags ) -{ - sal_uInt8 nBitField; - if( ! m_unmarshal.unpackInt8( &nBitField ) ) - { - m_pBridgeImpl->addError( "Unexpected end of message header (1)" ); - return sal_False; - } - - if( HDRFLAG_LONGHEADER & nBitField ) - { - // this is a long header, interpret the byte as bitfield - pFlags->bTid = (HDRFLAG_NEWTID & nBitField ); - pFlags->bRequest = (HDRFLAG_REQUEST & nBitField); - - if( pFlags->bRequest ) - { - // request - pFlags->bType = ( HDRFLAG_NEWTYPE & nBitField ); - pFlags->bOid = ( HDRFLAG_NEWOID & nBitField ); - pFlags->bIgnoreCache = ( HDRFLAG_IGNORECACHE & nBitField ); - pFlags->bMoreFlags = ( HDRFLAG_MOREFLAGS & nBitField ); - - if( pFlags->bMoreFlags ) - { - // another byte with flags - sal_Int8 moreFlags; - if( ! m_unmarshal.unpackInt8( &moreFlags ) ) - { - m_pBridgeImpl->addError( "Unexpected end of message header (2)" ); - return sal_False; - } - pFlags->bSynchronous = ( HDRFLAG_SYNCHRONOUS & moreFlags ); - pFlags->bMustReply = ( HDRFLAG_MUSTREPLY & moreFlags ); - OSL_ENSURE( (pFlags->bSynchronous && pFlags->bMustReply) || - (!pFlags->bSynchronous && !pFlags->bMustReply), - "urp-bridge : customized calls currently not supported !"); - } - - if( HDRFLAG_LONGMETHODID & nBitField ) - { - // methodid as unsigned short - if( ! m_unmarshal.unpackInt16( &(pFlags->nMethodId )) ) - { - m_pBridgeImpl->addError( "Unexpected end of message header (3)" ); - return sal_False; - } - } - else - { - sal_uInt8 id; - if( ! m_unmarshal.unpackInt8( &id ) ) - { - m_pBridgeImpl->addError( "Unexpected end of message header (4)" ); - return sal_False; - } - pFlags->nMethodId = (sal_uInt16) id; - } - } - else - { - // reply - pFlags->bRequest = sal_False; - pFlags->bException = ( HDRFLAG_EXCEPTION & nBitField ); - } - } - else - { - // short request - pFlags->bRequest = sal_True; - if( 0x40 & nBitField ) - { - sal_uInt8 lower; - if( ! m_unmarshal.unpackInt8( &lower ) ) - { - m_pBridgeImpl->addError( "Unexpected end of message header (5)" ); - return sal_False; - } - pFlags->nMethodId = ( nBitField & 0x3f ) << 8 | lower; - } - else - { - pFlags->nMethodId = ( nBitField & 0x3f ); - } - } - return sal_True; -} - -void OReaderThread::run() -{ - // This vars are needed to hold oid,tid and type information, which should not be cached. - Type lastTypeNoCache; - OUString lastOidNoCache; - ByteSequence lastTidNoCache; - - while( m_bContinue ) - { - sal_Int32 nMessageCount; - if( ! readBlock( &nMessageCount ) ) - { - disposeEnvironment(); - break; - } - - uno_Environment *pEnvRemote = 0; - m_pEnvRemote->harden( &pEnvRemote , m_pEnvRemote ); - if( !pEnvRemote ) - { - // environment has been disposed already, quit here - break; - } - ServerMultiJob *pMultiJob = 0; - remote_Interface *pLastRemoteI = 0; - while( ! m_unmarshal.finished() ) - { -#ifdef BRIDGES_URP_PROT - sal_uInt32 nLogStart = m_unmarshal.getPos(); - sal_Bool bIsOneWay = sal_False; - OUString sMemberName; -#endif - MessageFlags flags; - - if( ! readFlags( &flags ) ) - { - m_pBridgeImpl->addError( "incomplete message, skipping block" ); - OSL_ENSURE ( 0 , "urp-bridge : incomplete message, skipping block" ); - break; - } - - // use these ** to access the ids fast ( avoid acquire/release calls ) - sal_Sequence **ppLastTid = flags.bIgnoreCache ? - (sal_Sequence **) &lastTidNoCache : - (sal_Sequence **) &(m_pBridgeImpl->m_lastInTid); - rtl_uString **ppLastOid = flags.bIgnoreCache ? - (rtl_uString ** ) &lastOidNoCache : - (rtl_uString ** ) &(m_pBridgeImpl->m_lastInOid); - typelib_TypeDescriptionReference **ppLastType = - flags.bIgnoreCache ? - (typelib_TypeDescriptionReference ** ) &lastTypeNoCache : - (typelib_TypeDescriptionReference ** ) &(m_pBridgeImpl->m_lastInType); - - // get new type - if( flags.bType ) - { - typelib_TypeDescriptionReference *pTypeRef = 0; - if( m_unmarshal.unpackType( &pTypeRef ) ) - { - // release the old type - typelib_typedescriptionreference_release( *ppLastType ); - // set the new type - *ppLastType = pTypeRef; - - // no release on pTypeRef necessary (will be released by type dtor) - } - else - { - typelib_typedescriptionreference_release( pTypeRef ); - m_pBridgeImpl->addError( "error during unpacking (maybe cached) interface type" ); - OSL_ENSURE( 0 , "urp-bridge : error during unpacking interface type, terminating connection" ); - disposeEnvironment(); - break; - } - if( m_pBridgeImpl->m_lastInType.getTypeClass() != TypeClass_INTERFACE ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "interface type is not of typeclass interface (" ); - sMessage.append( (sal_Int32) m_pBridgeImpl->m_lastInType.getTypeClass() ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - OSL_ENSURE( 0 , "urp-bridge : not an interface type" ); - disposeEnvironment(); - break; - } - } - if( flags.bOid ) - { - rtl_uString *pOid = 0; - if( m_unmarshal.unpackOid( &pOid ) ) - { - rtl_uString_release( *ppLastOid ); - *ppLastOid = pOid; - } - else - { - rtl_uString_release( pOid ); - m_pBridgeImpl->addError( "error during unpacking (maybe cached) oid" ); - OSL_ENSURE( 0 , "urp-bridge : error during unpacking cached data, terminating connection" ); - disposeEnvironment(); - break; - } - } - - if( flags.bTid ) - { - sal_Sequence *pSeq = 0; - if( m_unmarshal.unpackTid( &pSeq ) ) - { - rtl_byte_sequence_release( *ppLastTid ); - *ppLastTid = pSeq; - } - else - { - rtl_byte_sequence_release( pSeq ); - - m_pBridgeImpl->addError( "error during unpacking (maybe cached) tid" ); - OSL_ENSURE( 0 , "urp-bridge : error during unpacking cached data, terminating connection" ); - disposeEnvironment(); - break; - } - } - - // do the job - if( flags.bRequest ) - { - bool bHasCc = m_pBridgeImpl->m_properties.bCurrentContext - && flags.nMethodId != REMOTE_RELEASE_METHOD_INDEX - && !rtl::OUString( *ppLastOid ).equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM( - g_NameOfUrpProtocolPropertiesObject ) ); - remote_Interface * pCc = 0; - if ( bHasCc ) - { - typelib_TypeDescription * pType = 0; - TYPELIB_DANGER_GET( - &pType, - XCurrentContext::static_type().getTypeLibType() ); - bool ok = m_unmarshal.unpack( &pCc, pType ); - TYPELIB_DANGER_RELEASE( pType ); - if ( !ok ) - { - OSL_ENSURE( - false, - ("urp_bridge: error while unpacking current" - " context") ); - disposeEnvironment(); - break; - } - } - - //-------------------------- - // handle request - //-------------------------- - // get the membertypedescription - typelib_InterfaceMethodTypeDescription *pMethodType = 0; - typelib_InterfaceAttributeTypeDescription *pAttributeType = 0; - sal_Bool bIsSetter = sal_False; - - if( getMemberTypeDescription( - &pAttributeType, &pMethodType, &bIsSetter, - flags.nMethodId, *ppLastType ) ) - { - if( ! pLastRemoteI || flags.bOid || flags.bType ) - { - // a new interface must be retrieved - - // retrieve the interface NOW from the environment - // (avoid race conditions : oneway followed by release ) - typelib_InterfaceTypeDescription *pInterfaceType = 0; - - TYPELIB_DANGER_GET( - (typelib_TypeDescription ** ) &pInterfaceType , - *ppLastType ); - if( !pInterfaceType ) - { - OUStringBuffer sMessage; - sMessage.appendAscii( "Couldn't retrieve type description for type " ); - sMessage.append( OUString( (*ppLastType)->pTypeName ) ); - m_pBridgeImpl->addError( sMessage.makeStringAndClear() ); - delete pMultiJob; - pMultiJob = 0; - disposeEnvironment(); - pLastRemoteI = 0; // stubs are released during dispose eitherway - break; - } - pEnvRemote->pExtEnv->getRegisteredInterface( - pEnvRemote->pExtEnv, ( void ** ) &pLastRemoteI, - *ppLastOid, pInterfaceType ); - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription * )pInterfaceType ); - - if( !pLastRemoteI && - REMOTE_RELEASE_METHOD_INDEX != flags.nMethodId && - 0 == rtl_ustr_ascii_compare_WithLength( - (*ppLastOid)->buffer, (*ppLastOid)->length, g_NameOfUrpProtocolPropertiesObject ) ) - { - // check for bridge internal propertyobject - pLastRemoteI = m_pBridgeImpl->m_pPropertyObject; - pLastRemoteI->acquire( pLastRemoteI ); - flags.bBridgePropertyCall = sal_True; - } - - // NOTE : Instance provider is called in the executing thread - // Otherwise, instance provider may block the bridge - } - - sal_Bool bCallIsOneway = sal_False; - if( flags.bMoreFlags ) - { - // flags override the default ! - bCallIsOneway = ! flags.bSynchronous; - } - else if( pMethodType && pMethodType->bOneWay ) - { - bCallIsOneway = sal_True; - } - - if( pMultiJob && ! flags.bTid && bCallIsOneway && ! pMultiJob->isFull()) - { - // add to the existing multijob, nothing to do here - } - else - { - // create a new multijob - if( pMultiJob ) - { - // there exists an old one, start it first. - pMultiJob->initiate(); - } - - pMultiJob = new ServerMultiJob( - pEnvRemote, - static_cast< remote_Context * >( - pEnvRemote->pContext ), - *ppLastTid, m_pBridgeImpl, &m_unmarshal, - nMessageCount ); - } - - pMultiJob->setCurrentContext( bHasCc, pCc ); - pMultiJob->setIgnoreCache( flags.bIgnoreCache ); - pMultiJob->setType( *ppLastType ); - if( pMethodType ) - { - pMultiJob->setMethodType( pMethodType , - REMOTE_RELEASE_METHOD_INDEX == flags.nMethodId, - bCallIsOneway ); - } - else if( pAttributeType ) - { - pMultiJob->setAttributeType( pAttributeType, bIsSetter, bCallIsOneway ); - } - else - { - OSL_ASSERT( 0 ); - } - - if( pLastRemoteI ) - pMultiJob->setInterface( pLastRemoteI ); - else - pMultiJob->setOid( *ppLastOid ); - } /* getMemberTypeDescription */ - else - { - delete pMultiJob; - pMultiJob = 0; - pLastRemoteI = 0; // stubs are released during dispose eitherway - disposeEnvironment(); - break; - } -#ifdef BRIDGES_URP_PROT - bIsOneWay = pMethodType && pMethodType->bOneWay; - sMemberName = pMethodType ? - pMethodType->aBase.pMemberName : - pAttributeType->aBase.pMemberName; - sal_uInt32 nLogHeader = m_unmarshal.getPos(); -#endif - if( ! pMultiJob->extract( ) ) - { - // severe error during extracting, dispose - delete pMultiJob; - pMultiJob = 0; - pLastRemoteI = 0; // stubs are released during dispose eitherway - disposeEnvironment(); - break; - } - -#ifdef BRIDGES_URP_PROT - urp_logServingRequest( - m_pBridgeImpl, m_unmarshal.getPos() - nLogStart, - m_unmarshal.getPos() - nLogHeader, - !bIsOneWay, - sMemberName ); -#endif - if ( flags.bBridgePropertyCall ) - { - // call to the bridge internal object. - // these calls MUST be executed within the dispatcher thread in order - // to synchronize properly with protocol changes - // NOTE : Threadid is not preserved for this call. - - // lock the marshaling NOW ! - { - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - - pMultiJob->execute(); - - if( m_pBridgeImpl->m_pPropertyObject->changesHaveBeenCommited() ) - { - Properties props; - props = m_pBridgeImpl->m_pPropertyObject->getCommitedChanges(); - - // This call modified the protocol, apply the changes NOW ! - m_pBridgeImpl->applyProtocolChanges( props ); - } - } - delete pMultiJob; - pMultiJob = 0; - } - } - else - { - //-------------------------- - // handle reply - //-------------------------- - if( pMultiJob ) - { - pMultiJob->initiate(); - pMultiJob = 0; - } - if( pLastRemoteI ) - { - pLastRemoteI->release( pLastRemoteI ); - pLastRemoteI = 0; - } - ClientJob *pClientJob = - m_pBridgeImpl->m_clientJobContainer.remove( *( ByteSequence * )ppLastTid ); - - // Bridge MUST be already disposed, otherwise we got a wrong threadid - // from remote ! - OSL_ASSERT( pClientJob || m_pBridgeImpl->m_bDisposed ); - if( ! pClientJob ) - { - OUStringBuffer error( 128 ); - error.appendAscii( "ThreadID " ); - OString o = byteSequence2HumanReadableString( *(ByteSequence* )ppLastTid ); - error.appendAscii( o.getStr(), o.getLength() ); - error.appendAscii( " unknown, so couldn't unmarshal reply" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - pLastRemoteI = 0; - disposeEnvironment(); - break; - } - - pClientJob->m_bExceptionOccured = flags.bException; - - pClientJob->setUnmarshal( &m_unmarshal ); -#ifdef BRIDGES_URP_PROT - sMemberName = pClientJob->m_pMethodType ? - pClientJob->m_pMethodType->aBase.pMemberName : - pClientJob->m_pAttributeType->aBase.pMemberName; - sal_uInt32 nLogHeader = m_unmarshal.getPos(); -#endif - if( ! pClientJob->extract( ) ) - { - // severe error during extracting, dispose - pLastRemoteI = 0; // stubs are released during dispose eitherway - disposeEnvironment(); - break; - } -#ifdef BRIDGES_URP_PROT - urp_logGettingReply( - m_pBridgeImpl, m_unmarshal.getPos() - nLogStart, - m_unmarshal.getPos() - nLogHeader, sMemberName ); -#endif - sal_Bool bBridgePropertyCallAndWaitingForReply = - pClientJob->isBridgePropertyCall(); - - pClientJob->initiate(); - - if( bBridgePropertyCallAndWaitingForReply ) - { - // NOTE : This must be the reply for commit change. The new properties - // are now applied by the clientJob thread, but the reader thread - // must wait for it, because the next message on the wire already - // uses the new protocol settings. - // waiting for the commit change reply - m_pBridgeImpl->m_pPropertyObject->waitUntilChangesAreCommitted(); - } - } - } // end while( !m_unmarshal.finished() ) - - if( pLastRemoteI ) - pLastRemoteI->release( pLastRemoteI ); - - if( pMultiJob ) - pMultiJob->initiate(); - - if( pEnvRemote ) - pEnvRemote->release( pEnvRemote ); - } - - if( m_pConnection ) - { - m_pConnection->release( m_pConnection ); - m_pConnection = 0; - } -} -} diff --git a/bridges/source/remote/urp/urp_reader.hxx b/bridges/source/remote/urp/urp_reader.hxx deleted file mode 100644 index 9ac03cde4..000000000 --- a/bridges/source/remote/urp/urp_reader.hxx +++ /dev/null @@ -1,78 +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 <osl/thread.hxx> - -#include "urp_unmarshal.hxx" - -struct remote_Connection; -typedef struct _uno_Environment uno_Environment; - -namespace bridges_urp -{ - -class OWriterThread; -struct MessageFlags; - -class OReaderThread : - public ::osl::Thread -{ -public: - OReaderThread( remote_Connection *pConnection , - uno_Environment *pEnvRemote, - OWriterThread *pWriterThread ); - ~OReaderThread(); - - // may only be called in the callstack of this thread !!!!! - // run() -> disposeEnvironment() -> dispose() -> destroyYourself() - void destroyYourself(); - -private: - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - inline sal_Bool readBlock( sal_Int32 *pnMessageCount ); - inline sal_Bool readFlags( struct MessageFlags *pFlags ); - - void disposeEnvironment(); - - inline sal_Bool getMemberTypeDescription( - typelib_InterfaceAttributeTypeDescription **ppAttributeType, - typelib_InterfaceMethodTypeDescription **ppMethodType, - sal_Bool *pbIsSetter, - sal_uInt16 nMethodId , - typelib_TypeDescriptionReference *pITypeRef); - - remote_Connection *m_pConnection; - uno_Environment *m_pEnvRemote; - OWriterThread *m_pWriterThread; - sal_Bool m_bDestroyMyself; - sal_Bool m_bContinue; - urp_BridgeImpl *m_pBridgeImpl; - Unmarshal m_unmarshal; -}; - -} diff --git a/bridges/source/remote/urp/urp_replycontainer.hxx b/bridges/source/remote/urp/urp_replycontainer.hxx deleted file mode 100644 index 5afe91293..000000000 --- a/bridges/source/remote/urp/urp_replycontainer.hxx +++ /dev/null @@ -1,75 +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 <hash_map> -#include <list> - -#include <osl/mutex.hxx> -#include <osl/diagnose.h> - -#include "urp_threadid.hxx" - -namespace bridges_urp -{ - class ClientJob; - typedef ::std::hash_map< ::rtl::ByteSequence , - ::std::list < ClientJob * > , - HashThreadId , - EqualThreadId > Id2ClientJobStackMap; - - class urp_ClientJobContainer - { - public: - void add( const ::rtl::ByteSequence &id , ClientJob *p ) - { - ::osl::MutexGuard guard( m_mutex ); - m_map[id].push_back( p ); - } - - ClientJob *remove( const ::rtl::ByteSequence & id ) - { - ::osl::MutexGuard guard( m_mutex ); - Id2ClientJobStackMap::iterator ii = m_map.find( id ); - - ClientJob *p = 0; - if( ii != m_map.end() ) - { - p = (*ii).second.back(); - (*ii).second.pop_back(); - if( (*ii).second.empty() ) - { - m_map.erase( ii ); - } - } - - return p; - } - - private: - ::osl::Mutex m_mutex; - Id2ClientJobStackMap m_map; - }; -} diff --git a/bridges/source/remote/urp/urp_threadid.cxx b/bridges/source/remote/urp/urp_threadid.cxx deleted file mode 100644 index ba9a6d752..000000000 --- a/bridges/source/remote/urp/urp_threadid.cxx +++ /dev/null @@ -1,48 +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_bridges.hxx" -#include "urp_threadid.hxx" - -#include <rtl/strbuf.hxx> - -using namespace rtl; - -namespace bridges_urp -{ - rtl::OString byteSequence2HumanReadableString( const rtl::ByteSequence &a ) - { - const sal_uInt8 *p = (const sal_uInt8 * ) a.getConstArray(); - sal_Int32 nLength = a.getLength(); - OStringBuffer buf( a.getLength() * 2 + 2 ); - buf.append( RTL_CONSTASCII_STRINGPARAM( "0x" ) ); - for( sal_Int32 i = 0 ; i < nLength ; i ++ ) - buf.append( (sal_Int32) p[i] , 16 ); - return buf.makeStringAndClear(); - } -} diff --git a/bridges/source/remote/urp/urp_threadid.hxx b/bridges/source/remote/urp/urp_threadid.hxx deleted file mode 100644 index 53fb15ece..000000000 --- a/bridges/source/remote/urp/urp_threadid.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _URP_THREADID_HXX_ -#define _URP_THREADID_HXX_ - -#include <sal/types.h> -#include <rtl/byteseq.hxx> -#include <rtl/string.hxx> - -namespace bridges_urp -{ - - struct EqualThreadId - { - sal_Int32 operator () ( const ::rtl::ByteSequence &a , const ::rtl::ByteSequence &b ) const - { - return a == b; - } - }; - - struct HashThreadId - { - sal_Int32 operator () ( const ::rtl::ByteSequence &a ) const - { - if( a.getLength() >= 4 ) - { - return *(sal_Int32*) a.getConstArray(); - } - return 0; - } - }; - - rtl::OString byteSequence2HumanReadableString( const rtl::ByteSequence &a ); -} -#endif diff --git a/bridges/source/remote/urp/urp_unmarshal.cxx b/bridges/source/remote/urp/urp_unmarshal.cxx deleted file mode 100644 index 9b18838a3..000000000 --- a/bridges/source/remote/urp/urp_unmarshal.cxx +++ /dev/null @@ -1,707 +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_bridges.hxx" -#include <string.h> - -#include <osl/diagnose.h> - -#include <rtl/alloc.h> -#include <rtl/ustrbuf.hxx> - -#include <uno/data.h> -#include <uno/any2.h> -#include <uno/sequence2.h> - -#include <com/sun/star/uno/Any.hxx> - -#include "urp_unmarshal.hxx" -#include "urp_bridgeimpl.hxx" - - -using namespace ::rtl; -using namespace ::com::sun::star::uno; - -namespace bridges_urp -{ -static int g_nDetectLittleEndian = 1; -char g_bSystemIsLittleEndian = ((char*)&g_nDetectLittleEndian)[0]; - - -Unmarshal::Unmarshal( struct urp_BridgeImpl *pBridgeImpl, - uno_Environment *pEnvRemote, - remote_createStubFunc callback ) : - m_nBufferSize( 4096 ), - m_base( (sal_Int8*) rtl_allocateMemory( m_nBufferSize ) ), - m_pos( m_base ), - m_nLength( 0 ), - m_callback( callback ), - m_pEnvRemote( pEnvRemote ), - m_pBridgeImpl( pBridgeImpl ) -{ -} - -Unmarshal::~Unmarshal() -{ - rtl_freeMemory( m_base ); -} - -// special unpacks -sal_Bool Unmarshal::unpackTid( sal_Sequence **ppThreadId ) -{ - sal_Int32 nSize; - sal_Bool bReturn = unpackCompressedSize( &nSize ); - if( bReturn ) - { - if( nSize ) - { - rtl_byte_sequence_constructFromArray( ppThreadId , m_pos , nSize ); - m_pos += nSize; - sal_uInt16 nIndex; - bReturn = unpackInt16( &nIndex ); - if( nIndex < m_pBridgeImpl->m_properties.nTidCacheSize ) - { - m_pBridgeImpl->m_pTidIn[nIndex] = *(ByteSequence * )ppThreadId; - } - else if( 0xffff != nIndex ) - { - bReturn = sal_False; - rtl_byte_sequence_construct( ppThreadId , 0 ); - - OUStringBuffer error( 128 ); - error.appendAscii( "cache index for tid " ); - OString o = byteSequence2HumanReadableString( *(ByteSequence * ) ppThreadId ); - error.appendAscii( o.getStr(), o.getLength() ); - error.appendAscii( "out of range(0x"); - error.append( (sal_Int32) nIndex ,16 ); - error.appendAscii( ")" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - else - { - sal_uInt16 nIndex; - bReturn = unpackInt16( &nIndex ); - if( nIndex < m_pBridgeImpl->m_properties.nTidCacheSize ) - { - *ppThreadId = m_pBridgeImpl->m_pTidIn[nIndex].getHandle(); - rtl_byte_sequence_acquire( *ppThreadId ); - } - else - { - bReturn = sal_False; - rtl_byte_sequence_construct( ppThreadId , 0 ); - OUStringBuffer error(128); - error.appendAscii( "cache index for tids out of range(0x" ); - error.append( (sal_Int32) nIndex ,16 ); - error.appendAscii( ")" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - } - else - { - m_pBridgeImpl->addError( "couldn't unpack thread id because of previous errors" ); - } - return bReturn; -} - -sal_Bool Unmarshal::unpackOid( rtl_uString **ppOid ) -{ - sal_Bool bReturn = sal_True; - sal_uInt16 nCacheIndex = 0; - - bReturn = bReturn && unpackString( ppOid ); - bReturn = bReturn && unpackInt16( &nCacheIndex ); - - if( bReturn && - ! ( 0xffff == nCacheIndex && 0 == (*ppOid)->length ) /* null reference */ ) - { - if( (*ppOid)->length ) - { - // new unknown reference - if( 0xffff != nCacheIndex ) - { - // oid should be cached ? - if( nCacheIndex < m_pBridgeImpl->m_properties.nOidCacheSize ) - { - m_pBridgeImpl->m_pOidIn[nCacheIndex] = *ppOid; - } - else - { - OUStringBuffer error( 128 ); - error.appendAscii( "new oid provided (" ); - error.append( *ppOid ); - error.appendAscii( "), but new cache index is out of range(0x"); - error.append( (sal_Int32) nCacheIndex ,16 ); - error.appendAscii( ")" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - - bReturn = sal_False; - rtl_uString_new( ppOid ); - } - } - } - else - { - // reference in cache ! - if( nCacheIndex < m_pBridgeImpl->m_properties.nOidCacheSize ) - { - rtl_uString_assign( ppOid , m_pBridgeImpl->m_pOidIn[nCacheIndex].pData ); - } - else - { - bReturn = sal_False; - rtl_uString_new( ppOid ); - - OUStringBuffer error( 128 ); - error.appendAscii( "cache index for oids out of range(0x"); - error.append( (sal_Int32) nCacheIndex ,16 ); - error.appendAscii( ")" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - } - - return bReturn; -} - -sal_Bool Unmarshal::unpack( void *pDestination , - typelib_TypeDescription *pTypeDescr ) -{ - // Note: We implement unpack functionality without recursions in order - // to avoid stack overflows caused by rotten URP blocks. - - m_aItemsToUnpack.push( UnpackItem( pDestination, pTypeDescr ) ); - - sal_Bool bReturn = sal_True; - do - { - void * pDest = m_aItemsToUnpack.top().pDest; - typelib_TypeDescription * pType = m_aItemsToUnpack.top().pType; - m_aItemsToUnpack.pop(); - - switch( pType->eTypeClass ) - { - case typelib_TypeClass_VOID: - // do nothing - break; - case typelib_TypeClass_BYTE: - { - bReturn = unpackInt8( pDest ); - break; - } - case typelib_TypeClass_BOOLEAN: - { - bReturn = ! checkOverflow( 1 ); - if( bReturn ) - { - *((sal_Bool*)pDest) = (sal_Bool ) ( *m_pos); - m_pos ++; - } - else - { - *((sal_Bool*)pDest) = 0; - } - break; - } - - case typelib_TypeClass_CHAR: - case typelib_TypeClass_SHORT: - case typelib_TypeClass_UNSIGNED_SHORT: - { - unpackInt16( pDest ); - break; - } - case typelib_TypeClass_ENUM: - case typelib_TypeClass_FLOAT: - case typelib_TypeClass_LONG: - case typelib_TypeClass_UNSIGNED_LONG: - { - bReturn = unpackInt32( pDest ); - break; - } - case typelib_TypeClass_DOUBLE: - case typelib_TypeClass_HYPER: - case typelib_TypeClass_UNSIGNED_HYPER: - { - sal_Int8 * p = static_cast< sal_Int8 * >(pDest); - bReturn = ! checkOverflow( 8 ); - if( bReturn ) - { - if( isSystemLittleEndian() ) - { - p[7] = m_pos[0]; - p[6] = m_pos[1]; - p[5] = m_pos[2]; - p[4] = m_pos[3]; - p[3] = m_pos[4]; - p[2] = m_pos[5]; - p[1] = m_pos[6]; - p[0] = m_pos[7]; - } - else - { - p[0] = m_pos[0]; - p[1] = m_pos[1]; - p[2] = m_pos[2]; - p[3] = m_pos[3]; - p[4] = m_pos[4]; - p[5] = m_pos[5]; - p[6] = m_pos[6]; - p[7] = m_pos[7]; - } - m_pos += 8; - } - else - { - // Do not trigger alignment errors: - p[0] = p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7] = 0; - } - break; - } - case typelib_TypeClass_STRING: - { - unpackString( pDest ); - break; - } - case typelib_TypeClass_ANY: - { - uno_Any *pAny = ( uno_Any * )pDest; - - pAny->pType = 0; - // Type is acquired with typelib_typedescription_acquire - - bReturn = unpackType( &(pAny->pType) ); - - typelib_TypeDescription *pDataType = 0; - if( bReturn && pAny->pType ) - { - typelib_typedescriptionreference_getDescription( &pDataType , pAny->pType ); - - if( pDataType ) - { - switch (pDataType->eTypeClass) - { - case typelib_TypeClass_HYPER: - case typelib_TypeClass_UNSIGNED_HYPER: - if (sizeof(void *) < sizeof(sal_Int64)) - { - pAny->pData = rtl_allocateMemory( sizeof(sal_Int64) ); - } - else - { - pAny->pData = &pAny->pReserved; - } - break; - case typelib_TypeClass_FLOAT: - if (sizeof(void *) < sizeof(float)) - { - pAny->pData = rtl_allocateMemory( sizeof(float) ); - } - else - { - pAny->pData = &pAny->pReserved; - } - break; - case typelib_TypeClass_DOUBLE: - if (sizeof(void *) < sizeof(double)) - { - pAny->pData = rtl_allocateMemory( sizeof(double) ); - } - else - { - pAny->pData = &pAny->pReserved; - } - break; - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_UNION: - case typelib_TypeClass_EXCEPTION: - case typelib_TypeClass_ARRAY: - pAny->pData = rtl_allocateMemory( pDataType->nSize ); - break; - case typelib_TypeClass_ANY: - { - m_pBridgeImpl->addError( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "can't unmarshal any: any in any not supported!" ) ) ); - - pAny->pData = 0; - Type type; // void - pAny->pType = type.getTypeLibType(); - typelib_typedescriptionreference_acquire( pAny->pType ); - - bReturn = sal_False; - break; - } - default: - pAny->pData = &pAny->pReserved; - } - - if ( bReturn ) - { - m_aItemsToUnpack.push( - UnpackItem( pAny->pData, pDataType ) ); - } - } - else - { - OUStringBuffer error; - error.appendAscii( "can't unmarshal any because typedescription for " ); - error.append( pAny->pType->pTypeName ); - error.appendAscii( " is missing" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - - if( pDataType ) - { - typelib_typedescription_release( pDataType ); - } - else - { - pAny->pData = 0; - Type type; // void - pAny->pType = type.getTypeLibType(); - typelib_typedescriptionreference_acquire( pAny->pType ); - - bReturn = sal_False; - } - - break; - } - case typelib_TypeClass_INTERFACE: - { - *(remote_Interface**)pDest = 0; - - rtl_uString *pString = 0; - bReturn = unpackOid( &pString ) && bReturn; - - if( bReturn && pString && pString->length ) - { - m_callback( (remote_Interface**) pDest , - pString, - pType->pWeakRef , - m_pEnvRemote, - urp_releaseRemoteCallback ); - } - if( pString ) - { - rtl_uString_release( pString ); - } - break; - } - case typelib_TypeClass_TYPE: - { - bReturn = unpackType( pDest ); - break; - } - case typelib_TypeClass_STRUCT: - case typelib_TypeClass_EXCEPTION: - { - typelib_CompoundTypeDescription * pCompType = - (typelib_CompoundTypeDescription *)pType; - - // direct members - typelib_TypeDescriptionReference ** ppTypeRefs = pCompType->ppTypeRefs; - sal_Int32 * pMemberOffsets = pCompType->pMemberOffsets; - sal_Int32 nDescr = pCompType->nMembers; - - // at least assume 1 byte per member - bReturn = bReturn && ! checkOverflow( nDescr * 1 ); - for ( sal_Int32 nPos = nDescr; nPos; --nPos ) - { - typelib_TypeDescription * pMemberType = 0; - typelib_typedescriptionreference_getDescription( - &pMemberType, ppTypeRefs[ nPos - 1 ] ); - - m_aItemsToUnpack.push( - UnpackItem( (char*)pDest + pMemberOffsets[ nPos - 1 ], - pMemberType, - true /* construct even in error case */ ) ); - - m_aTypesToRelease.push_back( pMemberType ); - } - - // parent - if (pCompType->pBaseTypeDescription) - { - m_aItemsToUnpack.push( - UnpackItem( pDest, - (typelib_TypeDescription *) - pCompType->pBaseTypeDescription ) ); - } - break; - } - case typelib_TypeClass_SEQUENCE: - { - sal_Int32 nLen; - bReturn = unpackCompressedSize( &nLen ); - - // urp protocol does not allow to use the elementsize as a guess, if enough data - // is available. However, at least one byte per member must be within the message - bReturn = bReturn && ! checkOverflow( 1 * nLen ); - uno_Sequence *pSequence = 0; - if( nLen && bReturn ) - { - typelib_TypeDescriptionReference * pETRef = - ((typelib_IndirectTypeDescription *)pType)->pType; - - typelib_TypeDescription * pET = 0; - typelib_typedescriptionreference_getDescription( &pET , pETRef ); - - if( pET ) - { - sal_Int32 nElementSize = pET->nSize; - - pSequence = (uno_Sequence *)rtl_allocateMemory( - SAL_SEQUENCE_HEADER_SIZE + nElementSize * nLen ); - pSequence->nRefCount = 1; - pSequence->nElements = nLen; - - if( typelib_TypeClass_BYTE == pET->eTypeClass ) - { - memcpy( pSequence->elements , m_pos , nLen ); - m_pos += nLen; - } - else - { - for ( sal_Int32 i = nLen; i; --i ) - { - m_aItemsToUnpack.push( - UnpackItem( - ((char*)pSequence->elements) - + (i - 1) * nElementSize, - pET ) ); - } - } - m_aTypesToRelease.push_back( pET ); - } - else - { - bReturn = sal_False; - uno_constructData( &pSequence , pType ); - OUStringBuffer error; - error.appendAscii( "can't unmarshal sequence, because there is no typedescription for element type " ); - error.append( pETRef->pTypeName ); - error.appendAscii( " available" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - else - { - uno_constructData( &pSequence , pType ); - } - - *((uno_Sequence **)pDest) = pSequence; - break; - } - case typelib_TypeClass_UNION: - case typelib_TypeClass_ARRAY: - case typelib_TypeClass_SERVICE: - case typelib_TypeClass_MODULE: - case typelib_TypeClass_INTERFACE_METHOD: - case typelib_TypeClass_INTERFACE_ATTRIBUTE: - case typelib_TypeClass_UNKNOWN: - default: - { - ::rtl::OUStringBuffer buffer( 128 ); - buffer.appendAscii( RTL_CONSTASCII_STRINGPARAM("Unsupported typeclass during unmarshaling (")); - buffer.append( ( sal_Int32 ) pType->eTypeClass , 10 ); - buffer.appendAscii( ")" ); - m_pBridgeImpl->addError( buffer.makeStringAndClear() ); - bReturn = sal_False; - } - } - - if ( !bReturn ) - { - // construct default data for every remaining item. - while ( !m_aItemsToUnpack.empty() ) - { - const UnpackItem & rItem = m_aItemsToUnpack.top(); - - if ( rItem.bMustBeConstructed ) - uno_constructData( rItem.pDest , rItem.pType ); - - m_aItemsToUnpack.pop(); - } - } - } - while ( !m_aItemsToUnpack.empty() ); - - // release pending type descriptions - TypeDescVector::const_iterator it = m_aTypesToRelease.begin(); - const TypeDescVector::const_iterator end = m_aTypesToRelease.end(); - while ( it != end ) - { - typelib_typedescription_release( *it ); - it++; - } - m_aTypesToRelease.clear(); - - return bReturn; -} - -sal_Bool Unmarshal::unpackType( void *pDest ) -{ - *(typelib_TypeDescriptionReference **) pDest = 0; - - sal_uInt8 nTypeClass; - sal_Bool bReturn = unpackInt8( &nTypeClass ); - - typelib_TypeDescriptionReference *pTypeRef = 0; - if( bReturn ) - { - if( nTypeClass <= 14 /* any */ ) - { - pTypeRef = * typelib_static_type_getByTypeClass((typelib_TypeClass )nTypeClass); - typelib_typedescriptionreference_acquire( pTypeRef ); - } - else - { - sal_uInt16 nCacheIndex = 0; - bReturn = bReturn && unpackInt16( &nCacheIndex ); - - if( bReturn ) - { - if( nTypeClass & 0x80 ) - { - // new type - rtl_uString *pString = 0; - bReturn = bReturn && unpackString( &pString ); - if( bReturn ) - { - typelib_TypeDescription *pType = 0; - typelib_typedescription_getByName( &pType, pString ); - if( pType ) - { - // type is known in this process - if( (typelib_TypeClass )(nTypeClass & 0x7f) == pType->eTypeClass ) - { - //typename and typeclass match, this is as it should be - pTypeRef = pType->pWeakRef; - typelib_typedescriptionreference_acquire( pTypeRef ); - } - else - { - // typename and typeclass do not match, dispose the bridge - // as there must be inconsistent type base between both processes - // or trash comes over the wire ... - bReturn = sal_False; - OUStringBuffer error( 128 ); - error.appendAscii( "it is tried to introduce type " ); - error.append( pString ); - error.appendAscii( "with typeclass " ); - error.append( (sal_Int32)( nTypeClass & 0x7f ) , 10 ); - error.appendAscii( " , which does not match with typeclass " ); - error.append( (sal_Int32) pType->eTypeClass ,10 ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - typelib_typedescription_release( pType ); - pType = 0; - } - else - { - // a type by this name is not known in the process. - if( (nTypeClass & 0x7f) < typelib_TypeClass_UNKNOWN ) - { - // typeclass is within a valid range, introduce the new - // type. - typelib_typedescriptionreference_new( - &pTypeRef, (typelib_TypeClass )(nTypeClass & 0x7f), pString ); - } - else - { - // typeclass is out of range ! - bReturn = sal_False; - OUStringBuffer error( 128 ); - error.appendAscii( "it is tried to introduce type " ); - error.append( pString ); - error.appendAscii( "with an out of range typeclass " ); - error.append( (sal_Int32)( nTypeClass & 0x7f ) , 10 ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - - if( bReturn && nCacheIndex != 0xffff ) - { - if( nCacheIndex < m_pBridgeImpl->m_properties.nTypeCacheSize ) - { - m_pBridgeImpl->m_pTypeIn[nCacheIndex] = *( Type * )&pTypeRef; - } - else - { - bReturn = sal_False; - OUStringBuffer error( 128 ); - error.appendAscii( "cache index for type " ); - error.append( pString ); - error.appendAscii( "out of range(0x" ); - error.append( (sal_Int32) nCacheIndex ,16 ); - error.appendAscii( ")" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - } - if( pString ) - { - rtl_uString_release( pString ); - } - } - else - { - if( nCacheIndex < m_pBridgeImpl->m_properties.nTypeCacheSize ) - { - pTypeRef = m_pBridgeImpl->m_pTypeIn[nCacheIndex].getTypeLibType(); - typelib_typedescriptionreference_acquire( pTypeRef ); - } - else - { - bReturn = sal_False; - OUStringBuffer error; - error.appendAscii( "cache index for types out of range(0x" ); - error.append( (sal_Int32) nCacheIndex ,16 ); - error.appendAscii( ")" ); - m_pBridgeImpl->addError( error.makeStringAndClear() ); - } - } - } - } - } - if( ! pTypeRef ) - { - pTypeRef = * typelib_static_type_getByTypeClass(typelib_TypeClass_VOID); - typelib_typedescriptionreference_acquire( pTypeRef ); - } - // pTypeRef is already acquired - *(typelib_TypeDescriptionReference**)pDest = pTypeRef; - return bReturn; -} - -} - diff --git a/bridges/source/remote/urp/urp_unmarshal.hxx b/bridges/source/remote/urp/urp_unmarshal.hxx deleted file mode 100644 index f7f99a97b..000000000 --- a/bridges/source/remote/urp/urp_unmarshal.hxx +++ /dev/null @@ -1,280 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _URP_UNMARSHAL_HXX_ -#define _URP_UNMARSHAL_HXX_ - -#include <stack> -#include <vector> -#include <rtl/byteseq.hxx> -#include <rtl/ustrbuf.hxx> -#include <bridges/remote/context.h> - -#ifndef _BRIDGES_REMOTE_HELPER_HXX_ -#include <bridges/remote/helper.hxx> -#endif -#include <com/sun/star/uno/Type.hxx> -#include "urp_bridgeimpl.hxx" - -typedef struct _uno_Environment uno_Environment; -struct remote_Interface; - -namespace bridges_urp -{ - -extern char g_bSystemIsLittleEndian; -class ThreadId; -struct urp_BridgeImpl; -void SAL_CALL urp_releaseRemoteCallback( - remote_Interface *pRemoteI,rtl_uString *pOid, - typelib_TypeDescriptionReference *pTypeRef, - uno_Environment *pEnvRemote ); - -struct UnpackItem -{ - void * pDest; - typelib_TypeDescription * pType; - bool bMustBeConstructed; - - UnpackItem() - : pDest( 0 ), pType( 0 ), bMustBeConstructed( false ) {} - UnpackItem( void * d, typelib_TypeDescription * t, bool b = false ) - : pDest( d ), pType( t ), bMustBeConstructed( b ) {} -}; - -typedef std::stack< UnpackItem > UnpackItemStack; -typedef std::vector< typelib_TypeDescription * > TypeDescVector; - -class Unmarshal -{ -public: - Unmarshal( - struct urp_BridgeImpl *, - uno_Environment *pEnvRemote, - remote_createStubFunc callback ); - ~Unmarshal(); - - inline sal_Bool finished() - { return m_base + m_nLength == m_pos; } - inline sal_uInt32 getPos() - { return (sal_uInt32 ) (m_pos - m_base); } - - inline sal_Bool setSize( sal_Int32 nSize ); - - sal_Bool unpack( void *pDest, typelib_TypeDescription *pType ); - inline sal_Bool unpackCompressedSize( sal_Int32 *pData ); - inline sal_Bool unpackInt8( void *pDest ); - inline sal_Bool unpackString( void *pDest ); - inline sal_Bool unpackInt16( void *pDest ); - inline sal_Bool unpackInt32( void *pDest ); - sal_Bool unpackType( void *pDest ); - - inline sal_Bool unpackAny( void *pDest ); - sal_Bool unpackOid( rtl_uString **ppOid ); - sal_Bool unpackTid( sal_Sequence **ppThreadId ); - - sal_Int8 *getBuffer() - { return m_base; } - inline sal_Bool isSystemLittleEndian() - { return g_bSystemIsLittleEndian; } - -private: - inline sal_Bool checkOverflow( sal_Int32 nNextMem ); - - UnpackItemStack m_aItemsToUnpack; - TypeDescVector m_aTypesToRelease; - - sal_Int32 m_nBufferSize; - sal_Int8 *m_base; - sal_Int8 *m_pos; - sal_Int32 m_nLength; - - remote_createStubFunc m_callback; - uno_Environment *m_pEnvRemote; - urp_BridgeImpl *m_pBridgeImpl; -}; - -inline sal_Bool Unmarshal::setSize( sal_Int32 nSize ) -{ - if( nSize > m_nBufferSize ) - { - // adjust buffer size and length. - sal_Int8 * base = - (sal_Int8*)rtl_reallocateMemory (m_base, sal_Size(nSize)); - if (base != 0) - { - m_base = base; - m_nLength = m_nBufferSize = nSize; - } - } - else - { - // adjust buffer length, only. - m_nLength = nSize; - } - - // reset buffer position, and leave. - m_pos = m_base; - return (m_nLength == nSize); -} - -inline sal_Bool Unmarshal::checkOverflow( sal_Int32 nNextMem ) -{ - sal_Bool bOverflow = nNextMem < 0 || - (((sal_Int32)( m_pos - m_base )) + nNextMem ) > m_nLength; - if( bOverflow ) - m_pBridgeImpl->addError( "message too short" ); - return bOverflow; -} - - -inline sal_Bool Unmarshal::unpackInt8( void *pDest ) -{ - sal_Bool bReturn = ! checkOverflow( 1 ); - if( bReturn ) - { - *((sal_Int8*)pDest ) = *m_pos; - m_pos++; - } - else - { - *((sal_Int8*)pDest ) = 0; - } - return bReturn; -} - -inline sal_Bool Unmarshal::unpackInt32( void *pDest ) -{ - sal_uInt32 *p = ( sal_uInt32 * ) pDest; - sal_Bool bReturn = ! checkOverflow(4); - if( bReturn ) - { - if( isSystemLittleEndian() ) - { - ((sal_Int8*) p )[3] = m_pos[0]; - ((sal_Int8*) p )[2] = m_pos[1]; - ((sal_Int8*) p )[1] = m_pos[2]; - ((sal_Int8*) p )[0] = m_pos[3]; - } - else - { - ((sal_Int8*) p )[3] = m_pos[3]; - ((sal_Int8*) p )[2] = m_pos[2]; - ((sal_Int8*) p )[1] = m_pos[1]; - ((sal_Int8*) p )[0] = m_pos[0]; - } - m_pos += 4; - } - else - { - *p = 0; - } - return bReturn; -} - -inline sal_Bool Unmarshal::unpackInt16( void *pDest ) -{ - sal_uInt16 *p = ( sal_uInt16 * ) pDest; - - sal_Bool bReturn = ! checkOverflow( 2 ); - if( bReturn ) - { - if( isSystemLittleEndian() ) - { - ((sal_Int8*) p )[1] = m_pos[0]; - ((sal_Int8*) p )[0] = m_pos[1]; - } - else - { - ((sal_Int8*) p )[1] = m_pos[1]; - ((sal_Int8*) p )[0] = m_pos[0]; - } - m_pos ++; - m_pos ++; - } - else - { - *p = 0; - } - return bReturn; -} - -inline sal_Bool Unmarshal::unpackString( void *pDest ) -{ - sal_Int32 nLength; - sal_Bool bReturn = unpackCompressedSize( &nLength ); - - bReturn = bReturn && ! checkOverflow( nLength ); - if( bReturn ) - { - *(rtl_uString **) pDest = 0; - rtl_string2UString( (rtl_uString**) pDest, (const sal_Char * )m_pos , nLength, - RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS ); - m_pos += nLength; - } - else - { - *(rtl_uString ** ) pDest = 0; - rtl_uString_new( (rtl_uString **) pDest ); - } - return bReturn; -} - -inline sal_Bool Unmarshal::unpackCompressedSize( sal_Int32 *pData ) -{ - sal_uInt8 n8Size; - sal_Bool bReturn = unpackInt8( &n8Size ); - if( bReturn ) - { - if( n8Size == 0xff ) - { - unpackInt32( pData ); - } - else - { - *pData = (sal_Int32 ) n8Size; - } - } - return bReturn; -} - -inline sal_Bool Unmarshal::unpackAny( void *pDest ) -{ - typelib_TypeDescriptionReference *pTypeRef = - * typelib_static_type_getByTypeClass( typelib_TypeClass_ANY ); - - typelib_TypeDescription * pTD = 0; - typelib_typedescriptionreference_getDescription( &pTD, pTypeRef ); - - sal_Bool bReturn = unpack( pDest, pTD ); - - typelib_typedescription_release( pTD ); - - return bReturn; -} - -} -#endif diff --git a/bridges/source/remote/urp/urp_writer.cxx b/bridges/source/remote/urp/urp_writer.cxx deleted file mode 100644 index b2b4cba60..000000000 --- a/bridges/source/remote/urp/urp_writer.cxx +++ /dev/null @@ -1,269 +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_bridges.hxx" -#include <stdio.h> -#include <osl/time.h> - -#include <osl/mutex.hxx> -#include <osl/conditn.h> - -#include <typelib/typedescription.h> - -#include <bridges/remote/connection.h> -#include <bridges/remote/remote.hxx> - -#include <com/sun/star/uno/Sequence.hxx> - -#include <bridges/remote/counter.hxx> - -#include "urp_writer.hxx" -#include "urp_bridgeimpl.hxx" -#include "urp_marshal.hxx" -#include "urp_dispatch.hxx" - -#if OSL_DEBUG_LEVEL > 1 -static MyCounter thisCounter( "DEBUG : WriterThread" ); -#endif - -using namespace ::osl; - -namespace bridges_urp { - -OWriterThread::OWriterThread( remote_Connection *pConnection, urp_BridgeImpl *pBridgeImpl, - uno_Environment *pEnvRemote) : - m_bAbort( sal_False ), - m_bInBlockingWait( sal_False ), - m_bEnterBlockingWait( sal_False ), - m_pConnection( pConnection ), - m_pBridgeImpl( pBridgeImpl ), - m_pEnvRemote( pEnvRemote ) - -{ - m_oslCondition = osl_createCondition(); - osl_resetCondition( m_oslCondition ); - m_pConnection->acquire( m_pConnection ); - -#if OSL_DEBUG_LEVEL > 1 - thisCounter.acquire(); -#endif -} - -OWriterThread::~OWriterThread() -{ - osl_destroyCondition( m_oslCondition ); - m_pConnection->release( m_pConnection ); -#if OSL_DEBUG_LEVEL > 1 - thisCounter.release(); -#endif -} - - -// touch is called with locked m_marshalingMutex -void OWriterThread::touch( sal_Bool bImmediately ) -{ - if( bImmediately || m_pBridgeImpl->m_blockMarshaler.getPos() > m_pBridgeImpl->m_properties.nFlushBlockSize ) - { - write(); - } - else - { - // wake the writer thread up - if( m_bInBlockingWait ) - { - m_bInBlockingWait = sal_False; - osl_setCondition( m_oslCondition ); - } - else - { - // ensure, that the writing thread does not enter blocking mode - m_bEnterBlockingWait = sal_False; - } - } -} - - -void OWriterThread::abortThread() -{ - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - - m_bAbort = sal_True; - m_bEnterBlockingWait = sal_False; - if( m_bInBlockingWait ) - { - m_bInBlockingWait = sal_False; - osl_setCondition( m_oslCondition ); - } -} - - -// must be called with locked marshaling mutex -void OWriterThread::write() -{ - if( ! m_pBridgeImpl->m_blockMarshaler.empty() && ! m_bAbort ) - { - m_pBridgeImpl->m_blockMarshaler.finish( m_pBridgeImpl->m_nMarshaledMessages); - m_pBridgeImpl->m_nMarshaledMessages = 0; - - sal_Int32 nLength = m_pBridgeImpl->m_blockMarshaler.getSize(); - sal_Int8 *pBuf = m_pBridgeImpl->m_blockMarshaler.getBuffer(); - - if( nLength != m_pConnection->write( m_pConnection, pBuf, nLength )) - { - m_pBridgeImpl->m_blockMarshaler.restart(); - return; - } - m_pConnection->flush( m_pConnection ); - m_pBridgeImpl->m_blockMarshaler.restart(); - } -} - -void OWriterThread::sendEmptyMessage() -{ - // must be called with locked marshaling mutex - sal_Int32 a[2] = {0,0}; - m_pConnection->write( m_pConnection , (sal_Int8*) a , sizeof( sal_Int32) *2 ); -} - -void OWriterThread::insertReleaseRemoteCall( - rtl_uString *pOid,typelib_TypeDescriptionReference *pTypeRef) -{ - { - ::osl::MutexGuard guard( m_releaseCallMutex ); - - struct RemoteReleaseCall call; - call.sOid = pOid; - call.typeInterface = pTypeRef; - m_lstReleaseCalls.push_back( call ); - } - { - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - if( m_bInBlockingWait ) - { - m_bInBlockingWait = sal_False; - osl_setCondition( m_oslCondition ); - } - else - { - // ensure, that the writing thread does not enter blocking mode - m_bEnterBlockingWait = sal_False; - } - } -} - -/* The release calls for doubled interfaces - * - * - ***/ -void OWriterThread::executeReleaseRemoteCalls() -{ - ::std::list< struct RemoteReleaseCall > lstReleaseCalls; - { - ::osl::MutexGuard guard( m_releaseCallMutex ); - lstReleaseCalls.swap( m_lstReleaseCalls ); - } - - for( ::std::list< struct RemoteReleaseCall >::iterator ii = lstReleaseCalls.begin(); - ii != lstReleaseCalls.end(); - ++ ii ) - { - struct RemoteReleaseCall &call = (*ii) ; - - typelib_TypeDescription *pInterfaceTypeDesc = 0; - typelib_TypeDescription *pReleaseMethod = 0; - - call.typeInterface.getDescription( &pInterfaceTypeDesc ); - if( ! pInterfaceTypeDesc->bComplete ) - { - typelib_typedescription_complete( &pInterfaceTypeDesc ); - } - - uno_Any any; - uno_Any *pAny = &any; - - typelib_typedescriptionreference_getDescription( - &pReleaseMethod , - ((typelib_InterfaceTypeDescription*)pInterfaceTypeDesc)->ppAllMembers[REMOTE_RELEASE_METHOD_INDEX] ); - - urp_sendRequest_internal( - m_pEnvRemote , pReleaseMethod, call.sOid.pData, - (typelib_InterfaceTypeDescription*) pInterfaceTypeDesc, 0, 0, - &pAny ); - - typelib_typedescription_release( pReleaseMethod ); - typelib_typedescription_release( pInterfaceTypeDesc ); - } -} - - -void OWriterThread::run() -{ - while( ! m_bAbort ) - { - sal_Bool bWait; - { - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - bWait = m_bEnterBlockingWait; - if( bWait ) - { - osl_resetCondition( m_oslCondition ); - m_bInBlockingWait = sal_True; - } - m_bEnterBlockingWait = sal_True; - } - - // wait for some notification - if( bWait ) - osl_waitCondition( m_oslCondition , 0 ); - // (m_bInBlockingWait = sal_False was set by the activating thread) - - if( m_bAbort ) - break; - - // Wait for the timeout - TimeValue value = { 0 , 1000 * m_pBridgeImpl->m_properties.nOnewayTimeoutMUSEC }; - osl_resetCondition( m_oslCondition ); - osl_waitCondition( m_oslCondition , &value ); - - // check if there are some release calls to be sent .... - executeReleaseRemoteCalls(); - - { - // write to the socket - MutexGuard guard( m_pBridgeImpl->m_marshalingMutex ); - if( ! m_pBridgeImpl->m_blockMarshaler.empty() ) - { - write(); - } - } - } -} - - -} - diff --git a/bridges/source/remote/urp/urp_writer.hxx b/bridges/source/remote/urp/urp_writer.hxx deleted file mode 100644 index a2d5decbe..000000000 --- a/bridges/source/remote/urp/urp_writer.hxx +++ /dev/null @@ -1,83 +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 <list> - -#include <osl/conditn.h> -#include <osl/mutex.hxx> - -#include <rtl/ustring.hxx> - -#include <osl/thread.hxx> - -#include <com/sun/star/uno/Type.hxx> - -struct remote_Connection; - -namespace bridges_urp -{ - struct RemoteReleaseCall - { - ::rtl::OUString sOid; - ::com::sun::star::uno::Type typeInterface; - }; - - struct urp_BridgeImpl; - class OWriterThread : - public ::osl::Thread - { - public: - OWriterThread( remote_Connection *pConnection, - urp_BridgeImpl *m_pBridgeImpl, - uno_Environment *pEnvRemote); - ~OWriterThread( ); - - virtual void SAL_CALL run(); - - void touch( sal_Bool bImmediately ); - void sendEmptyMessage(); - - void abortThread(); - - void SAL_CALL insertReleaseRemoteCall ( - rtl_uString *pOid,typelib_TypeDescriptionReference *pTypeRef); - void SAL_CALL executeReleaseRemoteCalls(); - - private: - void write(); - oslCondition m_oslCondition; - sal_Bool m_bAbort; - sal_Bool m_bInBlockingWait; - sal_Bool m_bEnterBlockingWait; - remote_Connection *m_pConnection; - urp_BridgeImpl *m_pBridgeImpl; - uno_Environment *m_pEnvRemote; // this is held weak only - - ::osl::Mutex m_releaseCallMutex; - ::std::list< struct RemoteReleaseCall > m_lstReleaseCalls; - }; -} - diff --git a/bridges/unotypes/makefile.mk b/bridges/unotypes/makefile.mk index d775638ac..d5b3bc970 100644 --- a/bridges/unotypes/makefile.mk +++ b/bridges/unotypes/makefile.mk @@ -41,20 +41,7 @@ UNOUCRRDB=$(SOLARBINDIR)$/udkapi.rdb UNOUCROUT=$(OUT)$/inc UNOTYPES = \ - com.sun.star.bridge.XProtocolProperties \ - com.sun.star.corba.giop.MessageHeader_1_2 \ - com.sun.star.corba.giop.MsgType_1_1 \ - com.sun.star.corba.iop.ServiceContextList \ - com.sun.star.corba.iop.ProfileIdGroup \ - com.sun.star.corba.iiop.ProfileBody_1_1 \ - com.sun.star.corba.LogicalThreadID \ - com.sun.star.corba.iop.ServiceIdGroup \ - com.sun.star.corba.giop.ReplyHeader_1_2 \ - com.sun.star.corba.giop.RequestHeader_1_2 \ - com.sun.star.corba.TCKind \ - com.sun.star.corba.ObjectKey \ com.sun.star.uno.XInterface \ - com.sun.star.lang.DisposedException \ com.sun.star.uno.TypeClass # --- Targets ------------------------------------------------------ diff --git a/cli_ure/version/version.txt b/cli_ure/version/version.txt index 8cbdedf65..b5ec56283 100644..100755 --- a/cli_ure/version/version.txt +++ b/cli_ure/version/version.txt @@ -25,23 +25,23 @@ # #************************************************************************* -CLI_URETYPES_NEW_VERSION=1.0.7.0 -CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.6.0 -CLI_URETYPES_POLICY_VERSION=7.0.0.0 +CLI_URETYPES_NEW_VERSION=1.0.8.0 +CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.7.0 +CLI_URETYPES_POLICY_VERSION=8.0.0.0 CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes -CLI_BASETYPES_NEW_VERSION=1.0.18.0 -CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.17.0 -CLI_BASETYPES_POLICY_VERSION=18.0.0.0 +CLI_BASETYPES_NEW_VERSION=1.0.19.0 +CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.18.0 +CLI_BASETYPES_POLICY_VERSION=19.0.0.0 CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes -CLI_URE_NEW_VERSION=1.0.21.0 -CLI_URE_OLD_VERSION=1.0.0.0-1.0.20.0 -CLI_URE_POLICY_VERSION=21.0.0.0 +CLI_URE_NEW_VERSION=1.0.22.0 +CLI_URE_OLD_VERSION=1.0.0.0-1.0.21.0 +CLI_URE_POLICY_VERSION=22.0.0.0 CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure -CLI_CPPUHELPER_NEW_VERSION=1.0.21.0 -CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.20.0 -CLI_CPPUHELPER_POLICY_VERSION=21.0.0.0 +CLI_CPPUHELPER_NEW_VERSION=1.0.22.0 +CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.21.0 +CLI_CPPUHELPER_POLICY_VERSION=22.0.0.0 CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper diff --git a/codemaker/source/bonobowrappermaker/corbaoptions.cxx b/codemaker/source/bonobowrappermaker/corbaoptions.cxx index 5273d5804..a9c3d3b56 100644 --- a/codemaker/source/bonobowrappermaker/corbaoptions.cxx +++ b/codemaker/source/bonobowrappermaker/corbaoptions.cxx @@ -247,9 +247,8 @@ OString CorbaOptions::prepareHelp() OString CorbaOptions::prepareVersion() { - OString version("\nSun Microsystems (R) "); + OString version(m_program); version += m_program + " Version 2.0\n\n"; - return version; } diff --git a/codemaker/source/cppumaker/cppuoptions.cxx b/codemaker/source/cppumaker/cppuoptions.cxx index d3a960b12..d3965fa30 100644 --- a/codemaker/source/cppumaker/cppuoptions.cxx +++ b/codemaker/source/cppumaker/cppuoptions.cxx @@ -34,6 +34,12 @@ #include "osl/thread.h" #include "osl/process.h" +#ifdef SAL_UNX +#define SEPARATOR '/' +#else +#define SEPARATOR '\\' +#endif + using namespace rtl; sal_Bool CppuOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) @@ -46,7 +52,9 @@ sal_Bool CppuOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) { bCmdFile = sal_True; - m_program = av[0]; + OString name(av[0]); + sal_Int32 index = name.lastIndexOf(SEPARATOR); + m_program = name.copy((index > 0 ? index+1 : 0)); if (ac < 2) { @@ -338,7 +346,7 @@ OString CppuOptions::prepareHelp() help += " necessary information is available for bridging the type in UNO.\n"; help += " -G = generate only target files which does not exists.\n"; help += " -Gc = generate only target files which content will be changed.\n"; - help += " -X<file> = extra types which will not be taken into account for generation.\n"; + help += " -X<file> = extra types which will not be taken into account for generation.\n\n"; help += prepareVersion(); return help; @@ -346,9 +354,8 @@ OString CppuOptions::prepareHelp() OString CppuOptions::prepareVersion() { - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 2.0\n\n"; - + OString version(m_program); + version += " Version 2.0\n\n"; return version; } diff --git a/codemaker/source/cunomaker/cunooptions.cxx b/codemaker/source/cunomaker/cunooptions.cxx index c0d58f01b..c52198e88 100644 --- a/codemaker/source/cunomaker/cunooptions.cxx +++ b/codemaker/source/cunomaker/cunooptions.cxx @@ -321,9 +321,8 @@ OString CunoOptions::prepareHelp() OString CunoOptions::prepareVersion() { - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 1.0\n\n"; - + OString version(m_program); + version += " Version 1.0\n\n"; return version; } diff --git a/codemaker/source/idlmaker/idloptions.cxx b/codemaker/source/idlmaker/idloptions.cxx index c143641f0..b365c0c10 100644 --- a/codemaker/source/idlmaker/idloptions.cxx +++ b/codemaker/source/idlmaker/idloptions.cxx @@ -242,9 +242,8 @@ OString IdlOptions::prepareHelp() OString IdlOptions::prepareVersion() { - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 2.0\n\n"; - + OString version(m_program); + version += " Version 2.0\n\n"; return version; } diff --git a/codemaker/source/javamaker/javaoptions.cxx b/codemaker/source/javamaker/javaoptions.cxx index afa8cc48c..a4aefb013 100644 --- a/codemaker/source/javamaker/javaoptions.cxx +++ b/codemaker/source/javamaker/javaoptions.cxx @@ -33,6 +33,12 @@ #include "osl/process.h" #include "osl/thread.h" +#ifdef SAL_UNX +#define SEPARATOR '/' +#else +#define SEPARATOR '\\' +#endif + using namespace rtl; sal_Bool JavaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) @@ -45,7 +51,9 @@ sal_Bool JavaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) { bCmdFile = sal_True; - m_program = av[0]; + OString name(av[0]); + sal_Int32 index = name.lastIndexOf(SEPARATOR); + m_program = name.copy((index > 0 ? index+1 : 0)); if (ac < 2) { @@ -282,7 +290,7 @@ OString JavaOptions::prepareHelp() help += " -nD = no dependent types are generated.\n"; help += " -G = generate only target files which does not exists.\n"; help += " -Gc = generate only target files which content will be changed.\n"; - help += " -X<file> = extra types which will not be taken into account for generation.\n"; + help += " -X<file> = extra types which will not be taken into account for generation.\n\n"; help += prepareVersion(); return help; @@ -290,9 +298,8 @@ OString JavaOptions::prepareHelp() OString JavaOptions::prepareVersion() { - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 2.0\n\n"; - + OString version(m_program); + version += " Version 2.0\n\n"; return version; } diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 1745dd69b..d29fa68eb 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -330,20 +330,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) delete pWeakMap; pWeakMap = 0; } -#if OSL_DEBUG_LEVEL > 1 - OSL_ASSERT( nTypeDescriptionCount == 0 ); - OSL_ASSERT( nCompoundTypeDescriptionCount == 0 ); - OSL_ASSERT( nUnionTypeDescriptionCount == 0 ); - OSL_ASSERT( nIndirectTypeDescriptionCount == 0 ); - OSL_ASSERT( nArrayTypeDescriptionCount == 0 ); - OSL_ASSERT( nEnumTypeDescriptionCount == 0 ); - OSL_ASSERT( nInterfaceMethodTypeDescriptionCount == 0 ); - OSL_ASSERT( nInterfaceAttributeTypeDescriptionCount == 0 ); - OSL_ASSERT( nInterfaceTypeDescriptionCount == 0 ); - OSL_ASSERT( nTypeDescriptionReferenceCount == 0 ); - - OSL_ASSERT( !pCallbacks || pCallbacks->empty() ); -#endif delete pCallbacks; pCallbacks = 0; diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index 0601a75dc..2d49e0036 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -28,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cppu.hxx" +#include <cstddef> +#include <stdio.h> + #include "cppu/macros.hxx" #include "osl/mutex.hxx" @@ -350,8 +353,6 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( #if OSL_DEBUG_LEVEL > 1 -#include <stdio.h> - #if defined( SAL_W32) #pragma pack(push, 8) #elif defined(SAL_OS2) @@ -364,12 +365,12 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( #define MAX_ALIGNMENT_4 #endif -#define OFFSET_OF( s, m ) ((sal_Size)((char *)&((s *)16)->m -16)) +#define OFFSET_OF( s, m ) reinterpret_cast< std::size_t >((char *)&((s *)16)->m -16) #define BINTEST_VERIFY( c ) \ - if (! (c)) { fprintf( stderr, "### binary compatibility test failed: " #c " [line %d]!!!\n", __LINE__ ); abort(); } + if (! (c)) { fprintf( stderr, "### binary compatibility test failed: %s [line %d]!!!\n", #c, __LINE__ ); abort(); } #define BINTEST_VERIFYOFFSET( s, m, n ) \ - if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %d instead of expected %d!!!\n", OFFSET_OF(s, m), n ); abort(); } + if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %" SAL_PRI_SIZET "u instead of expected %d!!!\n", OFFSET_OF(s, m), n ); abort(); } #if OSL_DEBUG_LEVEL > 1 #if defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD)) && (defined(INTEL) || defined(POWERPC) || defined(X86_64) || defined(S390)) diff --git a/cpputools/source/registercomponent/registercomponent.cxx b/cpputools/source/registercomponent/registercomponent.cxx index 5e35ed6c5..2654dbdf1 100644 --- a/cpputools/source/registercomponent/registercomponent.cxx +++ b/cpputools/source/registercomponent/registercomponent.cxx @@ -575,7 +575,7 @@ void DoIt::operator() (const OUString & url) throw() if ( ! _bSilent ) { - fprintf(stderr, "register component '%s' in registry '%s' succesful!\n", sUrl.getStr(), _sRegName.getStr()); + fprintf(stderr, "register component '%s' in registry '%s' successful!\n", sUrl.getStr(), _sRegName.getStr()); } } @@ -604,7 +604,7 @@ void DoIt::operator() (const OUString & url) throw() if (bRet) { if ( ! _bSilent ) - fprintf(stderr, "revoke component '%s' from registry '%s' succesful!\n", sUrl.getStr(), _sRegName.getStr()); + fprintf(stderr, "revoke component '%s' from registry '%s' successful!\n", sUrl.getStr(), _sRegName.getStr()); } else { diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index 268114a4b..576611a01 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -275,23 +275,14 @@ void createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.io.Connector") ), xSF, Reference< XRegistryKey >() ) ) ); - // iiop bridge - xSet->insert( makeAny( loadSharedLibComponentFactory( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "remotebridge.uno" SAL_DLLEXTENSION) ), - OUString(), - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.remotebridges." - "Bridge.various") ), - xSF, Reference< XRegistryKey >() ) ) ); // bridge factory xSet->insert( makeAny( loadSharedLibComponentFactory( OUString( RTL_CONSTASCII_USTRINGPARAM( - "bridgefac.uno" SAL_DLLEXTENSION) ), + "binaryurp.uno" SAL_DLLEXTENSION) ), OUString(), - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.remotebridges." - "BridgeFactory") ), + OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.comp.bridge.BridgeFactory") ), xSF, Reference< XRegistryKey >() ) ) ); } s_bSet = sal_True; diff --git a/idlc/inc/idlc/idlctypes.hxx b/idlc/inc/idlc/idlctypes.hxx index 39dc025e8..9bbe72a49 100644 --- a/idlc/inc/idlc/idlctypes.hxx +++ b/idlc/inc/idlc/idlctypes.hxx @@ -32,7 +32,9 @@ #include <hash_map> #include <list> #include <vector> +#include <string> #include <set> + #include <sal/types.h> #include <rtl/ustring.hxx> diff --git a/idlc/inc/idlc/options.hxx b/idlc/inc/idlc/options.hxx index d6ef3aab8..787d3a5e3 100644 --- a/idlc/inc/idlc/options.hxx +++ b/idlc/inc/idlc/options.hxx @@ -50,18 +50,29 @@ public: class Options { public: - Options(); + explicit Options(char const * progname); ~Options(); + static bool checkArgument(std::vector< std::string > & rArgs, char const * arg, size_t len); + static bool checkCommandFile(std::vector< std::string > & rArgs, char const * filename); + + bool initOptions(std::vector< std::string > & rArgs) + throw(IllegalArgument); + bool badOption(char const * reason, std::string const & rArg) + throw(IllegalArgument); + bool setOption(char const * option, std::string const & rArg); + +#if 0 /* @@@ */ sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False) throw( IllegalArgument ); +#endif /* @@@ */ ::rtl::OString prepareHelp(); ::rtl::OString prepareVersion(); const ::rtl::OString& getProgramName() const; - sal_Bool isValid(const ::rtl::OString& option); - const ::rtl::OString getOption(const ::rtl::OString& option) + bool isValid(const ::rtl::OString& option); + const ::rtl::OString& getOption(const ::rtl::OString& option) throw( IllegalArgument ); const StringVector& getInputFiles() const { return m_inputFiles; } diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx index 707629c1d..e051de2c7 100644 --- a/idlc/source/astexpression.cxx +++ b/idlc/source/astexpression.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_idlc.hxx" + #include <idlc/astexpression.hxx> #include <idlc/astconstant.hxx> #include <idlc/astscope.hxx> @@ -34,6 +35,7 @@ #include <limits.h> #include <float.h> +#include <memory> // auto_ptr<> #undef MAXCHAR #define MAXCHAR 127 @@ -927,7 +929,6 @@ AstExprValue* AstExpression::eval_internal(EvalKind ek) AstExprValue* AstExpression::eval_bin_op(EvalKind ek) { - AstExprValue *retval = NULL; ExprType eType = ET_double; if ( m_combOperator == EC_mod ) @@ -950,7 +951,7 @@ AstExprValue* AstExpression::eval_bin_op(EvalKind ek) if (m_subExpr2->getExprValue() == NULL) return NULL; - retval = new AstExprValue(); + std::auto_ptr< AstExprValue > retval(new AstExprValue()); retval->et = eType; switch (m_combOperator) @@ -971,20 +972,18 @@ AstExprValue* AstExpression::eval_bin_op(EvalKind ek) break; case EC_div: if (m_subExpr2->getExprValue()->u.dval == 0.0) - return NULL; + return NULL; retval->u.dval = m_subExpr1->getExprValue()->u.dval / m_subExpr2->getExprValue()->u.dval; break; default: return NULL; } - return retval; + return retval.release(); } AstExprValue* AstExpression::eval_bit_op(EvalKind ek) { - AstExprValue *retval = NULL; - if (ek != EK_const && ek != EK_positive_int) return NULL; if (m_subExpr1 == NULL || m_subExpr2 == NULL) @@ -1002,7 +1001,7 @@ AstExprValue* AstExpression::eval_bit_op(EvalKind ek) if (m_subExpr2->getExprValue() == NULL) return NULL; - retval = new AstExprValue; + std::auto_ptr< AstExprValue > retval(new AstExprValue()); retval->et = ET_long; switch (m_combOperator) @@ -1026,13 +1025,11 @@ AstExprValue* AstExpression::eval_bit_op(EvalKind ek) return NULL; } - return retval; + return retval.release(); } AstExprValue* AstExpression::eval_un_op(EvalKind ek) { - AstExprValue *retval = NULL; - if (m_exprValue != NULL) return m_exprValue; @@ -1047,7 +1044,7 @@ AstExprValue* AstExpression::eval_un_op(EvalKind ek) if (m_subExpr1->getExprValue() == NULL) return NULL; - retval = new AstExprValue(); + std::auto_ptr< AstExprValue > retval(new AstExprValue()); retval->et = ET_double; switch (m_combOperator) @@ -1068,7 +1065,7 @@ AstExprValue* AstExpression::eval_un_op(EvalKind ek) return NULL; } - return retval; + return retval.release(); } AstExprValue* AstExpression::eval_symbol(EvalKind ek) diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx index 578676e36..1ba712805 100644 --- a/idlc/source/idlcmain.cxx +++ b/idlc/source/idlcmain.cxx @@ -27,26 +27,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_idlc.hxx" -#include <idlc/idlc.hxx> + +#include "idlc/idlc.hxx" #include "sal/main.h" +#include <string.h> + using namespace ::rtl; SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { - Options options; + std::vector< std::string > args; + for (int i = 1; i < argc; i++) + { + if (!Options::checkArgument (args, argv[i], strlen(argv[i]))) + return (1); + } + Options options(argv[0]); try { - if (!options.initOptions(argc, argv)) - exit(1); + if (!options.initOptions(args)) + return (0); } catch( IllegalArgument& e) { fprintf(stderr, "Illegal argument: %s\n%s", e.m_message.getStr(), options.prepareVersion().getStr()); - exit(99); + return (99); } setIdlc(&options); diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index df53b2186..a9670050e 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -28,13 +28,26 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_idlc.hxx" +#include "idlc/options.hxx" + +#include "osl/diagnose.h" +#include "rtl/string.hxx" +#include "rtl/strbuf.hxx" + #include <stdio.h> -#include /*MSVC trouble: <cstring>*/ <string.h> -#include <idlc/options.hxx> +#include <string.h> + +using rtl::OString; +using rtl::OStringBuffer; -using namespace rtl; +#ifdef SAL_UNX +#define SEPARATOR '/' +#else +#define SEPARATOR '\\' +#endif -Options::Options(): m_stdin(false), m_verbose(false), m_quiet(false) +Options::Options(char const * progname) + : m_program(progname), m_stdin(false), m_verbose(false), m_quiet(false) { } @@ -42,274 +55,283 @@ Options::~Options() { } -sal_Bool Options::initOptions(int ac, char* av[], sal_Bool bCmdFile) - throw( IllegalArgument ) +// static +bool Options::checkArgument (std::vector< std::string > & rArgs, char const * arg, size_t len) { - sal_Bool ret = sal_True; - sal_uInt16 j=0; - - if (!bCmdFile) + bool result = ((arg != 0) && (len > 0)); + OSL_PRECOND(result, "idlc::Options::checkArgument(): invalid arguments"); + if (result) + { + switch(arg[0]) { - bCmdFile = sal_True; - - m_program = av[0]; - - if (ac < 2) + case '@': + if ((result = (len > 1)) == true) + { + // "@<cmdfile>" + result = Options::checkCommandFile (rArgs, &(arg[1])); + } + break; + case '-': + if ((result = (len > 1)) == true) + { + // "-<option>" + switch (arg[1]) { - fprintf(stderr, "%s", prepareHelp().getStr()); - ret = sal_False; + case 'O': + case 'I': + case 'D': + { + // "-<option>[<param>] + std::string option(&(arg[0]), 2); + rArgs.push_back(option); + if (len > 2) + { + // "-<option><param>" + std::string param(&(arg[2]), len - 2); + rArgs.push_back(param); + } + break; + } + default: + // "-<option>" ([long] option, w/o param) + rArgs.push_back(std::string(arg, len)); + break; } - - j = 1; - } else + } + break; + default: + // "<param>" + rArgs.push_back(std::string(arg, len)); + break; + } + } + return (result); +} + +// static +bool Options::checkCommandFile (std::vector< std::string > & rArgs, char const * filename) +{ + FILE * fp = fopen(filename, "r"); + if (fp == 0) { - j = 0; + fprintf(stderr, "ERROR: can't open command file \"%s\"\n", filename); + return (false); } - - char *s=NULL; - for (; j < ac; j++) + + std::string buffer; + buffer.reserve(256); + + bool quoted = false; + int c = EOF; + while ((c = fgetc(fp)) != EOF) { - if (av[j][0] == '-') - { - switch (av[j][1]) - { - case 'O': - if (av[j][2] == '\0') - { - if (j < ac - 1 && av[j+1][0] != '-') - { - j++; - s = av[j]; - } else - { - OString tmp("'-O', please check"); - if (j <= ac - 1) - { - tmp += " your input '" + OString(av[j+1]) + "'"; - } - - throw IllegalArgument(tmp); - } - } else - { - s = av[j] + 2; - } - - m_options["-O"] = OString(s); - break; - case 'I': - { - if (av[j][2] == '\0') - { - if (j < ac - 1 && av[j+1][0] != '-') - { - j++; - s = av[j]; - } else - { - OString tmp("'-I', please check"); - if (j <= ac - 1) - { - tmp += " your input '" + OString(av[j+1]) + "'"; - } - - throw IllegalArgument(tmp); - } - } else - { - s = av[j] + 2; - } - - OString inc(s); - if ( inc.indexOf(';') > 0 ) - { - OString tmp(s); - sal_Int32 nIndex = 0; - inc = OString(); - do inc = inc + " -I\"" + tmp.getToken( 0, ';', nIndex ) +"\""; while( nIndex != -1 ); - } else - inc = OString("-I\"") + s + "\""; - - if (m_options.count("-I") > 0) - { - OString tmp(m_options["-I"]); - tmp = tmp + " " + inc; - m_options["-I"] = tmp; - } else - { - m_options["-I"] = inc; - } - } - break; - case 'D': - if (av[j][2] == '\0') - { - if (j < ac - 1 && av[j+1][0] != '-') - { - j++; - s = av[j]; - } else - { - OString tmp("'-D', please check"); - if (j <= ac - 1) - { - tmp += " your input '" + OString(av[j+1]) + "'"; - } - - throw IllegalArgument(tmp); - } - } else - { - s = av[j]; - } - - if (m_options.count("-D") > 0) - { - OString tmp(m_options["-D"]); - tmp = tmp + " " + s; - m_options["-D"] = tmp; - } else - m_options["-D"] = OString(s); - break; - case 'C': - if (av[j][2] != '\0') - { - throw IllegalArgument(OString(av[j]) + ", please check your input"); - } - if (m_options.count("-C") == 0) - m_options["-C"] = OString(av[j]); - break; - case 'c': - if (av[j][2] == 'i' && av[j][3] == 'd' && av[j][4] == '\0') - { - if (m_options.count("-cid") == 0) - m_options["-cid"] = OString(av[j]); - } else - throw IllegalArgument(OString(av[j]) + ", please check your input"); - break; - case 'v': - if ( 0 == strcmp( &av[j][1], "verbose" ) ) - { - m_verbose = true; - } - else - throw IllegalArgument(OString(av[j]) + ", please check your input"); - break; - case 'q': - if ( 0 == strcmp( &av[j][1], "quiet" ) ) - { - m_quiet = true; - } - else - throw IllegalArgument(OString(av[j]) + ", please check your input"); - break; - case 'w': - if (av[j][2] == 'e' && av[j][3] == '\0') { - if (m_options.count("-we") == 0) - m_options["-we"] = OString(av[j]); - } else { - if (av[j][2] == '\0') { - if (m_options.count("-w") == 0) - m_options["-w"] = OString(av[j]); - } else - throw IllegalArgument(OString(av[j]) + ", please check your input"); - } - break; - case 'h': - case '?': - if (av[j][2] != '\0') - { - throw IllegalArgument(OString(av[j]) + ", please check your input"); - } else - { - fprintf(stdout, "%s", prepareHelp().getStr()); - exit(0); - } - case 's': - if (/*MSVC trouble: std::*/strcmp(&av[j][2], "tdin") == 0) - { - m_stdin = true; - break; - } - // fall through - default: - throw IllegalArgument("the option is unknown" + OString(av[j])); - } - } else + switch(c) { - if (av[j][0] == '@') - { - FILE* cmdFile = fopen(av[j]+1, "r"); - if( cmdFile == NULL ) + case '\"': + quoted = !quoted; + break; + case ' ': + case '\t': + case '\r': + case '\n': + if (!quoted) + { + if (!buffer.empty()) + { + // append current argument. + if (!Options::checkArgument(rArgs, buffer.c_str(), buffer.size())) { - fprintf(stderr, "%s", prepareHelp().getStr()); - ret = sal_False; - } else - { - int rargc=0; - char* rargv[512]; - char buffer[512]=""; + (void) fclose(fp); + return (false); + } + buffer.clear(); + } + break; + } + default: + // quoted white-space fall through + buffer.push_back(sal::static_int_cast<char>(c)); + break; + } + } + if (!buffer.empty()) + { + // append unterminated argument. + if (!Options::checkArgument(rArgs, buffer.c_str(), buffer.size())) + { + (void) fclose(fp); + return (false); + } + buffer.clear(); + } + return (fclose(fp) == 0); +} - int i=0; - int found = 0; - char c; - while ( fscanf(cmdFile, "%c", &c) != EOF ) - { - if (c=='\"') { - if (found) { - found=0; - } else { - found=1; - continue; - } - } else { - if (c!=13 && c!=10) { - if (found || c!=' ') { - buffer[i++]=c; - continue; - } - } - if (i==0) - continue; - } - buffer[i]='\0'; - found=0; - i=0; - rargv[rargc]= strdup(buffer); - rargc++; - buffer[0]='\0'; - } - if (buffer[0] != '\0') { - buffer[i]='\0'; - rargv[rargc]= strdup(buffer); - rargc++; - } - fclose(cmdFile); - - ret = initOptions(rargc, rargv, bCmdFile); - - long ii = 0; - for (ii=0; ii < rargc; ii++) - { - free(rargv[ii]); - } - } - } else - { - OString name(av[j]); - name = name.toAsciiLowerCase(); - if ( name.lastIndexOf(".idl") != (name.getLength() - 4) ) - { - throw IllegalArgument("'" + OString(av[j]) + - "' is not a valid input file, only '*.idl' files will be accepted"); - } - m_inputFiles.push_back(av[j]); - } +bool Options::badOption(char const * reason, std::string const & rArg) throw(IllegalArgument) +{ + OStringBuffer message; + if (reason != 0) + { + message.append(reason); message.append(" option '"); message.append(rArg.c_str()); message.append("'"); + throw IllegalArgument(message.makeStringAndClear()); + } + return false; +} + +bool Options::setOption(char const * option, std::string const & rArg) +{ + bool result = (0 == strcmp(option, rArg.c_str())); + if (result) + m_options[rArg.c_str()] = OString(rArg.c_str(), rArg.size()); + return (result); +} + +bool Options::initOptions(std::vector< std::string > & rArgs) throw(IllegalArgument) +{ + std::vector< std::string >::const_iterator first = rArgs.begin(), last = rArgs.end(); + for (; first != last; ++first) + { + if ((*first)[0] != '-') + { + OString filename((*first).c_str(), (*first).size()); + OString tmp(filename.toAsciiLowerCase()); + if (tmp.lastIndexOf(".idl") != (tmp.getLength() - 4)) + { + throw IllegalArgument("'" + filename + "' is not a valid input file, only '*.idl' files will be accepted"); + } + m_inputFiles.push_back(filename); + continue; + } + + std::string const option(*first); + switch((*first)[1]) + { + case 'O': + { + if (!((++first != last) && ((*first)[0] != '-'))) + { + return badOption("invalid", option); + } + OString param((*first).c_str(), (*first).size()); + m_options["-O"] = param; + break; + } + case 'I': + { + if (!((++first != last) && ((*first)[0] != '-'))) + { + return badOption("invalid", option); + } + OString param((*first).c_str(), (*first).size()); + { + // quote param token(s). + OStringBuffer buffer; + sal_Int32 k = 0; + do + { + OStringBuffer token; token.append("-I\""); token.append(param.getToken(0, ';', k)); token.append("\""); + if (buffer.getLength() > 0) + buffer.append(' '); + buffer.append(token); + } while (k != -1); + param = buffer.makeStringAndClear(); + } + if (m_options.count("-I") > 0) + { + // append param. + OStringBuffer buffer(m_options["-I"]); + buffer.append(' '); buffer.append(param); + param = buffer.makeStringAndClear(); + } + m_options["-I"] = param; + break; + } + case 'D': + { + if (!((++first != last) && ((*first)[0] != '-'))) + { + return badOption("invalid", option); + } + OString param("-D"); param += OString((*first).c_str(), (*first).size()); + if (m_options.count("-D") > 0) + { + OStringBuffer buffer(m_options["-D"]); + buffer.append(' '); buffer.append(param); + param = buffer.makeStringAndClear(); + } + m_options["-D"] = param; + break; + } + case 'C': + { + if (!setOption("-C", option)) + { + return badOption("invalid", option); } + break; + } + case 'c': + { + if (!setOption("-cid", option)) + { + return badOption("invalid", option); + } + break; + } + case 'q': + { + if (!setOption("-quiet", option)) + { + return badOption("invalid", option); + } + m_quiet = true; + break; + } + case 'v': + { + if (!setOption("-verbose", option)) + { + return badOption("invalid", option); + } + m_verbose = true; + break; + } + case 'w': + { + if (!(setOption("-w", option) || setOption("-we", option))) + { + return badOption("invalid", option); + } + break; + } + case 'h': + case '?': + { + if (!(setOption("-h", option) || setOption("-?", option))) + { + return badOption("invalid", option); + } + { + (void) fprintf(stdout, "%s", prepareHelp().getStr()); + return (false); + } + // break; // Unreachable + } + case 's': + { + if (!setOption("-stdin", option)) + { + return badOption("invalid", option); + } + m_stdin = true; + break; + } + default: + return badOption("unknown", option); } - - return ret; -} + } + return (true); +} OString Options::prepareHelp() { @@ -335,7 +357,7 @@ OString Options::prepareHelp() help += " requirements.\n"; help += " -w = display warning messages.\n"; help += " -we = treat warnings as errors.\n"; - help += " -h|-? = print this help message and exit.\n"; + help += " -h|-? = print this help message and exit.\n\n"; help += prepareVersion(); return help; @@ -343,8 +365,8 @@ OString Options::prepareHelp() OString Options::prepareVersion() { - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 1.1\n\n"; + OString version(m_program); + version += " Version 1.1\n\n"; return version; } @@ -353,19 +375,18 @@ const OString& Options::getProgramName() const return m_program; } -sal_Bool Options::isValid(const OString& option) +bool Options::isValid(const OString& option) { return (m_options.count(option) > 0); } -const OString Options::getOption(const OString& option) +const OString& Options::getOption(const OString& option) throw( IllegalArgument ) { - if (m_options.count(option) > 0) - { - return m_options[option]; - } else + if (!isValid(option)) { throw IllegalArgument("Option is not valid or currently not set."); } + return m_options[option]; } +/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/idlc/source/preproc/eval.c b/idlc/source/preproc/eval.c index cbac1d79c..96dc2342d 100644 --- a/idlc/source/preproc/eval.c +++ b/idlc/source/preproc/eval.c @@ -24,9 +24,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ + +#include "cpp.h" + #include <stdlib.h> #include <string.h> -#include "cpp.h" #define NSTAK 32 #define SGN 0 @@ -736,10 +738,10 @@ struct value } else { - static char cvcon[] - = "b\bf\fn\nr\rt\tv\v''\"\"??\\\\"; + static char cvcon[] = "b\bf\fn\nr\rt\tv\v''\"\"??\\\\"; + static int cvlen = sizeof(cvcon) - 1; - for (i = 0; i < (int)sizeof(cvcon); i += 2) + for (i = 0; i < cvlen; i += 2) { if (*p == cvcon[i]) { @@ -748,9 +750,8 @@ struct value } } p += 1; - if (i >= (int)sizeof(cvcon)) - error(WARNING, - "Undefined escape in character constant"); + if (i >= cvlen) + error(WARNING,"Undefined escape in character constant"); } } else diff --git a/idlc/source/preproc/lex.c b/idlc/source/preproc/lex.c index d88a475b3..87d9e6c8d 100644 --- a/idlc/source/preproc/lex.c +++ b/idlc/source/preproc/lex.c @@ -290,7 +290,7 @@ void bigfsm[j][fp->state] = (short) nstate; continue; case C_ALPH: - for (j = 0; j <= 256; j++) + for (j = 0; j < 256; j++) if (('a' <= j && j <= 'z') || ('A' <= j && j <= 'Z') || j == '_') bigfsm[j][fp->state] = (short) nstate; @@ -687,9 +687,13 @@ void if (s->fd >= 0) { - close(s->fd); - dofree(s->inb); + (void) close(s->fd); + dofree(s->filename); } + + if (s->inb) + dofree(s->inb); + cursource = s->next; dofree(s); } diff --git a/idlc/source/preproc/unix.c b/idlc/source/preproc/unix.c index 922b2a320..a7af8a301 100644 --- a/idlc/source/preproc/unix.c +++ b/idlc/source/preproc/unix.c @@ -91,6 +91,7 @@ void maketokenrow(3, &tr); gettokens(&tr, 1); doadefine(&tr, c); + dofree(tr.bp); tr.bp = 0; unsetsource(); break; diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index c7ea60d7d..acd5cdcbc 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -171,10 +171,10 @@ OUString OTextInputStream::readLine( ) return implReadString( aDummySeq, sal_True, sal_True ); } -OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool ) +OUString OTextInputStream::readString( const Sequence< sal_Unicode >& Delimiters, sal_Bool bRemoveDelimiter ) throw(IOException, RuntimeException) { - return implReadString( Delimiters, sal_True, sal_False ); + return implReadString( Delimiters, bRemoveDelimiter, sal_False ); } sal_Bool OTextInputStream::isEOF() diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx index c38fb0555..cbabb95be 100644 --- a/io/source/acceptor/acc_pipe.cxx +++ b/io/source/acceptor/acc_pipe.cxx @@ -101,11 +101,17 @@ namespace io_acceptor { if( ! m_nStatus ) { - if( aReadBytes.getLength() != nBytesToRead ) + if( aReadBytes.getLength() < nBytesToRead ) { aReadBytes.realloc( nBytesToRead ); } - return m_pipe.read( aReadBytes.getArray() , aReadBytes.getLength() ); + sal_Int32 n = m_pipe.read( aReadBytes.getArray(), nBytesToRead ); + OSL_ASSERT( n >= 0 && n <= aReadBytes.getLength() ); + if( n < aReadBytes.getLength() ) + { + aReadBytes.realloc( n ); + } + return n; } else { throw IOException(); diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java index 12ea6bd2e..e3513c7b0 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java @@ -155,7 +155,7 @@ public class java_remote_bridge new Job(obj, java_remote_bridge.this, msg)); } } catch (Throwable e) { - dispose(new DisposedException(e.toString())); + dispose(e); } } @@ -478,12 +478,12 @@ public class java_remote_bridge dispose = _life_count <= 0; } if (dispose) { - dispose(new com.sun.star.uno.RuntimeException("end of life")); + dispose(new Throwable("end of life")); } } public void dispose() { - dispose(new com.sun.star.uno.RuntimeException("user dispose")); + dispose(new Throwable("user dispose")); } private void dispose(Throwable throwable) { @@ -499,6 +499,8 @@ public class java_remote_bridge ((DisposeListener) i.next()).notifyDispose(this); } + _iProtocol.terminate(); + try { _messageDispatcher.terminate(); @@ -602,7 +604,8 @@ public class java_remote_bridge _iProtocol.writeReply(exception, threadId, result); } catch (IOException e) { dispose(e); - throw new DisposedException("unexpected " + e); + throw (DisposedException) + (new DisposedException("unexpected " + e).initCause(e)); } catch (RuntimeException e) { dispose(e); throw e; @@ -631,9 +634,9 @@ public class java_remote_bridge oid, TypeDescription.getTypeDescription(type), operation, threadId, params); } catch (IOException e) { - DisposedException d = new DisposedException(e.toString()); - dispose(d); - throw d; + dispose(e); + throw (DisposedException) + new DisposedException(e.toString()).initCause(e); } if (sync && Thread.currentThread() != _messageDispatcher) { result = _iThreadPool.enter(handle, threadId); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java index afb5fc586..9c7212130 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java @@ -51,6 +51,8 @@ public interface IProtocol { */ void init() throws IOException; + void terminate(); + /** * Reads a request or reply message. * diff --git a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java index 20017ed24..6296a2b50 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java @@ -110,10 +110,10 @@ public interface IThreadPool { /** * Disposes this thread pool, thus releasing - * all threads by throwing the given - * <code>Throwable</code>. + * all threads by throwing a <code>DisposedException</code> with the given + * <code>Throwable</code> cause. * <p> - * @param throwing the Throwable + * @param throwing the cause */ public void dispose(Throwable throwable); diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java index b8700b61f..c3847776a 100644 --- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java +++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java @@ -27,6 +27,7 @@ package com.sun.star.lib.uno.environments.remote; +import com.sun.star.lang.DisposedException; /** * The <code>JobQueue</code> implements a queue for jobs. @@ -200,7 +201,7 @@ public class JobQueue { * @return a job or null if timed out * @param waitTime the maximum amount of time to wait for a job */ - private Job removeJob(int waitTime) throws Throwable { + private Job removeJob(int waitTime) { if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId); Job job = null; @@ -210,7 +211,8 @@ public class JobQueue { while(_head == null && (waitTime == 0 || !waited)) { if(_doDispose == _disposeId) { _doDispose = null; - throw _throwable; + throw (DisposedException) + new DisposedException().initCause(_throwable); } // notify sync queues @@ -250,7 +252,8 @@ public class JobQueue { if(_doDispose == _disposeId) { _doDispose = null; - throw _throwable; + throw (DisposedException) + new DisposedException().initCause(_throwable); } try { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java index 3e33a6657..f72b56811 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/urp.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/urp.java @@ -30,6 +30,7 @@ package com.sun.star.lib.uno.protocols.urp; import com.sun.star.bridge.InvalidProtocolChangeException; import com.sun.star.bridge.ProtocolProperty; import com.sun.star.bridge.XProtocolProperties; +import com.sun.star.lang.DisposedException; import com.sun.star.lib.uno.environments.remote.IProtocol; import com.sun.star.lib.uno.environments.remote.Message; import com.sun.star.lib.uno.environments.remote.ThreadId; @@ -79,6 +80,15 @@ public final class urp implements IProtocol { } } + // @see IProtocol#terminate + public void terminate() { + synchronized (monitor) { + state = STATE_TERMINATED; + initialized = true; + monitor.notifyAll(); + } + } + // @see IProtocol#readMessage public Message readMessage() throws IOException { for (;;) { @@ -125,6 +135,9 @@ public final class urp implements IProtocol { throw new RuntimeException(e.toString()); } } + if (state == STATE_TERMINATED) { + throw new DisposedException(); + } return writeRequest(false, oid, type, function, tid, arguments); } } @@ -375,7 +388,6 @@ public final class urp implements IProtocol { if ((header & HEADER_NEWTID) != 0) { inL1Tid = unmarshal.readThreadId(); } - //TODO: check HEADER_IGNORECACHE return readRequest(funId, sync); } @@ -684,7 +696,6 @@ public final class urp implements IProtocol { private static final int HEADER_NEWOID = 0x10; private static final int HEADER_NEWTID = 0x08; private static final int HEADER_FUNCTIONID16 = 0x04; - private static final int HEADER_IGNORECACHE = 0x02; private static final int HEADER_MOREFLAGS = 0x01; private static final int HEADER_MUSTREPLY = 0x80; private static final int HEADER_SYNCHRONOUS = 0x40; @@ -701,6 +712,7 @@ public final class urp implements IProtocol { private static final int STATE_REQUESTED = 2; private static final int STATE_COMMITTED = 3; private static final int STATE_WAIT = 4; + private static final int STATE_TERMINATED = 5; private static final int MAX_RELEASE_QUEUE_SIZE = 100; diff --git a/offapi/com/sun/star/accessibility/XAccessibleMultiLineText.idl b/offapi/com/sun/star/accessibility/XAccessibleMultiLineText.idl index a9825b8e9..a7e3271af 100644 --- a/offapi/com/sun/star/accessibility/XAccessibleMultiLineText.idl +++ b/offapi/com/sun/star/accessibility/XAccessibleMultiLineText.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module accessibility { <type>XAccessibleText</type> interface and extents it with a notion of line numbers</p> - @since OOo 3.0.0 + @since OOo 3.0 */ /// not yet published diff --git a/offapi/com/sun/star/animations/XAnimationListener.idl b/offapi/com/sun/star/animations/XAnimationListener.idl index 9779c51cd..c885282db 100644 --- a/offapi/com/sun/star/animations/XAnimationListener.idl +++ b/offapi/com/sun/star/animations/XAnimationListener.idl @@ -43,7 +43,7 @@ /** makes it possible to register listeners, which are called whenever an animation event occurs. - @since #i71351# + @since OOo 3.0 */ interface XAnimationListener : ::com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/awt/EnhancedMouseEvent.idl b/offapi/com/sun/star/awt/EnhancedMouseEvent.idl index 9a2af3fbe..402be4f99 100644 --- a/offapi/com/sun/star/awt/EnhancedMouseEvent.idl +++ b/offapi/com/sun/star/awt/EnhancedMouseEvent.idl @@ -42,7 +42,7 @@ @see MouseEvent - @since OOo 2.0.0 + @since OOo 2.0 */ published struct EnhancedMouseEvent: com::sun::star::awt::MouseEvent diff --git a/offapi/com/sun/star/awt/UnoControlButtonModel.idl b/offapi/com/sun/star/awt/UnoControlButtonModel.idl index eaaea0808..ff35f98d3 100644 --- a/offapi/com/sun/star/awt/UnoControlButtonModel.idl +++ b/offapi/com/sun/star/awt/UnoControlButtonModel.idl @@ -95,7 +95,7 @@ published service UnoControlButtonModel If set to <FALSE/>, the focus is preserved when the user operates the button control with the mouse.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean FocusOnClick; @@ -183,7 +183,7 @@ published service UnoControlButtonModel /** specifies that the text may be displayed on more than one line. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean MultiLine; @@ -208,7 +208,7 @@ published service UnoControlButtonModel set to <TRUE/>, the button is repeatedly pressed while you hold down the mouse button.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Repeat; @@ -222,7 +222,7 @@ published service UnoControlButtonModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -261,7 +261,7 @@ published service UnoControlButtonModel <p>The default for this property is <FALSE/>, which means the button behaves like a usual push button.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Toggle; @@ -269,7 +269,7 @@ published service UnoControlButtonModel /** specifies the vertical alignment of the text in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; diff --git a/offapi/com/sun/star/awt/UnoControlCheckBoxModel.idl b/offapi/com/sun/star/awt/UnoControlCheckBoxModel.idl index b7fe6f487..4ad296ca6 100644 --- a/offapi/com/sun/star/awt/UnoControlCheckBoxModel.idl +++ b/offapi/com/sun/star/awt/UnoControlCheckBoxModel.idl @@ -65,7 +65,7 @@ published service UnoControlCheckBoxModel 2: right </pre> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short Align; @@ -155,7 +155,7 @@ published service UnoControlCheckBoxModel /** specifies that the text may be displayed on more than one line. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean MultiLine; @@ -205,7 +205,7 @@ published service UnoControlCheckBoxModel /** specifies the vertical alignment of the text in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; @@ -218,7 +218,7 @@ published service UnoControlCheckBoxModel @see com::sun::star::awt::VisualEffect - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short VisualEffect; diff --git a/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl b/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl index 2f766c3b4..d1fc60dee 100644 --- a/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl +++ b/offapi/com/sun/star/awt/UnoControlComboBoxModel.idl @@ -96,7 +96,7 @@ published service UnoControlComboBoxModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -149,7 +149,7 @@ published service UnoControlComboBoxModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; diff --git a/offapi/com/sun/star/awt/UnoControlContainerModel.idl b/offapi/com/sun/star/awt/UnoControlContainerModel.idl index 1235f23ae..9f59040ae 100644 --- a/offapi/com/sun/star/awt/UnoControlContainerModel.idl +++ b/offapi/com/sun/star/awt/UnoControlContainerModel.idl @@ -79,7 +79,7 @@ published service UnoControlContainerModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; diff --git a/offapi/com/sun/star/awt/UnoControlCurrencyFieldModel.idl b/offapi/com/sun/star/awt/UnoControlCurrencyFieldModel.idl index 8a9fa07e9..dcd41050f 100644 --- a/offapi/com/sun/star/awt/UnoControlCurrencyFieldModel.idl +++ b/offapi/com/sun/star/awt/UnoControlCurrencyFieldModel.idl @@ -80,7 +80,7 @@ published service UnoControlCurrencyFieldModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -139,7 +139,7 @@ published service UnoControlCurrencyFieldModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -167,7 +167,7 @@ published service UnoControlCurrencyFieldModel /** specifies whether the mouse should show repeating behaviour, i.e. repeatedly trigger an action when keeping pressed. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Repeat; @@ -181,7 +181,7 @@ published service UnoControlCurrencyFieldModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -267,7 +267,7 @@ published service UnoControlCurrencyFieldModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl b/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl index 3eefcac7f..1f71ef9dd 100644 --- a/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl +++ b/offapi/com/sun/star/awt/UnoControlDateFieldModel.idl @@ -80,7 +80,7 @@ published service UnoControlDateFieldModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -180,7 +180,7 @@ published service UnoControlDateFieldModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -201,7 +201,7 @@ published service UnoControlDateFieldModel /** specifies whether the mouse should show repeating behaviour, i.e. repeatedly trigger an action when keeping pressed. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Repeat; @@ -215,7 +215,7 @@ published service UnoControlDateFieldModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -241,7 +241,7 @@ published service UnoControlDateFieldModel /** specifies the text displayed in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string Text; @@ -279,7 +279,7 @@ published service UnoControlDateFieldModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlDialog.idl b/offapi/com/sun/star/awt/UnoControlDialog.idl index e7f08714e..0e6a73eef 100644 --- a/offapi/com/sun/star/awt/UnoControlDialog.idl +++ b/offapi/com/sun/star/awt/UnoControlDialog.idl @@ -35,8 +35,8 @@ #include <com/sun/star/awt/XTopWindow.idl> #endif -#ifndef __com_sun_star_awt_XDialog_idl__ -#include <com/sun/star/awt/XDialog.idl> +#ifndef __com_sun_star_awt_XDialog2_idl__ +#include <com/sun/star/awt/XDialog2.idl> #endif @@ -54,7 +54,7 @@ published service UnoControlDialog interface com::sun::star::awt::XTopWindow; - interface com::sun::star::awt::XDialog; + interface com::sun::star::awt::XDialog2; }; diff --git a/offapi/com/sun/star/awt/UnoControlDialogModel.idl b/offapi/com/sun/star/awt/UnoControlDialogModel.idl index 215568c35..a4b8b9887 100644 --- a/offapi/com/sun/star/awt/UnoControlDialogModel.idl +++ b/offapi/com/sun/star/awt/UnoControlDialogModel.idl @@ -161,7 +161,7 @@ published service UnoControlDialogModel /** If set to true the dialog will have the desktop as parent. - @since OOo 2.3.0 + @since OOo 2.3 */ [optional, property] boolean DesktopAsParent; @@ -169,7 +169,7 @@ published service UnoControlDialogModel background image. @see Graphic - @since OOo 2.4.0 + @since OOo 2.4 */ [optional, property] string ImageURL; @@ -184,7 +184,7 @@ published service UnoControlDialogModel to an empty string.</li> </ul></p> - @since OOo 2.4.0 + @since OOo 2.4 */ [optional, property, transient] com::sun::star::graphic::XGraphic Graphic; diff --git a/offapi/com/sun/star/awt/UnoControlDialogModelProvider.idl b/offapi/com/sun/star/awt/UnoControlDialogModelProvider.idl index 6e4f5b9e9..c1f91eb63 100644 --- a/offapi/com/sun/star/awt/UnoControlDialogModelProvider.idl +++ b/offapi/com/sun/star/awt/UnoControlDialogModelProvider.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module awt { /** specifies a service to load a dialog model and allows to access the control models inside - @since OOo 3.3.0 + @since OOo 3.3 */ service UnoControlDialogModelProvider : com::sun::star::container::XNameContainer { diff --git a/offapi/com/sun/star/awt/UnoControlEditModel.idl b/offapi/com/sun/star/awt/UnoControlEditModel.idl index b507751f1..19b637d84 100644 --- a/offapi/com/sun/star/awt/UnoControlEditModel.idl +++ b/offapi/com/sun/star/awt/UnoControlEditModel.idl @@ -72,7 +72,7 @@ published service UnoControlEditModel /** If set to true an horizontal scrollbar will be added automaticly when needed. - @since OOo 2.3.0 + @since OOo 2.3 */ [optional, property] boolean AutoHScroll; @@ -81,7 +81,7 @@ published service UnoControlEditModel /** If set to true an vertical scrollbar will be added automaticly when needed. - @since OOo 2.3.0 + @since OOo 2.3 */ [optional, property] boolean AutoVScroll; @@ -110,7 +110,7 @@ published service UnoControlEditModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -170,7 +170,7 @@ published service UnoControlEditModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -196,7 +196,7 @@ published service UnoControlEditModel No matter which line end format is used in this new text then, usual control implementations should recognize all line end formats and display them properly.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short LineEndFormat; @@ -218,7 +218,7 @@ published service UnoControlEditModel /** specifies whether the control paints it background or not. - @since OOo 2.3.0 + @since OOo 2.3 */ [optional, property] boolean PaintTransparent; @@ -279,7 +279,7 @@ published service UnoControlEditModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlFileControlModel.idl b/offapi/com/sun/star/awt/UnoControlFileControlModel.idl index 6ef9cec33..70505ad82 100644 --- a/offapi/com/sun/star/awt/UnoControlFileControlModel.idl +++ b/offapi/com/sun/star/awt/UnoControlFileControlModel.idl @@ -80,7 +80,7 @@ published service UnoControlFileControlModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -127,7 +127,7 @@ published service UnoControlFileControlModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -173,7 +173,7 @@ published service UnoControlFileControlModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlFixedHyperlinkModel.idl b/offapi/com/sun/star/awt/UnoControlFixedHyperlinkModel.idl index 441fa7506..1c70e95f6 100644 --- a/offapi/com/sun/star/awt/UnoControlFixedHyperlinkModel.idl +++ b/offapi/com/sun/star/awt/UnoControlFixedHyperlinkModel.idl @@ -93,7 +93,7 @@ service UnoControlFixedHyperlinkModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -175,7 +175,7 @@ service UnoControlFixedHyperlinkModel /** specifies the vertical alignment of the text in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlFixedTextModel.idl b/offapi/com/sun/star/awt/UnoControlFixedTextModel.idl index 93b22a37f..f1d648dd2 100644 --- a/offapi/com/sun/star/awt/UnoControlFixedTextModel.idl +++ b/offapi/com/sun/star/awt/UnoControlFixedTextModel.idl @@ -93,7 +93,7 @@ published service UnoControlFixedTextModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -169,7 +169,7 @@ published service UnoControlFixedTextModel /** specifies the vertical alignment of the text in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; diff --git a/offapi/com/sun/star/awt/UnoControlFormattedFieldModel.idl b/offapi/com/sun/star/awt/UnoControlFormattedFieldModel.idl index a4766d1b0..f0cbcb695 100644 --- a/offapi/com/sun/star/awt/UnoControlFormattedFieldModel.idl +++ b/offapi/com/sun/star/awt/UnoControlFormattedFieldModel.idl @@ -96,7 +96,7 @@ published service UnoControlFormattedFieldModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -196,7 +196,7 @@ published service UnoControlFormattedFieldModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -226,7 +226,7 @@ published service UnoControlFormattedFieldModel /** specifies whether the mouse should show repeating behaviour, i.e. repeatedly trigger an action when keeping pressed. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Repeat; @@ -240,7 +240,7 @@ published service UnoControlFormattedFieldModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -312,7 +312,7 @@ published service UnoControlFormattedFieldModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlImageControlModel.idl b/offapi/com/sun/star/awt/UnoControlImageControlModel.idl index e3b49065e..2b5697804 100644 --- a/offapi/com/sun/star/awt/UnoControlImageControlModel.idl +++ b/offapi/com/sun/star/awt/UnoControlImageControlModel.idl @@ -75,7 +75,7 @@ published service UnoControlImageControlModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; diff --git a/offapi/com/sun/star/awt/UnoControlListBoxModel.idl b/offapi/com/sun/star/awt/UnoControlListBoxModel.idl index 4352ca033..69c10b626 100644 --- a/offapi/com/sun/star/awt/UnoControlListBoxModel.idl +++ b/offapi/com/sun/star/awt/UnoControlListBoxModel.idl @@ -91,7 +91,7 @@ published service UnoControlListBoxModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; diff --git a/offapi/com/sun/star/awt/UnoControlNumericFieldModel.idl b/offapi/com/sun/star/awt/UnoControlNumericFieldModel.idl index a0313d9de..838e49e42 100644 --- a/offapi/com/sun/star/awt/UnoControlNumericFieldModel.idl +++ b/offapi/com/sun/star/awt/UnoControlNumericFieldModel.idl @@ -80,7 +80,7 @@ published service UnoControlNumericFieldModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -133,7 +133,7 @@ published service UnoControlNumericFieldModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -155,7 +155,7 @@ published service UnoControlNumericFieldModel /** specifies whether the mouse should show repeating behaviour, i.e. repeatedly trigger an action when keeping pressed. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Repeat; @@ -169,7 +169,7 @@ published service UnoControlNumericFieldModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -255,7 +255,7 @@ published service UnoControlNumericFieldModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlPatternFieldModel.idl b/offapi/com/sun/star/awt/UnoControlPatternFieldModel.idl index e26b3dae6..e1756a82a 100644 --- a/offapi/com/sun/star/awt/UnoControlPatternFieldModel.idl +++ b/offapi/com/sun/star/awt/UnoControlPatternFieldModel.idl @@ -80,7 +80,7 @@ published service UnoControlPatternFieldModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -133,7 +133,7 @@ published service UnoControlPatternFieldModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -214,7 +214,7 @@ published service UnoControlPatternFieldModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/UnoControlProgressBarModel.idl b/offapi/com/sun/star/awt/UnoControlProgressBarModel.idl index b94105fd8..428693b2c 100644 --- a/offapi/com/sun/star/awt/UnoControlProgressBarModel.idl +++ b/offapi/com/sun/star/awt/UnoControlProgressBarModel.idl @@ -73,7 +73,7 @@ published service UnoControlProgressBarModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; diff --git a/offapi/com/sun/star/awt/UnoControlRadioButtonModel.idl b/offapi/com/sun/star/awt/UnoControlRadioButtonModel.idl index 103c9c9e8..01dace2ec 100644 --- a/offapi/com/sun/star/awt/UnoControlRadioButtonModel.idl +++ b/offapi/com/sun/star/awt/UnoControlRadioButtonModel.idl @@ -66,7 +66,7 @@ published service UnoControlRadioButtonModel 2: right </pre> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short Align; @@ -156,7 +156,7 @@ published service UnoControlRadioButtonModel /** specifies that the text may be displayed on more than one line. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean MultiLine; @@ -199,7 +199,7 @@ published service UnoControlRadioButtonModel /** specifies the vertical alignment of the text in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; @@ -212,7 +212,7 @@ published service UnoControlRadioButtonModel @see com::sun::star::awt::VisualEffect - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short VisualEffect; diff --git a/offapi/com/sun/star/awt/UnoControlScrollBarModel.idl b/offapi/com/sun/star/awt/UnoControlScrollBarModel.idl index d5bf786bc..d9940fdb4 100644 --- a/offapi/com/sun/star/awt/UnoControlScrollBarModel.idl +++ b/offapi/com/sun/star/awt/UnoControlScrollBarModel.idl @@ -52,7 +52,7 @@ published service UnoControlScrollBarModel /** specifies the RGB color to be used for the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::util::Color BackgroundColor; @@ -81,7 +81,7 @@ published service UnoControlScrollBarModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -118,7 +118,7 @@ published service UnoControlScrollBarModel <FALSE/> means, that the window is only updated after the user has released the mouse button.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean LiveScroll; @@ -144,7 +144,7 @@ published service UnoControlScrollBarModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -174,7 +174,7 @@ published service UnoControlScrollBarModel /** specifies the RGB color to be used when painting symbols which are part of the control's appearance, such as the arrow buttons. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] com::sun::star::util::Color SymbolColor; @@ -182,7 +182,7 @@ published service UnoControlScrollBarModel /** specifies that the control can be reached with the TAB key. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Tabstop; diff --git a/offapi/com/sun/star/awt/UnoControlSpinButtonModel.idl b/offapi/com/sun/star/awt/UnoControlSpinButtonModel.idl index 05457b6e5..e43c20c20 100644..100755 --- a/offapi/com/sun/star/awt/UnoControlSpinButtonModel.idl +++ b/offapi/com/sun/star/awt/UnoControlSpinButtonModel.idl @@ -76,7 +76,7 @@ service UnoControlSpinButtonModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; diff --git a/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl b/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl index 168c00062..effbbee66 100644 --- a/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl +++ b/offapi/com/sun/star/awt/UnoControlTimeFieldModel.idl @@ -80,7 +80,7 @@ published service UnoControlTimeFieldModel <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; @@ -127,7 +127,7 @@ published service UnoControlTimeFieldModel /** specifies whether the selection in the control should be hidden when the control is not active (focused). - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean HideInactiveSelection; @@ -148,7 +148,7 @@ published service UnoControlTimeFieldModel /** specifies whether the mouse should show repeating behaviour, i.e. repeatedly trigger an action when keeping pressed. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean Repeat; @@ -162,7 +162,7 @@ published service UnoControlTimeFieldModel mouse button and to press it again. The delay between two such triggers is specified with this property.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RepeatDelay; @@ -188,7 +188,7 @@ published service UnoControlTimeFieldModel /** specifies the text displayed in the control. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string Text; @@ -259,7 +259,7 @@ published service UnoControlTimeFieldModel /** specifies the vertical alignment of the text in the control. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional, property] com::sun::star::style::VerticalAlignment VerticalAlign; }; diff --git a/offapi/com/sun/star/awt/XDialog2.idl b/offapi/com/sun/star/awt/XDialog2.idl index 6237a7f3b..594f072fc 100644 --- a/offapi/com/sun/star/awt/XDialog2.idl +++ b/offapi/com/sun/star/awt/XDialog2.idl @@ -16,7 +16,7 @@ module com { module sun { module star { module awt { @since OOo 3.0 */ -interface XDialog2: com::sun::star::awt::XDialog +published interface XDialog2: com::sun::star::awt::XDialog { /** hides the dialog and then causes <member>XDialog::execute</member> to return with the given result value. diff --git a/offapi/com/sun/star/awt/XEnhancedMouseClickHandler.idl b/offapi/com/sun/star/awt/XEnhancedMouseClickHandler.idl index 998cda103..3f2d57866 100644 --- a/offapi/com/sun/star/awt/XEnhancedMouseClickHandler.idl +++ b/offapi/com/sun/star/awt/XEnhancedMouseClickHandler.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module awt { /** makes it possible to receive enhanced events from the mouse. - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XEnhancedMouseClickHandler: ::com::sun::star::lang::XEventListener diff --git a/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl b/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl index cad071b3e..b07a20121 100644 --- a/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl +++ b/offapi/com/sun/star/awt/grid/DefaultGridColumnModel.idl @@ -38,7 +38,7 @@ //============================================================================= /** If you do not want to implement the <type>XGridColumnModel</type> yourself, use this service. - @since OOo 3.3.0 + @since OOo 3.3 */ service DefaultGridColumnModel { diff --git a/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl b/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl index c4f866e58..58a1129e5 100644 --- a/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl +++ b/offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl @@ -27,9 +27,7 @@ #ifndef __com_sun_star_awt_DefaultGridDataModel_idl__ #define __com_sun_star_awt_DefaultGridDataModel_idl__ -#ifndef __com_sun_star_awt_grid_XGridDataModel_idl__ -#include <com/sun/star/awt/grid/XGridDataModel.idl> -#endif +#include <com/sun/star/awt/grid/XMutableGridDataModel.idl> //============================================================================= @@ -39,12 +37,15 @@ /** If you do not want to implement the <type>XGridDataModel</type> yourself, use this service. - @since OOo 3.3.0 + <p>The <code>DefaultGridDataModel</code> implementation is a dumb container of tabular data. You can add + and remove rows, modify cell values, and the like.</p> + + <p>The implementation will implicitly increase its column count if you add a row which has more values than + the current column count.</p> + + @since OOo 3.3 */ -service DefaultGridDataModel -{ - interface com::sun::star::awt::grid::XGridDataModel; -}; +service DefaultGridDataModel : ::com::sun::star::awt::grid::XMutableGridDataModel; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/GridColumn.idl b/offapi/com/sun/star/awt/grid/GridColumn.idl index d5dd5f2cc..79cfce91b 100644 --- a/offapi/com/sun/star/awt/grid/GridColumn.idl +++ b/offapi/com/sun/star/awt/grid/GridColumn.idl @@ -39,7 +39,7 @@ /** Represents a column as used by the <type>DefaultGridColumnModel</type> - @since OOo 3.3.0 + @since OOo 3.3 */ service GridColumn { diff --git a/offapi/com/sun/star/awt/grid/GridColumnEvent.idl b/offapi/com/sun/star/awt/grid/GridColumnEvent.idl index 3ee38f50e..fe6c93f7a 100644 --- a/offapi/com/sun/star/awt/grid/GridColumnEvent.idl +++ b/offapi/com/sun/star/awt/grid/GridColumnEvent.idl @@ -38,21 +38,21 @@ module com { module sun { module star { module awt { module grid { //============================================================================= /** An event used by a <type>XGridColumn</type> to notify changes in the column. - @since OOo 3.3.0 + @since OOo 3.3 */ struct GridColumnEvent: com::sun::star::lang::EventObject { - /** Contains the property name of the changed value **/ - string valueName; + /** Contains the name of the attributes whose value changed. **/ + string AttributeName; /** Contains the old value **/ - any oldValue; + any OldValue; /** Contains the new value **/ - any newValue; + any NewValue; /** Contains the index of the changed column**/ - long index; + long ColumnIndex; //------------------------------------------------------------------------- }; diff --git a/offapi/com/sun/star/awt/grid/GridControlEvent.idl b/offapi/com/sun/star/awt/grid/GridControlEvent.idl deleted file mode 100644 index 18e9958e0..000000000 --- a/offapi/com/sun/star/awt/grid/GridControlEvent.idl +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __com_sun_star_awt_GridControlEvent_idl__ -#define __com_sun_star_awt_GridControlEvent_idl__ - -#ifndef __com_sun_star_lang_EventObject_idl__ -#include <com/sun/star/lang/EventObject.idl> -#endif - - -//============================================================================= - -module com { module sun { module star { module awt { module grid { - -//============================================================================= - - -struct GridControlEvent: com::sun::star::lang::EventObject -{ - //------------------------------------------------------------------------- - - string ActionCommand; - -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/com/sun/star/awt/grid/GridDataEvent.idl b/offapi/com/sun/star/awt/grid/GridDataEvent.idl index b406c33f4..7430f3d97 100644 --- a/offapi/com/sun/star/awt/grid/GridDataEvent.idl +++ b/offapi/com/sun/star/awt/grid/GridDataEvent.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 @@ -24,55 +24,54 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __com_sun_star_awt_grid_GridDataEvent_idl__ -#define __com_sun_star_awt_grid_GridDataEvent_idl__ - -#include <com/sun/star/lang/EventObject.idl> - -//============================================================================= - +#ifndef __com_sun_star_awt_grid_GridDataEvent_idl__ +#define __com_sun_star_awt_grid_GridDataEvent_idl__ + +#include <com/sun/star/lang/EventObject.idl> + +//============================================================================= + module com { module sun { module star { module awt { module grid { - -//============================================================================= - -/** An event used by a <type>XGridDataModel</type> to notify changes in the data - model to the <type>XGridControl</type>. - You usually need to fill this event only if you implement the <type>XGridDataModel</type> - yourself. - - @see XGridDataModel - @see XGridControl + +//============================================================================= + +/** used to notify changes in the data represented by an <type>XMutableGridDataModel</type>. + + <p>Effectively, a <code>GridDataEvent</code> denotes a continuous two-dimensional cell range + within a grid's data model, which is affected by a certain change.</p> + + @see XMutableGridDataModel @see XGridDataListener - @sonce OOo 3.3.0 - */ + @since OOo 3.3 + */ struct GridDataEvent: com::sun::star::lang::EventObject -{ - //------------------------------------------------------------------------- - - /** Contains the property name of the changed value **/ - string valueName; - - /** Contains the old value **/ - any oldValue; - - /** Contains the new value **/ - any newValue; - - /** Contains the index of the changed row**/ - long index; - - /** Contains the header name of the changed row**/ - string headerName; - - /** Contains the changed row**/ - sequence<any> rowData; - - -}; - -//============================================================================= - -}; }; }; }; }; - -#endif +{ + /** denotes the first column affected by a change. + + <p>If <code>FirstColumn</code> is -1, the listener should assume that all rows of a grid's data model + are affected.</p> + */ + long FirstColumn; + + /** denotes the last column affected by a change + */ + long LastColumn; + + /** denotes the first row affected by a change. + + <p>If <code>FirstRow</code> is -1, the listener should assume that all rows of a grid's data model + are affected.</p> + */ + long FirstRow; + + /** denotes the last row affected by a change + */ + long LastRow; +}; + +//============================================================================= + +}; }; }; }; }; + +#endif diff --git a/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl b/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl index e2d44d346..c80e1ce5a 100644 --- a/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl +++ b/offapi/com/sun/star/awt/grid/GridInvalidDataException.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module awt { module grid { /** Exception is thrown to indicate that set data is invalid, e.g. type of data is unknown or data count doesn't match with column count. - @since OOo 3.3.0 + @since OOo 3.3 */ exception GridInvalidDataException : com::sun::star::uno::RuntimeException { diff --git a/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl b/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl index 71e79d5fa..828d679c4 100644 --- a/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl +++ b/offapi/com/sun/star/awt/grid/GridInvalidModelException.idl @@ -43,7 +43,7 @@ module com { module sun { module star { module awt { module grid { /** Exception is thrown when data or column model isn't set. - @since OOo 3.3.0 + @since OOo 3.3 */ exception GridInvalidModelException : com::sun::star::uno::RuntimeException { diff --git a/offapi/com/sun/star/awt/grid/ScrollBarMode.idl b/offapi/com/sun/star/awt/grid/ScrollBarMode.idl deleted file mode 100644 index d0bf44ff8..000000000 --- a/offapi/com/sun/star/awt/grid/ScrollBarMode.idl +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __com_sun_star_awt_grid_ScrollBarMode_idl__ -#define __com_sun_star_awt_grid_ScrollBarMode_idl__ - - -//============================================================================= - -module com { module sun { module star { module awt { module grid { - -//============================================================================= - -/** specifies the adjustment type. - */ -enum ScrollBarMode -{ - //------------------------------------------------------------------------- - - /** adjustment is originated by a line jump. - - <p>A line jump can, for example, be caused by a click on - one of the pointer buttons.</p> - */ - AUTO, - - //------------------------------------------------------------------------- - - /** adjustment is originated by a page jump. - - <p>A page jump can, for example, be caused by a click in the - background area of the scrollbar (neither one of the pointer - buttons, nor the thumb).</p> - */ - ON, - - OFF - - - -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/com/sun/star/awt/grid/SortableGridDataModel.idl b/offapi/com/sun/star/awt/grid/SortableGridDataModel.idl new file mode 100755 index 000000000..2b7aca1ca --- /dev/null +++ b/offapi/com/sun/star/awt/grid/SortableGridDataModel.idl @@ -0,0 +1,102 @@ +/************************************************************************* + * 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_awt_grid_SortableGridDataModel_idl__ +#define __com_sun_star_awt_grid_SortableGridDataModel_idl__ + +#include <com/sun/star/i18n/XCollator.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> + +//================================================================================================================== + +module com { module sun { module star { module awt { module grid { + +interface XSortableMutableGridDataModel; +interface XMutableGridDataModel; + +//================================================================================================================== + +/** provides a default implementation of a <type>XSortableGridData</type>. + + <p>This service must be created with a secondary grid data model, which all actual data requests are delegated to. + But before providing this data to the service's own clients, it is sorted, according to the sort order defined + via the <code>XSortableGridData</code> interface.</p> + + <p>The service implementation is able to compare the default scalar types, plus strings.</p> + + <p>For determining the data type of a column which the data should be sorted by, the first non-<VOID/> data encountered + in this column is taken into account. Further read requests to this column will assume that all non-<VOID/> data is of + the same type.</p> + + <p>Consequently, you cannot use this service with data sets containing heterogenous data in a given column.</p> + + <p>All requests made via the <type>XMutableGridDataModel</type> are delegated to the <code>XMutableGridDataModel</code> + instance passed in the service constructor.</p> + + <p>Note that changing the data might result in the sort order being destroyed. If you want to ensure + that the data represented by the model is still sorted after your modifications, you should call + <member>XSortableGridData::sortByColumn</member>, again.</p> + */ +service SortableGridDataModel : XSortableMutableGridDataModel +{ + /** creates a new instance of the <code>SortableGridDataModel</code> + + <p>For string comparison, a default <type scope="::com::sun::star::i18n">Collator</type>, based on the system's + locale, will be used.</p> + + @param DelegatorModel + the data model to which read requests are delegated. + @throws ::com::sun::star::lang::IllegalArgumentException + if the given <code>DelegatorModel</code> is <NULL/> + */ + create( + [in] XMutableGridDataModel DelegatorModel + ) + raises ( ::com::sun::star::lang::IllegalArgumentException ); + + /** creates a new instance of the ScortableDefaultGridDataModel, passing a collator to be used for string comparison. + + @param DelegatorModel + is the data model to which read requests are delegated + @param Collator + is the collator to be used for string comparison + @throws ::com::sun::star::lang::IllegalArgumentException + if the given <code>DelegatorModel</code> is <NULL/> + */ + createWithCollator( + [in] XMutableGridDataModel DelegatorModel, + [in] ::com::sun::star::i18n::XCollator Collator + ) + raises ( ::com::sun::star::lang::IllegalArgumentException ); +}; + +//================================================================================================================== + +}; }; }; }; }; + +//================================================================================================================== + +#endif diff --git a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl index 87a26ba96..dbb36374f 100644 --- a/offapi/com/sun/star/awt/grid/UnoControlGrid.idl +++ b/offapi/com/sun/star/awt/grid/UnoControlGrid.idl @@ -66,7 +66,7 @@ The <type>XGridSelection</type> interface provides a bunch of methods to set and get selection for the grid control. </p> - @since OOo 3.3.0 + @since OOo 3.3 */ service UnoControlGrid { diff --git a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl index b61d8b568..26d7f96fc 100644 --- a/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl +++ b/offapi/com/sun/star/awt/grid/UnoControlGridModel.idl @@ -28,19 +28,11 @@ #define __com_sun_star_awt_grid_UnoControlGridModel_idl__ #include <com/sun/star/awt/grid/XGridColumnModel.idl> - #include <com/sun/star/awt/grid/XGridDataModel.idl> - -#include <com/sun/star/awt/grid/ScrollBarMode.idl> - #include <com/sun/star/awt/UnoControlModel.idl> - #include <com/sun/star/view/SelectionType.idl> - #include <com/sun/star/awt/FontDescriptor.idl> - #include <com/sun/star/style/VerticalAlignment.idl> - #include <com/sun/star/util/Color.idl> //============================================================================= @@ -49,9 +41,9 @@ module com { module sun { module star { module awt { module grid { //============================================================================= -/** specifies the standard model of a <type>UnoControlGridModel</type>. +/** specifies the standard model of a <type>UnoControlGrid</type> control. - @since OOo 3.3.0 + @since OOo 3.3 */ service UnoControlGridModel { @@ -59,19 +51,51 @@ service UnoControlGridModel service com::sun::star::awt::UnoControlModel; /** Specifies whether the grid control should display a special header column. - <p>The default value is <FALSE/></p> + + <p>The default value is <FALSE/></p> */ [property] boolean ShowRowHeader; + /** specifies the width of the row header column, if applicable. + + <p>The width is specified in application font units - see <type scope="com::sun::star::util">MeasureUnit</type>.</p> + + <p>The value given here is ignored if <member>ShowRowHeader</member> is <FALSE/>.</p> + */ + [property] long RowHeaderWidth; + /** Specifies whether the grid control should display a title row. - <p>The default value is <TRUE/></p> + + <p>The default value is <TRUE/></p> */ [property] boolean ShowColumnHeader; + /** specifies the height of the column header row, if applicable. + + <p>The height is specified in application font units - see <type scope="com::sun::star::util">MeasureUnit</type>.</p> + + <p>The value given here is ignored if <member>ShowColumnHeader</member> is <FALSE/>.</p> + + <p>If the property is <void/>, the grid control shall automatically determine a height which conveniently allows, + according to the used font, to display one line of text.</p> + */ + [property, maybevoid] long ColumnHeaderHeight; + + /** Specifies the height of rows in the grid control. + + <p>The height is specified in application font units - see <type scope="com::sun::star::util">MeasureUnit</type>.</p> + */ + [property, maybevoid] long RowHeight; + /** Specifies the <type>XGridColumnModel</type> that is providing the column structure. <p>You can implement your own instance of <type>XGridColumnModel</type> or use the <type>DefaultGridColumnModel</type>. + + <p>The column model is in the ownership of the grid model: When you set a new column model, or dispose + the grid model, then the (old) column model is disposed, too.</p> + + <p>The default for this property is an empty instance of the <type>DefaultGridColumnModel</type>.</p> */ [property] XGridColumnModel ColumnModel; @@ -79,6 +103,11 @@ service UnoControlGridModel <p>You can implement your own instance of <type>XGridDataModel</type> or use the <type>DefaultGridDataModel</type>. + + <p>The data model is in the ownership of the grid model: When you set a new data model, or dispose + the grid model, then the (old) data model is disposed, too.</p> + + <p>The default for this property is an empty instance of the <type>DefaultGridDataModel</type>.</p> */ [property] XGridDataModel GridDataModel; @@ -101,27 +130,49 @@ service UnoControlGridModel */ [property] ::com::sun::star::view::SelectionType SelectionModel; - /** Specifies the background color of rows. If color for even rows is set, then specifies - the color of odd rows. Default value is white. + /** controls whether or not to paint horizontal and vertical lines between the grid cells. + + @see LineColor */ - [property] ::com::sun::star::util::Color RowBackgroundColor; + [property] boolean UseGridLines; - /** Specifies the background color of even rows. Default value is white. + /** specifies the color to be used when drawing lines between cells + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the system's style settings.</p> + + @see UseGridLines */ - [property] ::com::sun::star::util::Color EvenRowBackgroundColor; + [property, maybevoid] ::com::sun::star::util::Color GridLineColor; + + /** specifies the color to be used when drawing the background of row or column headers - /** Specifies the background color of header. Default value is white. + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the system's style settings.</p> */ - [property] ::com::sun::star::util::Color HeaderBackgroundColor; + [property, maybevoid] ::com::sun::star::util::Color HeaderBackgroundColor; - /** Specifies the text color. Default value is black. + /** specifies the color to be used when drawing the text within row or column headers + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the system's style settings.</p> */ - [property] ::com::sun::star::util::Color TextColor; + [property, maybevoid] ::com::sun::star::util::Color HeaderTextColor; + + /** specifies the colors to be used as background for data rows. - /** Specifies the line color. Default value is white. + <p>If this sequence is non-empty, the data rows will be rendered with alternating background colors: Assuming + the sequence has <code>n</code> elements, each row will use the background color as specified by its number's + remainder modulo <code>n</code>.</p> + + <p>If this sequence is empty, all rows will use the same background color as the control as whole.</p> + + <p>If this property does not exist at a particular implementation, or is <VOID/>, rows will be painted + in alternating background colors, every second row having a background color derived from the control's + selection color.</p> */ - [property] ::com::sun::star::util::Color LineColor; - + [property, maybevoid] sequence< ::com::sun::star::util::Color > RowBackgroundColors; + /** specifies the vertical alignment of the content in the control. <pre> @@ -136,6 +187,20 @@ service UnoControlGridModel */ [property] com::sun::star::awt::FontDescriptor FontDescriptor; + /** specifies the color to be used when drawing cell texts + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the system's style settings.</p> + */ + [property, maybevoid] ::com::sun::star::util::Color TextColor; + + /** specifies the color to be used when drawing text lines (underlining and strikethrough) + + <p>If this property has a value of <VOID/>, the grid control renderer will use some default color, + depending on the system's style settings.</p> + */ + [property, maybevoid] com::sun::star::util::Color TextLineColor; + /** specifies the <type scope="com::sun::star::text">FontEmphasis</type> value of the text in the control. */ diff --git a/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl b/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl deleted file mode 100644 index 996874e55..000000000 --- a/offapi/com/sun/star/awt/grid/XGridCellRenderer.idl +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __com_sun_star_awt_grid_XGridCellRenderer_idl__ -#define __com_sun_star_awt_grid_XGridCellRenderer_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif - -//============================================================================= - -module com { module sun { module star { module awt { module grid { - -//============================================================================= - -/** renderer for cells - */ -interface XGridCellRenderer -{ - //------------------------------------------------------------------------- - -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/com/sun/star/awt/grid/XGridColumn.idl b/offapi/com/sun/star/awt/grid/XGridColumn.idl index 0ca7fad70..4c9c7b9a9 100644 --- a/offapi/com/sun/star/awt/grid/XGridColumn.idl +++ b/offapi/com/sun/star/awt/grid/XGridColumn.idl @@ -27,12 +27,11 @@ #ifndef __com_sun_star_awt_grid_XGridColumn_idl__ #define __com_sun_star_awt_grid_XGridColumn_idl__ -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif +#include <com/sun/star/lang/XComponent.idl> #include <com/sun/star/style/HorizontalAlignment.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> #include <com/sun/star/awt/grid/XGridColumnListener.idl> - +#include <com/sun/star/util/XCloneable.idl> //============================================================================= @@ -41,46 +40,100 @@ module com { module sun { module star { module awt { module grid { //============================================================================= /** The <type>XGridColumn</types> defines the properties and behavior of a column in a grid control - @since OOo 3.3.0 + @since OOo 3.3 */ interface XGridColumn { - /** Specifies the an idendifier of the colomn.**/ + /** implements life time control for the component + */ + interface ::com::sun::star::lang::XComponent; + + /** allows cloning the complete grid column + */ + interface ::com::sun::star::util::XCloneable; + + /** specifies an identifier of the column + + <p>This identifier will not be evaluated by the grid control, or its model. It is merely for clients + to identify particular columns.</p> + */ [attribute] any Identifier; - /** Specifies the default column witdth. **/ + /** specifies the current width of the column. + */ [attribute] long ColumnWidth; - - /** Specifies the preferred column witdth. **/ - [attribute] long PreferredWidth; - /** Specifies the min column witdth. **/ + /** specifies the minimal width the column can have. + */ [attribute] long MinWidth; - /** Specifies the max column witdth. **/ + /** specifies the maximal width the column can have. + */ [attribute] long MaxWidth; - - /** Specifies whether column has fixed size or not. **/ + + /** controls whether or not the column's width is fixed or not. + + <p>If this is <TRUE/>, the user can interactively change the column's width. Also, the column is subject to + auto-resizing, if its <member>Flexibility</member> attribute is greater <code>0</code>.</p> + */ [attribute] boolean Resizeable; - - /** Specifies the horizontal alignment of the content in the control. - <pre> - LEFT - CENTER - RIGHT - </pre> + /** specifies the flexibility of the column when it is automatically resized due to the grid control as a whole + being resized. + + <p>Specify <code>0</code> here if you do not want the column to be resized automatically.</p> + + <p>If a column has a flexibility greater than 0, it is set in relationship to the flexibility of all + other such columns, and the respective widths of the columns are changed in the same relationship.</p> + + <p>Note that a column's flexibility is ignored if its <member>Resizeable</member> attribute is + <FALSE/>.</p> + + <p>A column's flexibility cannot be negative, attempts to set a negative value will raise an exception.</p> + */ + [attribute] long Flexibility + { + set raises ( ::com::sun::star::lang::IllegalArgumentException ); + }; + + /** Specifies the horizontal alignment of the content in the control. */ [attribute] ::com::sun::star::style::HorizontalAlignment HorizontalAlign; /** A title is displayed in the colum header row if <method>UnoControlGridModel::ShowRowHeader</method> is set to <true/>**/ [attribute] string Title; + /** is the help text associated with the column. + + <p>A grid control will usually display a column's help text as tooltip.</p> + */ + [attribute] string HelpText; + + /** denotes the index of the column within the grid column model it belongs to + + <p>If the column is not yet part of a column model, <code>Index</code> is -1.</p> + */ + [attribute, readonly] long Index; + + /** denotes the index of the data column which should be used to fetch this grid column's data + + <p>A grid control has a column model and a data model, both containing a possibly different number of columns. + The <code>DataColumnIndex</code> attribute defines the index of the column within the data model, which should + be used to retrieve actual data.</p> + + <p>Using this, you can do runtime changes to the column model, i.e. insertion and removal of columns, without + necessarily needing to adjust the data model, too.</p> + + <p>If <code>DataColumnIndex</code> is negative, the it will be ignored, then the column's index within its + column model, as determined by the <member>Index</member> attribute, will be used.</p> + */ + [attribute] long DataColumnIndex; + /** Adds a listener for the <type>GridColumnEvent</type> posted after the grid changes. @param Listener the listener to add. */ - [oneway] void addColumnListener( [in] XGridColumnListener listener); + void addGridColumnListener( [in] XGridColumnListener listener); //------------------------------------------------------------------------- @@ -88,20 +141,7 @@ interface XGridColumn @param Listener the listener to remove. */ - [oneway] void removeColumnListener( [in] XGridColumnListener listener); - - /**Updates changed column widths, when column widths are being resized. - @param name - can be PrefWidth or ColWidth, depending on which was changed - @param width - the new column width - */ - void updateColumn( [in] string name, [in] long width); - /**Sets column index - @param index - index, which is the index of the column in the column array of the column model - */ - void setIndex( [in] long index ); + void removeGridColumnListener( [in] XGridColumnListener listener); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridColumnListener.idl b/offapi/com/sun/star/awt/grid/XGridColumnListener.idl index c77943a3f..c1f96b14a 100644 --- a/offapi/com/sun/star/awt/grid/XGridColumnListener.idl +++ b/offapi/com/sun/star/awt/grid/XGridColumnListener.idl @@ -27,13 +27,8 @@ #ifndef __com_sun_star_awt_grid_XGridColumnListener_idl__ #define __com_sun_star_awt_grid_XGridColumnListener_idl__ -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif - -#ifndef __com_sun_star_awt_grid_GridColumnEvent_idl__ #include <com/sun/star/awt/grid/GridColumnEvent.idl> -#endif +#include <com/sun/star/lang/XEventListener.idl> //============================================================================= @@ -44,25 +39,11 @@ module com { module sun { module star { module awt { module grid { /** An instance of this interface is used by the <type>XGridColumnModel</type> to get notifications about column model changes. - <p>Usually you must not implement this interface yourself, but you must notify it correctly if - you implement the <type>XGridColumnModel</type> yourself</p>. - - @since OOo 3.3.0 + @since OOo 3.3 */ -interface XGridColumnListener +interface XGridColumnListener : ::com::sun::star::lang::XEventListener { - // /** - // Invoked after a column was added to the column model. - //*/ - //void columnAdded( [in] GridColumnEvent event ); - // - // /** - // Invoked after a column was removed from the column model. - //*/ - //void columnRemoved( [in] GridColumnEvent event ); - - /** - Invoked after a column was modified. + /** Invoked after a column was modified. */ void columnChanged( [in] GridColumnEvent event ); }; diff --git a/offapi/com/sun/star/awt/grid/XGridColumnModel.idl b/offapi/com/sun/star/awt/grid/XGridColumnModel.idl index b26dc2ef2..97d8131d6 100644 --- a/offapi/com/sun/star/awt/grid/XGridColumnModel.idl +++ b/offapi/com/sun/star/awt/grid/XGridColumnModel.idl @@ -28,11 +28,14 @@ #define __com_sun_star_awt_grid_XGridColumnModel_idl__ #include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/lang/XComponent.idl> +#include <com/sun/star/util/XCloneable.idl> #include <com/sun/star/awt/grid/XGridColumn.idl> +#include <com/sun/star/container/XContainer.idl> +#include <com/sun/star/lang/IndexOutOfBoundsException.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> -#include <com/sun/star/awt/grid/XGridColumnListener.idl> - //============================================================================= module com { module sun { module star { module awt { module grid { @@ -44,41 +47,68 @@ module com { module sun { module star { module awt { module grid { If you do not need your own model implementation, you can also use the <type>DefaultGridColumnModel</type>. - @since OOo 3.3.0 + @since OOo 3.3 */ interface XGridColumnModel { - ///** Specifies whether column selection is allowed - //*/ - //[attribute] boolean ColumnSelectionAllowed; + /** implements life time control for the component + */ + interface ::com::sun::star::lang::XComponent; + + /** allows to register listeners to be notified when columns are inserted or removed + */ + interface ::com::sun::star::container::XContainer; - /**Specifies the height of column header. + /** allows cloning the complete column model */ - [attribute] long ColumnHeaderHeight; + interface ::com::sun::star::util::XCloneable; /** Returns the number of columns. + @returns the number of columns. */ long getColumnCount(); + /** creates a new column for use with the column model. + + <p>The newly created column is not yet inserted into the column container, you need to call <member>addColumn</member> + after you initialized the column object.</p> + */ + XGridColumn + createColumn(); + /** Adds a column to the model. + + <p>You should use the <member>createColumn</member> member to create a new column. This gives + implementations of the <code>XGridColumnModel</code> interface the possibility to provide own column + implementations which extend the basic <type>GridColumn</type> type.</p> + + <p>As soon as the column has been inserted into the model, the model takes ownership of it. This means when the + column is removed, or when the column model is disposed, the grid column is disposed as well.</p> + @param column the column to add to the model. - @returns - the index of new created column. + the index of new created column. + + @throws ::com::sun::star::lang::IllegalArgumentException + if the given column is not a valid element for the column container, or if it is <NULL/>. */ - long addColumn( [in] XGridColumn column ); + long addColumn( [in] XGridColumn column ) + raises ( ::com::sun::star::lang::IllegalArgumentException ); - /* - long getSelectedCount(); - - sequence<XGridColumn> getSelectedColumns(); - - sequence<long> getSelectedIndex(); - + /** removes a column from the model + + <p>The column object will be disposed upon removal.</p> + + @param ColumnIndex + denotes the index of the column to remove + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if <code>ColumnIndex</code> does not denote a valid column index. */ + void removeColumn( [in] long ColumnIndex ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); /** Returns all columns of the model. @returns @@ -92,24 +122,20 @@ interface XGridColumnModel @returns the requested column. */ - XGridColumn getColumn( [in] long index); + XGridColumn getColumn( [in] long index) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** Fills the model with the given number of default columns + + <p>Existing columns will be removed before adding new columns. Listeners at the column model will + be notified one <member scope="com::sun::star::container">XContainerListener::elementRemoved</member> event + for each removed column, and one <member scope="com::sun::star::container">XContainerListener::elementInserted</member> + event for each insertion.</p> - /** Sets default columns to the column model. @param elements the number of default columns that should be set. */ void setDefaultColumns([in] long elements); - - /**Creates new XGridColumn with the settings of other column. To be used if the columns which are added to - the column model have the same settings. - @param column - the column, which is already created - */ - XGridColumn copyColumn( [in] XGridColumn column ); - - /* - long getTotalColumnWidth(); - */ }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridControl.idl b/offapi/com/sun/star/awt/grid/XGridControl.idl index 0ea37504a..36e7274cd 100644 --- a/offapi/com/sun/star/awt/grid/XGridControl.idl +++ b/offapi/com/sun/star/awt/grid/XGridControl.idl @@ -28,9 +28,6 @@ #define __com_sun_star_awt_grid_XGridControl_idl__ #include <com/sun/star/awt/grid/XGridSelection.idl> -#include <com/sun/star/awt/grid/XGridColumnModel.idl> -#include <com/sun/star/awt/grid/XGridDataModel.idl> -#include <com/sun/star/awt/XMouseListener.idl> //============================================================================= @@ -42,25 +39,45 @@ module com { module sun { module star { module awt { module grid { @see UnoControlGrid - @since OOo 3.3.0 + @since OOo 3.3 */ -interface XGridControl: XGridSelection +interface XGridControl : XGridSelection { - /** Converting + /** retrieves the column which a given point belongs to + + @param X + the ordinate of the point, in pixel coordinates. + @param Y + the abscissa of the point, in pixel coordinates. + @return + the index of the column which the point lies in, or -1 if no column is under the given point. */ + long getColumnAtPoint( [in] long X, [in] long Y ); - long getItemIndexAtPoint( [in] long x, [in] long y); + /** retrieves the row which a given point belongs to - /** Sets tooltip for row - @param textForTooltip - text, which will be shown as tooltip. - If only cell content should be displayed, leave sequence empty. - @param columnsForTooltip - column numbers, which define the cell content that should be shown in the tooltip. - If only text should be shown, leave this sequence empty. + @param X + the ordinate of the point, in pixel coordinates. + @param Y + the abscissa of the point, in pixel coordinates. + @return + the index of the row which the point lies in, or -1 if no row is under the given point. */ - void setToolTip( [in] sequence< string > textForTooltip, [in] sequence< long > columnsForTooltip); - + long getRowAtPoint( [in] long X, [in] long Y ); + + /** returns the column index of the currently active cell + + <p>If the grid control's does not contain any cells (which happens if the grid column model does not contain any + columns, or if grid data model does not contain any rows), then <code>-1</code> is returned.</p> + */ + long getCurrentColumn(); + + /** returns the row index of the currently active cell + + <p>If the grid control's does not contain any cells (which happens if the grid column model does not contain any + columns, or if grid data model does not contain any rows), then <code>-1</code> is returned.</p> + */ + long getCurrentRow(); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridDataListener.idl b/offapi/com/sun/star/awt/grid/XGridDataListener.idl index 534c3d788..d8bd7065f 100644 --- a/offapi/com/sun/star/awt/grid/XGridDataListener.idl +++ b/offapi/com/sun/star/awt/grid/XGridDataListener.idl @@ -47,25 +47,26 @@ module com { module sun { module star { module awt { module grid { <p>Usually you must not implement this interface yourself, but you must notify it correctly if you implement the <type>XGridDataModel</type> yourself</p>. - @since OOo 3.3.0 + @since OOo 3.3 */ interface XGridDataListener: com::sun::star::lang::XEventListener { - /** - Invoked after a row was added to the data model. + /** is called when one or more rows of data have been inserted into a grid control's data model. */ - void rowAdded( [in] GridDataEvent Event ); + void rowsInserted( [in] GridDataEvent Event ); - /** - Invoked after a row was added to the data model. + /** is called when one or more rows of data have been removed from a grid control's data model. */ - void rowRemoved( [in] GridDataEvent Event ); + void rowsRemoved( [in] GridDataEvent Event ); - /** - Invoked after a row was added to the data model. + /** is called when existing data in a grid control's data model has been modified. */ void dataChanged( [in] GridDataEvent Event ); + + /** is called when the title of one or more rows changed. + */ + void rowHeadingChanged( [in] GridDataEvent Event ); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridDataModel.idl b/offapi/com/sun/star/awt/grid/XGridDataModel.idl index 7489e4960..98f4d6055 100644 --- a/offapi/com/sun/star/awt/grid/XGridDataModel.idl +++ b/offapi/com/sun/star/awt/grid/XGridDataModel.idl @@ -30,8 +30,9 @@ #include <com/sun/star/lang/XComponent.idl> +#include <com/sun/star/util/XCloneable.idl> #include <com/sun/star/awt/grid/XGridDataListener.idl> - +#include <com/sun/star/lang/IndexOutOfBoundsException.idl> //============================================================================= @@ -43,88 +44,59 @@ module com { module sun { module star { module awt { module grid { If you do not need your own model implementation, you can also use the <type>DefaultGridDataModel</type>. - @since OOo 3.3.0 + @since OOo 3.3 */ -interface XGridDataModel: ::com::sun::star::lang::XComponent +interface XGridDataModel { - /** Specifies the height of each row. + /** implements life time control for the component */ - [attribute] long RowHeight; + interface ::com::sun::star::lang::XComponent; - /** Contains the row header. + /** allows cloning the complete column model */ - [attribute] sequence< string > RowHeaders; + interface ::com::sun::star::util::XCloneable; - /** Returns the content of each row. + /** denotes the number of rows for which the model can provide data */ - [attribute,readonly] sequence< sequence< any > > Data; + [attribute, readonly] long RowCount; - /**Specifies the width of row header. + /** denotes the number of columns for which the model can provide data */ - [attribute] long RowHeaderWidth; + [attribute, readonly] long ColumnCount; + + /** retrieves the data for a given cell - /** Returns the number of rows in in the model. - @returns - the number of rows. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the column or row index do not denote a valid cell position. */ - long getRowCount(); + any getCellData( [in] long Column, [in] long Row ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** Adds a row to the model. + /** retrieves the tool tip to be displayed when the mouse hovers over a given cell - @param headername - specifies the name of the row. - @param data - the content of the row. - */ - void addRow( [in] string headername, [in] sequence< any > data ); + <p>At the moment, only string tool tips are supported.</p> - /** Removes a row from the model. + <p>If <VOID/> is returned here, the cell's content will be displayed as tip, but only if it does + not fit into the cell.</p> - @param index - the index of the row that should be removed. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the column or row index do not denote a valid cell position. */ - void removeRow( [in] long index); + any getCellToolTip( [in] long Column, [in] long Row ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); - /** Removes all rows from the model. - */ - void removeAll(); - - /**Updates the content of a given cell. - @param row - the row index - @param column - the column index - @param value - the new value of the cell. - */ - void updateCell([in] long row, [in] long column, [in] any value ); - - /**Updates the content of a given row. - @param row - the row index - @param columns - column indexes of the cells, which should be updated - @param value - the new values of the cells. - */ - void updateRow([in] long row, [in] sequence< long > columns, [in] sequence< any > values); + /** retrieves the heading of a given row - //------------------------------------------------------------------------- + <p>A grid control will usually paint a row's title in the header column of the respective row.</p> - /** Adds a listener for the <type>GridDataEvent</type> posted after the grid changes. - @param Listener - the listener to add. - */ - [oneway] void addDataListener( [in] XGridDataListener listener); - - //------------------------------------------------------------------------- - - /** Removes a listener previously added with <method>addDataListener()</method>. - @param Listener - the listener to remove. - */ - [oneway] void removeDataListener( [in] XGridDataListener listener); - + <p>At the moment, only strings are supported as row headings.</p> + + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the given index does not denote a valid row. + */ + any + getRowHeading( [in] long RowIndex ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); }; //============================================================================= diff --git a/offapi/com/sun/star/awt/grid/XGridSelection.idl b/offapi/com/sun/star/awt/grid/XGridSelection.idl index a94c06ba7..def1b79e6 100644 --- a/offapi/com/sun/star/awt/grid/XGridSelection.idl +++ b/offapi/com/sun/star/awt/grid/XGridSelection.idl @@ -41,37 +41,27 @@ module com { module sun { module star { module awt { module grid { */ interface XGridSelection { - /** Returns the lowest index of the selection. - @returns - the lowest index. - */ - long getMinSelectionIndex(); - - /** Returns the highest index of the selection. - @returns - the highest index. - */ - long getMaxSelectionIndex(); - /** Selects all rows. */ - [oneway] void selectAllRows(); + void selectAllRows(); + + /** selects a given row - /** Selects multiple rows. Previous selections will be removed. - @param rangeOfRows - array of rows indexes, which will be selected. + @param RowIndex + denotes the index of the row to select */ - [oneway] void selectRows( [in] sequence< long > rangeOfRows); + void selectRow( [in] long RowIndex ); /** Deselects all selected rows. */ - [oneway] void deselectAllRows(); + void deselectAllRows(); - /** Deselects selected rows. Selected rows, which aren't in the range remain selected. - @param rangeOfRows - array of rows indexes, which will be deselected. + /** removes the selection for a given row + + @param RowIndex + denotes the index of the row to deselect */ - [oneway] void deselectRows( [in] sequence< long > rangeOfRows); + void deselectRow( [in] long RowIndex ); /** Returns the indicies of all selected rows. @returns @@ -93,21 +83,11 @@ interface XGridSelection */ boolean isSelectedIndex( [in] long index); - /** Marks a row as selected. - @param index - the index of a row. - */ - [oneway] void selectRow( [in] long index); - - /* - [oneway] void selectColumn( [in] long x); - */ - /** Adds a listener for the <type>GridSelectionEvent</type> posted after the grid changes. @param listener the listener to add. */ - [oneway] void addSelectionListener( [in] XGridSelectionListener listener); + void addSelectionListener( [in] XGridSelectionListener listener); //------------------------------------------------------------------------- @@ -115,7 +95,7 @@ interface XGridSelection @param listener the listener to remove. */ - [oneway] void removeSelectionListener( [in] XGridSelectionListener listener); + void removeSelectionListener( [in] XGridSelectionListener listener); }; diff --git a/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl b/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl new file mode 100755 index 000000000..5e10820ff --- /dev/null +++ b/offapi/com/sun/star/awt/grid/XMutableGridDataModel.idl @@ -0,0 +1,163 @@ +/************************************************************************* + * 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_awt_grid_XMutableGridDataModel_idl__ +#define __com_sun_star_awt_grid_XMutableGridDataModel_idl__ + +#include <com/sun/star/awt/grid/XGridDataModel.idl> +#include <com/sun/star/lang/IllegalArgumentException.idl> +#include <com/sun/star/lang/IndexOutOfBoundsException.idl> + +//================================================================================================================== + +module com { module sun { module star { module awt { module grid { + +//================================================================================================================== + +/** allows to modify the data represented by a <type>XGridDataModel</type> + */ +interface XMutableGridDataModel : XGridDataModel +{ + /** adds a row to the model. + + @param Heading + denotes the heading of the row. + @param Data + specifies the content of the row. + */ + void addRow( [in] any Heading, [in] sequence< any > Data ); + + /** adds multiple rows of data to the model. + @param Headings + denotes the headings of the to-be-added rows. + @param Data + specifies the data of the rows to be added. + @throws ::com::sun::star::lang::IllegalArgumentException + if <code>Titles</code> and <code>Data</code> are of different length. + */ + void addRows( [in] sequence< any > Headings, [in] sequence< sequence< any > > Data ) + raises ( ::com::sun::star::lang::IllegalArgumentException ); + + /** removes a row of data from the model + + @param RowIndex + the index of the row that should be removed. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the given index is invalid + */ + void removeRow( [in] long RowIndex ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** Removes all rows from the model. + */ + void removeAllRows(); + + /** updates the content of the given cell + @param ColumnIndex + the column index of the to-be-updated cell + @param RowIndex + the row index of the to-be-updated cell + @param Value + the new value of the cell. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the row or column index is invalid + */ + void updateCellData( [in] long ColumnIndex, [in] long RowIndex, [in] any Value ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** updates the content of a given row. + + <p>The change in the data model will be notified to registered listeners via + <member">XGridDataListener::dataChanged</member>. The <member>GridDataEvent::FirstColumn</member> and + <member>GridDataEvent::LastColumn</member> will denote the smallest respectively largest column + index from <argColumnIndexes</arg>.</p> + + @param ColumnIndexes + contains the column indexes of the cells, which should be updated + @param RowIndex + contains the index of the row whose data is to be updated + @param Values + specifies the new values of the cells. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if one of the row indexes or the column index is invalid + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the lengths of the <code>ColumnIndexes</code> and <code>Values</code> sequences are not equal. + */ + void updateRowData( [in] sequence< long > ColumnIndexes, [in] long RowIndex, [in] sequence< any > Values ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException + , ::com::sun::star::lang::IllegalArgumentException); + + /** sets a new title for a given row. + + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if the given index does not denote a valid row. + */ + void + updateRowHeading( [in] long RowIndex, [in] any Heading ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** updates the tooltip to be displayed for a given cell + + @see XGridDataModel::getCellToolTip + */ + void updateCellToolTip( [in] long ColumnIndex, [in] long RowIndex, [in] any Value ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** updates the tooltip for all cells of a given row + + <p>Effectively this method is a shortcut for calling <member>updateCellToolTip</member> multiple + times in a row, for all cells of a given row.</p> + + @see XGridDataModel::getCellToolTip + @see updateCellToolTip + */ + void updateRowToolTip( [in] long RowIndex, [in] any Value ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + //------------------------------------------------------------------------- + + /** registers listener to be notified of data changes in the model + @param Listener + specifies the listener to register + */ + void addGridDataListener( [in] XGridDataListener Listener ); + + //------------------------------------------------------------------------- + + /** revokes a listener which was previously registered via <member>addGridDataListener</member> + @param Listener + specifies the listener to revoke. + */ + void removeGridDataListener( [in] XGridDataListener Listener ); +}; + +//================================================================================================================== + +}; }; }; }; }; + +//================================================================================================================== + +#endif diff --git a/offapi/com/sun/star/awt/grid/XSortableGridData.idl b/offapi/com/sun/star/awt/grid/XSortableGridData.idl new file mode 100755 index 000000000..dd40d2a46 --- /dev/null +++ b/offapi/com/sun/star/awt/grid/XSortableGridData.idl @@ -0,0 +1,77 @@ +/************************************************************************* + * 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_awt_grid_XSortableGridData_idl__ +#define __com_sun_star_awt_grid_XSortableGridData_idl__ + +#include <com/sun/star/lang/IndexOutOfBoundsException.idl> +#include <com/sun/star/beans/Pair.idl> + +//================================================================================================================== + +module com { module sun { module star { module awt { module grid { + +//================================================================================================================== + +/** allows to sort the data represented by a <type>XGridDataModel</type> + */ +interface XSortableGridData +{ + /** sorts the rows represented by the model by a given column's data. + + @param ColumnIndex + the index of the column whose data should be used as sort key + @param SortAscending + is <TRUE/> if the data should be sorted ascending, <FALSE/> otherwise. + @throws ::com::sun::star::lang::IndexOutOfBoundsException + if <code>ColumnIndex</code> does not denote a valid column. + */ + void sortByColumn( [in] long ColumnIndex, [in] boolean SortAscending ) + raises ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** removes any possibly present sorting of the grid data + */ + void removeColumnSort(); + + /** returns the current sort order. + + @return + a structure describing the current sort order. <member scope="::com::sun::star::beans">Pair::First</member> + denotes the column by which the data is sorted, or -1 if the data is currently unsorted. + <member scope="::com::sun::star::beans">Pair::Second</member> is <TRUE/> if the data is sorted ascending, + <FALSE/> otherwise. + */ + ::com::sun::star::beans::Pair< long, boolean > + getCurrentSortOrder(); +}; + +//================================================================================================================== + +}; }; }; }; }; + +//================================================================================================================== + +#endif diff --git a/offapi/drafts/com/sun/star/form/IncompatibleTypesException.idl b/offapi/com/sun/star/awt/grid/XSortableMutableGridDataModel.idl index 8702aebe0..a07dabbbb 100644..100755 --- a/offapi/drafts/com/sun/star/form/IncompatibleTypesException.idl +++ b/offapi/com/sun/star/awt/grid/XSortableMutableGridDataModel.idl @@ -1,7 +1,6 @@ /************************************************************************* - * * 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 @@ -24,34 +23,39 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __drafts_com_sun_star_form_IncompatibleTypesException_idl__ -#define __drafts_com_sun_star_form_IncompatibleTypesException_idl__ - -#ifndef __com_sun_star_uno_Exception_idl__ -#include <com/sun/star/uno/Exception.idl> -#endif +#ifndef __com_sun_star_awt_grid_XSortableMutableGridDataModel_idl__ +#define __com_sun_star_awt_grid_XSortableMutableGridDataModel_idl__ -//============================================================================= +#include <com/sun/star/awt/grid/XMutableGridDataModel.idl> +#include <com/sun/star/awt/grid/XSortableGridData.idl> -module drafts { module com { module sun { module star { module form { +//================================================================================================================== -//============================================================================= +module com { module sun { module star { module awt { module grid { -/** thrown to indicate that the types of an <type>XValueBinding</type> and - an <type>XBindableValue</type> are incompatible +//================================================================================================================== - @deprecated - This exception is superseeded by <type scope="com::sun::star::form::binding">IncompatibleTypesException</type> -*/ -exception IncompatibleTypesException: com::sun::star::uno::Exception +/** describes a grid control data model whose data can be modified and sorted. + */ +interface XSortableMutableGridDataModel { + /** provides access to the basic functionality of a grid data model, plus functions to modify it. + */ + interface XMutableGridDataModel; + + /** provides means to sort the data represented by the model. + + <p>If you set a new column sort order, the implementation will notify the registered <type>XGridDataListener</type>s + via a call to its <member>XGridDataListener::dataChanged</member> method.</p> + */ + interface XSortableGridData; }; -//============================================================================= +//================================================================================================================== -}; }; }; }; }; +}; }; }; }; }; -//============================================================================= +//================================================================================================================== #endif diff --git a/offapi/com/sun/star/awt/grid/makefile.mk b/offapi/com/sun/star/awt/grid/makefile.mk index 02c159f8f..8499dca27 100644 --- a/offapi/com/sun/star/awt/grid/makefile.mk +++ b/offapi/com/sun/star/awt/grid/makefile.mk @@ -39,27 +39,27 @@ PACKAGE=com$/sun$/star$/awt$/grid # ------------------------------------------------------------------------ IDLFILES=\ GridColumnEvent.idl\ - GridControlEvent.idl\ GridDataEvent.idl\ SelectionEventType.idl\ GridSelectionEvent.idl\ - XGridControlListener.idl\ XGridSelectionListener.idl\ XGridSelection.idl\ XGridColumn.idl\ XGridColumnListener.idl\ XGridDataListener.idl\ - XGridCell.idl\ - XGridCellRenderer.idl\ DefaultGridDataModel.idl\ XGridDataModel.idl\ + XMutableGridDataModel.idl\ XGridColumnModel.idl\ - ScrollBarMode.idl\ XGridControl.idl\ UnoControlGrid.idl\ UnoControlGridModel.idl\ GridInvalidDataException.idl\ - GridInvalidModelException.idl + GridInvalidModelException.idl\ + XSortableGridData.idl\ + SortableGridDataModel.idl\ + XSortableMutableGridDataModel.idl\ + # ------------------------------------------------------------------ .INCLUDE : target.mk diff --git a/offapi/com/sun/star/awt/tree/XTreeControl.idl b/offapi/com/sun/star/awt/tree/XTreeControl.idl index dafdedc1a..33713d470 100644 --- a/offapi/com/sun/star/awt/tree/XTreeControl.idl +++ b/offapi/com/sun/star/awt/tree/XTreeControl.idl @@ -154,7 +154,7 @@ interface XTreeControl @throws ::com::sun::star::lang::IllegalArgumentException if <var>Node</var> is not a valid node of the corresponding <type>XTreeDataModel</type>. - @raises ExpandVetoException + @throws ExpandVetoException if collapsing <var>Node</var> failed because at least one of the registered <type>XTreeExpansionListener</type> raised a <type>ExpandVetoException</type>. */ diff --git a/offapi/com/sun/star/chart2/LegendExpansion.idl b/offapi/com/sun/star/chart/ChartLegendExpansion.idl index 10191f240..93b58e5cf 100644..100755 --- a/offapi/com/sun/star/chart2/LegendExpansion.idl +++ b/offapi/com/sun/star/chart/ChartLegendExpansion.idl @@ -24,8 +24,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef com_sun_star_chart_LegendExpansion_idl -#define com_sun_star_chart_LegendExpansion_idl +#ifndef com_sun_star_chart_ChartLegendExpansion_idl +#define com_sun_star_chart_ChartLegendExpansion_idl module com { @@ -33,41 +33,37 @@ module sun { module star { -module chart2 +module chart { -/** +/** Specifies sizing aspects of the legend */ -enum LegendExpansion +enum ChartLegendExpansion { - /** The legend is laid out such that it is wider that high. The - aspect ratio is greater than 1. + /** The legend entries are arranged in a single row if possible. If not enough space is available further rows are added. <p>This is usually used for legends that are displayed at the top or bottom of the page.</p> */ WIDE, - /** The legend is laid out such that it is higher that wide. The - aspect ratio is less than 1. + /** The legend entries are stacked in a single column if possible. If not enough space is available further columns are added. <p>This is usually used for legends that are displayed on the left or right hand side of the page.</p> */ HIGH, - /** The legend is laid out such that height and width are not - differing too much. It is not guaranteed to have an aspect - ratio of 1. + /** The legend entries are arranged in a way that the aspect ratio of the resulting legend is as near to 1 as possible. */ BALANCED, - /** The aspect ratio of the legend is given explicitly + /** The size of the legend is given explicitly */ CUSTOM }; -} ; // chart2 +} ; // chart } ; // com } ; // sun } ; // star diff --git a/offapi/com/sun/star/chart/makefile.mk b/offapi/com/sun/star/chart/makefile.mk index 7c9d53e12..94592e0d7 100644 --- a/offapi/com/sun/star/chart/makefile.mk +++ b/offapi/com/sun/star/chart/makefile.mk @@ -73,6 +73,7 @@ IDLFILES=\ ChartGrid.idl\ ChartLegend.idl\ ChartLegendPosition.idl\ + ChartLegendExpansion.idl \ ChartLine.idl\ ChartPieSegmentProperties.idl\ ChartRegressionCurveType.idl\ diff --git a/offapi/com/sun/star/chart2/CustomLegendEntry.idl b/offapi/com/sun/star/chart2/CustomLegendEntry.idl deleted file mode 100644 index 9668eaf90..000000000 --- a/offapi/com/sun/star/chart2/CustomLegendEntry.idl +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef com_sun_star_chart_CustomLegendEntry_idl -#define com_sun_star_chart_CustomLegendEntry_idl - -#include <com/sun/star/beans/XPropertySet.idl> -#include <com/sun/star/chart2/XLegendSymbolProvider.idl> - -module com -{ -module sun -{ -module star -{ -module chart2 -{ - -/** A legend entry that does not depend on data series or other chart - objects. It may contain any text a user specifies. - */ -service CustomLegendEntry -{ - /** Is used to identify an object as one that may be shown in a - legend. - */ - interface XLegendEntry; - - /** Is used to display a legend text - */ - interface XTitled; - - /** If the legend entry should contain a user-defined symbol, you - have to implement this interface. - */ - [optional] interface XLegendSymbolProvider; - - /** must be supported, if properties are implemented - */ - [optional] service ::com::sun::star::beans::XPropertySet; - - /** determines what kind of symbol is displayed next to the entry - in the legend. - */ - [optional, property] LegendSymbolStyle SymbolStyle; -}; - -} ; // chart2 -} ; // com -} ; // sun -} ; // star - -#endif diff --git a/offapi/com/sun/star/chart2/Legend.idl b/offapi/com/sun/star/chart2/Legend.idl index e48b6d3c0..2b1565480 100644 --- a/offapi/com/sun/star/chart2/Legend.idl +++ b/offapi/com/sun/star/chart2/Legend.idl @@ -29,7 +29,7 @@ #include <com/sun/star/chart2/XLegend.idl> #include <com/sun/star/chart2/LegendPosition.idl> -#include <com/sun/star/chart2/LegendExpansion.idl> +#include <com/sun/star/chart/ChartLegendExpansion.idl> #include <com/sun/star/beans/PropertySet.idl> #include <com/sun/star/drawing/LineProperties.idl> @@ -63,12 +63,12 @@ service Legend /** Determines how the aspect ratio of the legend should roughly be. - <p>Set the Expansion to <member>LegendExpansion::HIGH</member> + <p>Set the Expansion to <member>::com::sun::star::chart::ChartLegendExpansion::HIGH</member> for a legend that is positioned on the right or left hand side. Use <member>LegendExpansion::WIDE</member> for a legend that is positioned on top or the bottom.</p> */ - [property] LegendExpansion Expansion; + [property] ::com::sun::star::chart::ChartLegendExpansion Expansion; /** Determines, whether the legend should be redered by the view. */ diff --git a/offapi/com/sun/star/chart2/LegendSymbolStyle.idl b/offapi/com/sun/star/chart2/LegendSymbolStyle.idl deleted file mode 100644 index 4ffdf9200..000000000 --- a/offapi/com/sun/star/chart2/LegendSymbolStyle.idl +++ /dev/null @@ -1,107 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef com_sun_star_chart_LegendSymbolStyle_idl -#define com_sun_star_chart_LegendSymbolStyle_idl - -#include <com/sun/star/uno/XInterface.idl> - -#include <com/sun/star/chart2/XTitle.idl> - -module com -{ -module sun -{ -module star -{ -module chart2 -{ - -/** - */ -enum LegendSymbolStyle -{ - /** A square box with border. - */ - BOX, - - /** A rectangle that is wider than high with border. - */ - BAR, - - /** A square box with border, that may change its aspect ratio if - the layout of the legend requires this. - */ - RECTANGLE, - - /** A filled rectangle with no border that uses all the space - available for the legend entry's symbol, leaving no padding - space. This is especially useful for legends representing a - color-scale. - */ - STRETCHED_RECTANGLE, - - /** A line extending from the left edge to the right edge - */ - HORIZONTAL_LINE, - - /** A line extending from the top edge to the bottom edge - */ - VERTICAL_LINE, - - /** A line spanning the diagonal of the box you would get with - <member>BOX</member>. - */ - DIAGONAL_LINE, - - /** A line like with <member>LINE</member>, but with a small - bordered square box in the middle. - */ - LINE_WITH_BOX, - - /** A line like with <member>LINE</member>, but with the symbol - that is returned by <member>XLegendEntry::getSymbol</member> - (see also <member>USER_DEFINED</member>). - */ - LINE_WITH_SYMBOL, - - /** A bordered circle which has the same bounding-box as the - <member>BOX</member>. - */ - CIRCLE, - - /** Use the symbol that is returned by - <member>XLegendEntry::getSymbol</member>. - */ - USER_DEFINED -}; - -} ; // chart2 -} ; // com -} ; // sun -} ; // star - -#endif diff --git a/offapi/com/sun/star/chart2/XLegend.idl b/offapi/com/sun/star/chart2/XLegend.idl index 309aa148d..1cc8666ef 100644 --- a/offapi/com/sun/star/chart2/XLegend.idl +++ b/offapi/com/sun/star/chart2/XLegend.idl @@ -3,15 +3,6 @@ #include <com/sun/star/uno/XInterface.idl> -#ifndef __com_sun_star_lang_IllegalArgumentException_idl__ -#include <com/sun/star/lang/IllegalArgumentException.idl> -#endif -#ifndef __com_sun_star_container_NoSuchElementException_idl__ -#include <com/sun/star/container/NoSuchElementException.idl> -#endif - -#include <com/sun/star/chart2/XLegendEntry.idl> - module com { module sun @@ -25,30 +16,6 @@ module chart2 */ interface XLegend : ::com::sun::star::uno::XInterface { - /** The entry added is appended to the list, such that it appears - at the end of the legend. - - @param xEntry - - If it supports <type>CustomLegendEntry</type>, - the <type>XTitle</type> is used for displaying a text, and - the symbol is displayed according to the - <member>CustomLegendEntry::SymbolStyle</member> property. - */ - void registerEntry( [in] XLegendEntry xEntry ) - raises( com::sun::star::lang::IllegalArgumentException ); - - /** Removes an entry that was registered before - - <p>(see <member>registerEntry</member>)</p> - */ - void revokeEntry( [in] XLegendEntry xEntry ) - raises( com::sun::star::container::NoSuchElementException ); - - /** Returns a list of all legend entries in the order in which - they were registered. - */ - sequence< XLegendEntry > getEntries(); }; } ; // chart2 diff --git a/offapi/com/sun/star/chart2/XLegendEntry.idl b/offapi/com/sun/star/chart2/XLegendEntry.idl deleted file mode 100644 index 579c453db..000000000 --- a/offapi/com/sun/star/chart2/XLegendEntry.idl +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef com_sun_star_chart_XLegendEntry_idl -#define com_sun_star_chart_XLegendEntry_idl - -#include <com/sun/star/uno/XInterface.idl> - -#include "com/sun/star/chart2/XTitle.idl" -#include "com/sun/star/chart2/LegendSymbolStyle.idl" - -module com -{ -module sun -{ -module star -{ -module chart2 -{ - -/** Object type for Legend. - */ -interface XLegendEntry : ::com::sun::star::uno::XInterface -{ - // no methods, currently only used for type safety -}; - -} ; // chart2 -} ; // com -} ; // sun -} ; // star - -#endif diff --git a/offapi/com/sun/star/chart2/XLegendSymbolProvider.idl b/offapi/com/sun/star/chart2/XLegendSymbolProvider.idl deleted file mode 100644 index 56b2b082d..000000000 --- a/offapi/com/sun/star/chart2/XLegendSymbolProvider.idl +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef com_sun_star_chart_XLegendSymbolProvider_idl -#define com_sun_star_chart_XLegendSymbolProvider_idl - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/drawing/XShape.idl> - -module com -{ -module sun -{ -module star -{ -module chart2 -{ - -/** - */ -interface XLegendSymbolProvider : ::com::sun::star::uno::XInterface -{ - /** The returned shape is used for display in the legend. It may - also be used for display at a data points. - - <p>The shape returned here, will be resized using - <member scope="com::sun::star::drawing">XShape::setSize</member> - to fit the available space in the legend.</p> - */ - com::sun::star::drawing::XShape getSymbol(); -}; - -} ; // chart2 -} ; // com -} ; // sun -} ; // star - -#endif diff --git a/offapi/com/sun/star/chart2/makefile.mk b/offapi/com/sun/star/chart2/makefile.mk index 60cc8393e..873bb985d 100644 --- a/offapi/com/sun/star/chart2/makefile.mk +++ b/offapi/com/sun/star/chart2/makefile.mk @@ -48,9 +48,7 @@ IDLFILES= \ FillBitmap.idl \ IncrementData.idl \ InterpretedData.idl \ - LegendExpansion.idl \ LegendPosition.idl \ - LegendSymbolStyle.idl \ LightSource.idl \ PieChartOffsetMode.idl \ RelativePosition.idl \ @@ -62,7 +60,6 @@ IDLFILES= \ SymbolStyle.idl \ TickmarkStyle.idl \ TransparencyStyle.idl \ - ViewLegendEntry.idl \ XAnyDescriptionAccess.idl\ XAxis.idl \ XCoordinateSystem.idl \ @@ -86,8 +83,6 @@ IDLFILES= \ XInternalDataProvider.idl \ XLabeled.idl \ XLegend.idl \ - XLegendEntry.idl \ - XLegendSymbolProvider.idl \ XRegressionCurve.idl \ XRegressionCurveCalculator.idl \ XRegressionCurveContainer.idl \ diff --git a/offapi/com/sun/star/configuration/DefaultProvider.idl b/offapi/com/sun/star/configuration/DefaultProvider.idl index 337516f73..6767063af 100644 --- a/offapi/com/sun/star/configuration/DefaultProvider.idl +++ b/offapi/com/sun/star/configuration/DefaultProvider.idl @@ -78,14 +78,14 @@ published service DefaultProvider /** Enable setting/getting locale for Provider - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface com::sun::star::lang::XLocalizable; /** Property to enable/disable asynchronous write-back from in-memory cache to backend(s) - @since OOo 2.0.0 + @since OOo 2.0 */ [optional,property] boolean EnableAsync; diff --git a/offapi/com/sun/star/configuration/Update.idl b/offapi/com/sun/star/configuration/Update.idl index 790a4bb40..8cd52a1c1 100644 --- a/offapi/com/sun/star/configuration/Update.idl +++ b/offapi/com/sun/star/configuration/Update.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module configuration { <p>This singleton is unpublished and unstable.</p> - @since OOo 3.3.0 + @since OOo 3.3 */ singleton Update: XUpdate; diff --git a/offapi/com/sun/star/configuration/XUpdate.idl b/offapi/com/sun/star/configuration/XUpdate.idl index c3316ea5d..16455528f 100644 --- a/offapi/com/sun/star/configuration/XUpdate.idl +++ b/offapi/com/sun/star/configuration/XUpdate.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module configuration { <p>This interface is unpublished and unstable.</p> - @since OOo 3.3.0 + @since OOo 3.3 */ interface XUpdate { void insertExtensionXcsFile([in] boolean shared, [in] string fileUri); diff --git a/offapi/com/sun/star/configuration/backend/InteractionHandler.idl b/offapi/com/sun/star/configuration/backend/InteractionHandler.idl index ac73fda62..eb3c07fc3 100644 --- a/offapi/com/sun/star/configuration/backend/InteractionHandler.idl +++ b/offapi/com/sun/star/configuration/backend/InteractionHandler.idl @@ -67,7 +67,7 @@ module com { module sun { module star { module configuration { module backend { <LI>Approve, Disapprove, Abort</LI> </UL></P> - @since OOo 2.0.0 + @since OOo 2.0 @see com::sun::star::task::InteractionHandler */ diff --git a/offapi/com/sun/star/configuration/backend/Layer.idl b/offapi/com/sun/star/configuration/backend/Layer.idl index 204166f19..31d67ca07 100644 --- a/offapi/com/sun/star/configuration/backend/Layer.idl +++ b/offapi/com/sun/star/configuration/backend/Layer.idl @@ -102,7 +102,7 @@ published service Layer /** The URL of the layer data. - @since OOo 2.0.0 + @since OOo 2.0 */ [property,optional,readonly] string URL ; diff --git a/offapi/com/sun/star/configuration/backend/LayerFilter.idl b/offapi/com/sun/star/configuration/backend/LayerFilter.idl index 4f6515fac..9666dfb22 100644 --- a/offapi/com/sun/star/configuration/backend/LayerFilter.idl +++ b/offapi/com/sun/star/configuration/backend/LayerFilter.idl @@ -54,7 +54,7 @@ module com { module sun { module star { module configuration { module backend { @see com::sun::star::configuration::backend::DataImporter Service that supports applying a <type>LayerFilter</type> to imported data. - @since OOo 2.0.0 + @since OOo 2.0 */ published service LayerFilter { diff --git a/offapi/com/sun/star/configuration/backend/MergeRecoveryRequest.idl b/offapi/com/sun/star/configuration/backend/MergeRecoveryRequest.idl index ef0f48f6c..592e0cd8b 100644 --- a/offapi/com/sun/star/configuration/backend/MergeRecoveryRequest.idl +++ b/offapi/com/sun/star/configuration/backend/MergeRecoveryRequest.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module configuration { module backend { /** is passed to an <type>InteractionHandler<type> when merging fails due to invalid layer data or access problems. - @since OOo 2.0.0 + @since OOo 2.0 */ exception MergeRecoveryRequest: ::com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/configuration/backend/Schema.idl b/offapi/com/sun/star/configuration/backend/Schema.idl index 55347bf17..8c35fa8d0 100644 --- a/offapi/com/sun/star/configuration/backend/Schema.idl +++ b/offapi/com/sun/star/configuration/backend/Schema.idl @@ -72,7 +72,7 @@ published service Schema /** The URL of the layer data. - @since OOo 2.0.0 + @since OOo 2.0 */ [property,optional,readonly] string URL ; diff --git a/offapi/com/sun/star/configuration/backend/StratumCreationException.idl b/offapi/com/sun/star/configuration/backend/StratumCreationException.idl index 507fc314c..2c25fe7df 100644 --- a/offapi/com/sun/star/configuration/backend/StratumCreationException.idl +++ b/offapi/com/sun/star/configuration/backend/StratumCreationException.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module configuration { module backend { /** is passed to an <type>InteractionHandler<type> when creating a stratum backend fails. - @since OOo 2.0.0 + @since OOo 2.0 */ exception StratumCreationException : BackendSetupException { diff --git a/offapi/com/sun/star/deployment/DeploymentException.idl b/offapi/com/sun/star/deployment/DeploymentException.idl index 2ad2401db..5943c1c59 100644 --- a/offapi/com/sun/star/deployment/DeploymentException.idl +++ b/offapi/com/sun/star/deployment/DeploymentException.idl @@ -35,7 +35,7 @@ module com { module sun { module star { module deployment { /** A DeploymentException reflects a deployment error. - @since OOo 2.0.0 + @since OOo 2.0 */ exception DeploymentException : com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/deployment/ExtensionManager.idl b/offapi/com/sun/star/deployment/ExtensionManager.idl index a1747393c..3cbc665c1 100644 --- a/offapi/com/sun/star/deployment/ExtensionManager.idl +++ b/offapi/com/sun/star/deployment/ExtensionManager.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module deployment { /singletons/com.sun.star.deployment.ExtensionManager </code>. - @since OOo 3.3.0 + @since OOo 3.3 */ singleton ExtensionManager : XExtensionManager; diff --git a/offapi/com/sun/star/deployment/ExtensionRemovedException.idl b/offapi/com/sun/star/deployment/ExtensionRemovedException.idl index a33a681a7..dcf23832a 100644 --- a/offapi/com/sun/star/deployment/ExtensionRemovedException.idl +++ b/offapi/com/sun/star/deployment/ExtensionRemovedException.idl @@ -39,7 +39,7 @@ interface XPackage; because the extension was removed. <member>XPackage::isRemoved</member> will return true on that object. - @since OOo 3.3.0 + @since OOo 3.3 */ exception ExtensionRemovedException: com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/deployment/InvalidRemovedParameterException.idl b/offapi/com/sun/star/deployment/InvalidRemovedParameterException.idl index 1d047e91f..a9f6f6a30 100644 --- a/offapi/com/sun/star/deployment/InvalidRemovedParameterException.idl +++ b/offapi/com/sun/star/deployment/InvalidRemovedParameterException.idl @@ -39,7 +39,7 @@ interface XPackage; called with a different value for the <code>removed</code> parameter and that the <type>XPackage</type> object created by that call still exist. - @since OOo 3.3.0 + @since OOo 3.3 */ exception InvalidRemovedParameterException: com::sun::star::uno::Exception { /** the value of the <code>removed</code> parameter which was used in diff --git a/offapi/com/sun/star/deployment/PackageRegistryBackend.idl b/offapi/com/sun/star/deployment/PackageRegistryBackend.idl index 17dc5749c..da9ed1b1d 100644 --- a/offapi/com/sun/star/deployment/PackageRegistryBackend.idl +++ b/offapi/com/sun/star/deployment/PackageRegistryBackend.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module deployment { are related to a <type>XPackageManager</type> instance. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service PackageRegistryBackend : XPackageRegistry { diff --git a/offapi/com/sun/star/deployment/PlatformException.idl b/offapi/com/sun/star/deployment/PlatformException.idl index 7776e9954..190cbc201 100644 --- a/offapi/com/sun/star/deployment/PlatformException.idl +++ b/offapi/com/sun/star/deployment/PlatformException.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module deployment { /** A DeploymentException indicates that the current platform is not supported. - @since OOo 3.0.0 + @since OOo 3.0 */ exception PlatformException : com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/deployment/XExtensionManager.idl b/offapi/com/sun/star/deployment/XExtensionManager.idl index 368e3f148..9f484ba68 100644 --- a/offapi/com/sun/star/deployment/XExtensionManager.idl +++ b/offapi/com/sun/star/deployment/XExtensionManager.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module deployment { in the user, shared and bundled repository. @see ExtensionManager - @since OOo 3.3.0 + @since OOo 3.3 */ interface XExtensionManager { diff --git a/offapi/com/sun/star/deployment/XPackage.idl b/offapi/com/sun/star/deployment/XPackage.idl index f93c8de99..9fbd965f0 100755..100644 --- a/offapi/com/sun/star/deployment/XPackage.idl +++ b/offapi/com/sun/star/deployment/XPackage.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module deployment { /** Objects of this interface reflect a bound package and are issued by a <type>PackageRegistryBackend</type>. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XPackage { @@ -100,7 +100,7 @@ interface XPackage After updateing the OpenOffice.org, some dependencies for packages might no longer be satisfied. - @since OOo 3.2.0 + @since OOo 3.2 @param xCmdEnv command environment for error handling and other interaction. diff --git a/offapi/com/sun/star/deployment/XPackageManager.idl b/offapi/com/sun/star/deployment/XPackageManager.idl index cde8ecbe0..96f1b00b9 100644 --- a/offapi/com/sun/star/deployment/XPackageManager.idl +++ b/offapi/com/sun/star/deployment/XPackageManager.idl @@ -67,7 +67,7 @@ module com { module sun { module star { module deployment { </p> @see thePackageManagerFactory - @since OOo 2.0.0 + @since OOo 2.0 @deprecated Use <type>XExtensionManager</type>. */ diff --git a/offapi/com/sun/star/deployment/XPackageManagerFactory.idl b/offapi/com/sun/star/deployment/XPackageManagerFactory.idl index 7dc720541..629e82745 100644 --- a/offapi/com/sun/star/deployment/XPackageManagerFactory.idl +++ b/offapi/com/sun/star/deployment/XPackageManagerFactory.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module deployment { exclusively. </p> - @since OOo 2.0.0 + @since OOo 2.0 @deprecated Use <type>XExtensionManager</type>. */ diff --git a/offapi/com/sun/star/deployment/XPackageRegistry.idl b/offapi/com/sun/star/deployment/XPackageRegistry.idl index ddb4efc12..289ce6ca7 100644 --- a/offapi/com/sun/star/deployment/XPackageRegistry.idl +++ b/offapi/com/sun/star/deployment/XPackageRegistry.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module deployment { /** Interface to bind an UNO package. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XPackageRegistry { diff --git a/offapi/com/sun/star/deployment/XPackageTypeInfo.idl b/offapi/com/sun/star/deployment/XPackageTypeInfo.idl index f7860da4f..5260eeecc 100644 --- a/offapi/com/sun/star/deployment/XPackageTypeInfo.idl +++ b/offapi/com/sun/star/deployment/XPackageTypeInfo.idl @@ -35,7 +35,7 @@ module com { module sun { module star { module deployment { /** Objects of this interface provide information about a package's type. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XPackageTypeInfo { diff --git a/offapi/com/sun/star/deployment/thePackageManagerFactory.idl b/offapi/com/sun/star/deployment/thePackageManagerFactory.idl index 18c583f14..7ca0188dd 100644 --- a/offapi/com/sun/star/deployment/thePackageManagerFactory.idl +++ b/offapi/com/sun/star/deployment/thePackageManagerFactory.idl @@ -42,7 +42,7 @@ module com { module sun { module star { module deployment { </code>. </p> - @since OOo 2.0.0 + @since OOo 2.0 @deprecated Use <type>XExtensionManager</type>. */ diff --git a/offapi/com/sun/star/deployment/ui/PackageManagerDialog.idl b/offapi/com/sun/star/deployment/ui/PackageManagerDialog.idl index f3c06f910..8bed6dc2d 100644 --- a/offapi/com/sun/star/deployment/ui/PackageManagerDialog.idl +++ b/offapi/com/sun/star/deployment/ui/PackageManagerDialog.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module deployment { module ui { packages of the user and shared installation as well as currently open documents. - @since OOo 2.0.0 + @since OOo 2.0 */ service PackageManagerDialog : com::sun::star::ui::dialogs::XAsynchronousExecutableDialog { diff --git a/offapi/com/sun/star/deployment/ui/UpdateRequiredDialog.idl b/offapi/com/sun/star/deployment/ui/UpdateRequiredDialog.idl index b3bb4807f..e2a5008f7 100644 --- a/offapi/com/sun/star/deployment/ui/UpdateRequiredDialog.idl +++ b/offapi/com/sun/star/deployment/ui/UpdateRequiredDialog.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module deployment { module ui { /** The <type>UpdateRequiredDialog</type> is used to show a list of extensions not compatible with this office version. - @since OOo 3.2.0 + @since OOo 3.2 */ service UpdateRequiredDialog : com::sun::star::ui::dialogs::XExecutableDialog { diff --git a/offapi/com/sun/star/document/CorruptedFilterConfigurationException.idl b/offapi/com/sun/star/document/CorruptedFilterConfigurationException.idl index 13de1ef49..b7fe140fe 100644 --- a/offapi/com/sun/star/document/CorruptedFilterConfigurationException.idl +++ b/offapi/com/sun/star/document/CorruptedFilterConfigurationException.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module document { /** This exception is thrown in case the global filter configuration does not exists or contains corrupted data. - @since OOo 2.0.0 + @since OOo 2.0 */ published exception CorruptedFilterConfigurationException : ::com::sun::star::uno::RuntimeException { diff --git a/offapi/com/sun/star/document/DocumentEvent.idl b/offapi/com/sun/star/document/DocumentEvent.idl index b4d1d8cb1..f3244e79c 100644 --- a/offapi/com/sun/star/document/DocumentEvent.idl +++ b/offapi/com/sun/star/document/DocumentEvent.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module document { anymore.</p> @see XDocumentEventBroadcaster - @since OpenOffice.org 3.1 + @since OOo 3.1 */ struct DocumentEvent : ::com::sun::star::lang::EventObject { diff --git a/offapi/com/sun/star/document/XDocumentEventBroadcaster.idl b/offapi/com/sun/star/document/XDocumentEventBroadcaster.idl index b74d40802..b4ccd6f55 100644 --- a/offapi/com/sun/star/document/XDocumentEventBroadcaster.idl +++ b/offapi/com/sun/star/document/XDocumentEventBroadcaster.idl @@ -58,7 +58,7 @@ interface XDocumentEventListener; anymore.</p> @see DocumentEvent - @since OpenOffice.org 3.1 + @since OOo 3.1 */ interface XDocumentEventBroadcaster { diff --git a/offapi/com/sun/star/document/XDocumentEventListener.idl b/offapi/com/sun/star/document/XDocumentEventListener.idl index efbfc7104..d27092c51 100644 --- a/offapi/com/sun/star/document/XDocumentEventListener.idl +++ b/offapi/com/sun/star/document/XDocumentEventListener.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module document { anymore.</p> @see XDocumentEventBroadcaster - @since OpenOffice.org 3.1 + @since OOo 3.1 */ interface XDocumentEventListener : ::com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/document/XMLBasicExporter.idl b/offapi/com/sun/star/document/XMLBasicExporter.idl index 75515e435..91c82f416 100644 --- a/offapi/com/sun/star/document/XMLBasicExporter.idl +++ b/offapi/com/sun/star/document/XMLBasicExporter.idl @@ -53,7 +53,7 @@ module com { module sun { module star { module document { from which the data should be exported. After that, the export is started by calling the <method>XFilter::filter</method> method.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published service XMLBasicExporter { diff --git a/offapi/com/sun/star/document/XMLBasicImporter.idl b/offapi/com/sun/star/document/XMLBasicImporter.idl index d7290662e..495481717 100644 --- a/offapi/com/sun/star/document/XMLBasicImporter.idl +++ b/offapi/com/sun/star/document/XMLBasicImporter.idl @@ -50,7 +50,7 @@ module com { module sun { module star { module document { The <type scope="com::sun::star::xml::sax">XDocumentHandler</type> interface is used to stream the XML data into the filter.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published service XMLBasicImporter { diff --git a/offapi/com/sun/star/document/XMLOasisBasicExporter.idl b/offapi/com/sun/star/document/XMLOasisBasicExporter.idl index 5235ee464..936fce9ae 100644 --- a/offapi/com/sun/star/document/XMLOasisBasicExporter.idl +++ b/offapi/com/sun/star/document/XMLOasisBasicExporter.idl @@ -53,7 +53,7 @@ module com { module sun { module star { module document { from which the data should be exported. After that, the export is started by calling the <method>XFilter::filter</method> method.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published service XMLOasisBasicExporter { diff --git a/offapi/com/sun/star/document/XMLOasisBasicImporter.idl b/offapi/com/sun/star/document/XMLOasisBasicImporter.idl index 4e9b128f0..87c1f7fb2 100644 --- a/offapi/com/sun/star/document/XMLOasisBasicImporter.idl +++ b/offapi/com/sun/star/document/XMLOasisBasicImporter.idl @@ -50,7 +50,7 @@ module com { module sun { module star { module document { The <type scope="com::sun::star::xml::sax">XDocumentHandler</type> interface is used to stream the XML data into the filter.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published service XMLOasisBasicImporter { diff --git a/offapi/com/sun/star/form/FormComponent.idl b/offapi/com/sun/star/form/FormComponent.idl index a539838dc..47aacf923 100644 --- a/offapi/com/sun/star/form/FormComponent.idl +++ b/offapi/com/sun/star/form/FormComponent.idl @@ -104,7 +104,7 @@ published service FormComponent will always be set, even if you do not specify it in the <member scope="com::sun::star::beans">XPropertyContainer::addProperty</member> call.</p> - @since OpenOffice.org 2.3.0 + @since OOo 2.3 */ [optional] service com::sun::star::beans::PropertyBag; diff --git a/offapi/com/sun/star/form/XErrorListener.idl b/offapi/com/sun/star/form/XErrorListener.idl index d791f554b..76b508cd4 100644 --- a/offapi/com/sun/star/form/XErrorListener.idl +++ b/offapi/com/sun/star/form/XErrorListener.idl @@ -51,7 +51,6 @@ <p>Please do <em><b>not</b></em> use anymore, this interface is superseeded by <type scope="com::sun::star::sdb">XSQLErrorListener</type>.</p> -@since foo @deprecated */ published interface XErrorListener: com::sun::star::lang::XEventListener diff --git a/offapi/com/sun/star/form/component/GridControl.idl b/offapi/com/sun/star/form/component/GridControl.idl index 52ef5f20a..e4e53c1ed 100644 --- a/offapi/com/sun/star/form/component/GridControl.idl +++ b/offapi/com/sun/star/form/component/GridControl.idl @@ -162,7 +162,7 @@ published service GridControl <p>Not every border style (see <member>Border</member>) may support coloring. For instance, usually a border with 3D effect will ignore the BorderColor setting.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long BorderColor; diff --git a/offapi/com/sun/star/form/inspection/DefaultFormComponentInspectorModel.idl b/offapi/com/sun/star/form/inspection/DefaultFormComponentInspectorModel.idl index 81f086089..26bc733cf 100644 --- a/offapi/com/sun/star/form/inspection/DefaultFormComponentInspectorModel.idl +++ b/offapi/com/sun/star/form/inspection/DefaultFormComponentInspectorModel.idl @@ -62,7 +62,7 @@ service DefaultFormComponentInspectorModel : com::sun::star::inspection::XObject /** creates a default DefaultFormComponentInspectorModel, providing factories for all handlers listed above. - @since OOo 2.2.0 + @since OOo 2.2 */ createDefault(); @@ -85,7 +85,7 @@ service DefaultFormComponentInspectorModel : com::sun::star::inspection::XObject @see XObjectInspectorModel::MinHelpTextLines @see XObjectInspectorModel::MaxHelpTextLines - @since OOo 2.2.0 + @since OOo 2.2 */ createWithHelpSection( [in] long minHelpTextLines, diff --git a/offapi/com/sun/star/form/runtime/FeatureState.idl b/offapi/com/sun/star/form/runtime/FeatureState.idl index 6dc8aa8b3..8068e8144 100644 --- a/offapi/com/sun/star/form/runtime/FeatureState.idl +++ b/offapi/com/sun/star/form/runtime/FeatureState.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module form { module runtime { @see XFormOperations - @since OpenOffice.org 2.2.0 + @since OOo 2.2 */ struct FeatureState { diff --git a/offapi/com/sun/star/form/runtime/FilterEvent.idl b/offapi/com/sun/star/form/runtime/FilterEvent.idl index 10358f824..b817ff1ae 100644 --- a/offapi/com/sun/star/form/runtime/FilterEvent.idl +++ b/offapi/com/sun/star/form/runtime/FilterEvent.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module form { module runtime { @see XFilterController - @since OpenOffice.org 3.3 + @since OOo 3.3 */ struct FilterEvent : ::com::sun::star::lang::EventObject { diff --git a/offapi/com/sun/star/form/runtime/FormFeature.idl b/offapi/com/sun/star/form/runtime/FormFeature.idl index e04341661..5adf1e7f7 100644 --- a/offapi/com/sun/star/form/runtime/FormFeature.idl +++ b/offapi/com/sun/star/form/runtime/FormFeature.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module form { module runtime { /** specifies the operations on a user interface form, as supported by the <type>XFormOperations</type> interface. - @since OpenOffice.org 2.2.0 + @since OOo 2.2 */ constants FormFeature { diff --git a/offapi/com/sun/star/form/runtime/FormOperations.idl b/offapi/com/sun/star/form/runtime/FormOperations.idl index 209f0c692..e47f078d4 100644 --- a/offapi/com/sun/star/form/runtime/FormOperations.idl +++ b/offapi/com/sun/star/form/runtime/FormOperations.idl @@ -50,7 +50,7 @@ module com { module sun { module star { module form { module runtime { /** encapsulates operations on a database form which has a UI representation, and is interacting with the user. - @since OpenOffice.org 2.2.0 + @since OOo 2.2 */ service FormOperations : XFormOperations { diff --git a/offapi/com/sun/star/form/runtime/XFeatureInvalidation.idl b/offapi/com/sun/star/form/runtime/XFeatureInvalidation.idl index 5821d8ae3..6486de470 100644 --- a/offapi/com/sun/star/form/runtime/XFeatureInvalidation.idl +++ b/offapi/com/sun/star/form/runtime/XFeatureInvalidation.idl @@ -43,7 +43,7 @@ module com { module sun { module star { module form { module runtime { @see XFormOperations - @since OpenOffice.org 2.2.0 + @since OOo 2.2 */ interface XFeatureInvalidation { diff --git a/offapi/com/sun/star/form/runtime/XFilterController.idl b/offapi/com/sun/star/form/runtime/XFilterController.idl index 40aa5d2f2..47e684f1d 100644 --- a/offapi/com/sun/star/form/runtime/XFilterController.idl +++ b/offapi/com/sun/star/form/runtime/XFilterController.idl @@ -73,7 +73,7 @@ interface XFilterControllerListener; @see com::sun::star::sdb::XSingleSelectQueryAnalyzer::getStructuredFilter @see com::sun::star::sdb::SQLFilterOperator - @since OpenOffice.org 3.3 + @since OOo 3.3 */ interface XFilterController { diff --git a/offapi/com/sun/star/form/runtime/XFilterControllerListener.idl b/offapi/com/sun/star/form/runtime/XFilterControllerListener.idl index c50b22d67..8833e13cd 100644 --- a/offapi/com/sun/star/form/runtime/XFilterControllerListener.idl +++ b/offapi/com/sun/star/form/runtime/XFilterControllerListener.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module form { module runtime { /** is implemented by components listening for events fired by an <type>XFilterController</type>. - @since OpenOffice.org 3.3 + @since OOo 3.3 */ interface XFilterControllerListener : ::com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/form/runtime/XFormController.idl b/offapi/com/sun/star/form/runtime/XFormController.idl index e7fa9139f..00af0be48 100644 --- a/offapi/com/sun/star/form/runtime/XFormController.idl +++ b/offapi/com/sun/star/form/runtime/XFormController.idl @@ -248,7 +248,7 @@ interface XFormControllerContext; @see ::com::sun::star::form::binding::BindableControlModel @see ::com::sun::star::sdb::DataSource::Settings - @since OpenOffice.org 3.3 + @since OOo 3.3 */ interface XFormController { diff --git a/offapi/com/sun/star/form/runtime/XFormOperations.idl b/offapi/com/sun/star/form/runtime/XFormOperations.idl index bfb8c2338..7757b959f 100644 --- a/offapi/com/sun/star/form/runtime/XFormOperations.idl +++ b/offapi/com/sun/star/form/runtime/XFormOperations.idl @@ -93,7 +93,7 @@ interface XFeatureInvalidation; @see FormFeature - @since OpenOffice.org 2.2.0 + @since OOo 2.2 */ interface XFormOperations : ::com::sun::star::lang::XComponent { diff --git a/offapi/com/sun/star/frame/CommandGroup.idl b/offapi/com/sun/star/frame/CommandGroup.idl index 36454d076..2b3f87422 100644 --- a/offapi/com/sun/star/frame/CommandGroup.idl +++ b/offapi/com/sun/star/frame/CommandGroup.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module frame { @see XDispatchInformationProvider @see Controller - @since OOo 2.0.0 + @since OOo 2.0 */ published constants CommandGroup { diff --git a/offapi/com/sun/star/frame/DispatchInformation.idl b/offapi/com/sun/star/frame/DispatchInformation.idl index d6ce8e011..a402f8942 100644 --- a/offapi/com/sun/star/frame/DispatchInformation.idl +++ b/offapi/com/sun/star/frame/DispatchInformation.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module frame { @see XDispatchInformationProvider @see Controller - @since OOo 2.0.0 + @since OOo 2.0 */ published struct DispatchInformation { diff --git a/offapi/com/sun/star/frame/Frame.idl b/offapi/com/sun/star/frame/Frame.idl index ddb880ea6..864c2c949 100644 --- a/offapi/com/sun/star/frame/Frame.idl +++ b/offapi/com/sun/star/frame/Frame.idl @@ -127,7 +127,7 @@ published service Frame //------------------------------------------------------------------------- /** provides information about supported commands - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface XDispatchInformationProvider; diff --git a/offapi/com/sun/star/frame/LayoutManager.idl b/offapi/com/sun/star/frame/LayoutManager.idl index 2465b0fb3..f57f44fcf 100644 --- a/offapi/com/sun/star/frame/LayoutManager.idl +++ b/offapi/com/sun/star/frame/LayoutManager.idl @@ -72,7 +72,7 @@ the size and position of those user interface elements. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service LayoutManager diff --git a/offapi/com/sun/star/frame/LayoutManagerEvents.idl b/offapi/com/sun/star/frame/LayoutManagerEvents.idl index 7809d4afc..fdf29c7e8 100644 --- a/offapi/com/sun/star/frame/LayoutManagerEvents.idl +++ b/offapi/com/sun/star/frame/LayoutManagerEvents.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module frame { @see com::sun::star::frame::LayoutManager @see com::sun::star::frame::XLayoutManagerEventBroadcaster - @since OOo 2.0.0 + @since OOo 2.0 */ constants LayoutManagerEvents { diff --git a/offapi/com/sun/star/frame/ModuleManager.idl b/offapi/com/sun/star/frame/ModuleManager.idl index 4513478d7..b74bab4e8 100644 --- a/offapi/com/sun/star/frame/ModuleManager.idl +++ b/offapi/com/sun/star/frame/ModuleManager.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module frame { of office modules. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ModuleManager diff --git a/offapi/com/sun/star/frame/PopupMenuController.idl b/offapi/com/sun/star/frame/PopupMenuController.idl index ce9ebfa9a..5e63c643d 100644 --- a/offapi/com/sun/star/frame/PopupMenuController.idl +++ b/offapi/com/sun/star/frame/PopupMenuController.idl @@ -65,7 +65,7 @@ module com { module sun { module star { module frame { worked on. This list gets changes consistently during a work session. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service PopupMenuController diff --git a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl index 675b09f7e..e8a247e9f 100644 --- a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl +++ b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl @@ -50,7 +50,7 @@ module com { module sun { module star { module frame { it contains a registered command URL. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service PopupMenuControllerFactory diff --git a/offapi/com/sun/star/frame/StatusbarController.idl b/offapi/com/sun/star/frame/StatusbarController.idl index 6754d1443..cd3273300 100644 --- a/offapi/com/sun/star/frame/StatusbarController.idl +++ b/offapi/com/sun/star/frame/StatusbarController.idl @@ -64,7 +64,7 @@ @see com::sun::star::frame::XDispatchProvider @see com::sun::star::frame::XStatusbarController - @since OOo 2.0.0 + @since OOo 2.0 */ service StatusbarController diff --git a/offapi/com/sun/star/frame/StatusbarControllerFactory.idl b/offapi/com/sun/star/frame/StatusbarControllerFactory.idl index fcffafa55..a74cdfd0e 100644 --- a/offapi/com/sun/star/frame/StatusbarControllerFactory.idl +++ b/offapi/com/sun/star/frame/StatusbarControllerFactory.idl @@ -51,7 +51,7 @@ module com { module sun { module star { module frame { if it contains a registered command URL. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service StatusbarControllerFactory diff --git a/offapi/com/sun/star/frame/ToolbarController.idl b/offapi/com/sun/star/frame/ToolbarController.idl index b79fe669d..4b56aadf7 100644 --- a/offapi/com/sun/star/frame/ToolbarController.idl +++ b/offapi/com/sun/star/frame/ToolbarController.idl @@ -67,7 +67,7 @@ @see com::sun::star::frame::XDispatchProvider - @since OOo 2.0.0 + @since OOo 2.0 */ service ToolbarController diff --git a/offapi/com/sun/star/frame/TransientDocumentsDocumentContentFactory.idl b/offapi/com/sun/star/frame/TransientDocumentsDocumentContentFactory.idl index 2dfb26d38..d2fdf37c1 100644 --- a/offapi/com/sun/star/frame/TransientDocumentsDocumentContentFactory.idl +++ b/offapi/com/sun/star/frame/TransientDocumentsDocumentContentFactory.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module frame { /** specifies a factory for <type scope="com::sun::star::ucb">TransientDocumentsDocumentContent</type>s. - @since OOo 2.0.0 + @since OOo 2.0 */ service TransientDocumentsDocumentContentFactory { diff --git a/offapi/com/sun/star/frame/UnknownModuleException.idl b/offapi/com/sun/star/frame/UnknownModuleException.idl index 39f47ef7b..de0f97c7a 100644 --- a/offapi/com/sun/star/frame/UnknownModuleException.idl +++ b/offapi/com/sun/star/frame/UnknownModuleException.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module frame { * module could not be classified or does not have * a valid configuration. - @since OOo 2.0.0 + @since OOo 2.0 */ exception UnknownModuleException : ::com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/frame/XDispatchInformationProvider.idl b/offapi/com/sun/star/frame/XDispatchInformationProvider.idl index f3c722ff6..a40b5e923 100644 --- a/offapi/com/sun/star/frame/XDispatchInformationProvider.idl +++ b/offapi/com/sun/star/frame/XDispatchInformationProvider.idl @@ -56,7 +56,7 @@ module com { module sun { module star { module frame { @see Frame - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XDispatchInformationProvider: com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XInplaceLayout.idl b/offapi/com/sun/star/frame/XInplaceLayout.idl index ba923da41..f79ecdcc2 100644 --- a/offapi/com/sun/star/frame/XInplaceLayout.idl +++ b/offapi/com/sun/star/frame/XInplaceLayout.idl @@ -43,7 +43,7 @@ module com { module sun { module star { module frame { @deprecated - @since OOo 2.0.0 + @since OOo 2.0 */ interface XInplaceLayout : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/frame/XLayoutManager.idl b/offapi/com/sun/star/frame/XLayoutManager.idl index f280d8606..49cb50b8e 100644 --- a/offapi/com/sun/star/frame/XLayoutManager.idl +++ b/offapi/com/sun/star/frame/XLayoutManager.idl @@ -95,7 +95,7 @@ module com { module sun { module star { module frame { @see com::sun::star::frame::XFrame </p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XLayoutManager : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/frame/XLayoutManagerEventBroadcaster.idl b/offapi/com/sun/star/frame/XLayoutManagerEventBroadcaster.idl index 53d179139..a6d74a8a7 100644 --- a/offapi/com/sun/star/frame/XLayoutManagerEventBroadcaster.idl +++ b/offapi/com/sun/star/frame/XLayoutManagerEventBroadcaster.idl @@ -40,7 +40,7 @@ @see ::com::sun::star::frame::LayoutManager - @since OOo 2.0.0 + @since OOo 2.0 */ interface XLayoutManagerEventBroadcaster : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/frame/XLayoutManagerListener.idl b/offapi/com/sun/star/frame/XLayoutManagerListener.idl index dbdc68ed6..5e4d37ed0 100644 --- a/offapi/com/sun/star/frame/XLayoutManagerListener.idl +++ b/offapi/com/sun/star/frame/XLayoutManagerListener.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module frame { @see ::com::sun::star::frame::LayoutManager @see ::com::sun::star::frame::LayoutManagerEvents - @since OOo 2.0.0 + @since OOo 2.0 */ interface XLayoutManagerListener : com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/frame/XMenuBarAcceptor.idl b/offapi/com/sun/star/frame/XMenuBarAcceptor.idl index 51320a28f..0ef9d880c 100644 --- a/offapi/com/sun/star/frame/XMenuBarAcceptor.idl +++ b/offapi/com/sun/star/frame/XMenuBarAcceptor.idl @@ -46,7 +46,7 @@ module com { module sun { module star { module frame { @deprecated - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMenuBarAcceptor : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/frame/XMenuBarMergingAcceptor.idl b/offapi/com/sun/star/frame/XMenuBarMergingAcceptor.idl index 5ae56391a..1d64bb947 100644 --- a/offapi/com/sun/star/frame/XMenuBarMergingAcceptor.idl +++ b/offapi/com/sun/star/frame/XMenuBarMergingAcceptor.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module frame { /** provides functions to set and remove a merged menu bar for inplace editing. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMenuBarMergingAcceptor : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/frame/XModule.idl b/offapi/com/sun/star/frame/XModule.idl index b6ad30a0a..df07bfded 100644 --- a/offapi/com/sun/star/frame/XModule.idl +++ b/offapi/com/sun/star/frame/XModule.idl @@ -58,7 +58,7 @@ module com { module sun { module star { module frame { @see XModuleManager - @since OOo 2.3.0 + @since OOo 2.3 */ interface XModule : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XModuleManager.idl b/offapi/com/sun/star/frame/XModuleManager.idl index 066ff40d2..4fd7914f7 100644 --- a/offapi/com/sun/star/frame/XModuleManager.idl +++ b/offapi/com/sun/star/frame/XModuleManager.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module frame { //=============================================== /** can be used to identify office modules. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XModuleManager : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XPopupMenuController.idl b/offapi/com/sun/star/frame/XPopupMenuController.idl index b06d2a2b3..59009ef18 100644 --- a/offapi/com/sun/star/frame/XPopupMenuController.idl +++ b/offapi/com/sun/star/frame/XPopupMenuController.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module frame { briefs the controller whenever the popup menu gets activated by a user. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XPopupMenuController : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XStatusbarController.idl b/offapi/com/sun/star/frame/XStatusbarController.idl index 466372817..b5888d9d7 100644 --- a/offapi/com/sun/star/frame/XStatusbarController.idl +++ b/offapi/com/sun/star/frame/XStatusbarController.idl @@ -62,7 +62,7 @@ module com { module sun { module star { module frame { @see com::sun::star::frame::XDispatchProvider - @since OOo 2.0.0 + @since OOo 2.0 */ interface XStatusbarController : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XSubToolbarController.idl b/offapi/com/sun/star/frame/XSubToolbarController.idl index 413674c81..f6823ddb7 100644 --- a/offapi/com/sun/star/frame/XSubToolbarController.idl +++ b/offapi/com/sun/star/frame/XSubToolbarController.idl @@ -47,7 +47,7 @@ @see com::sun::star::frame::ToolbarController - @since OOo 2.0.0 + @since OOo 2.0 */ interface XSubToolbarController : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XSynchronousDispatch.idl b/offapi/com/sun/star/frame/XSynchronousDispatch.idl index 90fe07159..12616fb6e 100644 --- a/offapi/com/sun/star/frame/XSynchronousDispatch.idl +++ b/offapi/com/sun/star/frame/XSynchronousDispatch.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module frame { //============================================================================= /** additional interfaces for dispatch objects: allow to execute with return value - @since OOo 2.0.0 + @since OOo 2.0 @see XDispatch */ published interface XSynchronousDispatch: com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/frame/XToolbarController.idl b/offapi/com/sun/star/frame/XToolbarController.idl index cd0c7f20d..cb081a0a1 100644 --- a/offapi/com/sun/star/frame/XToolbarController.idl +++ b/offapi/com/sun/star/frame/XToolbarController.idl @@ -53,7 +53,7 @@ @see com::sun::star::frame::XDispatchProvider - @since OOo 2.0.0 + @since OOo 2.0 */ interface XToolbarController : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XToolbarControllerListener.idl b/offapi/com/sun/star/frame/XToolbarControllerListener.idl index 5e1e5b3a8..2dbe99be4 100644 --- a/offapi/com/sun/star/frame/XToolbarControllerListener.idl +++ b/offapi/com/sun/star/frame/XToolbarControllerListener.idl @@ -36,7 +36,7 @@ @see com::sun::star::frame::ToolbarController - @since OOo 2.0.0 + @since OOo 2.0 */ interface XToolbarControllerListener : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/frame/XTransientDocumentsDocumentContentFactory.idl b/offapi/com/sun/star/frame/XTransientDocumentsDocumentContentFactory.idl index 318576465..52d6d7d30 100644 --- a/offapi/com/sun/star/frame/XTransientDocumentsDocumentContentFactory.idl +++ b/offapi/com/sun/star/frame/XTransientDocumentsDocumentContentFactory.idl @@ -56,7 +56,7 @@ module com { module sun { module star { module frame { @see com::sun::star::document::OfficeDocument @see com::sun::star::ucb::TransientDocumentsDocumentContent - @since OOo 2.0.0 + @since OOo 2.0 */ interface XTransientDocumentsDocumentContentFactory : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/geometry/AffineMatrix2D.idl b/offapi/com/sun/star/geometry/AffineMatrix2D.idl index e63df2fca..11306a269 100644 --- a/offapi/com/sun/star/geometry/AffineMatrix2D.idl +++ b/offapi/com/sun/star/geometry/AffineMatrix2D.idl @@ -65,7 +65,7 @@ module com { module sun { module star { module geometry { printer, Then, the total transformation matrix and the device resolution determine the actual measurement unit.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct AffineMatrix2D { diff --git a/offapi/com/sun/star/geometry/AffineMatrix3D.idl b/offapi/com/sun/star/geometry/AffineMatrix3D.idl index 7b9c769a0..f697b2beb 100644 --- a/offapi/com/sun/star/geometry/AffineMatrix3D.idl +++ b/offapi/com/sun/star/geometry/AffineMatrix3D.idl @@ -67,7 +67,7 @@ module com { module sun { module star { module geometry { Only then the total transformation matrix (oncluding projection to 2D) and the device resolution determine the actual measurement unit in 3D.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct AffineMatrix3D { diff --git a/offapi/com/sun/star/geometry/EllipticalArc.idl b/offapi/com/sun/star/geometry/EllipticalArc.idl index 7c9bc1ee4..0a5d96e1e 100644 --- a/offapi/com/sun/star/geometry/EllipticalArc.idl +++ b/offapi/com/sun/star/geometry/EllipticalArc.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module geometry { constrains. Thus, there are two flags indicating which one of those ellipses should be taken.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct EllipticalArc { diff --git a/offapi/com/sun/star/geometry/IntegerBezierSegment2D.idl b/offapi/com/sun/star/geometry/IntegerBezierSegment2D.idl index 0d08afd38..ac8d8f9c8 100644 --- a/offapi/com/sun/star/geometry/IntegerBezierSegment2D.idl +++ b/offapi/com/sun/star/geometry/IntegerBezierSegment2D.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module geometry { ignored.<p> @see com.sun.star.rendering.XBezierPolyPolygon2D - @since OOo 2.0.0 + @since OOo 2.0 */ struct IntegerBezierSegment2D { diff --git a/offapi/com/sun/star/geometry/IntegerPoint2D.idl b/offapi/com/sun/star/geometry/IntegerPoint2D.idl index 1d30e5af2..699bc193d 100644 --- a/offapi/com/sun/star/geometry/IntegerPoint2D.idl +++ b/offapi/com/sun/star/geometry/IntegerPoint2D.idl @@ -34,7 +34,7 @@ module com { module sun { module star { module geometry { This structure contains x and y integer-valued coordinates of a two-dimensional point. - @since OOo 2.0.0 + @since OOo 2.0 */ struct IntegerPoint2D { diff --git a/offapi/com/sun/star/geometry/IntegerRectangle2D.idl b/offapi/com/sun/star/geometry/IntegerRectangle2D.idl index 075e0f4c4..77bdb9919 100644 --- a/offapi/com/sun/star/geometry/IntegerRectangle2D.idl +++ b/offapi/com/sun/star/geometry/IntegerRectangle2D.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module geometry { /** This structure contains the necessary information for a two-dimensional rectangle.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct IntegerRectangle2D { diff --git a/offapi/com/sun/star/geometry/IntegerSize2D.idl b/offapi/com/sun/star/geometry/IntegerSize2D.idl index 1732c4a43..e9aea711e 100644 --- a/offapi/com/sun/star/geometry/IntegerSize2D.idl +++ b/offapi/com/sun/star/geometry/IntegerSize2D.idl @@ -33,7 +33,7 @@ module com { module sun { module star { module geometry { The data is stored integer-valued.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct IntegerSize2D { diff --git a/offapi/com/sun/star/geometry/Matrix2D.idl b/offapi/com/sun/star/geometry/Matrix2D.idl index 44f4c7dfe..3fac5764d 100644 --- a/offapi/com/sun/star/geometry/Matrix2D.idl +++ b/offapi/com/sun/star/geometry/Matrix2D.idl @@ -68,7 +68,7 @@ module com { module sun { module star { module geometry { printer. Then, the total transformation matrix and the device resolution determine the actual measurement unit.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct Matrix2D { diff --git a/offapi/com/sun/star/geometry/RealBezierSegment2D.idl b/offapi/com/sun/star/geometry/RealBezierSegment2D.idl index f5bfce093..3183f7407 100644 --- a/offapi/com/sun/star/geometry/RealBezierSegment2D.idl +++ b/offapi/com/sun/star/geometry/RealBezierSegment2D.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module geometry { ignored.<p> @see com.sun.star.rendering.XBezierPolyPolygon2D - @since OOo 2.0.0 + @since OOo 2.0 */ struct RealBezierSegment2D { diff --git a/offapi/com/sun/star/geometry/RealPoint2D.idl b/offapi/com/sun/star/geometry/RealPoint2D.idl index 8c64dda9a..bb95ab45c 100644 --- a/offapi/com/sun/star/geometry/RealPoint2D.idl +++ b/offapi/com/sun/star/geometry/RealPoint2D.idl @@ -34,7 +34,7 @@ module com { module sun { module star { module geometry { This structure contains x and y real-valued coordinates of a two-dimensional point. - @since OOo 2.0.0 + @since OOo 2.0 */ struct RealPoint2D { diff --git a/offapi/com/sun/star/geometry/RealRectangle2D.idl b/offapi/com/sun/star/geometry/RealRectangle2D.idl index 71b730ab4..d81a6d62a 100644 --- a/offapi/com/sun/star/geometry/RealRectangle2D.idl +++ b/offapi/com/sun/star/geometry/RealRectangle2D.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module geometry { /** This structure contains the necessary information for a two-dimensional rectangle.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct RealRectangle2D { diff --git a/offapi/com/sun/star/geometry/RealRectangle3D.idl b/offapi/com/sun/star/geometry/RealRectangle3D.idl index 4b0854487..880df8e7c 100644 --- a/offapi/com/sun/star/geometry/RealRectangle3D.idl +++ b/offapi/com/sun/star/geometry/RealRectangle3D.idl @@ -32,7 +32,7 @@ module com { module sun { module star { module geometry { /** This structure contains the necessary information for a three-dimensional cube.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct RealRectangle3D { diff --git a/offapi/com/sun/star/geometry/RealSize2D.idl b/offapi/com/sun/star/geometry/RealSize2D.idl index fa0d3cb2c..0177c57ca 100644 --- a/offapi/com/sun/star/geometry/RealSize2D.idl +++ b/offapi/com/sun/star/geometry/RealSize2D.idl @@ -33,7 +33,7 @@ module com { module sun { module star { module geometry { The data is stored real-valued.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct RealSize2D { diff --git a/offapi/com/sun/star/geometry/XMapping2D.idl b/offapi/com/sun/star/geometry/XMapping2D.idl index 2967d646e..981f5394b 100644 --- a/offapi/com/sun/star/geometry/XMapping2D.idl +++ b/offapi/com/sun/star/geometry/XMapping2D.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module geometry { pair of real numbers there must be another pair that is mapped upon them.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMapping2D : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/i18n/OrdinalSuffix.idl b/offapi/com/sun/star/i18n/OrdinalSuffix.idl index a2909ad40..b13beb501 100644 --- a/offapi/com/sun/star/i18n/OrdinalSuffix.idl +++ b/offapi/com/sun/star/i18n/OrdinalSuffix.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module i18n { /** provides access to locale specific ordinal suffix systems. - @since OOo2.2 + @since OOo 2.2 @internal diff --git a/offapi/com/sun/star/i18n/TextConversionOption.idl b/offapi/com/sun/star/i18n/TextConversionOption.idl index 79b0113fa..e6ca35218 100644 --- a/offapi/com/sun/star/i18n/TextConversionOption.idl +++ b/offapi/com/sun/star/i18n/TextConversionOption.idl @@ -59,7 +59,7 @@ published constants TextConversionOption /** Use Taiwan, HongKong SAR, and Macao SAR character variants for Simplified to Traditionary Chinese conversion - @since OOo 2.0.0 + @since OOo 2.0 */ const long USE_CHARACTER_VARIANTS = 2; // (1 << 1) }; diff --git a/offapi/com/sun/star/i18n/TransliterationModules.idl b/offapi/com/sun/star/i18n/TransliterationModules.idl index 0b629c034..51f37b62b 100644 --- a/offapi/com/sun/star/i18n/TransliterationModules.idl +++ b/offapi/com/sun/star/i18n/TransliterationModules.idl @@ -33,8 +33,12 @@ module com { module sun { module star { module i18n { //============================================================================= -/** Old transliteration module enumeration to use with - <member>XTransliteration::loadModule()</member> +/** Old transliteration module enumeration. + + <p> Use with <member>XTransliteration::loadModule()</member> and + <member scope="com::sun::star::util">SearchOptions::transliterateFlags</member> </p> + + <p> Note that values >=0x100 are logically or'ed with other values! </p> */ published enum TransliterationModules diff --git a/offapi/com/sun/star/i18n/XOrdinalSuffix.idl b/offapi/com/sun/star/i18n/XOrdinalSuffix.idl index e88c9005e..5d5587a04 100644 --- a/offapi/com/sun/star/i18n/XOrdinalSuffix.idl +++ b/offapi/com/sun/star/i18n/XOrdinalSuffix.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module i18n { /** provides access to locale specific ordinal suffix systems. - @since OOo2.2 + @since OOo 2.2 @internal diff --git a/offapi/com/sun/star/linguistic2/ConversionDictionary.idl b/offapi/com/sun/star/linguistic2/ConversionDictionary.idl index d56b4ffee..d81eae905 100644 --- a/offapi/com/sun/star/linguistic2/ConversionDictionary.idl +++ b/offapi/com/sun/star/linguistic2/ConversionDictionary.idl @@ -69,7 +69,7 @@ published service ConversionDictionary [optional] interface com::sun::star::util::XFlushable; /** - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface com::sun::star::linguistic2::XConversionPropertyType; }; diff --git a/offapi/com/sun/star/linguistic2/ConversionDictionaryType.idl b/offapi/com/sun/star/linguistic2/ConversionDictionaryType.idl index 954c7dd21..42c3262c4 100644 --- a/offapi/com/sun/star/linguistic2/ConversionDictionaryType.idl +++ b/offapi/com/sun/star/linguistic2/ConversionDictionaryType.idl @@ -44,7 +44,7 @@ constants ConversionDictionaryType /** Dictionary type for the conversion between Simplified and Traditionary Chinese - @since OOo 2.0.0 + @since OOo 2.0 */ const short SCHINESE_TCHINESE = 2; }; diff --git a/offapi/com/sun/star/linguistic2/ConversionPropertyType.idl b/offapi/com/sun/star/linguistic2/ConversionPropertyType.idl index b38e8956b..5197c7b25 100644 --- a/offapi/com/sun/star/linguistic2/ConversionPropertyType.idl +++ b/offapi/com/sun/star/linguistic2/ConversionPropertyType.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module linguistic2 { @see com::sun::star::linguistic2::XConversionDictionary @see com::sun::star::linguistic2::XConversionPropertyType - @since OOo 2.0.0 + @since OOo 2.0 */ constants ConversionPropertyType { diff --git a/offapi/com/sun/star/linguistic2/XConversionPropertyType.idl b/offapi/com/sun/star/linguistic2/XConversionPropertyType.idl index 7b1e2a27a..79c2de073 100644 --- a/offapi/com/sun/star/linguistic2/XConversionPropertyType.idl +++ b/offapi/com/sun/star/linguistic2/XConversionPropertyType.idl @@ -56,7 +56,7 @@ module com { module sun { module star { module linguistic2 { @see com::sun::star::linguistic2::XConversionDictionary @see com::sun::star::linguistic2::ConversionPropertyType - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XConversionPropertyType : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/mail/MailAttachment.idl b/offapi/com/sun/star/mail/MailAttachment.idl index 7d335bfb7..78325a8d4 100644 --- a/offapi/com/sun/star/mail/MailAttachment.idl +++ b/offapi/com/sun/star/mail/MailAttachment.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module mail { @see ::com::sun::star::mail::XMailMessage - @since OOo 2.0.0 + @since OOo 2.0 */ struct MailAttachment { diff --git a/offapi/com/sun/star/mail/MailException.idl b/offapi/com/sun/star/mail/MailException.idl index bafbd8193..8355699ff 100644 --- a/offapi/com/sun/star/mail/MailException.idl +++ b/offapi/com/sun/star/mail/MailException.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module mail { An MailException is the base of all mail related exceptions. - @since OOo 2.0.0 + @since OOo 2.0 */ exception MailException: com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/mail/MailMessage.idl b/offapi/com/sun/star/mail/MailMessage.idl index 2ced59572..658c9cfe1 100644 --- a/offapi/com/sun/star/mail/MailMessage.idl +++ b/offapi/com/sun/star/mail/MailMessage.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module mail { interface XMailMessage; /** - @since OOo 2.0.0 + @since OOo 2.0 */ service MailMessage: XMailMessage { diff --git a/offapi/com/sun/star/mail/MailServer.idl b/offapi/com/sun/star/mail/MailServer.idl index 0b1cb8b7c..7c9497fef 100644 --- a/offapi/com/sun/star/mail/MailServer.idl +++ b/offapi/com/sun/star/mail/MailServer.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module mail { interface XMailServer; /** - @since OOo 2.0.0 + @since OOo 2.0 */ service MailServer: XMailServer { diff --git a/offapi/com/sun/star/mail/MailServiceProvider.idl b/offapi/com/sun/star/mail/MailServiceProvider.idl index eabe2fc8f..e9e0f1dbb 100644 --- a/offapi/com/sun/star/mail/MailServiceProvider.idl +++ b/offapi/com/sun/star/mail/MailServiceProvider.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module mail { interface XMailService; /** - @since OOo 2.0.0 + @since OOo 2.0 */ service MailServiceProvider: XMailServiceProvider { diff --git a/offapi/com/sun/star/mail/MailServiceType.idl b/offapi/com/sun/star/mail/MailServiceType.idl index 42c7023ea..4bd5f8a37 100644 --- a/offapi/com/sun/star/mail/MailServiceType.idl +++ b/offapi/com/sun/star/mail/MailServiceType.idl @@ -31,7 +31,7 @@ module com { module sun { module star { module mail { /** - @since OOo 2.0.0 + @since OOo 2.0 */ enum MailServiceType { diff --git a/offapi/com/sun/star/mail/NoMailServiceProviderException.idl b/offapi/com/sun/star/mail/NoMailServiceProviderException.idl index a8dfb8514..1e913e3a0 100644 --- a/offapi/com/sun/star/mail/NoMailServiceProviderException.idl +++ b/offapi/com/sun/star/mail/NoMailServiceProviderException.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::MailService - @since OOo 2.0.0 + @since OOo 2.0 */ exception NoMailServiceProviderException: com::sun::star::mail::MailException { diff --git a/offapi/com/sun/star/mail/NoMailTransportProviderException.idl b/offapi/com/sun/star/mail/NoMailTransportProviderException.idl index a8d50b786..89341a4c7 100644 --- a/offapi/com/sun/star/mail/NoMailTransportProviderException.idl +++ b/offapi/com/sun/star/mail/NoMailTransportProviderException.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::MailServer - @since OOo 2.0.0 + @since OOo 2.0 */ exception NoMailTransportProviderException: com::sun::star::mail::MailException { diff --git a/offapi/com/sun/star/mail/SendMailMessageFailedException.idl b/offapi/com/sun/star/mail/SendMailMessageFailedException.idl index a9cb18d38..8eb498ee3 100644 --- a/offapi/com/sun/star/mail/SendMailMessageFailedException.idl +++ b/offapi/com/sun/star/mail/SendMailMessageFailedException.idl @@ -42,7 +42,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::XMailServer - @since OOo 2.0.0 + @since OOo 2.0 */ exception SendMailMessageFailedException: com::sun::star::mail::MailException { diff --git a/offapi/com/sun/star/mail/XAuthenticator.idl b/offapi/com/sun/star/mail/XAuthenticator.idl index 4f7ce9ce8..f3103d832 100644 --- a/offapi/com/sun/star/mail/XAuthenticator.idl +++ b/offapi/com/sun/star/mail/XAuthenticator.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module mail { An implementation of this interface may for instance show a dialog to query the user for the necessary data. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XAuthenticator: ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/mail/XConnectionListener.idl b/offapi/com/sun/star/mail/XConnectionListener.idl index 70a4677f5..025da122d 100644 --- a/offapi/com/sun/star/mail/XConnectionListener.idl +++ b/offapi/com/sun/star/mail/XConnectionListener.idl @@ -43,7 +43,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::XMailServer - @since OOo 2.0.0 + @since OOo 2.0 */ interface XConnectionListener: ::com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/mail/XMailMessage.idl b/offapi/com/sun/star/mail/XMailMessage.idl index 15de75b95..16edb5dfc 100644 --- a/offapi/com/sun/star/mail/XMailMessage.idl +++ b/offapi/com/sun/star/mail/XMailMessage.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::XMailServer - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMailMessage: ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/mail/XMailServer.idl b/offapi/com/sun/star/mail/XMailServer.idl index 57af147a5..99d751fb5 100644 --- a/offapi/com/sun/star/mail/XMailServer.idl +++ b/offapi/com/sun/star/mail/XMailServer.idl @@ -95,7 +95,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::XMailMessage - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMailServer: ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/mail/XMailService.idl b/offapi/com/sun/star/mail/XMailService.idl index 91076e071..cf8d25ec6 100644 --- a/offapi/com/sun/star/mail/XMailService.idl +++ b/offapi/com/sun/star/mail/XMailService.idl @@ -82,7 +82,7 @@ module com { module sun { module star { module mail { /** Represents a mail server abstraction. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMailService: ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/mail/XMailServiceProvider.idl b/offapi/com/sun/star/mail/XMailServiceProvider.idl index ed265e8f0..bdabc05b1 100644 --- a/offapi/com/sun/star/mail/XMailServiceProvider.idl +++ b/offapi/com/sun/star/mail/XMailServiceProvider.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module mail { /** A factory for creating different mail services. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XMailServiceProvider: ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/mail/XSmtpService.idl b/offapi/com/sun/star/mail/XSmtpService.idl index 5e490e0eb..949553cfe 100644 --- a/offapi/com/sun/star/mail/XSmtpService.idl +++ b/offapi/com/sun/star/mail/XSmtpService.idl @@ -64,7 +64,7 @@ module com { module sun { module star { module mail { @see com::sun::star::mail::XMailService @see com::sun::star::mail::XMailMessage - @since OOo 2.0.0 + @since OOo 2.0 */ interface XSmtpService: ::com::sun::star::mail::XMailService { diff --git a/offapi/com/sun/star/rendering/AnimationAttributes.idl b/offapi/com/sun/star/rendering/AnimationAttributes.idl index 50656d8ea..64e674681 100644 --- a/offapi/com/sun/star/rendering/AnimationAttributes.idl +++ b/offapi/com/sun/star/rendering/AnimationAttributes.idl @@ -35,7 +35,7 @@ module com { module sun { module star { module rendering { /** This structure contains attributes needed to run an animation. - @since OOo 2.0.0 + @since OOo 2.0 */ struct AnimationAttributes { diff --git a/offapi/com/sun/star/rendering/AnimationRepeat.idl b/offapi/com/sun/star/rendering/AnimationRepeat.idl index c29869422..bb0506376 100644 --- a/offapi/com/sun/star/rendering/AnimationRepeat.idl +++ b/offapi/com/sun/star/rendering/AnimationRepeat.idl @@ -35,7 +35,7 @@ module com { module sun { module star { module rendering { animation is driven through, thus defining the possible repeat modes.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants AnimationRepeat { diff --git a/offapi/com/sun/star/rendering/CanvasFactory.idl b/offapi/com/sun/star/rendering/CanvasFactory.idl index 80edd3a5f..996f019b7 100644 --- a/offapi/com/sun/star/rendering/CanvasFactory.idl +++ b/offapi/com/sun/star/rendering/CanvasFactory.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module rendering { a service name to try first. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service CanvasFactory : com::sun::star::lang::XMultiComponentFactory; diff --git a/offapi/com/sun/star/rendering/Caret.idl b/offapi/com/sun/star/rendering/Caret.idl index 439b33643..0c7fee72b 100644 --- a/offapi/com/sun/star/rendering/Caret.idl +++ b/offapi/com/sun/star/rendering/Caret.idl @@ -34,7 +34,7 @@ module com { module sun { module star { module rendering { This structure is used from the <type>XTextLayout</type> interface to transport information regarding a text caret.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct Caret { diff --git a/offapi/com/sun/star/rendering/CompositeOperation.idl b/offapi/com/sun/star/rendering/CompositeOperation.idl index 85e4c1e35..dd3a103c5 100644 --- a/offapi/com/sun/star/rendering/CompositeOperation.idl +++ b/offapi/com/sun/star/rendering/CompositeOperation.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module rendering { different composite modes (wherein Aa and Ab denote source and destination alpha, respectively).<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants CompositeOperation { diff --git a/offapi/com/sun/star/rendering/EmphasisMark.idl b/offapi/com/sun/star/rendering/EmphasisMark.idl index abda617a1..f70c456cd 100644 --- a/offapi/com/sun/star/rendering/EmphasisMark.idl +++ b/offapi/com/sun/star/rendering/EmphasisMark.idl @@ -34,7 +34,7 @@ module com { module sun { module star { module rendering { These constants control the automatic rendering of emphasis marks for a given font.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants EmphasisMark { diff --git a/offapi/com/sun/star/rendering/FillRule.idl b/offapi/com/sun/star/rendering/FillRule.idl index 105fe3b17..d445ec879 100644 --- a/offapi/com/sun/star/rendering/FillRule.idl +++ b/offapi/com/sun/star/rendering/FillRule.idl @@ -32,7 +32,7 @@ module com { module sun { module star { module rendering { /** Determines which algorithm to use when determining inside and outside of filled poly-polygons. - @since OOo 2.0.0 + @since OOo 2.0 */ enum FillRule { diff --git a/offapi/com/sun/star/rendering/FloatingPointBitmapFormat.idl b/offapi/com/sun/star/rendering/FloatingPointBitmapFormat.idl index 69c082044..f772fe299 100644 --- a/offapi/com/sun/star/rendering/FloatingPointBitmapFormat.idl +++ b/offapi/com/sun/star/rendering/FloatingPointBitmapFormat.idl @@ -31,7 +31,7 @@ module com { module sun { module star { module rendering { /** This structure describes format of a floating point bitmap.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants FloatingPointBitmapFormat { diff --git a/offapi/com/sun/star/rendering/FloatingPointBitmapLayout.idl b/offapi/com/sun/star/rendering/FloatingPointBitmapLayout.idl index b49ab3504..045357699 100644 --- a/offapi/com/sun/star/rendering/FloatingPointBitmapLayout.idl +++ b/offapi/com/sun/star/rendering/FloatingPointBitmapLayout.idl @@ -42,7 +42,7 @@ module com { module sun { module star { module rendering { This structure collects all necessary information to describe the memory layout of a bitmap having floating point color channels<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct FloatingPointBitmapLayout { diff --git a/offapi/com/sun/star/rendering/FontInfo.idl b/offapi/com/sun/star/rendering/FontInfo.idl index bd8fd1a52..ebc8c68e8 100644 --- a/offapi/com/sun/star/rendering/FontInfo.idl +++ b/offapi/com/sun/star/rendering/FontInfo.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module rendering { /** This structure provides information about a specific font.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct FontInfo { diff --git a/offapi/com/sun/star/rendering/FontMetrics.idl b/offapi/com/sun/star/rendering/FontMetrics.idl index c802ab317..638bcb78c 100644 --- a/offapi/com/sun/star/rendering/FontMetrics.idl +++ b/offapi/com/sun/star/rendering/FontMetrics.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module rendering { underlying font technology, actual device output might be off by up to one device pixel from the transformed metrics. - @since OOo 2.0.0 + @since OOo 2.0 */ struct FontMetrics { diff --git a/offapi/com/sun/star/rendering/FontRequest.idl b/offapi/com/sun/star/rendering/FontRequest.idl index bbc045c3d..6ee711a66 100644 --- a/offapi/com/sun/star/rendering/FontRequest.idl +++ b/offapi/com/sun/star/rendering/FontRequest.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module rendering { <member>FontInfo::StyleName</member> empty, if font selection should only happen via the PANOSE description. - @since OOo 2.0.0 + @since OOo 2.0 */ struct FontRequest { diff --git a/offapi/com/sun/star/rendering/IntegerBitmapLayout.idl b/offapi/com/sun/star/rendering/IntegerBitmapLayout.idl index c4c6f10a3..18ada68da 100644 --- a/offapi/com/sun/star/rendering/IntegerBitmapLayout.idl +++ b/offapi/com/sun/star/rendering/IntegerBitmapLayout.idl @@ -42,7 +42,7 @@ module com { module sun { module star { module rendering { This structure collects all necessary information to describe the memory layout of a bitmap having integer color channels<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct IntegerBitmapLayout { diff --git a/offapi/com/sun/star/rendering/InterpolationMode.idl b/offapi/com/sun/star/rendering/InterpolationMode.idl index 8ec16cd57..ac5c47f7a 100644 --- a/offapi/com/sun/star/rendering/InterpolationMode.idl +++ b/offapi/com/sun/star/rendering/InterpolationMode.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module rendering { takes place between two consecutive frames of a discrete animation sequence. - @since OOo 2.0.0 + @since OOo 2.0 */ constants InterpolationMode { diff --git a/offapi/com/sun/star/rendering/PathCapType.idl b/offapi/com/sun/star/rendering/PathCapType.idl index b00bfa265..9d8cc40f3 100644 --- a/offapi/com/sun/star/rendering/PathCapType.idl +++ b/offapi/com/sun/star/rendering/PathCapType.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module rendering { different shapes (which are, of course, only visible for strokes wider than one device pixel).<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants PathCapType { diff --git a/offapi/com/sun/star/rendering/PathJoinType.idl b/offapi/com/sun/star/rendering/PathJoinType.idl index 294978b67..b555f8677 100644 --- a/offapi/com/sun/star/rendering/PathJoinType.idl +++ b/offapi/com/sun/star/rendering/PathJoinType.idl @@ -35,7 +35,7 @@ module com { module sun { module star { module rendering { several different shapes (which are of course only visible for strokes wider than one device pixel).<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants PathJoinType { diff --git a/offapi/com/sun/star/rendering/RenderState.idl b/offapi/com/sun/star/rendering/RenderState.idl index 3c80e39bf..4e9cf6533 100644 --- a/offapi/com/sun/star/rendering/RenderState.idl +++ b/offapi/com/sun/star/rendering/RenderState.idl @@ -45,7 +45,7 @@ interface XPolyPolygon2D; state, i.e. the common setup required to render each individual <type>XCanvas</type> primitive.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct RenderState { diff --git a/offapi/com/sun/star/rendering/RenderingIntent.idl b/offapi/com/sun/star/rendering/RenderingIntent.idl index 0d50ddf9b..231c0edbc 100644 --- a/offapi/com/sun/star/rendering/RenderingIntent.idl +++ b/offapi/com/sun/star/rendering/RenderingIntent.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module rendering { href="http://en.wikipedia.org/wiki/Rendering_intent">Wikipedia</a> for a thorough explanation. - @since OOo 2.0.0 + @since OOo 2.0 */ constants RenderingIntent { diff --git a/offapi/com/sun/star/rendering/RepaintResult.idl b/offapi/com/sun/star/rendering/RepaintResult.idl index 7f5d36d49..5abdc7b72 100644 --- a/offapi/com/sun/star/rendering/RepaintResult.idl +++ b/offapi/com/sun/star/rendering/RepaintResult.idl @@ -32,7 +32,7 @@ module com { module sun { module star { module rendering { /** These constants specify the result of the <type>XCachedPrimitive</type> render operation.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants RepaintResult { diff --git a/offapi/com/sun/star/rendering/StringContext.idl b/offapi/com/sun/star/rendering/StringContext.idl index 39b7f66e1..ee16c5220 100644 --- a/offapi/com/sun/star/rendering/StringContext.idl +++ b/offapi/com/sun/star/rendering/StringContext.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module rendering { here, because in several languages, glyph selection is context dependent.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct StringContext { diff --git a/offapi/com/sun/star/rendering/TextDirection.idl b/offapi/com/sun/star/rendering/TextDirection.idl index 3629a1775..5a0571fce 100644 --- a/offapi/com/sun/star/rendering/TextDirection.idl +++ b/offapi/com/sun/star/rendering/TextDirection.idl @@ -33,7 +33,7 @@ module com { module sun { module star { module rendering { This also changes the interpretation of the start point.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants TextDirection { diff --git a/offapi/com/sun/star/rendering/TextHit.idl b/offapi/com/sun/star/rendering/TextHit.idl index 6c4e1960a..bd7bf0555 100644 --- a/offapi/com/sun/star/rendering/TextHit.idl +++ b/offapi/com/sun/star/rendering/TextHit.idl @@ -34,7 +34,7 @@ module com { module sun { module star { module rendering { This structure is used from the <type>XTextLayout</type> interface to transport information regarding hit tests.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct TextHit { diff --git a/offapi/com/sun/star/rendering/Texture.idl b/offapi/com/sun/star/rendering/Texture.idl index 02362c3ce..a7bbf35b4 100644 --- a/offapi/com/sun/star/rendering/Texture.idl +++ b/offapi/com/sun/star/rendering/Texture.idl @@ -51,7 +51,7 @@ interface XParametricPolyPolygon2D; as the hatch and the gradient. The transformation member can then be used to scale the complete texture as it fits suit.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct Texture { diff --git a/offapi/com/sun/star/rendering/TexturingMode.idl b/offapi/com/sun/star/rendering/TexturingMode.idl index 9dfcef6f6..a97693e62 100644 --- a/offapi/com/sun/star/rendering/TexturingMode.idl +++ b/offapi/com/sun/star/rendering/TexturingMode.idl @@ -32,7 +32,7 @@ module com { module sun { module star { module rendering { /** Enumeration of possible values to spread a texture across a primitive. - @since OOo 2.0.0 + @since OOo 2.0 */ constants TexturingMode { diff --git a/offapi/com/sun/star/rendering/ViewState.idl b/offapi/com/sun/star/rendering/ViewState.idl index 34c3bc034..1f35b74c8 100644 --- a/offapi/com/sun/star/rendering/ViewState.idl +++ b/offapi/com/sun/star/rendering/ViewState.idl @@ -41,7 +41,7 @@ interface XPolyPolygon2D; i.e. the invariant setup used when painting a whole view of something.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ struct ViewState { diff --git a/offapi/com/sun/star/rendering/VolatileContentDestroyedException.idl b/offapi/com/sun/star/rendering/VolatileContentDestroyedException.idl index 62fbc9ec9..d8681859e 100644 --- a/offapi/com/sun/star/rendering/VolatileContentDestroyedException.idl +++ b/offapi/com/sun/star/rendering/VolatileContentDestroyedException.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module rendering { When accessing or rendering XVolatileBitmap data, that has been invalidated by the system, this exception will be thrown.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ exception VolatileContentDestroyedException : ::com::sun::star::uno::Exception { diff --git a/offapi/com/sun/star/rendering/XAnimatedSprite.idl b/offapi/com/sun/star/rendering/XAnimatedSprite.idl index 49f5be001..37d375ed1 100644 --- a/offapi/com/sun/star/rendering/XAnimatedSprite.idl +++ b/offapi/com/sun/star/rendering/XAnimatedSprite.idl @@ -54,7 +54,7 @@ module com { module sun { module star { module rendering { This interface can be used to control an animated sprite object on an XSpriteCanvas. Sprites are moving, animated objects.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XAnimatedSprite : XSprite { diff --git a/offapi/com/sun/star/rendering/XAnimation.idl b/offapi/com/sun/star/rendering/XAnimation.idl index b7ba4809f..8008c3d8b 100644 --- a/offapi/com/sun/star/rendering/XAnimation.idl +++ b/offapi/com/sun/star/rendering/XAnimation.idl @@ -58,7 +58,7 @@ module com { module sun { module star { module rendering { is used by the <type>XCanvas</type> interface to render generic animations.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XAnimation : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XBezierPolyPolygon2D.idl b/offapi/com/sun/star/rendering/XBezierPolyPolygon2D.idl index 150be04e9..e464c59b8 100644 --- a/offapi/com/sun/star/rendering/XBezierPolyPolygon2D.idl +++ b/offapi/com/sun/star/rendering/XBezierPolyPolygon2D.idl @@ -54,7 +54,7 @@ module com { module sun { module star { module rendering { By convention, a <type>RealBezierSegment2D</type> is a straight line segment, if all three contained points are strictly equal.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XBezierPolyPolygon2D : XPolyPolygon2D { diff --git a/offapi/com/sun/star/rendering/XBitmap.idl b/offapi/com/sun/star/rendering/XBitmap.idl index a8a287a70..e58ba975d 100644 --- a/offapi/com/sun/star/rendering/XBitmap.idl +++ b/offapi/com/sun/star/rendering/XBitmap.idl @@ -55,7 +55,7 @@ interface XBitmapCanvas; <type>XIeeeDoubleBitmap</type>, <type>XIeeeFloatBitmap</type> and <type>XHalfFloatBitmap</type> interfaces.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XBitmap : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XBitmapCanvas.idl b/offapi/com/sun/star/rendering/XBitmapCanvas.idl index 48d56c575..fb4a2df3b 100644 --- a/offapi/com/sun/star/rendering/XBitmapCanvas.idl +++ b/offapi/com/sun/star/rendering/XBitmapCanvas.idl @@ -59,7 +59,7 @@ module com { module sun { module star { module rendering { bitmapped canvases, where additional methods for accessing and moving of bitmap content are provided.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XBitmapCanvas : XCanvas { diff --git a/offapi/com/sun/star/rendering/XBitmapPalette.idl b/offapi/com/sun/star/rendering/XBitmapPalette.idl index 86f0501e6..f15073301 100644 --- a/offapi/com/sun/star/rendering/XBitmapPalette.idl +++ b/offapi/com/sun/star/rendering/XBitmapPalette.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module rendering { /** Interface to access the palette of a color-indexed bitmap. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XBitmapPalette : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XBufferController.idl b/offapi/com/sun/star/rendering/XBufferController.idl index e7238195e..1e8e2bf6b 100644 --- a/offapi/com/sun/star/rendering/XBufferController.idl +++ b/offapi/com/sun/star/rendering/XBufferController.idl @@ -42,7 +42,7 @@ module com { module sun { module star { module rendering { This interface provides methods to enable and control double/multi-buffering facilities on screen devices.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XBufferController : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XCachedPrimitive.idl b/offapi/com/sun/star/rendering/XCachedPrimitive.idl index 62aacef1a..5870d1679 100644 --- a/offapi/com/sun/star/rendering/XCachedPrimitive.idl +++ b/offapi/com/sun/star/rendering/XCachedPrimitive.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module rendering { This interface provides a method to quickly redraw some <type>XCanvas</type> primitives, using cached data.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XCachedPrimitive : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XCanvas.idl b/offapi/com/sun/star/rendering/XCanvas.idl index bb3df8a6c..b6ce01dc3 100644 --- a/offapi/com/sun/star/rendering/XCanvas.idl +++ b/offapi/com/sun/star/rendering/XCanvas.idl @@ -148,7 +148,7 @@ interface XTextLayout; <member>getDevice()</member> call) - they will then internally optimize to the underlying graphics subsystem.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XCanvas : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XIntegerBitmap.idl b/offapi/com/sun/star/rendering/XIntegerBitmap.idl index 4ce4579d1..2950a8e42 100644 --- a/offapi/com/sun/star/rendering/XIntegerBitmap.idl +++ b/offapi/com/sun/star/rendering/XIntegerBitmap.idl @@ -52,7 +52,7 @@ module com { module sun { module star { module rendering { /** This is a specialized interface for bitmaps having integer color channels.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XIntegerBitmap : XIntegerReadOnlyBitmap { diff --git a/offapi/com/sun/star/rendering/XLinePolyPolygon2D.idl b/offapi/com/sun/star/rendering/XLinePolyPolygon2D.idl index eedb1e140..ae4215aaa 100644 --- a/offapi/com/sun/star/rendering/XLinePolyPolygon2D.idl +++ b/offapi/com/sun/star/rendering/XLinePolyPolygon2D.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module rendering { /** Specialized interface for a 2D poly-polygon containing only straight line segments. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XLinePolyPolygon2D : XPolyPolygon2D { diff --git a/offapi/com/sun/star/rendering/XPolyPolygon2D.idl b/offapi/com/sun/star/rendering/XPolyPolygon2D.idl index b663cd28a..86b24b721 100644 --- a/offapi/com/sun/star/rendering/XPolyPolygon2D.idl +++ b/offapi/com/sun/star/rendering/XPolyPolygon2D.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module rendering { /** Generic interface for poly-polygons in 2D. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XPolyPolygon2D : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/rendering/XTextLayout.idl b/offapi/com/sun/star/rendering/XTextLayout.idl index 1059eb676..a6930659d 100644 --- a/offapi/com/sun/star/rendering/XTextLayout.idl +++ b/offapi/com/sun/star/rendering/XTextLayout.idl @@ -90,7 +90,7 @@ interface XPolyPolygon2D; might be off by up to one device pixel from the transformed metrics.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XTextLayout : ::com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/report/XReportControlFormat.idl b/offapi/com/sun/star/report/XReportControlFormat.idl index 2dbf1e5ba..c15278866 100644 --- a/offapi/com/sun/star/report/XReportControlFormat.idl +++ b/offapi/com/sun/star/report/XReportControlFormat.idl @@ -143,7 +143,7 @@ interface XReportControlFormat /** If this optional property is <TRUE/>, then the characters are invisible. - @since OOo 2.0.0 + @since OOo 2.0 */ [attribute,bound] boolean CharHidden { diff --git a/offapi/com/sun/star/resource/OfficeResourceLoader.idl b/offapi/com/sun/star/resource/OfficeResourceLoader.idl index 307b40d5e..de0f7d86d 100644 --- a/offapi/com/sun/star/resource/OfficeResourceLoader.idl +++ b/offapi/com/sun/star/resource/OfficeResourceLoader.idl @@ -70,7 +70,7 @@ module com { module sun { module star { module resource { OpenOffice.org build), you are <strong>strongly</strong> discouraged from using the <type>OfficeResoureLoader</type> service in a component which targets more than one particular OpenOffice.org build.</p> - @since OpenOffice.org 2.0.3 + @since OOo 2.0.3 */ singleton OfficeResourceLoader : XResourceBundleLoader; diff --git a/offapi/com/sun/star/script/browse/BrowseNode.idl b/offapi/com/sun/star/script/browse/BrowseNode.idl index b7e3090df..899d7afe3 100755 --- a/offapi/com/sun/star/script/browse/BrowseNode.idl +++ b/offapi/com/sun/star/script/browse/BrowseNode.idl @@ -46,7 +46,7 @@ module com { XBrowseNode interface. XInvocation is an optional interface that is used to execute macros, or to create/delete/rename macros or macro containers. - @since OOo 2.0.0 + @since OOo 2.0 */ service BrowseNode { diff --git a/offapi/com/sun/star/script/browse/BrowseNodeFactory.idl b/offapi/com/sun/star/script/browse/BrowseNodeFactory.idl index 62113f0ca..b0cf65058 100755 --- a/offapi/com/sun/star/script/browse/BrowseNodeFactory.idl +++ b/offapi/com/sun/star/script/browse/BrowseNodeFactory.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module script { module browse { /** This service is used to create Root XBrowseNodes. - @since OOo 2.0.0 + @since OOo 2.0 */ service BrowseNodeFactory { @@ -52,7 +52,7 @@ service BrowseNodeFactory /singletons/com.sun.star.script.theBrowseNodeFactory </pre> - @since OOo 2.0.0 + @since OOo 2.0 */ singleton theBrowseNodeFactory { diff --git a/offapi/com/sun/star/sdb/DatabaseContext.idl b/offapi/com/sun/star/sdb/DatabaseContext.idl index c727733e3..77ff3db29 100644 --- a/offapi/com/sun/star/sdb/DatabaseContext.idl +++ b/offapi/com/sun/star/sdb/DatabaseContext.idl @@ -96,7 +96,7 @@ published service DatabaseContext are maintained, so if possible at all, you should use this interface, instead of modifying or querying the configuration data directly.</p> - @since OpenOffice.org 3.3 + @since OOo 3.3 */ [optional] interface XDatabaseRegistrations; }; diff --git a/offapi/com/sun/star/sdb/DatabaseDocument.idl b/offapi/com/sun/star/sdb/DatabaseDocument.idl index 6cfd84698..33d86e373 100644 --- a/offapi/com/sun/star/sdb/DatabaseDocument.idl +++ b/offapi/com/sun/star/sdb/DatabaseDocument.idl @@ -43,7 +43,7 @@ module com { module sun { module star { module sdb { /** specifies a link to a document associated with a database document - @since OOo 2.0.0 + @since OOo 2.0 @deprecated */ published service DatabaseDocument diff --git a/offapi/com/sun/star/sdb/DocumentSaveRequest.idl b/offapi/com/sun/star/sdb/DocumentSaveRequest.idl index a6b726c64..bf496ce58 100644 --- a/offapi/com/sun/star/sdb/DocumentSaveRequest.idl +++ b/offapi/com/sun/star/sdb/DocumentSaveRequest.idl @@ -44,7 +44,7 @@ <p> Usually thrown if someone tries to save a document which hasn't a name yet. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ exception DocumentSaveRequest: com::sun::star::task::ClassifiedInteractionRequest { diff --git a/offapi/com/sun/star/sdb/OfficeDatabaseDocument.idl b/offapi/com/sun/star/sdb/OfficeDatabaseDocument.idl index cbcba773f..fedbe81cc 100644 --- a/offapi/com/sun/star/sdb/OfficeDatabaseDocument.idl +++ b/offapi/com/sun/star/sdb/OfficeDatabaseDocument.idl @@ -63,7 +63,7 @@ module com { module sun { module star { module sdb { @see com::sun::star::sdb::XOfficeDatabaseDocument @see com::sun::star::document::OfficeDocument - @since OOo 2.0.0 + @since OOo 2.0 */ service OfficeDatabaseDocument { diff --git a/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl b/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl index cd0db2011..013ec0ab4 100644 --- a/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl +++ b/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl @@ -47,7 +47,7 @@ interface XDatabaseRegistrationsListener; if possible at all, use this interface, instead of modifying or querying the configuration data directly.</p> - @since OpenOffice.org 3.3 + @since OOo 3.3 */ interface XDatabaseRegistrations { diff --git a/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl b/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl index de38921bd..789dfa323 100644 --- a/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl +++ b/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module sdb { @see XDatabaseRegistrations - @since OpenOffice.org 3.3 + @since OOo 3.3 */ interface XDatabaseRegistrationsListener : ::com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/sdb/XInteractionDocumentSave.idl b/offapi/com/sun/star/sdb/XInteractionDocumentSave.idl index f4617aebb..d74584d30 100644 --- a/offapi/com/sun/star/sdb/XInteractionDocumentSave.idl +++ b/offapi/com/sun/star/sdb/XInteractionDocumentSave.idl @@ -43,7 +43,7 @@ module com { module sun { module star { module sdb { This continuation is typically used in conjunction with a <type scope="com::sun::star::sdb">DocumentSaveRequest</type>. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XInteractionDocumentSave: com::sun::star::task::XInteractionContinuation { diff --git a/offapi/com/sun/star/sdb/XSubDocument.idl b/offapi/com/sun/star/sdb/XSubDocument.idl index c722259f2..92a09e586 100644 --- a/offapi/com/sun/star/sdb/XSubDocument.idl +++ b/offapi/com/sun/star/sdb/XSubDocument.idl @@ -52,7 +52,7 @@ interface XSubDocument or an <type scope="com::sun::star::frame">XController</type> if the sub document does not have an own model. - @raises ::com::sun::star::lang::WrappedTargetException + @throws ::com::sun::star::lang::WrappedTargetException if an error occurs during opening the document */ ::com::sun::star::lang::XComponent @@ -66,7 +66,7 @@ interface XSubDocument or an <type scope="com::sun::star::frame">XController</type> if the sub document does not have an own model. - @raises ::com::sun::star::lang::WrappedTargetException + @throws ::com::sun::star::lang::WrappedTargetException if an error occurs during opening the document */ ::com::sun::star::lang::XComponent @@ -75,7 +75,7 @@ interface XSubDocument /** stores the sub document, if it had previously been opened in either mode - @raises ::com::sun::star::lang::WrappedTargetException + @throws ::com::sun::star::lang::WrappedTargetException if an error occurs during storing the document */ void store() @@ -86,7 +86,7 @@ interface XSubDocument @return <TRUE/> if and only if the document could be closed, <FALSE/> otherwise, e.g. if the closing has been vetoed by the user. - @raises ::com::sun::star::lang::WrappedTargetException + @throws ::com::sun::star::lang::WrappedTargetException if an error occurs during closing the document */ boolean close() diff --git a/offapi/com/sun/star/sdb/application/DatabaseObject.idl b/offapi/com/sun/star/sdb/application/DatabaseObject.idl index abb5b356e..f961a569f 100644 --- a/offapi/com/sun/star/sdb/application/DatabaseObject.idl +++ b/offapi/com/sun/star/sdb/application/DatabaseObject.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module sdb { module application { /** denotes different objects within a database document - @since OOo 2.2.0 + @since OOo 2.2 @see DatabaseObjectContainer */ diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl index b90eb751a..00fff0afb 100644 --- a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl +++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl @@ -52,7 +52,7 @@ module com { module sun { module star { module sdb { module application { @see com::sun::star::frame::Controller @see com::sun::star::sdb::DatabaseDocument - @since OOo 2.2.0 + @since OOo 2.2 */ interface XDatabaseDocumentUI { diff --git a/offapi/com/sun/star/sdb/application/XTableUIProvider.idl b/offapi/com/sun/star/sdb/application/XTableUIProvider.idl index fbc71078e..1e2fba4df 100644 --- a/offapi/com/sun/star/sdb/application/XTableUIProvider.idl +++ b/offapi/com/sun/star/sdb/application/XTableUIProvider.idl @@ -45,7 +45,7 @@ interface XDatabaseDocumentUI; @see com::sun::star::sdb::Connection - @since OOo 2.2.0 + @since OOo 2.2 */ interface XTableUIProvider { diff --git a/offapi/com/sun/star/sdbc/DataType.idl b/offapi/com/sun/star/sdbc/DataType.idl index 915380923..6f5b9b309 100644 --- a/offapi/com/sun/star/sdbc/DataType.idl +++ b/offapi/com/sun/star/sdbc/DataType.idl @@ -133,7 +133,7 @@ published constants DataType /** identifies the generic SQL type * <code>BOOLEAN</code>. * - * @since OOo 2.0.0 + * @since OOo 2.0 */ const long BOOLEAN = 16; }; diff --git a/offapi/com/sun/star/awt/grid/XGridCell.idl b/offapi/com/sun/star/security/CertAltNameEntry.idl index 7b6ea52b6..40ad93d76 100644 --- a/offapi/com/sun/star/awt/grid/XGridCell.idl +++ b/offapi/com/sun/star/security/CertAltNameEntry.idl @@ -24,33 +24,36 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __com_sun_star_awt_grid_XGridCell_idl__ -#define __com_sun_star_awt_grid_XGridCell_idl__ -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif - +#ifndef __com_sun_star_security_CertAltNameEntry_idl__ +#define __com_sun_star_security_CertAltNameEntry_idl__ + +#include <com/sun/star/security/ExtAltNameType.idl> //============================================================================= -module com { module sun { module star { module awt { module grid { + module com { module sun { module star { module security { //============================================================================= - -interface XGridCell +/** + * struct contains a single entry within a Subject Alternative Name Extension of a + * X509 certificate. + */ +struct CertAltNameEntry { + /** + * defines the type of the value . With this information you can determine how to interprete the Any value. + * @see com::sun::star::security::ExtAltNameType + */ + com::sun::star::security::ExtAltNameType Type; - [attribute] string Value; - - [attribute] boolean Editable; - - [attribute] any Data; + /** + * stores the value of entry. + */ + any Value; }; -//============================================================================= - -}; }; }; }; }; - -#endif + +}; }; }; }; +#endif diff --git a/offapi/com/sun/star/security/ExtAltNameType.idl b/offapi/com/sun/star/security/ExtAltNameType.idl new file mode 100644 index 000000000..aec560a65 --- /dev/null +++ b/offapi/com/sun/star/security/ExtAltNameType.idl @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +/** -- idl definition -- **/ + +#ifndef __com_sun_star_security_ExtAltNameType_idl_ +#define __com_sun_star_security_ExtAltNameType_idl_ + +#include <com/sun/star/uno/XInterface.idl> + +module com { module sun { module star { module security { + +/** + * Constant definiton of a certificate container status. + */ +enum ExtAltNameType +{ + /** + * Cutomize name/value pair + * The value of CertAltNameEntry contains a NamedValue. + * + * @see com::sun::star::security::CertAltNameEntry + */ + OTHER_NAME, + + /** + * The entry contains rfc822 name. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + RFC822_NAME, + + /** + * The entry contains a dns name. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + DNS_NAME, + + /** + * Currently unsupported. + */ + DIRECTORY_NAME, + + /** + * The entry contains an url. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + URL, + + /** + * The entry contains a ip address. + * The value of CertAltNameEntry contains a Sequence of sal_Int8. + * + * @see com::sun::star::security::CertAltNameEntry + */ + IP_ADDRESS, + + /** + * The entry contains a registered id. + * The value of CertAltNameEntry contains a OUString. + * + * @see com::sun::star::security::CertAltNameEntry + */ + REGISTERED_ID, + + /** + * Currently unsupported. + */ + EDI_PARTY_NAME, + + /** + * Currently unsupported. + */ + X400_ADDRESS + +}; + +} ; } ; } ; } ; + +#endif + diff --git a/offapi/com/sun/star/security/SerialNumberAdapter.idl b/offapi/com/sun/star/security/SerialNumberAdapter.idl index c6fbcf5f0..40cb3a3e4 100644 --- a/offapi/com/sun/star/security/SerialNumberAdapter.idl +++ b/offapi/com/sun/star/security/SerialNumberAdapter.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module security { <p>An implementation of this service enables the conversion of certificate serial number to and from a string</p> - @since OOo 3.1.0 + @since OOo 3.1 */ service SerialNumberAdapter : XSerialNumberAdapter; diff --git a/offapi/com/sun/star/chart2/ViewLegendEntry.idl b/offapi/com/sun/star/security/XSanExtension.idl index ce50a03b7..54133d038 100644 --- a/offapi/com/sun/star/chart2/ViewLegendEntry.idl +++ b/offapi/com/sun/star/security/XSanExtension.idl @@ -24,35 +24,34 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef com_sun_star_chart2_ViewLegendEntry_idl -#define com_sun_star_chart2_ViewLegendEntry_idl + +//i20156 - new file for xmlsecurity module -#include <com/sun/star/drawing/XShape.idl> -#include <com/sun/star/chart2/XFormattedString.idl> +/** -- idl definition -- **/ -//============================================================================= +#ifndef __com_sun_star_security_XSanExtension_idl_ +#define __com_sun_star_security_XSanExtension_idl_ -module com { module sun { module star { module chart2 { +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/security/XCertificateExtension.idl> +#include <com/sun/star/security/CertAltNameEntry.idl> -//============================================================================= +module com { module sun { module star { module security { /** + * Interface of a X509 Subject Alternative Name Certificate Extension + * + * <p>This interface represents a x509 certificate extension.</p> */ -struct ViewLegendEntry +interface XSanExtension : com::sun::star::security::XCertificateExtension { - /** The legend symbol that represents a data series or other - information contained in the legend - */ - ::com::sun::star::drawing::XShape aSymbol; - - /** The descriptive text for a legend entry. - */ - sequence< XFormattedString > aLabel; -}; - -//============================================================================= + /** + * Contains the alternative names of a certificate + */ + [attribute, readonly] sequence< com::sun::star::security::CertAltNameEntry > AlternativeNames; +}; -}; }; }; }; +} ; } ; } ; } ; -#endif +#endif diff --git a/offapi/com/sun/star/security/makefile.mk b/offapi/com/sun/star/security/makefile.mk index 21667da10..2064e9fb4 100644 --- a/offapi/com/sun/star/security/makefile.mk +++ b/offapi/com/sun/star/security/makefile.mk @@ -59,7 +59,13 @@ IDLFILES=\ XSerialNumberAdapter.idl \ SerialNumberAdapter.idl \ CertificateContainer.idl \ - CertificateContainerStatus.idl + CertificateContainerStatus.idl \ + ExtAltNameType.idl \ + XSanExtension.idl \ + CertAltNameEntry.idl + + + # ------------------------------------------------------------------ diff --git a/offapi/com/sun/star/sheet/ActivationEvent.idl b/offapi/com/sun/star/sheet/ActivationEvent.idl index d0f194be7..7cf624f6a 100644 --- a/offapi/com/sun/star/sheet/ActivationEvent.idl +++ b/offapi/com/sun/star/sheet/ActivationEvent.idl @@ -44,7 +44,7 @@ /** describes a change of the active sheet. The new active sheet is given with this event. - @since OOo 2.0.0 + @since OOo 2.0 */ published struct ActivationEvent: com::sun::star::lang::EventObject diff --git a/offapi/com/sun/star/sheet/CellAreaLink.idl b/offapi/com/sun/star/sheet/CellAreaLink.idl index 555f8515f..58f1883bd 100644 --- a/offapi/com/sun/star/sheet/CellAreaLink.idl +++ b/offapi/com/sun/star/sheet/CellAreaLink.idl @@ -106,7 +106,7 @@ published service CellAreaLink /** specifies the time between two refresh actions in seconds. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RefreshPeriod; diff --git a/offapi/com/sun/star/sheet/DDEItemInfo.idl b/offapi/com/sun/star/sheet/DDEItemInfo.idl index 0d4267e55..68d68d768 100644 --- a/offapi/com/sun/star/sheet/DDEItemInfo.idl +++ b/offapi/com/sun/star/sheet/DDEItemInfo.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module sheet { A DDE connection consists of the DDE service name, the DDE topic and a list of DDE items which may contain cached result sets. - @since OOo3.1 + @since OOo 3.1 */ struct DDEItemInfo { diff --git a/offapi/com/sun/star/sheet/DDELinkInfo.idl b/offapi/com/sun/star/sheet/DDELinkInfo.idl index a7d6c9405..22da15ff6 100644 --- a/offapi/com/sun/star/sheet/DDELinkInfo.idl +++ b/offapi/com/sun/star/sheet/DDELinkInfo.idl @@ -51,7 +51,7 @@ module com { module sun { module star { module sheet { single quotes they are escaped by doubling them, as usual, for example <code>=[2]!'''Sheet name''.A1'</code> in a "soffice" service.</p> - @since OOo3.1 + @since OOo 3.1 */ struct DDELinkInfo { diff --git a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl index 070ac31d0..d1da44027 100644 --- a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl +++ b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl @@ -80,7 +80,7 @@ published service DataPilotDescriptor /** specifies parameters to create the data pilot table from a database. @see DatabaseImportDescriptor - @since OOo 3.3.0 + @since OOo 3.3 */ [optional, property] sequence< com::sun::star::beans::PropertyValue > ImportDescriptor; @@ -90,7 +90,7 @@ published service DataPilotDescriptor /** specifies the name of a <type>DataPilotSource</type> implementation for the data pilot table. - @since OOo 3.3.0 + @since OOo 3.3 */ [optional, property] string SourceServiceName; @@ -100,32 +100,33 @@ published service DataPilotDescriptor /** specifies arguments that are passed to the implementation named by <member>SourceServiceName</member>. - @since OOo 3.3.0 + @since OOo 3.3 */ [optional, property] sequence< com::sun::star::beans::PropertyValue > ServiceArguments; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if empty rows in the source data are ignored. */ [optional, property] boolean IgnoreEmptyRows; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if empty category cells in the source data should be treated + as repetition of the content from the previous row. */ [optional, property] boolean RepeatIfEmpty; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if columns for grand total results are created. */ [optional, property] boolean ColumnGrand; //------------------------------------------------------------------------- - /** specifies the orientation of the field. + /** specifies if rows for grand total results are created. */ [optional, property] boolean RowGrand; @@ -142,6 +143,14 @@ published service DataPilotDescriptor [optional, property] boolean DrillDownOnDoubleClick; //------------------------------------------------------------------------- + + /** specifies a label for grand total results. + + @since OOo 3.4 + */ + [optional, property] string GrandTotalName; + + //------------------------------------------------------------------------- }; //============================================================================= diff --git a/offapi/com/sun/star/sheet/DataPilotItem.idl b/offapi/com/sun/star/sheet/DataPilotItem.idl index 3addf5533..ae0b4713e 100644 --- a/offapi/com/sun/star/sheet/DataPilotItem.idl +++ b/offapi/com/sun/star/sheet/DataPilotItem.idl @@ -77,7 +77,7 @@ service DataPilotItem /** specifies the item's position in its field if sorting is manual. - @since OOo 2.4.0 + @since OOo 2.4 */ [optional, property] long Position; }; diff --git a/offapi/com/sun/star/sheet/DataPilotOutputRangeType.idl b/offapi/com/sun/star/sheet/DataPilotOutputRangeType.idl index 911e86639..2c2453777 100644 --- a/offapi/com/sun/star/sheet/DataPilotOutputRangeType.idl +++ b/offapi/com/sun/star/sheet/DataPilotOutputRangeType.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::XDataPilotTable2 - @since OOo 3.0.0 + @since OOo 3.0 */ constants DataPilotOutputRangeType { diff --git a/offapi/com/sun/star/sheet/DataPilotSource.idl b/offapi/com/sun/star/sheet/DataPilotSource.idl index 66792647c..8a8b662cb 100644 --- a/offapi/com/sun/star/sheet/DataPilotSource.idl +++ b/offapi/com/sun/star/sheet/DataPilotSource.idl @@ -100,7 +100,7 @@ published service DataPilotSource /** specifies the number of row fields. - @since OOo 3.0.0 + @since OOo 3.0 */ [readonly, property, optional] long RowFieldCount; @@ -108,7 +108,7 @@ published service DataPilotSource /** specifies the number of column fields. - @since OOo 3.0.0 + @since OOo 3.0 */ [readonly, property, optional] long ColumnFieldCount; @@ -116,7 +116,7 @@ published service DataPilotSource /** specifies the number of data fields. - @since OOo 3.0.0 + @since OOo 3.0 */ [readonly, property, optional] long DataFieldCount; }; diff --git a/offapi/com/sun/star/sheet/DataPilotSourceMember.idl b/offapi/com/sun/star/sheet/DataPilotSourceMember.idl index 6b01ebbdd..1b45d0680 100644 --- a/offapi/com/sun/star/sheet/DataPilotSourceMember.idl +++ b/offapi/com/sun/star/sheet/DataPilotSourceMember.idl @@ -86,7 +86,7 @@ published service DataPilotSourceMember /** specifies the member's position in its hierarchy level if sorting is manual. - @since OOo 2.4.0 + @since OOo 2.4 */ [optional, property] boolean Position; }; diff --git a/offapi/com/sun/star/sheet/DataPilotTable.idl b/offapi/com/sun/star/sheet/DataPilotTable.idl index 672cafc2d..d2fbbed56 100644 --- a/offapi/com/sun/star/sheet/DataPilotTable.idl +++ b/offapi/com/sun/star/sheet/DataPilotTable.idl @@ -66,7 +66,7 @@ published service DataPilotTable /** allows notification of modifications to the data pilot table. - @since OOo 3.3.0 + @since OOo 3.3 */ [optional] interface com::sun::star::util::XModifyBroadcaster; diff --git a/offapi/com/sun/star/sheet/DataPilotTableHeaderData.idl b/offapi/com/sun/star/sheet/DataPilotTableHeaderData.idl index f88385774..6b673e953 100644 --- a/offapi/com/sun/star/sheet/DataPilotTableHeaderData.idl +++ b/offapi/com/sun/star/sheet/DataPilotTableHeaderData.idl @@ -51,7 +51,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::DataPilotFieldFilter @see com::sun::star::sheet::DataResult - @since OOo 3.0.0 + @since OOo 3.0 */ struct DataPilotTableHeaderData { diff --git a/offapi/com/sun/star/sheet/DataPilotTablePositionData.idl b/offapi/com/sun/star/sheet/DataPilotTablePositionData.idl index 3d2b9876a..3c4797296 100644 --- a/offapi/com/sun/star/sheet/DataPilotTablePositionData.idl +++ b/offapi/com/sun/star/sheet/DataPilotTablePositionData.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::DataPiotTableResultData @see com::sun::star::sheet::DataPiotTableHeaderData - @since OOo 3.0.0 + @since OOo 3.0 */ struct DataPilotTablePositionData { diff --git a/offapi/com/sun/star/sheet/DataPilotTablePositionType.idl b/offapi/com/sun/star/sheet/DataPilotTablePositionType.idl index 5d669db6b..ffb873dd5 100644 --- a/offapi/com/sun/star/sheet/DataPilotTablePositionType.idl +++ b/offapi/com/sun/star/sheet/DataPilotTablePositionType.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::DataPilotTableResultData @see com::sun::star::sheet::DataPilotTableHeaderData - @since OOo 3.0.0 + @since OOo 3.0 */ constants DataPilotTablePositionType { diff --git a/offapi/com/sun/star/sheet/DataPilotTableResultData.idl b/offapi/com/sun/star/sheet/DataPilotTableResultData.idl index d3f4aa509..aead8aeb9 100644 --- a/offapi/com/sun/star/sheet/DataPilotTableResultData.idl +++ b/offapi/com/sun/star/sheet/DataPilotTableResultData.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::DataPilotFieldFilter @see com::sun::star::sheet::DataResult - @since OOo 3.0.0 + @since OOo 3.0 */ struct DataPilotTableResultData { diff --git a/offapi/com/sun/star/sheet/DatabaseImportDescriptor.idl b/offapi/com/sun/star/sheet/DatabaseImportDescriptor.idl index 644c6cb2d..de0c48905 100644 --- a/offapi/com/sun/star/sheet/DatabaseImportDescriptor.idl +++ b/offapi/com/sun/star/sheet/DatabaseImportDescriptor.idl @@ -72,7 +72,7 @@ published service DatabaseImportDescriptor /** specifies whether the SQL statement is given directly to the database or is parsed before. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean IsNative; @@ -80,7 +80,7 @@ published service DatabaseImportDescriptor //------------------------------------------------------------------------- /** indicates a connection URL, which locates a database driver. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string ConnectionResource; diff --git a/offapi/com/sun/star/sheet/DatabaseRange.idl b/offapi/com/sun/star/sheet/DatabaseRange.idl index 26b695f1a..76dea581b 100644 --- a/offapi/com/sun/star/sheet/DatabaseRange.idl +++ b/offapi/com/sun/star/sheet/DatabaseRange.idl @@ -134,7 +134,7 @@ published service DatabaseRange /** specifies the time between two refresh actions in seconds. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] long RefreshPeriod; @@ -142,7 +142,7 @@ published service DatabaseRange /** specifies whether the imported data is only a selection of the database. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean FromSelection; diff --git a/offapi/com/sun/star/sheet/ExternalDocLink.idl b/offapi/com/sun/star/sheet/ExternalDocLink.idl index a58fd0fdd..f2dd5ea2e 100644 --- a/offapi/com/sun/star/sheet/ExternalDocLink.idl +++ b/offapi/com/sun/star/sheet/ExternalDocLink.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::XExternalDocLink - @since OOo 3.1.0 + @since OOo 3.1 */ service ExternalDocLink : XExternalDocLink { diff --git a/offapi/com/sun/star/sheet/ExternalDocLinks.idl b/offapi/com/sun/star/sheet/ExternalDocLinks.idl index 15ca94d1d..86d3eb552 100644 --- a/offapi/com/sun/star/sheet/ExternalDocLinks.idl +++ b/offapi/com/sun/star/sheet/ExternalDocLinks.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::ExternalDocLink @see com::sun::star::sheet::XExternalDocLinks - @since OOo 3.1.0 + @since OOo 3.1 */ service ExternalDocLinks : XExternalDocLinks { diff --git a/offapi/com/sun/star/sheet/ExternalLinkInfo.idl b/offapi/com/sun/star/sheet/ExternalLinkInfo.idl index 749d95b36..db537e749 100644 --- a/offapi/com/sun/star/sheet/ExternalLinkInfo.idl +++ b/offapi/com/sun/star/sheet/ExternalLinkInfo.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module sheet { //============================================================================= /** describes an external link in a formula. - @since OOo3.1 + @since OOo 3.1 */ struct ExternalLinkInfo { diff --git a/offapi/com/sun/star/sheet/ExternalLinkType.idl b/offapi/com/sun/star/sheet/ExternalLinkType.idl index 7e54750b5..75719a9d3 100644 --- a/offapi/com/sun/star/sheet/ExternalLinkType.idl +++ b/offapi/com/sun/star/sheet/ExternalLinkType.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module sheet { <type>ExternalLinkInfo</type>, used with <member>FormulaParser::ExternalLinks</member>. - @since OOo3.1 + @since OOo 3.1 */ constants ExternalLinkType { diff --git a/offapi/com/sun/star/sheet/ExternalSheetCache.idl b/offapi/com/sun/star/sheet/ExternalSheetCache.idl index bda4f4829..a7d9b37cd 100644 --- a/offapi/com/sun/star/sheet/ExternalSheetCache.idl +++ b/offapi/com/sun/star/sheet/ExternalSheetCache.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::ExternalDocLink @see com::sun::star::sheet::XExternalSheetCache - @since OOo 3.1.0 + @since OOo 3.1 */ service ExternalSheetCache : XExternalSheetCache { diff --git a/offapi/com/sun/star/sheet/FormulaParser.idl b/offapi/com/sun/star/sheet/FormulaParser.idl index ac13717e6..6d3483228 100644 --- a/offapi/com/sun/star/sheet/FormulaParser.idl +++ b/offapi/com/sun/star/sheet/FormulaParser.idl @@ -103,7 +103,7 @@ service FormulaParser that indices are 1-based, the sequence must start with an empty element.</p> - @since OOo3.1 + @since OOo 3.1 */ [property] sequence< ExternalLinkInfo > ExternalLinks; diff --git a/offapi/com/sun/star/sheet/SheetCell.idl b/offapi/com/sun/star/sheet/SheetCell.idl index 2fb9bfef3..bc9e3afcf 100644 --- a/offapi/com/sun/star/sheet/SheetCell.idl +++ b/offapi/com/sun/star/sheet/SheetCell.idl @@ -241,7 +241,7 @@ published service SheetCell /** - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface com::sun::star::util::XModifyBroadcaster; diff --git a/offapi/com/sun/star/sheet/SheetCellRange.idl b/offapi/com/sun/star/sheet/SheetCellRange.idl index b2ebc0952..4c16c2582 100644 --- a/offapi/com/sun/star/sheet/SheetCellRange.idl +++ b/offapi/com/sun/star/sheet/SheetCellRange.idl @@ -350,7 +350,7 @@ published service SheetCellRange /** - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface com::sun::star::util::XModifyBroadcaster; diff --git a/offapi/com/sun/star/sheet/TablePageStyle.idl b/offapi/com/sun/star/sheet/TablePageStyle.idl index 7715cf7d4..68b4baf4e 100644 --- a/offapi/com/sun/star/sheet/TablePageStyle.idl +++ b/offapi/com/sun/star/sheet/TablePageStyle.idl @@ -197,7 +197,7 @@ published service TablePageStyle /** contains the number of horizontal pages the sheet will printed on. - @since OOo 2.0.0 + @since OOo 2.0 */ [property, optional] short ScaleToPagesX; @@ -206,7 +206,7 @@ published service TablePageStyle /** contains the number of vertical pages the sheet will printed on. - @since OOo 2.0.0 + @since OOo 2.0 */ [property, optional] short ScaleToPagesY; diff --git a/offapi/com/sun/star/sheet/XActivationBroadcaster.idl b/offapi/com/sun/star/sheet/XActivationBroadcaster.idl index 117dee539..3e58f608e 100644 --- a/offapi/com/sun/star/sheet/XActivationBroadcaster.idl +++ b/offapi/com/sun/star/sheet/XActivationBroadcaster.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module sheet { /** provides methods to add and remove XActivationEventListener - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XActivationBroadcaster: com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/sheet/XActivationEventListener.idl b/offapi/com/sun/star/sheet/XActivationEventListener.idl index bec94c138..56bb09ddf 100644 --- a/offapi/com/sun/star/sheet/XActivationEventListener.idl +++ b/offapi/com/sun/star/sheet/XActivationEventListener.idl @@ -60,7 +60,7 @@ published interface XActivationEventListener: com::sun::star::lang::XEventListen @see ActivationEvent @see XSpreadsheetViewEventProvieder - @since OOo 2.0.0 + @since OOo 2.0 */ void activeSpreadsheetChanged( [in] com::sun::star::sheet::ActivationEvent aEvent ); diff --git a/offapi/com/sun/star/sheet/XDataPilotTable2.idl b/offapi/com/sun/star/sheet/XDataPilotTable2.idl index 0063105f9..6d50b6f1a 100644 --- a/offapi/com/sun/star/sheet/XDataPilotTable2.idl +++ b/offapi/com/sun/star/sheet/XDataPilotTable2.idl @@ -65,7 +65,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::XDataPilotTable - @since OOo 3.0.0 + @since OOo 3.0 */ interface XDataPilotTable2: com::sun::star::sheet::XDataPilotTable { diff --git a/offapi/com/sun/star/sheet/XDrillDownDataSupplier.idl b/offapi/com/sun/star/sheet/XDrillDownDataSupplier.idl index 3219b2fa0..36d175002 100644 --- a/offapi/com/sun/star/sheet/XDrillDownDataSupplier.idl +++ b/offapi/com/sun/star/sheet/XDrillDownDataSupplier.idl @@ -57,7 +57,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::DataPilotSource - @since OOo 3.0.0 + @since OOo 3.0 */ interface XDrillDownDataSupplier: com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/sheet/XEnhancedMouseClickBroadcaster.idl b/offapi/com/sun/star/sheet/XEnhancedMouseClickBroadcaster.idl index 4e9fe3227..94569c8c5 100644 --- a/offapi/com/sun/star/sheet/XEnhancedMouseClickBroadcaster.idl +++ b/offapi/com/sun/star/sheet/XEnhancedMouseClickBroadcaster.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module sheet { /** provides methods to add and remove EnhancedMouseClickHandler - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XEnhancedMouseClickBroadcaster: com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/sheet/XExternalDocLink.idl b/offapi/com/sun/star/sheet/XExternalDocLink.idl index 2ca038f38..8fdaf0ebd 100644 --- a/offapi/com/sun/star/sheet/XExternalDocLink.idl +++ b/offapi/com/sun/star/sheet/XExternalDocLink.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::ExternalDocLink - @since OOo 3.1.0 + @since OOo 3.1 */ interface XExternalDocLink { diff --git a/offapi/com/sun/star/sheet/XExternalDocLinks.idl b/offapi/com/sun/star/sheet/XExternalDocLinks.idl index 16d9383e9..a851f9423 100644 --- a/offapi/com/sun/star/sheet/XExternalDocLinks.idl +++ b/offapi/com/sun/star/sheet/XExternalDocLinks.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::ExternalDocLinks - @since OOo 3.1.0 + @since OOo 3.1 */ interface XExternalDocLinks { diff --git a/offapi/com/sun/star/sheet/XExternalSheetCache.idl b/offapi/com/sun/star/sheet/XExternalSheetCache.idl index 8acc3452a..bf01ccabf 100644 --- a/offapi/com/sun/star/sheet/XExternalSheetCache.idl +++ b/offapi/com/sun/star/sheet/XExternalSheetCache.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::ExternalSheetCache - @since OOo 3.1.0 + @since OOo 3.1 */ interface XExternalSheetCache { diff --git a/offapi/com/sun/star/sheet/XScenarioEnhanced.idl b/offapi/com/sun/star/sheet/XScenarioEnhanced.idl index 2e530b51b..2aae00c99 100644 --- a/offapi/com/sun/star/sheet/XScenarioEnhanced.idl +++ b/offapi/com/sun/star/sheet/XScenarioEnhanced.idl @@ -50,7 +50,7 @@ module com { module sun { module star { module sheet { @see com::sun::star::sheet::XScenario - @since OOo 2.0.0 + @since OOo 2.0 */ interface XScenarioEnhanced: com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/smarttags/SmartTagAction.idl b/offapi/com/sun/star/smarttags/SmartTagAction.idl index 9f43a6ada..f4d1f5cd2 100644 --- a/offapi/com/sun/star/smarttags/SmartTagAction.idl +++ b/offapi/com/sun/star/smarttags/SmartTagAction.idl @@ -46,7 +46,7 @@ module com { module sun { module star { module smarttags { that can be performed for a smart tag which has been recognized by a <type>SmartTagRecognizer</type> service.</p> - @since OOo 2.3.0 + @since OOo 2.3 */ service SmartTagAction : XSmartTagAction {}; diff --git a/offapi/com/sun/star/smarttags/SmartTagRecognizer.idl b/offapi/com/sun/star/smarttags/SmartTagRecognizer.idl index c1862bb0c..83cb328c6 100644 --- a/offapi/com/sun/star/smarttags/SmartTagRecognizer.idl +++ b/offapi/com/sun/star/smarttags/SmartTagRecognizer.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module smarttags { associated with specific actions which are defined by implementations of the <type>SmartTagAction</type> service.</p> - @since OOo 2.3.0 + @since OOo 2.3 */ service SmartTagRecognizer : XSmartTagRecognizer {}; diff --git a/offapi/com/sun/star/smarttags/SmartTagRecognizerMode.idl b/offapi/com/sun/star/smarttags/SmartTagRecognizerMode.idl index 3b64e2d9e..8c09daece 100644 --- a/offapi/com/sun/star/smarttags/SmartTagRecognizerMode.idl +++ b/offapi/com/sun/star/smarttags/SmartTagRecognizerMode.idl @@ -37,7 +37,7 @@ /** specifies the which type of text is passed to <method>XSmartTagRecognizer::recognize()</method></p> - @since OOo 2.3.0 + @since OOo 2.3 */ enum SmartTagRecognizerMode diff --git a/offapi/com/sun/star/smarttags/XSmartTagAction.idl b/offapi/com/sun/star/smarttags/XSmartTagAction.idl index 538c14b85..da7c26d24 100644 --- a/offapi/com/sun/star/smarttags/XSmartTagAction.idl +++ b/offapi/com/sun/star/smarttags/XSmartTagAction.idl @@ -64,7 +64,7 @@ module com { module sun { module star { module smarttags { /** provides access to smart tag actions. - @since OOo 2.3.0 + @since OOo 2.3 */ interface XSmartTagAction: com::sun::star::lang::XInitialization diff --git a/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl b/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl index 4c7fd1c84..1b2e4c833 100644 --- a/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl +++ b/offapi/com/sun/star/smarttags/XSmartTagRecognizer.idl @@ -65,7 +65,7 @@ module com { module sun { module star { module smarttags { /** provides access to a smart tag recognizer. - @since OOo 2.3.0 + @since OOo 2.3 */ interface XSmartTagRecognizer: com::sun::star::lang::XInitialization diff --git a/offapi/com/sun/star/style/CharacterProperties.idl b/offapi/com/sun/star/style/CharacterProperties.idl index e7dcc6846..eeed5d35d 100644 --- a/offapi/com/sun/star/style/CharacterProperties.idl +++ b/offapi/com/sun/star/style/CharacterProperties.idl @@ -428,7 +428,7 @@ published service CharacterProperties /** If this optional property is <TRUE/>, then the characters are invisible. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean CharHidden; diff --git a/offapi/com/sun/star/style/NumberingType.idl b/offapi/com/sun/star/style/NumberingType.idl index 8a408f667..ca694eaa6 100644 --- a/offapi/com/sun/star/style/NumberingType.idl +++ b/offapi/com/sun/star/style/NumberingType.idl @@ -226,7 +226,7 @@ published constants NumberingType //------------------------------------------------------------------------- /** Numbering in Hebrew alphabet letters - @since OOo 2.0.0 + @since OOo 2.0 */ const short CHARS_HEBREW = 33; diff --git a/offapi/com/sun/star/task/XRestartManager.idl b/offapi/com/sun/star/task/XRestartManager.idl index 0bea91ccd..a6d97142b 100644 --- a/offapi/com/sun/star/task/XRestartManager.idl +++ b/offapi/com/sun/star/task/XRestartManager.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module task { //============================================================================= /** allows to try to restart the office. - @since OOo3.3 + @since OOo 3.3 */ published interface XRestartManager : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/text/BaseFrameProperties.idl b/offapi/com/sun/star/text/BaseFrameProperties.idl index ea01c4c18..595c9544b 100644 --- a/offapi/com/sun/star/text/BaseFrameProperties.idl +++ b/offapi/com/sun/star/text/BaseFrameProperties.idl @@ -335,7 +335,7 @@ published service BaseFrameProperties of the shape, if the text document setting ConsiderTextWrapOnObjPos is <TRUE/>. Valid values are given by <member>WrapInfluenceOnPosition</member></p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short WrapInfluenceOnPosition; diff --git a/offapi/com/sun/star/text/Cell.idl b/offapi/com/sun/star/text/Cell.idl index 539272034..e1e8acedc 100644 --- a/offapi/com/sun/star/text/Cell.idl +++ b/offapi/com/sun/star/text/Cell.idl @@ -93,7 +93,7 @@ service Cell <li>CellProtection: non-functional implementation.</li> </ul> - @since OOo 2.0.0 + @since OOo 2.0 */ service com::sun::star::table::CellProperties; diff --git a/offapi/com/sun/star/text/DocumentSettings.idl b/offapi/com/sun/star/text/DocumentSettings.idl index 99921e6e2..6751cc93d 100644 --- a/offapi/com/sun/star/text/DocumentSettings.idl +++ b/offapi/com/sun/star/text/DocumentSettings.idl @@ -139,7 +139,7 @@ published service DocumentSettings a proportional line spacing is only applied below a text line and it's always added to the paragraph spacing between two paragraphs.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean UseFormerLineSpacing; // ------------------------------------------------------------ @@ -156,7 +156,7 @@ published service DocumentSettings the spacing of the last paragraph respectively table of a table cell isn't added at the bottom of this table cell.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean AddParaSpacingToTableCells; // ------------------------------------------------------------ @@ -174,7 +174,7 @@ published service DocumentSettings its vertical position, doesn't include the lower spacing and the line spacing of the previous paragraph.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean UseFormerObjectPositioning; @@ -191,7 +191,7 @@ published service DocumentSettings If <FALSE/> (default value), the former object positioning algorithm (known from OpenOffice.org 1.1) is applied.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean ConsiderTextWrapOnObjPos; diff --git a/offapi/com/sun/star/text/FootnoteSettings.idl b/offapi/com/sun/star/text/FootnoteSettings.idl index 858b4f75c..b7d133cb2 100644 --- a/offapi/com/sun/star/text/FootnoteSettings.idl +++ b/offapi/com/sun/star/text/FootnoteSettings.idl @@ -126,7 +126,7 @@ published service FootnoteSettings /** contains the name of the character style that is used for footnote/endnote anchor in the text. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string AnchorCharStyleName; diff --git a/offapi/com/sun/star/text/GenericTextDocument.idl b/offapi/com/sun/star/text/GenericTextDocument.idl index f9ece957c..cd110c9da 100644 --- a/offapi/com/sun/star/text/GenericTextDocument.idl +++ b/offapi/com/sun/star/text/GenericTextDocument.idl @@ -179,22 +179,28 @@ published service GenericTextDocument [optional] interface com::sun::star::style::XStyleFamiliesSupplier; - /// @since OOo 1.1.2 + /** @since OOo 1.1.2 + */ [optional] interface com::sun::star::text::XBookmarksSupplier; - /// @since OOo 1.1.2 + /** @since OOo 1.1.2 + */ [optional] interface com::sun::star::text::XDocumentIndexesSupplier; - /// @since OOo 1.1.2 + /** @since OOo 1.1.2 + */ [optional] interface com::sun::star::text::XTextFieldsSupplier; - /// @since OOo 1.1.2 + /** @since OOo 1.1.2 + */ [optional] interface com::sun::star::text::XTextFramesSupplier; - /// @since OOo 1.1.2 + /** @since OOo 1.1.2 + */ [optional] interface com::sun::star::text::XTextSectionsSupplier; - /// @since OOo 1.1.2 + /** @since OOo 1.1.2 + */ [optional] interface com::sun::star::util::XNumberFormatsSupplier; //------------------------------------------------------------------------- diff --git a/offapi/com/sun/star/text/LineNumberingProperties.idl b/offapi/com/sun/star/text/LineNumberingProperties.idl index 8b93d946b..8a2ff0e2f 100644 --- a/offapi/com/sun/star/text/LineNumberingProperties.idl +++ b/offapi/com/sun/star/text/LineNumberingProperties.idl @@ -103,7 +103,7 @@ published service LineNumberingProperties <p>If set to <FALSE/> the line numbering will be continous.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean RestartAtEachPage; diff --git a/offapi/com/sun/star/text/Paragraph.idl b/offapi/com/sun/star/text/Paragraph.idl index 0602db4c9..6712ee738 100644 --- a/offapi/com/sun/star/text/Paragraph.idl +++ b/offapi/com/sun/star/text/Paragraph.idl @@ -142,7 +142,7 @@ published service Paragraph interface com::sun::star::container::XEnumerationAccess; /** gives access to a sequence of properties. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface ::com::sun::star::beans::XTolerantMultiPropertySet; }; diff --git a/offapi/com/sun/star/text/PositionLayoutDir.idl b/offapi/com/sun/star/text/PositionLayoutDir.idl index 3be276119..f4ccadf8e 100644 --- a/offapi/com/sun/star/text/PositionLayoutDir.idl +++ b/offapi/com/sun/star/text/PositionLayoutDir.idl @@ -37,7 +37,7 @@ /** These values specify the layout direction, in which the position attributes of a shape are given - @since OOo 2.0.0 + @since OOo 2.0 */ constants PositionLayoutDir { diff --git a/offapi/com/sun/star/text/RelOrientation.idl b/offapi/com/sun/star/text/RelOrientation.idl index ffe57851b..6a9054894 100644 --- a/offapi/com/sun/star/text/RelOrientation.idl +++ b/offapi/com/sun/star/text/RelOrientation.idl @@ -108,7 +108,7 @@ published constants RelOrientation /** at the top of the text line, only sensible for vertical orientation. - @since OOo 2.0.0 + @since OOo 2.0 */ const short TEXT_LINE = 9; diff --git a/offapi/com/sun/star/text/Shape.idl b/offapi/com/sun/star/text/Shape.idl index 12a63b2e3..08ee925d7 100644 --- a/offapi/com/sun/star/text/Shape.idl +++ b/offapi/com/sun/star/text/Shape.idl @@ -184,7 +184,7 @@ published service Shape of the shape, if the text document setting ConsiderTextWrapOnObjPos is <TRUE/>. Valid values are given by <member>WrapInfluenceOnPosition</member></p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short WrapInfluenceOnPosition; @@ -197,7 +197,7 @@ published service Shape transformation property of the included service com::sun::star::drawing::Shape converted to the horizontal left-to-right layout.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, readonly, property] com::sun::star::drawing::HomogenMatrix3 TransformationInHoriL2R; //------------------------------------------------------------------------- @@ -206,7 +206,7 @@ published service Shape <p>Valid values are given by <member>PositionLayoutDir</member></p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] short PositionLayoutDir; //------------------------------------------------------------------------- @@ -218,7 +218,7 @@ published service Shape start position property of the included service com::sun::star::drawing::Shape converted to the horizontal left-to-right layout.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, readonly, property] com::sun::star::awt::Point StartPositionInHoriL2R; //------------------------------------------------------------------------- @@ -230,7 +230,7 @@ published service Shape end position property of the included service com::sun::star::drawing::Shape converted to the horizontal left-to-right layout.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, readonly, property] com::sun::star::awt::Point EndPositionInHoriL2R; }; diff --git a/offapi/com/sun/star/text/TextMarkupType.idl b/offapi/com/sun/star/text/TextMarkupType.idl index fe631b5c8..d66235758 100644 --- a/offapi/com/sun/star/text/TextMarkupType.idl +++ b/offapi/com/sun/star/text/TextMarkupType.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module text { <p>These constants are used with <method>XTextMarkup::commitTextMarkup()</method></p> - @since OOo 2.3.0 + @since OOo 2.3 */ constants TextMarkupType diff --git a/offapi/com/sun/star/text/TextPortion.idl b/offapi/com/sun/star/text/TextPortion.idl index fa4310609..601c25222 100644 --- a/offapi/com/sun/star/text/TextPortion.idl +++ b/offapi/com/sun/star/text/TextPortion.idl @@ -85,7 +85,7 @@ published service TextPortion //------------------------------------------------------------------------- /** gives access to a sequence of properties. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional] interface ::com::sun::star::beans::XTolerantMultiPropertySet; diff --git a/offapi/com/sun/star/text/TextTableRow.idl b/offapi/com/sun/star/text/TextTableRow.idl index 11e900959..19836bd04 100644 --- a/offapi/com/sun/star/text/TextTableRow.idl +++ b/offapi/com/sun/star/text/TextTableRow.idl @@ -111,7 +111,7 @@ published service TextTableRow /** If <TRUE/>, the row is allowed to be split at page or column breaks. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property, maybevoid] boolean IsSplitAllowed; diff --git a/offapi/com/sun/star/text/ViewSettings.idl b/offapi/com/sun/star/text/ViewSettings.idl index 8f0bb6ee2..4ecc22959 100644 --- a/offapi/com/sun/star/text/ViewSettings.idl +++ b/offapi/com/sun/star/text/ViewSettings.idl @@ -260,7 +260,7 @@ published service ViewSettings //------------------------------------------------------------------------- /** Specifies whether to display the grid or not - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean IsRasterVisible; @@ -268,7 +268,7 @@ published service ViewSettings /** Specifies whether to move frames, drawing elements, and form functions only between grid points. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] boolean IsSnapToRaster; @@ -278,7 +278,7 @@ published service ViewSettings <p>The value must be greater or equal to 0, and the application may enforce an upper bound for the value.</p> - @since OOo 2.0.0 + @since OOo 2.0 @throws com::sun::star::lang::IllegalArgumentException if the value is out of bounds. */ @@ -290,7 +290,7 @@ published service ViewSettings <p>The value must be greater or equal to 0, and the application may enforce an upper bound for the value.</p> - @since OOo 2.0.0 + @since OOo 2.0 @throws com::sun::star::lang::IllegalArgumentException if the value is out of bounds. */ @@ -303,7 +303,7 @@ published service ViewSettings <p>The value must be greater than 0. The application may enforce more restricting bounds for the value.</p> - @since OOo 2.0.0 + @since OOo 2.0 @throws com::sun::star::lang::IllegalArgumentException if the value is out of bounds. */ @@ -316,7 +316,7 @@ published service ViewSettings <p>The value must be greater than 0. The application may enforce more restricting bounds for the value.</p> - @since OOo 2.0.0 + @since OOo 2.0 @throws com::sun::star::lang::IllegalArgumentException if the value is out of bounds. */ @@ -325,7 +325,7 @@ published service ViewSettings //------------------------------------------------------------------------- /** If this property is <TRUE/>, hidden characters are displayed - @since OOo 3.0.0 + @since OOo 3.0 */ [optional, property] boolean ShowHiddenCharacters; //------------------------------------------------------------------------- @@ -334,7 +334,7 @@ published service ViewSettings <p>This option controls the use of the settings ShowHiddenCharacters, ShowTabstops, ShowSpaces, ShowBreaks and ShowParaBreaks </p> - @since OOo 3.0.0 + @since OOo 3.0 */ [optional, property] boolean ShowNonprintingCharacters; //------------------------------------------------------------------------- @@ -342,7 +342,7 @@ published service ViewSettings <p>Uses values <type scope="com::sun::star::awt">FieldUnit</type></p> - @since OOo 3.1.0 + @since OOo 3.1 */ [optional, property] long HorizontalRulerMetric; //------------------------------------------------------------------------- @@ -350,7 +350,7 @@ published service ViewSettings <p>Uses values from <type scope="com::sun::star::awt">FieldUnit</type></p> - @since OOo 3.1.0 + @since OOo 3.1 */ [optional, property] long VerticalRulerMetric; }; diff --git a/offapi/com/sun/star/text/XTextMarkup.idl b/offapi/com/sun/star/text/XTextMarkup.idl index ec5ae8514..e9ab744cd 100644 --- a/offapi/com/sun/star/text/XTextMarkup.idl +++ b/offapi/com/sun/star/text/XTextMarkup.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module text { /** provides functionality to markup text. - @since OOo 2.3.0 + @since OOo 2.3 */ interface XTextMarkup diff --git a/offapi/com/sun/star/text/fieldmaster/Database.idl b/offapi/com/sun/star/text/fieldmaster/Database.idl index 72e95393a..271c8442a 100644 --- a/offapi/com/sun/star/text/fieldmaster/Database.idl +++ b/offapi/com/sun/star/text/fieldmaster/Database.idl @@ -70,13 +70,13 @@ published service Database //------------------------------------------------------------------------ /** indicates the URL of a database file. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseURL; //------------------------------------------------------------------------ /** indicates a connection URL, which locates a database driver. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseResource; //------------------------------------------------------------------------ diff --git a/offapi/com/sun/star/text/textfield/DatabaseName.idl b/offapi/com/sun/star/text/textfield/DatabaseName.idl index 0a34e1385..6fe2fa858 100644 --- a/offapi/com/sun/star/text/textfield/DatabaseName.idl +++ b/offapi/com/sun/star/text/textfield/DatabaseName.idl @@ -62,12 +62,12 @@ published service DatabaseName [property] string DataTableName; /** indicates the URL of a database file. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseURL; /** indicates a connection URL, which locates a database driver. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseResource; diff --git a/offapi/com/sun/star/text/textfield/DatabaseNextSet.idl b/offapi/com/sun/star/text/textfield/DatabaseNextSet.idl index c6071f9d0..41bd78d01 100644 --- a/offapi/com/sun/star/text/textfield/DatabaseNextSet.idl +++ b/offapi/com/sun/star/text/textfield/DatabaseNextSet.idl @@ -66,12 +66,12 @@ published service DatabaseNextSet [property] string Condition; /** indicates the URL of a database file. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseURL; /** indicates a connection URL, which locates a database driver. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseResource; diff --git a/offapi/com/sun/star/text/textfield/DatabaseNumberOfSet.idl b/offapi/com/sun/star/text/textfield/DatabaseNumberOfSet.idl index 3f31ff259..9483b3c3b 100644 --- a/offapi/com/sun/star/text/textfield/DatabaseNumberOfSet.idl +++ b/offapi/com/sun/star/text/textfield/DatabaseNumberOfSet.idl @@ -71,12 +71,12 @@ published service DatabaseNumberOfSet [property] long SetNumber; /** indicates the URL of a database file. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseURL; /** indicates a connection URL, which locates a database driver. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseResource; diff --git a/offapi/com/sun/star/text/textfield/DatabaseSetNumber.idl b/offapi/com/sun/star/text/textfield/DatabaseSetNumber.idl index 67016dfcb..8c3987253 100644 --- a/offapi/com/sun/star/text/textfield/DatabaseSetNumber.idl +++ b/offapi/com/sun/star/text/textfield/DatabaseSetNumber.idl @@ -72,12 +72,12 @@ published service DatabaseSetNumber [property] long SetNumber; /** indicates the URL of a database file. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseURL; /** indicates a connection URL, which locates a database driver. - @since OOo 2.0.0 + @since OOo 2.0 */ [optional, property] string DataBaseResource; diff --git a/offapi/com/sun/star/ucb/TransientDocumentsContentProvider.idl b/offapi/com/sun/star/ucb/TransientDocumentsContentProvider.idl index e9719428d..3c82422ac 100644 --- a/offapi/com/sun/star/ucb/TransientDocumentsContentProvider.idl +++ b/offapi/com/sun/star/ucb/TransientDocumentsContentProvider.idl @@ -57,7 +57,7 @@ module com { module sun { module star { module ucb { @see TransientDocumentsFolderContent @see TransientDocumentsStreamContent - @since OOo 2.0.0 + @since OOo 2.0 */ service TransientDocumentsContentProvider { diff --git a/offapi/com/sun/star/ucb/TransientDocumentsDocumentContent.idl b/offapi/com/sun/star/ucb/TransientDocumentsDocumentContent.idl index 99cd1a1f2..429eb859c 100644 --- a/offapi/com/sun/star/ucb/TransientDocumentsDocumentContent.idl +++ b/offapi/com/sun/star/ucb/TransientDocumentsDocumentContent.idl @@ -82,7 +82,7 @@ module com { module sun { module star { module ucb { @see TransientDocumentsFolderContent @see TransientDocumentsStreamContent - @since OOo 2.0.0 + @since OOo 2.0 */ service TransientDocumentsDocumentContent { diff --git a/offapi/com/sun/star/ucb/TransientDocumentsFolderContent.idl b/offapi/com/sun/star/ucb/TransientDocumentsFolderContent.idl index 50ba75059..5942752c2 100644 --- a/offapi/com/sun/star/ucb/TransientDocumentsFolderContent.idl +++ b/offapi/com/sun/star/ucb/TransientDocumentsFolderContent.idl @@ -81,7 +81,7 @@ module com { module sun { module star { module ucb { @see TransientDocumentsDocumentContent @see TransientDocumentsStreamContent - @since OOo 2.0.0 + @since OOo 2.0 */ service TransientDocumentsFolderContent { diff --git a/offapi/com/sun/star/ucb/TransientDocumentsRootContent.idl b/offapi/com/sun/star/ucb/TransientDocumentsRootContent.idl index f580548e8..b407692a6 100644 --- a/offapi/com/sun/star/ucb/TransientDocumentsRootContent.idl +++ b/offapi/com/sun/star/ucb/TransientDocumentsRootContent.idl @@ -79,7 +79,7 @@ module com { module sun { module star { module ucb { @see TransientDocumentsFolderContent @see TransientDocumentsStreamContent - @since OOo 2.0.0 + @since OOo 2.0 */ service TransientDocumentsRootContent { diff --git a/offapi/com/sun/star/ucb/TransientDocumentsStreamContent.idl b/offapi/com/sun/star/ucb/TransientDocumentsStreamContent.idl index 594cfa6f3..c66d923f9 100644 --- a/offapi/com/sun/star/ucb/TransientDocumentsStreamContent.idl +++ b/offapi/com/sun/star/ucb/TransientDocumentsStreamContent.idl @@ -79,7 +79,7 @@ module com { module sun { module star { module ucb { @see TransientDocumentsDocumentContent @see TransientDocumentsFolderContent - @since OOo 2.0.0 + @since OOo 2.0 */ service TransientDocumentsStreamContent { diff --git a/offapi/com/sun/star/ui/ConfigurableUIElement.idl b/offapi/com/sun/star/ui/ConfigurableUIElement.idl index f1dac2500..3ccab5861 100644 --- a/offapi/com/sun/star/ui/ConfigurableUIElement.idl +++ b/offapi/com/sun/star/ui/ConfigurableUIElement.idl @@ -74,7 +74,7 @@ module com { module sun { module star { module ui { </ul> </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ConfigurableUIElement diff --git a/offapi/com/sun/star/ui/ConfigurationEvent.idl b/offapi/com/sun/star/ui/ConfigurationEvent.idl index 7b034f047..110275178 100644 --- a/offapi/com/sun/star/ui/ConfigurationEvent.idl +++ b/offapi/com/sun/star/ui/ConfigurationEvent.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module ui { /** this event is broadcasted by a configuration manager whenever the state of user interface element has changed. - @since OOo 2.0.0 + @since OOo 2.0 */ published struct ConfigurationEvent : ::com::sun::star::container::ContainerEvent diff --git a/offapi/com/sun/star/ui/DockingArea.idl b/offapi/com/sun/star/ui/DockingArea.idl index 55ab469ee..3812eeeac 100644 --- a/offapi/com/sun/star/ui/DockingArea.idl +++ b/offapi/com/sun/star/ui/DockingArea.idl @@ -44,7 +44,7 @@ module com { module sun { module star { module ui { @see com::sun::star::frame::XLayoutManager </p> - @since OOo 2.0.0 + @since OOo 2.0 */ enum DockingArea diff --git a/offapi/com/sun/star/ui/GlobalAcceleratorConfiguration.idl b/offapi/com/sun/star/ui/GlobalAcceleratorConfiguration.idl index 861f4f7fb..0d573bd15 100644 --- a/offapi/com/sun/star/ui/GlobalAcceleratorConfiguration.idl +++ b/offapi/com/sun/star/ui/GlobalAcceleratorConfiguration.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module ui { by using an UNO service manager. It provides then access to the global accelerator configuration.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ service GlobalAcceleratorConfiguration : XAcceleratorConfiguration {}; diff --git a/offapi/com/sun/star/ui/ImageType.idl b/offapi/com/sun/star/ui/ImageType.idl index b3887643c..07d9e5dcc 100644 --- a/offapi/com/sun/star/ui/ImageType.idl +++ b/offapi/com/sun/star/ui/ImageType.idl @@ -36,7 +36,7 @@ module com { module sun { module star { module ui { the current image set of an image manager. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants ImageType { diff --git a/offapi/com/sun/star/ui/ItemDescriptor.idl b/offapi/com/sun/star/ui/ItemDescriptor.idl index fbc3313aa..231f2aa5c 100644 --- a/offapi/com/sun/star/ui/ItemDescriptor.idl +++ b/offapi/com/sun/star/ui/ItemDescriptor.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module ui { You could have a menu or a toolbox working with the same item descriptor. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ItemDescriptor { diff --git a/offapi/com/sun/star/ui/ItemStyle.idl b/offapi/com/sun/star/ui/ItemStyle.idl index 4e259ccff..ea6e899d2 100644 --- a/offapi/com/sun/star/ui/ItemStyle.idl +++ b/offapi/com/sun/star/ui/ItemStyle.idl @@ -56,7 +56,7 @@ module com { module sun { module star { module ui { </ul> </p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants ItemStyle { diff --git a/offapi/com/sun/star/ui/ItemType.idl b/offapi/com/sun/star/ui/ItemType.idl index cadb2fe26..45d6fe74f 100644 --- a/offapi/com/sun/star/ui/ItemType.idl +++ b/offapi/com/sun/star/ui/ItemType.idl @@ -31,7 +31,7 @@ module com { module sun { module star { module ui { /** Determins the type of an item. - @since OOo 2.0.0 + @since OOo 2.0 */ constants ItemType { diff --git a/offapi/com/sun/star/ui/ModuleUICategoryDescription.idl b/offapi/com/sun/star/ui/ModuleUICategoryDescription.idl index 1d705460e..5ce6f9e7f 100644 --- a/offapi/com/sun/star/ui/ModuleUICategoryDescription.idl +++ b/offapi/com/sun/star/ui/ModuleUICategoryDescription.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module ui { or Calc. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ModuleUICategoryDescription diff --git a/offapi/com/sun/star/ui/ModuleUICommandDescription.idl b/offapi/com/sun/star/ui/ModuleUICommandDescription.idl index cc672ae5b..1f1e1073f 100644 --- a/offapi/com/sun/star/ui/ModuleUICommandDescription.idl +++ b/offapi/com/sun/star/ui/ModuleUICommandDescription.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module ui { that are part of a single OpenOffice.org module, like Writer or Calc. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ModuleUICommandDescription diff --git a/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl b/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl index 7e740ca38..8f264da0a 100644 --- a/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/ModuleUIConfigurationManager.idl @@ -63,7 +63,7 @@ module com { module sun { module star { module ui { this layer.</br> </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ModuleUIConfigurationManager diff --git a/offapi/com/sun/star/ui/ModuleUIConfigurationManagerSupplier.idl b/offapi/com/sun/star/ui/ModuleUIConfigurationManagerSupplier.idl index 68f69b8c3..998e2fc63 100644 --- a/offapi/com/sun/star/ui/ModuleUIConfigurationManagerSupplier.idl +++ b/offapi/com/sun/star/ui/ModuleUIConfigurationManagerSupplier.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module ui { /** specifies a central user interface configuration provider which gives access to module based user interface configuration managers. - @since OOo 2.0.0 + @since OOo 2.0 */ service ModuleUIConfigurationManagerSupplier diff --git a/offapi/com/sun/star/ui/ModuleWindowStateConfiguration.idl b/offapi/com/sun/star/ui/ModuleWindowStateConfiguration.idl index d557d952f..5ce9a8774 100644 --- a/offapi/com/sun/star/ui/ModuleWindowStateConfiguration.idl +++ b/offapi/com/sun/star/ui/ModuleWindowStateConfiguration.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module ui { Calc. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service ModuleWindowStateConfiguration diff --git a/offapi/com/sun/star/ui/UICategoryDescription.idl b/offapi/com/sun/star/ui/UICategoryDescription.idl index f6018ac2e..c45bbeca0 100644 --- a/offapi/com/sun/star/ui/UICategoryDescription.idl +++ b/offapi/com/sun/star/ui/UICategoryDescription.idl @@ -46,7 +46,7 @@ module com { module sun { module star { module ui { implementations which provides all commands to a user. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ //============================================================================= diff --git a/offapi/com/sun/star/ui/UICommandDescription.idl b/offapi/com/sun/star/ui/UICommandDescription.idl index 5eca3c04a..0beeeac66 100644 --- a/offapi/com/sun/star/ui/UICommandDescription.idl +++ b/offapi/com/sun/star/ui/UICommandDescription.idl @@ -46,7 +46,7 @@ module com { module sun { module star { module ui { are part of OpenOffice.org modules, like Writer or Calc. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service UICommandDescription diff --git a/offapi/com/sun/star/ui/UIConfigurationManager.idl b/offapi/com/sun/star/ui/UIConfigurationManager.idl index 7ae757413..d89334c83 100644 --- a/offapi/com/sun/star/ui/UIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/UIConfigurationManager.idl @@ -52,7 +52,7 @@ module com { module sun { module star { module ui { /** specifies a user interface configuration manager which controls all customizeable user interface elements of an object. - @since OOo 2.0.0 + @since OOo 2.0 */ service UIConfigurationManager diff --git a/offapi/com/sun/star/ui/UIElement.idl b/offapi/com/sun/star/ui/UIElement.idl index 6572c7e16..17461b18a 100644 --- a/offapi/com/sun/star/ui/UIElement.idl +++ b/offapi/com/sun/star/ui/UIElement.idl @@ -63,7 +63,7 @@ module com { module sun { module star { module ui { before it can be used. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service UIElement diff --git a/offapi/com/sun/star/ui/UIElementFactory.idl b/offapi/com/sun/star/ui/UIElementFactory.idl index 4bcb2915d..9693c5ecd 100644 --- a/offapi/com/sun/star/ui/UIElementFactory.idl +++ b/offapi/com/sun/star/ui/UIElementFactory.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module ui { service to provide access to itself. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service UIElementFactory diff --git a/offapi/com/sun/star/ui/UIElementFactoryManager.idl b/offapi/com/sun/star/ui/UIElementFactoryManager.idl index a5a2a0526..3a6231894 100644 --- a/offapi/com/sun/star/ui/UIElementFactoryManager.idl +++ b/offapi/com/sun/star/ui/UIElementFactoryManager.idl @@ -49,7 +49,7 @@ module com { module sun { module star { module ui { <type scope="com::sun::star::lang">ServiceManager</type>. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service UIElementFactoryManager diff --git a/offapi/com/sun/star/ui/UIElementSettings.idl b/offapi/com/sun/star/ui/UIElementSettings.idl index 4edb6774a..7c7442f3d 100644 --- a/offapi/com/sun/star/ui/UIElementSettings.idl +++ b/offapi/com/sun/star/ui/UIElementSettings.idl @@ -51,7 +51,7 @@ module com { module sun { module star { module ui { although limitations based on the real user interface element may be visible. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service UIElementSettings { diff --git a/offapi/com/sun/star/ui/UIElementType.idl b/offapi/com/sun/star/ui/UIElementType.idl index ea78e5938..c57951600 100644 --- a/offapi/com/sun/star/ui/UIElementType.idl +++ b/offapi/com/sun/star/ui/UIElementType.idl @@ -35,7 +35,7 @@ module com { module sun { module star { module ui { /** determine the type of a user interface element which is controlled by a layout manager. - @since OOo 2.0.0 + @since OOo 2.0 */ constants UIElementType { diff --git a/offapi/com/sun/star/ui/WindowContentFactory.idl b/offapi/com/sun/star/ui/WindowContentFactory.idl index b8f309fee..e4c323a4b 100644 --- a/offapi/com/sun/star/ui/WindowContentFactory.idl +++ b/offapi/com/sun/star/ui/WindowContentFactory.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module ui { The specific type of the created window depends on the provided arguments. </p> - @since OOo 3.1.0 + @since OOo 3.1 */ service WindowContentFactory : com::sun::star::lang::XSingleComponentFactory diff --git a/offapi/com/sun/star/ui/WindowStateConfiguration.idl b/offapi/com/sun/star/ui/WindowStateConfiguration.idl index 505ce1016..78d9f0e4c 100644 --- a/offapi/com/sun/star/ui/WindowStateConfiguration.idl +++ b/offapi/com/sun/star/ui/WindowStateConfiguration.idl @@ -48,7 +48,7 @@ module com { module sun { module star { module ui { part of OpenOffice.org modules, like Writer or Calc. </p> - @since OOo 2.0.0 + @since OOo 2.0 */ service WindowStateConfiguration diff --git a/offapi/com/sun/star/ui/XAcceleratorConfiguration.idl b/offapi/com/sun/star/ui/XAcceleratorConfiguration.idl index ee0707c78..c8205b940 100644 --- a/offapi/com/sun/star/ui/XAcceleratorConfiguration.idl +++ b/offapi/com/sun/star/ui/XAcceleratorConfiguration.idl @@ -77,7 +77,7 @@ module com { module sun { module star { module ui { @see AcceleratorConfiguration @see <type scope="dom::sun::star::util">XFlushable</type> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XAcceleratorConfiguration { diff --git a/offapi/com/sun/star/ui/XDockingAreaAcceptor.idl b/offapi/com/sun/star/ui/XDockingAreaAcceptor.idl index cc3c62713..65478487c 100644 --- a/offapi/com/sun/star/ui/XDockingAreaAcceptor.idl +++ b/offapi/com/sun/star/ui/XDockingAreaAcceptor.idl @@ -59,7 +59,7 @@ module com { module sun { module star { module ui { @see com::sun::star::frame::XFrame </p> - @since OOo 2.0.0 + @since OOo 2.0 */ diff --git a/offapi/com/sun/star/ui/XModuleUIConfigurationManager.idl b/offapi/com/sun/star/ui/XModuleUIConfigurationManager.idl index 2215d2f63..8039551ed 100644 --- a/offapi/com/sun/star/ui/XModuleUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/XModuleUIConfigurationManager.idl @@ -69,7 +69,7 @@ module com { module sun { module star { module ui { configuration manager uses.</br> </p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XModuleUIConfigurationManager : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XModuleUIConfigurationManagerSupplier.idl b/offapi/com/sun/star/ui/XModuleUIConfigurationManagerSupplier.idl index 6f23f3616..b4d86c3d6 100644 --- a/offapi/com/sun/star/ui/XModuleUIConfigurationManagerSupplier.idl +++ b/offapi/com/sun/star/ui/XModuleUIConfigurationManagerSupplier.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module ui { /** allows to retrieve user interface configuration managers related to OpenOffice.org modules. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XModuleUIConfigurationManagerSupplier : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIConfiguration.idl b/offapi/com/sun/star/ui/XUIConfiguration.idl index 4a2cf0cfb..2f2b6fd00 100644 --- a/offapi/com/sun/star/ui/XUIConfiguration.idl +++ b/offapi/com/sun/star/ui/XUIConfiguration.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module ui { <p>This can be useful for UI to enable/disable some functions without actually accessing the data.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIConfiguration : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIConfigurationListener.idl b/offapi/com/sun/star/ui/XUIConfigurationListener.idl index cdc2f739d..f3fd87752 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationListener.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationListener.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module ui { /** supplies information about changes of a user interface configuration manager. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIConfigurationListener : com::sun::star::lang::XEventListener diff --git a/offapi/com/sun/star/ui/XUIConfigurationManager.idl b/offapi/com/sun/star/ui/XUIConfigurationManager.idl index 477c74412..66a400978 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationManager.idl @@ -70,7 +70,7 @@ module com { module sun { module star { module ui { controls the structure of all customizable user interface elements. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIConfigurationManager : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIConfigurationManagerSupplier.idl b/offapi/com/sun/star/ui/XUIConfigurationManagerSupplier.idl index 5d182fc85..c1f731508 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationManagerSupplier.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationManagerSupplier.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module ui { /** allows to retrieve the user interface configuration manager related to an object. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIConfigurationManagerSupplier : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIConfigurationPersistence.idl b/offapi/com/sun/star/ui/XUIConfigurationPersistence.idl index ad37e9a48..ae417a6f2 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationPersistence.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationPersistence.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module ui { interface configuration data to a storage and to retrieve information about the current state. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIConfigurationPersistence : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIConfigurationStorage.idl b/offapi/com/sun/star/ui/XUIConfigurationStorage.idl index ff7f369ed..6cc0f6ea4 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationStorage.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationStorage.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module ui { /** supplies functions to change or get information about the storage of a user interface configuration manager. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIConfigurationStorage : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIElementFactory.idl b/offapi/com/sun/star/ui/XUIElementFactory.idl index 4d39e73b3..9c1a05c2f 100644 --- a/offapi/com/sun/star/ui/XUIElementFactory.idl +++ b/offapi/com/sun/star/ui/XUIElementFactory.idl @@ -67,7 +67,7 @@ module com { module sun { module star { module ui { </ul> </p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIElementFactory : ::com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIElementFactoryRegistration.idl b/offapi/com/sun/star/ui/XUIElementFactoryRegistration.idl index 5f2882486..81b17e463 100644 --- a/offapi/com/sun/star/ui/XUIElementFactoryRegistration.idl +++ b/offapi/com/sun/star/ui/XUIElementFactoryRegistration.idl @@ -76,7 +76,7 @@ module com { module sun { module star { module ui { </ul> </p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIElementFactoryRegistration : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIElementSettings.idl b/offapi/com/sun/star/ui/XUIElementSettings.idl index 9219bd0a4..cc0513094 100644 --- a/offapi/com/sun/star/ui/XUIElementSettings.idl +++ b/offapi/com/sun/star/ui/XUIElementSettings.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module ui { /** provides functions to retrieve and change user interface element structure data and to update its visible representation. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIElementSettings : com::sun::star::uno::XInterface diff --git a/offapi/com/sun/star/ui/XUIFunctionListener.idl b/offapi/com/sun/star/ui/XUIFunctionListener.idl index b9f4e9cdc..d252c610d 100644 --- a/offapi/com/sun/star/ui/XUIFunctionListener.idl +++ b/offapi/com/sun/star/ui/XUIFunctionListener.idl @@ -39,7 +39,7 @@ /** special interface to receive notification that a user interface element will execute a function. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XUIFunctionListener : com::sun::star::lang::XEventListener { diff --git a/offapi/com/sun/star/util/Endianness.idl b/offapi/com/sun/star/util/Endianness.idl index f63126d72..624328e0e 100644 --- a/offapi/com/sun/star/util/Endianness.idl +++ b/offapi/com/sun/star/util/Endianness.idl @@ -34,7 +34,7 @@ module com { module sun { module star { module util { The endianness specifies the order in which the bytes of larger types are laid out in memory.<p> - @since OOo 2.0.0 + @since OOo 2.0 */ constants Endianness { diff --git a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl index 2a79d6aff..027f7ec6c 100644 --- a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl +++ b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl @@ -50,7 +50,7 @@ module com { module sun { module star { module util { possibility to share one office user data directory among parallel office installtions. - @since OOo 2.0.0 + @since OOo 2.0 */ published service OfficeInstallationDirectories { diff --git a/offapi/com/sun/star/util/PathSubstitution.idl b/offapi/com/sun/star/util/PathSubstitution.idl index d17abd88d..5cc8a793e 100644 --- a/offapi/com/sun/star/util/PathSubstitution.idl +++ b/offapi/com/sun/star/util/PathSubstitution.idl @@ -48,57 +48,65 @@ module com { module sun { module star { module util { /** A service to support the substitution and resubstitution of path variables. - <p> - A path variable must be specified with the following synatx: "$("<variable-name>")". - Path variables are not case sensitive and are always provided as a UCB-complient URL's - (for example: "file:///c:/temp" or "file:///usr/install"). This is mandatory to support an - optional remote file system.<br> - A user defined list of path variables is supported. This list is stored in the Office - configuration file (org/openoffice/Office/Substitution.xml). Please have a look at the - schema definition file which configuration structure this file uses.<br> - There is also a set of variables that have pre-defined values: - </p> - <dl> - <dt>$(inst)</dt> - <dd>Installation path of the Office Basis layer.</dd> - <dt>$(prog)</dt> - <dd>Program path of the Office Basis layer.</dd> + <p> + A path variable must be specified with the following synatx: "$("<variable-name>")". + Path variables are not case sensitive and are always provided as a UCB-complient URL's + (for example: "file:///c:/temp" or "file:///usr/install"). This is mandatory to support an + optional remote file system.<br> + A user defined list of path variables is supported. This list is stored in the Office + configuration file (org/openoffice/Office/Substitution.xml). Please have a look at the + schema definition file which configuration structure this file uses.<br> + There is also a set of variables that have pre-defined values: + </p> + <dl> + <dt>$(inst)</dt> + <dd>Installation path of the Office Basis layer.</dd> + <dt>$(prog)</dt> + <dd>Program path of the Office Basis layer.</dd> <dt>$(brandbaseurl)</dt> <dd>Installation path of the the Office Brand layer.</dd> - <dt>$(user)</dt> - <dd>The user installation directory.</dd> - <dt>$(work)</dt> - <dd>The work directory of the user. Under Windows this would be the - "MyDocuments" subdirectory. Under Unix this would be the home-directory</dd> + <dt>$(user)</dt> + <dd>The user installation directory.</dd> + <dt>$(work)</dt> + <dd>The work directory of the user. Under Windows this would be the + "MyDocuments" subdirectory. Under Unix this would be the home-directory</dd> <dt>$(home)</dt> - <dd>The home directory of the user. Under Unix this would be the home- - directory. Under Windows this would be the "Documents and Settings\<username>" - subdirectory.</dd> + <dd>The home directory of the user. Under Unix this would be the home- + directory. Under Windows this would be the "Documents and Settings\<username>" + subdirectory.</dd> <dt>$(temp)</dt> - <dd>The current temporary directory.</dd> + <dd>The current temporary directory.</dd> <dt>$(path)</dt> - <dd>The value of PATH environment variable.</dd> + <dd>The value of PATH environment variable.</dd> <dt>$(lang)</dt> - <dd>The country code used by the Office, like 01=english, 49=german.</dd> - <dt>$(langid)</dt> - <dd>The language code used by the Office, like 0x0009=english, 0x0409=english us.</dd> + <dd>The country code used by the Office, like 01=english, 49=german.</dd> + <dt>$(langid)</dt> + <dd>The language code used by the Office, like 0x0009=english, 0x0409=english us.</dd> <dt>$(vlang)</dt> - <dd>The language used by the Office as a string. Like "german" for a german Office.</dd> - </dl> + <dd>The language used by the Office as a string. Like "german" for a german Office.</dd> + </dl> + <p> + Attention: Most predefined variables describe an absolute path. + The only exceptions are: $(lang), $(langid) and $(vlang). + Therefore the service implementation should only substitute variables which + are located at the start of a provided path string or are part of a multi-path. + This special service is not designed to be a text substiution but shall + provide (a) valid substituted path(s). + </p> @since OOo 1.1.2 */ published service PathSubstitution { - //------------------------------------------------------------------------- - /** Interface to exchange path variables with defined paths and to resubstitute paths with path variables. + //------------------------------------------------------------------------- + /** Interface to exchange path variables with defined paths and to resubstitute paths with path variables. - <p> - To resubstitute path variables the caller must provide pathes as UCB-compliant URL's. - </p> - */ - interface com::sun::star::util::XStringSubstitution; + <p> + To resubstitute path variables the caller must provide pathes as UCB-compliant URL's. + </p> + */ + interface com::sun::star::util::XStringSubstitution; }; //============================================================================= diff --git a/offapi/com/sun/star/util/XBroadcaster.idl b/offapi/com/sun/star/util/XBroadcaster.idl index 641661995..334435093 100644 --- a/offapi/com/sun/star/util/XBroadcaster.idl +++ b/offapi/com/sun/star/util/XBroadcaster.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module util { /** allows to control notification behaviour of a broadcaster. - @since 3.0 + @since OOo 3.0 */ interface XBroadcaster: com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl b/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl index d79d0cffc..b8cabbb25 100644 --- a/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl +++ b/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl @@ -45,7 +45,7 @@ module com { module sun { module star { module util { later. In many cases, storing the reference directly would destroy the relocatability of an office installation. - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/util/XTextSearch.idl b/offapi/com/sun/star/util/XTextSearch.idl index e1ea524d1..18207f2b0 100644 --- a/offapi/com/sun/star/util/XTextSearch.idl +++ b/offapi/com/sun/star/util/XTextSearch.idl @@ -40,97 +40,151 @@ module com { module sun { module star { module util { //============================================================================= -published enum SearchAlgorithms { - ABSOLUTE, // "normal" a kind of Boyer-Moore - REGEXP, // regular expression - APPROXIMATE // Leveinstein distance +published enum SearchAlgorithms +{ + /// Literal + ABSOLUTE, // implemented as a kind of Boyer-Moore + /// Regular expression + REGEXP, + /// Weighted Levenshtein Distance + APPROXIMATE }; +/// Flags for search methods published constants SearchFlags { - //Flag for all search methods - /** - @deprecated : the constant ALL_IGNORE_CASE is never supported - - it must use the transliteration flags of - the SearchOptions. - <p>@see TransliterationModulesNew + @deprecated The constant ALL_IGNORE_CASE is never supported - use + <const scope="com::sun::star::i18n">TransliterationModules::IGNORE_CASE</const> + with + <member>SearchOptions::transliterateFlags</member> + instead. + + @see <type scope="com::sun::star::i18n">TransliterationModules</type> */ - const long ALL_IGNORE_CASE = 0x00000001; + const long ALL_IGNORE_CASE = 0x00000001; - /// Flag for normal (Boyer-Moore) search - const long NORM_WORD_ONLY = 0x00000010; + /** Flag for normal (Boyer-Moore) search / Search for word only. */ + const long NORM_WORD_ONLY = 0x00000010; - /// Flag for "regular expression" search / interpret as extended regular expression - const long REG_EXTENDED = 0x00000100; - /** Flag for "regular expression" search / No replace, i.e., avoid sub regular - expresions, return true/false to match + /** Flag for "regular expression" search / Interpret as extended + regular expression. -<!-- JRH: Check this for sense of the expression. --> + @deprecated The flag is currently not supported by OOo. */ - const long REG_NOSUB = 0x00000200; - - /// Flag for "regular expression" search / Special new line treatment - const long REG_NEWLINE = 0x00000400; - - /** A NEWLINE character in string will not be matched by a period outside bracket - expression or by any form of a non matching list. - A circumflex (^) in pattern when used to specify expression anchoring -<!-- JRH: anhoring to anchoring. --> - will match the zero length string immediately after a newline in string, - regardless of the setting of REG_NOTBOL - A dollar-sign ($) in pattern when used to specify expression anchoring, - will match zero-length string immediately before a new line in string, - regardless of the setting of REG_NOTEOL -*/ - const long REG_NOT_BEGINOFLINE = 0x00000800; - - /** The first character in the string is not the beginning of the line therefore ^ will not - match with first character of the string + const long REG_EXTENDED = 0x00000100; + + /** Flag for "regular expression" search / No register information + or backreferences, i.e., avoid sub expressions. Return only + true/false if matched or not. + + @deprecated The flag is currently not supported by OOo. */ - const long REG_NOT_ENDOFLINE = 0x00001000; + const long REG_NOSUB = 0x00000200; + + /** Flag for "regular expression" search / Special new line + treatment. + + @deprecated The flag is currently not supported by OOo. + + <p> A NEWLINE character in string will not be matched by a + period outside bracket expression or by any form of a non + matching list. </p> + <p> A circumflex (^) in pattern when used to specify expression + anchoring will match the zero length string immediately after a + newline in string, regardless of the setting of + REG_NOT_BEGINOFLINE. </p> - /// Flags for "Weight Levenshtein-Distance" search - const long LEV_RELAXED = 0x00010000; + <p> A dollar-sign ($) in pattern when used to specify expression + anchoring, will match zero-length string immediately before a + new line in string, regardless of the setting of + REG_NOT_ENDOFLINE. </p> + */ + const long REG_NEWLINE = 0x00000400; + + /** The first character in the string is not the beginning of the + line therefore ^ will not match with first character of the + string. + */ + const long REG_NOT_BEGINOFLINE = 0x00000800; + + /** The last character in the string is not the end of the line + therefore $ will not match with last character of the string. + */ + const long REG_NOT_ENDOFLINE = 0x00001000; + + /** Flag for "Weighted Levenshtein Distance" search / Relaxed + checking of limit, split weigh pools. + + <p> If not specified (<b>strict</b>), the search is sucessful if + the WLD is within a calculated limit where each insertion, + deletion and replacement adds a weight to a common pool of + weights. This is the mathematically correct WLD. </p> + + <p> From a user's point of view the strict WLD is an + exclusive-OR of the arguments given, for example if allowed + insertions=2 and allowed replacements=2, the search fails if 2 + characters had been inserted and an additional operation would + be needed to match. Depending on the weights it may also fail if + 1 character was inserted and 1 character replaced and an + additional operation would be needed to match. The strict + algorithm may match less than expected from a first glance of + the specified arguments, but does not return false positives. </p> + + <p> If specified (<b>relaxed</b>), the search is also successful + if the combined pool for insertions and deletions is below a + doubled calculated limit and replacements are treated + differently. Additionally, swapped characters are counted as one + replacement. </p> + + <p> From a user's point of view the relaxed WLD is an + inclusive-OR of the arguments given, for example if allowed + insertions=2 and allowed replacements=2, the search succeeds if + 2 characters had been inserted and an additional replacement is + needed to match. The relaxed algorithm may return false + positives, but meets user expectation better. </p> + */ + const long LEV_RELAXED = 0x00010000; }; published struct SearchOptions { //------------------------------------------------------------------------- - /// search type, can be: ABSOLUTE, REGEXP, APPROXIMATE + /** search type */ SearchAlgorithms algorithmType; /** some flags - can be mixed - @see SearchFlags + @see <type>SearchFlags</type> */ long searchFlag; - /// the search text + /** The text or pattern to be searched. */ string searchString; - /** the replace text - (is for optional replacing - SearchOption is only the data container for it)*/ + /** The replacement text + (is for optional replacing - SearchOption is only the data container for it) */ string replaceString; - /// this is the language for case insensitive search + /** The locale for case insensitive search. */ ::com::sun::star::lang::Locale Locale; - /** this many characters can be different between the found and search word - in a "Weight Levenshtein-Distance"*/ + /** This many characters can be different (as a replacement) between + the found word and the search pattern in a "Weighted Levenshtein + Distance" search. */ long changedChars; - /** this many characters can be missed in the found word - in a "Weight Levenshtein-Distance"*/ + /** This many characters can be missing in the found word in a + "Weighted Levenshtein Distance" search. */ long deletedChars; - /// this many characters can be additional in the found word in a "Weight Levenshtein-Distance" + /** This many characters can be additional in the found word in a + "Weighted Levenshtein Distance" search. */ long insertedChars; - /** asian flags for the transliteration. Same meaning as the enum of TransliteratorModule - - @see com/sun/star/i18n/XTransliteration.idl + /** Flags for the transliteration. Same meaning as the enum of + <type scope="com::sun::star::i18n">TransliterationModules</type> */ long transliterateFlags; }; diff --git a/offapi/com/sun/star/view/XMultiSelectionSupplier.idl b/offapi/com/sun/star/view/XMultiSelectionSupplier.idl index f8d0ac311..2e05e84ed 100644 --- a/offapi/com/sun/star/view/XMultiSelectionSupplier.idl +++ b/offapi/com/sun/star/view/XMultiSelectionSupplier.idl @@ -66,7 +66,7 @@ interface XMultiSelectionSupplier: XSelectionSupplier added to the current selection. For example, if the selection already contains objects that are forbidden to be selected together with <var>Selection</var> - @raises com::sun::star::lang::IllegalArgumentException + @throws com::sun::star::lang::IllegalArgumentException If <var>Selection</var> is not a selectable object for this <type>XMultiSelectionSupplier</type>. <p>Adding an object to the selection that is already part of the selection should not raise this exception</p> */ @@ -87,7 +87,7 @@ interface XMultiSelectionSupplier: XSelectionSupplier added to the current selection. For example, if the selection already contains objects that are forbidden to be selected together with <var>Selection</var>. - @raises com::sun::star::lang::IllegalArgumentException + @throws com::sun::star::lang::IllegalArgumentException If <var>Selection</var> is not a selectable object for this <type>XMultiSelectionSupplier</type>. <p>Removing an object from the selection that is not part of the selection should not raise this exception</p> */ diff --git a/offapi/com/sun/star/xml/dom/XNode.idl b/offapi/com/sun/star/xml/dom/XNode.idl index bc6727dbc..8dbe2bc4b 100644 --- a/offapi/com/sun/star/xml/dom/XNode.idl +++ b/offapi/com/sun/star/xml/dom/XNode.idl @@ -79,7 +79,7 @@ information.</p> </table></p> @see <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113">Document Object Model (DOM) Level 2 Core Specification</a> </p> -@since OOo 2.0.0 +@since OOo 2.0 */ interface XNode : com::sun::star::uno::XInterface { diff --git a/offapi/com/sun/star/xml/sax/XFastAttributeList.idl b/offapi/com/sun/star/xml/sax/XFastAttributeList.idl index 8a3d1180a..0b6b8f417 100644 --- a/offapi/com/sun/star/xml/sax/XFastAttributeList.idl +++ b/offapi/com/sun/star/xml/sax/XFastAttributeList.idl @@ -92,7 +92,7 @@ interface XFastAttributeList: com::sun::star::uno::XInterface @returns The integer token of the value from the attribute or <const>FastToken::Invalid</const> - @raises SAXEXception + @throws SAXEXception if the attribute is not available */ @@ -137,7 +137,7 @@ interface XFastAttributeList: com::sun::star::uno::XInterface @returns The string value from the attribute. - @raises SAXEXception + @throws SAXEXception if the attribute is not available */ diff --git a/offapi/drafts/com/sun/star/form/ListEntryEvent.idl b/offapi/drafts/com/sun/star/form/ListEntryEvent.idl deleted file mode 100644 index e3f4aa36a..000000000 --- a/offapi/drafts/com/sun/star/form/ListEntryEvent.idl +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __drafts_com_sun_star_form_ListEntryEvent_idl__ -#define __drafts_com_sun_star_form_ListEntryEvent_idl__ - -#ifndef __com_sun_star_lang_EventObject_idl__ -#include <com/sun/star/lang/EventObject.idl> -#endif - -//============================================================================= - -module drafts { module com { module sun { module star { module form { - -//============================================================================= - -/** specifies the event which is notified when a change in a string entry - list occured - - @see XListEntrySource - @see XListEntryListener - - @deprecated - This structure is superseeded by <type scope="com::sun::star::form::binding">ListEntryEvent</type> -*/ -struct ListEntryEvent : com::sun::star::lang::EventObject -{ - /** denotes the position where a change occured. - - <p>The concrete semantics of the value depends on the concrete - event being notified.</p> - */ - long Position; - - /** denotes the number of changed entries, in case a change of - an entry <em>range</em> is being notified. - */ - long Count; - - /** denotes the changed entries - - <p>The concrete semantics of the value depends on the concrete - event being notified.</p> - */ - sequence< string > - Entries; -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/drafts/com/sun/star/form/XBindableValue.idl b/offapi/drafts/com/sun/star/form/XBindableValue.idl deleted file mode 100644 index 95bbe1f20..000000000 --- a/offapi/drafts/com/sun/star/form/XBindableValue.idl +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __drafts_com_sun_star_form_XBindableValue_idl__ -#define __drafts_com_sun_star_form_XBindableValue_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif -#ifndef __drafts_com_sun_star_form_IncompatibleTypesException_idl__ -#include <drafts/com/sun/star/form/IncompatibleTypesException.idl> -#endif - -//============================================================================= - -module drafts { module com { module sun { module star { module form { - -interface XValueBinding; - -//============================================================================= - -/** specifies support for being bound to an external value - - @see XValueBinding - - @deprecated - This interface is superseeded by <type scope="com::sun::star::form::binding">XBindableValue</type> -*/ -interface XBindableValue : com::sun::star::uno::XInterface -{ - /** sets an external instance which controls the value of the component - - <p>Any previously active binding will be revoked. There can be only one!</p> - - @param XValueBinding - the new binding which is to be used by the component. May be <NULL/>, - in this case only the current binding is revoked. - - @throws <type>IncompatibleTypesException</type> - if the new binding (provided it's not <NULL/>) supports only types - which are incompatible with the types of the bindable component. - */ - void setValueBinding( [in] XValueBinding aBinding ) - raises ( IncompatibleTypesException ); - - /** retrieves the external instance which currently controls the value of the - component - */ - XValueBinding - getValueBinding( ); -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/drafts/com/sun/star/form/XListEntryListener.idl b/offapi/drafts/com/sun/star/form/XListEntryListener.idl deleted file mode 100644 index a65821150..000000000 --- a/offapi/drafts/com/sun/star/form/XListEntryListener.idl +++ /dev/null @@ -1,92 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __drafts_com_sun_star_form_XListEntryListener_idl__ -#define __drafts_com_sun_star_form_XListEntryListener_idl__ - -#ifndef __com_sun_star_lang_XEventListener_idl__ -#include <com/sun/star/lang/XEventListener.idl> -#endif -#ifndef __drafts_com_sun_star_form_ListEntryEvent_idl__ -#include <drafts/com/sun/star/form/ListEntryEvent.idl> -#endif - -//============================================================================= - -module drafts { module com { module sun { module star { module form { - -//============================================================================= - -/** specifies a listener for changes in a string entry list - - @deprecated - This interface is superseeded by <type scope="com::sun::star::form::binding">XListEntryListener</type> -*/ -interface XListEntryListener : com::sun::star::lang::XEventListener -{ - /** notifies the listener that a single entry in the list has change - - @param Source - is the event describing the change. The <member>ListEntryEvent::Position</member> - member denotes the position of the changed entry, the first (and only) element - of the <member>ListEntryEvent::Entries</member> member denotes the new string - */ - void entryChanged( [in] ListEntryEvent Source ); - - /** notifies the listener that a range of entries has been inserted into the list - - @param Source - is the event describing the change. The <member>ListEntryEvent::Position</member> - member denotes the position of the first inserted entry, the - <member>ListEntryEvent::Entries</member> member contains the strings which have - been inserted. - */ - void entryRangeInserted( [in] ListEntryEvent Source ); - - /** notifies the listener that a range of entries has been removed from the list - - @param Source - is the event describing the change. The <member>ListEntryEvent::Position</member> - member denotes the position of the first removed entry, the - <member>ListEntryEvent::Count</member> member the number of removed entries. - */ - void entryRangeRemoved( [in] ListEntryEvent Source ); - - /** notifies the listener that all entries of the list have changed. - - <p>The listener should retrieve the complete new list by calling the - <member>XListEntrySource::getAllListEntries</member> method of the event source - (which is denoted by <member scope="com::sun::star::lang">EventObject::Source</member>). - */ - void allEntriesChanged( [in] com::sun::star::lang::EventObject Source ); -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/drafts/com/sun/star/form/XListEntrySink.idl b/offapi/drafts/com/sun/star/form/XListEntrySink.idl deleted file mode 100644 index 8825abe13..000000000 --- a/offapi/drafts/com/sun/star/form/XListEntrySink.idl +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __drafts_com_sun_star_form_XListEntrySink_idl__ -#define __drafts_com_sun_star_form_XListEntrySink_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif - -//============================================================================= - -module drafts { module com { module sun { module star { module form { - -interface XListEntrySource; - -//============================================================================= - -/** specifies support for indirect manipulation of of a string list - - @deprecated - This interface is superseeded by <type scope="com::sun::star::form::binding">XListEntrySink</type> -*/ -interface XListEntrySink : com::sun::star::uno::XInterface -{ - /** sets the new source for the list entries of the component - - <p>The list represented by this component will be cleared, and initially - filled with the entries from the new list source.</p> - - @param Source - the new source for the list entries. May be <NULL/>, in this - case, the current source is revoked. - */ - void setListEntrySource( [in] XListEntrySource Source ); - - /** retrieves the current source for the list entries of the component. - */ - XListEntrySource - getListEntrySource( ); -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/drafts/com/sun/star/form/XListEntrySource.idl b/offapi/drafts/com/sun/star/form/XListEntrySource.idl deleted file mode 100644 index 499ed4311..000000000 --- a/offapi/drafts/com/sun/star/form/XListEntrySource.idl +++ /dev/null @@ -1,103 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __drafts_com_sun_star_form_XListEntrySource_idl__ -#define __drafts_com_sun_star_form_XListEntrySource_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif -#ifndef __com_sun_star_lang_NullPointerException_idl__ -#include <com/sun/star/lang/NullPointerException.idl> -#endif -#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__ -#include <com/sun/star/lang/IndexOutOfBoundsException.idl> -#endif - -//============================================================================= - -module drafts { module com { module sun { module star { module form { - -interface XListEntryListener; - -//============================================================================= - -/** specifies a source of string list entries - - <p>The interface supports foreign components which actively retrieve list entries, - as well as components which want to passively being notified of changes in the list.</p> - - @see XListEntrySink - - @deprecated - This interface is superseeded by <type scope="com::sun::star::form::binding">XListEntrySource</type> -*/ -interface XListEntrySource : com::sun::star::uno::XInterface -{ - /** retrieves the number of entries in the list - */ - long getListEntryCount( ); - - /** provides access to a single list entry - - @throws <type scope="com::sun::star::lang">IndexOutOfBoundsException</type> - if the given position does not denote a valid index in the list - - @see getListEntryCount - */ - string getListEntry( [in] long Position ) - raises( com::sun::star::lang::IndexOutOfBoundsException ); - - /** provides access to the entirety of all list entries - */ - sequence< string > - getAllListEntries( ); - - /** adds a listener which will be notified about changes in the list - reflected by the component. - - @throws <type scope="com::sun::star::lang">NullPointerException</type> - if the given listener is <NULL/> - */ - void addListEntryListener( [in] XListEntryListener Listener ) - raises( com::sun::star::lang::NullPointerException ); - - /** revokes the given listener from the list of components which will - be notfiied about changes in the entry list. - - @throws <type scope="com::sun::star::lang">NullPointerException</type> - if the given listener is <NULL/> - */ - void removeListEntryListener( [in] XListEntryListener Listener ) - raises( com::sun::star::lang::NullPointerException ); -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/drafts/com/sun/star/form/XValueBinding.idl b/offapi/drafts/com/sun/star/form/XValueBinding.idl deleted file mode 100644 index db4f850fe..000000000 --- a/offapi/drafts/com/sun/star/form/XValueBinding.idl +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef __drafts_com_sun_star_form_XValueBinding_idl__ -#define __drafts_com_sun_star_form_XValueBinding_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif -#ifndef __com_sun_star_lang_NoSupportException_idl__ -#include <com/sun/star/lang/NoSupportException.idl> -#endif -#ifndef __drafts_com_sun_star_form_IncompatibleTypesException_idl__ -#include <drafts/com/sun/star/form/IncompatibleTypesException.idl> -#endif - -//============================================================================= - -module drafts { module com { module sun { module star { module form { - -//============================================================================= - -/** specifies a binding to a value which can be read and written. - - @deprecated - This interface is superseeded by <type scope="com::sun::star::form::binding">XValueBinding</type> -*/ -interface XValueBinding : com::sun::star::uno::XInterface -{ - //------------------------------------------------------------------------- - /** determines the types which are supported by this binding for value exchange - - @see supportsType - */ - sequence< type > - getSupportedValueTypes( ); - - /** determines whether a given type is supported by this binding for value exchange - - <p>Calling this method is equal to calling <member>getSupportedValueTypes</member>, - and looking up the given type in the resulting type sequence.</p> - - @see getSupportedValueTypes - */ - boolean supportsType( [in] type aType ); - - /** retrieves the current value - - @throws <type>IncompatibleTypesException</type> - if the requested value type is not supported by the binding - @see getSupportedValueTypes - @see supportsType - */ - any getValue( [in] type aType ) - raises( IncompatibleTypesException ); - - /** sets the current value - - @throws <type>IncompatibleTypesException</type> - if the given value type is not supported by the binding - @throws <type scope="com::sun::star::lang">NoSupportException</type> - if the value currently cannot be changed (e.g. because it's readonly), - or if the binding in general does not support write access to it's binding - - @see getSupportedValueTypes - @see supportsType - @see ValueBinding - */ - void setValue( [in] any aValue ) - raises( IncompatibleTypesException, com::sun::star::lang::NoSupportException ); -}; - -//============================================================================= - -}; }; }; }; }; - -#endif diff --git a/offapi/prj/build.lst b/offapi/prj/build.lst index a4ed8a8ce..c3a5f06d4 100644 --- a/offapi/prj/build.lst +++ b/offapi/prj/build.lst @@ -106,5 +106,4 @@ oa offapi\com\sun\star\geometry nmake - all oa_geometry NULL oa offapi\com\sun\star\rendering nmake - all oa_rendering oa_geometry NULL oa offapi\com\sun\star\rdf nmake - all oa_rdf oa_datatransfer oa_text NULL oa offapi\com\sun\star\office nmake - all oa_office oa_text NULL -oa offapi\drafts\com\sun\star\form nmake - all oa_drafts_form NULL -oa offapi\util nmake - all oa_util oa_auth oa_awt oa_awttree oa_awtgrid oa_awttab oa_chart oa_chart2 oa_chart2_data oa_config oa_configbootstrap oa_configbackend oa_configbackend_xml oa_datatrans_clip oa_datatrans_dnd oa_datatransfer oa_docu oa_draw oa_draw_framework oa_embed oa_fcomp oa_finsp oa_fcontr oa_fieldmaster oa_form oa_xforms oa_formula oa_frame oa_i18n oa_inst oa_ldap oa_ling2 oa_logging oa_mail oa_media oa_mozilla oa_packages oa_manifest oa_zippackage oa_plug oa_pres oa_animations oa_putil oa_resrc oa_sax oa_xml_input oa_scan oa_sdb oa_sdbtools oa_sdbapp oa_sdbc oa_sdbcx oa_setup oa_sheet oa_style oa_svg oa_sync oa_sync2 oa_system oa_table oa_task oa_text oa_textfield oa_docinfo oa_ucb oa_view oa_xml oa_xml_dom oa_xml_xpath oa_xml_views oa_xml_events oa_image oa_xsd oa_inspection oa_ui oa_ui_dialogs oa_accessibility oa_form_binding oa_form_validation oa_form_submission oa_fruntime oa_geometry oa_rendering oa_sfprovider oa_sfbrowse oa_drafts_form oa_deployment oa_deploymenttest oa_deployment_ui oa_frame_status oa_gallery oa_graphic oa_security oa_crypto_sax oa_crypto oa_csax oa_wrapper oa_script oa_smarttags oa_report oa_reportins oa_reportmeta oa_rdf oa_oooimprovement oa_office oa_prestextfield oa_starme oa_script_vba NULL +oa offapi\util nmake - all oa_util oa_auth oa_awt oa_awttree oa_awtgrid oa_awttab oa_chart oa_chart2 oa_chart2_data oa_config oa_configbootstrap oa_configbackend oa_configbackend_xml oa_datatrans_clip oa_datatrans_dnd oa_datatransfer oa_docu oa_draw oa_draw_framework oa_embed oa_fcomp oa_finsp oa_fcontr oa_fieldmaster oa_form oa_xforms oa_formula oa_frame oa_i18n oa_inst oa_ldap oa_ling2 oa_logging oa_mail oa_media oa_mozilla oa_packages oa_manifest oa_zippackage oa_plug oa_pres oa_animations oa_putil oa_resrc oa_sax oa_xml_input oa_scan oa_sdb oa_sdbtools oa_sdbapp oa_sdbc oa_sdbcx oa_setup oa_sheet oa_style oa_svg oa_sync oa_sync2 oa_system oa_table oa_task oa_text oa_textfield oa_docinfo oa_ucb oa_view oa_xml oa_xml_dom oa_xml_xpath oa_xml_views oa_xml_events oa_image oa_xsd oa_inspection oa_ui oa_ui_dialogs oa_accessibility oa_form_binding oa_form_validation oa_form_submission oa_fruntime oa_geometry oa_rendering oa_sfprovider oa_sfbrowse oa_deployment oa_deploymenttest oa_deployment_ui oa_frame_status oa_gallery oa_graphic oa_security oa_crypto_sax oa_crypto oa_csax oa_wrapper oa_script oa_smarttags oa_report oa_reportins oa_reportmeta oa_rdf oa_oooimprovement oa_office oa_prestextfield oa_starme oa_script_vba NULL diff --git a/offapi/prj/d.lst b/offapi/prj/d.lst index a271a7159..ab0e4eb7a 100644 --- a/offapi/prj/d.lst +++ b/offapi/prj/d.lst @@ -110,12 +110,6 @@ mkdir: %COMMON_DEST%\idl%_EXT%\com\sun\star\xml\sax mkdir: %COMMON_DEST%\idl%_EXT%\com\sun\star\xml\wrapper mkdir: %COMMON_DEST%\idl%_EXT%\com\sun\star\xml\xpath mkdir: %COMMON_DEST%\idl%_EXT%\com\sun\star\xsd -mkdir: %COMMON_DEST%\idl%_EXT%\drafts -mkdir: %COMMON_DEST%\idl%_EXT%\drafts\com -mkdir: %COMMON_DEST%\idl%_EXT%\drafts\com\sun -mkdir: %COMMON_DEST%\idl%_EXT%\drafts\com\sun\star -mkdir: %COMMON_DEST%\idl%_EXT%\drafts\com\sun\star\form - ..\%__SRC%\ucr\offapi.db %_DEST%\bin%_EXT%\offapi.rdb ..\%__SRC%\ucrdoc\offapi_doc.db %_DEST%\bin%_EXT%\offapi_doc.rdb @@ -228,5 +222,3 @@ mkdir: %COMMON_DEST%\idl%_EXT%\drafts\com\sun\star\form ..\com\sun\star\xml\wrapper\*.idl %COMMON_DEST%\idl%_EXT%\com\sun\star\xml\wrapper ..\com\sun\star\xml\xpath\*.idl %COMMON_DEST%\idl%_EXT%\com\sun\star\xml\xpath ..\com\sun\star\xsd\*.idl %COMMON_DEST%\idl%_EXT%\com\sun\star\xsd - -..\drafts\com\sun\star\form\*.idl %COMMON_DEST%\idl%_EXT%\drafts\com\sun\star\form diff --git a/offapi/type_reference/typelibrary_history.txt b/offapi/type_reference/typelibrary_history.txt index 7dcd438d5..a678ca7d6 100644 --- a/offapi/type_reference/typelibrary_history.txt +++ b/offapi/type_reference/typelibrary_history.txt @@ -158,3 +158,10 @@ Update reference type library with the version of OOo 3.2.1. The new reference type library is taken from the release source tree OOO320 m19. +11/09/10 (JSC): TaskID=i114887 + remove drafts module from reference rdb. The odl drafts type are not used + and i cleaned up the module and the type library. + +01/28/11 (JSC): TaskID=116682 + Update css.awt.UnoControlDialog to reflect the supported XDialog2 interface + additionally to XDialog diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 6d9f76133..1f9d5aea0 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/offapi/util/makefile.mk b/offapi/util/makefile.mk index dd91e2d99..f0837e21c 100644 --- a/offapi/util/makefile.mk +++ b/offapi/util/makefile.mk @@ -133,7 +133,6 @@ UNOIDLDBFILES= \ $(UCR)$/cssgallery.db \ $(UCR)$/cssxsd.db \ $(UCR)$/cssinspection.db \ - $(UCR)$/dcssform.db \ $(UCR)$/xsec-security.db \ $(UCR)$/xsec-crypto.db \ $(UCR)$/xsec-csax.db \ diff --git a/registry/tools/checksingleton.cxx b/registry/tools/checksingleton.cxx index 0b83d59bb..f1a50d755 100644 --- a/registry/tools/checksingleton.cxx +++ b/registry/tools/checksingleton.cxx @@ -28,297 +28,150 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" -#include <stdio.h> -#include <string.h> - #include "registry/registry.hxx" #include "registry/reflread.hxx" -#include <rtl/ustring.hxx> -#include <rtl/alloc.h> -#include <osl/process.h> -#include <osl/diagnose.h> -#include <osl/thread.h> -#include <osl/file.hxx> - -#ifdef SAL_UNX -#define SEPARATOR '/' -#else -#define SEPARATOR '\\' -#endif +#include "fileurl.hxx" +#include "options.hxx" -using namespace ::rtl; -using namespace ::osl; +#include "rtl/ustring.hxx" +#include "osl/diagnose.h" -sal_Bool isFileUrl(const OString& fileName) -{ - if (fileName.indexOf("file://") == 0 ) - return sal_True; - return sal_False; -} - -OUString convertToFileUrl(const OString& fileName) -{ - if ( isFileUrl(fileName) ) - { - return OStringToOUString(fileName, osl_getThreadTextEncoding()); - } +#include <stdio.h> +#include <string.h> - OUString uUrlFileName; - OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); - if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) - { - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) - { - OSL_ASSERT(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } else - { - if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } +#include <vector> +#include <string> - return uUrlFileName; -} +using namespace rtl; +using namespace registry::tools; #define U2S( s ) \ OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() #define S2U( s ) \ OStringToOUString(s, RTL_TEXTENCODING_UTF8) -struct LessString -{ - sal_Bool operator()(const OUString& str1, const OUString& str2) const - { - return (str1 < str2); - } -}; - -class Options +class Options_Impl : public Options { public: - Options() - : m_bForceOutput(sal_False) + explicit Options_Impl(char const * program) + : Options (program), m_bForceOutput(false) {} - ~Options() - {} - - sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False); - OString prepareHelp(); - OString prepareVersion(); - - const OString& getProgramName() - { return m_program; } - const OString& getIndexReg() + std::string const & getIndexReg() const { return m_indexRegName; } - const OString& getTypeReg() + std::string const & getTypeReg() const { return m_typeRegName; } - sal_Bool hasBase() - { return m_base.getLength() > 0; } - const OString& getBase() + bool hasBase() const + { return (m_base.getLength() > 0); } + const OString & getBase() const { return m_base; } - sal_Bool forceOutput() + bool forceOutput() const { return m_bForceOutput; } + protected: - OString m_program; - OString m_indexRegName; - OString m_typeRegName; + virtual void printUsage_Impl() const; + virtual bool initOptions_Impl (std::vector< std::string > & rArgs); + + std::string m_indexRegName; + std::string m_typeRegName; OString m_base; - sal_Bool m_bForceOutput; + bool m_bForceOutput; }; -sal_Bool Options::initOptions(int ac, char* av[], sal_Bool bCmdFile) +// virtual +void Options_Impl::printUsage_Impl() const { - sal_Bool bRet = sal_True; - sal_uInt16 i=0; + std::string const & rProgName = getProgramName(); + fprintf(stderr, + "Usage: %s -r<filename> -o<filename> [-options] | @<filename>\n", rProgName.c_str() + ); + fprintf(stderr, + " -o<filename> = filename specifies the name of the new singleton index registry.\n" + " -r<filename> = filename specifies the name of the type registry.\n" + " @<filename> = filename specifies a command file.\n" + "Options:\n" + " -b<name> = name specifies the name of a start key. The types will be searched\n" + " under this key in the type registry.\n" + " -f = force the output of all found singletons.\n" + " -h|-? = print this help message and exit.\n" + ); + fprintf(stderr, + "\n%s Version 1.0\n\n", rProgName.c_str() + ); +} - if (!bCmdFile) +// virtual +bool Options_Impl::initOptions_Impl(std::vector< std::string > & rArgs) +{ + std::vector< std::string >::const_iterator first = rArgs.begin(), last = rArgs.end(); + for (; first != last; ++first) { - bCmdFile = sal_True; - - m_program = av[0]; - - if (ac < 2) + std::string option (*first); + if ((*first)[0] != '-') { - fprintf(stderr, "%s", prepareHelp().getStr()); - bRet = sal_False; + return badOption("invalid", option.c_str()); } - - i = 1; - } else - { - i = 0; - } - - char *s=NULL; - for (; i < ac; i++) - { - if (av[i][0] == '-') + switch ((*first)[1]) { - switch (av[i][1]) + case 'r': + case 'R': { - case 'r': - case 'R': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_typeRegName = OString(s); - break; - case 'o': - case 'O': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_indexRegName = OString(s); - break; - case 'b': - case 'B': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_base = OString(s); - break; - case 'f': - case 'F': - if (av[i][2] != '\0') - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - } - m_bForceOutput = sal_True; - break; - case 'h': - case '?': - if (av[i][2] != '\0') - { - fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - } else - { - fprintf(stdout, "%s", prepareHelp().getStr()); - exit(0); - } - break; - default: - fprintf(stderr, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; + if (!((++first != last) && ((*first)[0] != '-'))) + { + return badOption("invalid", option.c_str()); + } + m_typeRegName = OString((*first).c_str(), (*first).size()); + break; } - } else - { - if (av[i][0] == '@') + case 'o': + case 'O': { - FILE* cmdFile = fopen(av[i]+1, "r"); - if( cmdFile == NULL ) - { - fprintf(stderr, "%s", prepareHelp().getStr()); - bRet = sal_False; - } else + if (!((++first != last) && ((*first)[0] != '-'))) { - int rargc=0; - char* rargv[512]; - char buffer[512]; - - while ( fscanf(cmdFile, "%s", buffer) != EOF ) - { - rargv[rargc]= strdup(buffer); - rargc++; - } - fclose(cmdFile); - - bRet = initOptions(rargc, rargv, bCmdFile); - - for (long j=0; j < rargc; j++) - { - free(rargv[j]); - } + return badOption("invalid", option.c_str()); + } + m_indexRegName = (*first); + break; + } + case 'b': + case 'B': + { + if (!((++first != last) && ((*first)[0] != '-'))) + { + return badOption("invalid", option.c_str()); } - } else + m_base = OString((*first).c_str(), (*first).size()); + break; + } + case 'f': + case 'F': + { + if ((*first).size() > 2) + { + return badOption("invalid", option.c_str()); + } + m_bForceOutput = sal_True; + break; + } + case 'h': + case '?': { - fprintf(stderr, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; + if ((*first).size() > 2) + { + return badOption("invalid", option.c_str()); + } + return printUsage(); + // break; // unreachable } + default: + return badOption("unknown", option.c_str()); + // break; // unreachable } } - - return bRet; + return true; } -OString Options::prepareHelp() -{ - OString help("\nusing: "); - help += m_program + " -r<filename> -o<filename> [-options] | @<filename>\n"; - help += " -o<filename> = filename specifies the name of the new singleton index registry.\n"; - help += " -r<filename> = filename specifies the name of the type registry.\n"; - help += " @<filename> = filename specifies a command file.\n"; - help += "Options:\n"; - help += " -b<name> = name specifies the name of a start key. The types will be searched\n"; - help += " under this key in the type registry.\n"; - help += " -f = force the output of all found singletons.\n"; - help += " -h|-? = print this help message and exit.\n"; - help += prepareVersion(); - - return help; -} - -OString Options::prepareVersion() -{ - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 1.0\n\n"; - return version; -} - -static Options options; - -static sal_Bool checkSingletons(RegistryKey& singletonKey, RegistryKey& typeKey) +static sal_Bool checkSingletons(Options_Impl const & options, RegistryKey& singletonKey, RegistryKey& typeKey) { RegValueType valueType = RG_VALUETYPE_NOT_DEFINED; sal_uInt32 size = 0; @@ -326,24 +179,22 @@ static sal_Bool checkSingletons(RegistryKey& singletonKey, RegistryKey& typeKey) sal_Bool bRet = sal_False; RegError e = typeKey.getValueInfo(tmpName, &valueType, &size); - - if ( e != REG_VALUE_NOT_EXISTS && e != REG_INVALID_VALUE && valueType == RG_VALUETYPE_BINARY) + if ((e != REG_VALUE_NOT_EXISTS) && (e != REG_INVALID_VALUE) && (valueType == RG_VALUETYPE_BINARY)) { - RegistryKey entryKey; - RegValue value = rtl_allocateMemory(size); - - typeKey.getValue(tmpName, value); + std::vector< sal_uInt8 > value(size); + typeKey.getValue(tmpName, &value[0]); // @@@ broken api: write to buffer w/o buffer size. - RegistryTypeReader reader((sal_uInt8*)value, size, sal_False); - + RegistryTypeReader reader(&value[0], value.size(), sal_False); if ( reader.isValid() && reader.getTypeClass() == RT_TYPE_SINGLETON ) { - OUString singletonName = reader.getTypeName().replace('/', '.'); + RegistryKey entryKey; + OUString singletonName = reader.getTypeName().replace('/', '.'); if ( singletonKey.createKey(singletonName, entryKey) ) { fprintf(stderr, "%s: could not create SINGLETONS entry for \"%s\"\n", - options.getProgramName().getStr(), U2S( singletonName )); - } else + options.getProgramName().c_str(), U2S( singletonName )); + } + else { bRet = sal_True; OUString value2 = reader.getSuperTypeName(); @@ -352,30 +203,26 @@ static sal_Bool checkSingletons(RegistryKey& singletonKey, RegistryKey& typeKey) (RegValue)value2.getStr(), sizeof(sal_Unicode)* (value2.getLength()+1)) ) { fprintf(stderr, "%s: could not create data entry for singleton \"%s\"\n", - options.getProgramName().getStr(), U2S( singletonName )); + options.getProgramName().c_str(), U2S( singletonName )); } if ( options.forceOutput() ) { fprintf(stderr, "%s: create SINGLETON entry for \"%s\" -> \"%s\"\n", - options.getProgramName().getStr(), U2S( singletonName ), U2S(value2)); + options.getProgramName().c_str(), U2S( singletonName ), U2S(value2)); } } } - - rtl_freeMemory(value); } RegistryKeyArray subKeys; - typeKey.openSubKeys(tmpName, subKeys); sal_uInt32 length = subKeys.getLength(); - RegistryKey elementKey; for (sal_uInt32 i = 0; i < length; i++) { - elementKey = subKeys.getElement(i); - if ( checkSingletons(singletonKey, elementKey) ) + RegistryKey elementKey = subKeys.getElement(i); + if ( checkSingletons(options, singletonKey, elementKey) ) { bRet = sal_True; } @@ -389,69 +236,85 @@ int main( int argc, char * argv[] ) int _cdecl main( int argc, char * argv[] ) #endif { - if ( !options.initOptions(argc, argv) ) + std::vector< std::string > args; + for (int i = 1; i < argc; i++) { - exit(1); + int result = Options::checkArgument(args, argv[i], strlen(argv[i])); + if (result != 0) + { + // failure. + return (result); + } } - OUString indexRegName( convertToFileUrl(options.getIndexReg()) ); - OUString typeRegName( convertToFileUrl(options.getTypeReg()) ); - - Registry indexReg; - Registry typeReg; + Options_Impl options(argv[0]); + if (!options.initOptions(args)) + { + options.printUsage(); + return (1); + } + OUString indexRegName( convertToFileUrl(options.getIndexReg().c_str(), options.getIndexReg().size()) ); + Registry indexReg; if ( indexReg.open(indexRegName, REG_READWRITE) ) { if ( indexReg.create(indexRegName) ) { fprintf(stderr, "%s: open registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getIndexReg().getStr()); - exit(2); + options.getProgramName().c_str(), options.getIndexReg().c_str()); + return (2); } } + + OUString typeRegName( convertToFileUrl(options.getTypeReg().c_str(), options.getTypeReg().size()) ); + Registry typeReg; if ( typeReg.open(typeRegName, REG_READONLY) ) { fprintf(stderr, "%s: open registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(3); + options.getProgramName().c_str(), options.getTypeReg().c_str()); + return (3); } - RegistryKey indexRoot, typeRoot; + RegistryKey indexRoot; if ( indexReg.openRootKey(indexRoot) ) { fprintf(stderr, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getIndexReg().getStr()); - exit(4); + options.getProgramName().c_str(), options.getIndexReg().c_str()); + return (4); } + + RegistryKey typeRoot; if ( typeReg.openRootKey(typeRoot) ) { fprintf(stderr, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(5); + options.getProgramName().c_str(), options.getTypeReg().c_str()); + return (5); } - RegistryKey singletonKey, typeKey; + RegistryKey typeKey; if ( options.hasBase() ) { if ( typeRoot.openKey(S2U(options.getBase()), typeKey) ) { fprintf(stderr, "%s: open base key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(6); + options.getProgramName().c_str(), options.getTypeReg().c_str()); + return (6); } - } else + } + else { typeKey = typeRoot; } + RegistryKey singletonKey; if ( indexRoot.createKey(OUString::createFromAscii("SINGLETONS"), singletonKey) ) { fprintf(stderr, "%s: open/create SINGLETONS key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getIndexReg().getStr()); - exit(7); + options.getProgramName().c_str(), options.getIndexReg().c_str()); + return (7); } - sal_Bool bSingletonsExist = checkSingletons(singletonKey, typeKey); + sal_Bool bSingletonsExist = checkSingletons(options, singletonKey, typeKey); indexRoot.releaseKey(); typeRoot.releaseKey(); @@ -460,24 +323,22 @@ int _cdecl main( int argc, char * argv[] ) if ( indexReg.close() ) { fprintf(stderr, "%s: closing registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getIndexReg().getStr()); - exit(9); + options.getProgramName().c_str(), options.getIndexReg().c_str()); + return (9); } if ( !bSingletonsExist ) { if ( indexReg.destroy(OUString()) ) { fprintf(stderr, "%s: destroy registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getIndexReg().getStr()); - exit(10); + options.getProgramName().c_str(), options.getIndexReg().c_str()); + return (10); } } if ( typeReg.close() ) { fprintf(stderr, "%s: closing registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getTypeReg().getStr()); - exit(11); + options.getProgramName().c_str(), options.getTypeReg().c_str()); + return (11); } } - - diff --git a/registry/tools/fileurl.cxx b/registry/tools/fileurl.cxx new file mode 100644 index 000000000..e1d24a542 --- /dev/null +++ b/registry/tools/fileurl.cxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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 "fileurl.hxx" + +#include "rtl/ustring.hxx" +#include "osl/diagnose.h" +#include "osl/file.hxx" +#include "osl/process.h" +#include "osl/thread.h" + +#include <string.h> + +#ifdef SAL_UNX +#define SEPARATOR '/' +#else +#define SEPARATOR '\\' +#endif + +using rtl::OUString; +using osl::FileBase; + +namespace registry +{ +namespace tools +{ + +OUString convertToFileUrl(char const * filename, size_t length) +{ + OUString const uFileName(filename, length, osl_getThreadTextEncoding()); + if (strncmp(filename, "file://", 7) == 0) + { + // already a FileUrl. + return uFileName; + } + + OUString uFileUrl; + if (length > 0) + { + if ((filename[0] == '.') || (filename[0] != SEPARATOR)) + { + // relative path name. + OUString uWorkingDir; + if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) + { + OSL_ASSERT(false); + } + if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uFileUrl) != FileBase::E_None) + { + OSL_ASSERT(false); + } + } + else + { + // absolute path name. + if (FileBase::getFileURLFromSystemPath(uFileName, uFileUrl) != FileBase::E_None) + { + OSL_ASSERT(false); + } + } + } + return uFileUrl; +} + +} // namespace tools +} // namespace registry diff --git a/offapi/com/sun/star/awt/grid/XGridControlListener.idl b/registry/tools/fileurl.hxx index 4e7876cbe..4c34d0097 100644 --- a/offapi/com/sun/star/awt/grid/XGridControlListener.idl +++ b/registry/tools/fileurl.hxx @@ -24,26 +24,20 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef __com_sun_star_awt_grid_XGridControlListener_idl__ -#define __com_sun_star_awt_grid_XGridControlListener_idl__ - -#ifndef __com_sun_star_uno_XInterface_idl__ -#include <com/sun/star/uno/XInterface.idl> -#endif - -//============================================================================= - -module com { module sun { module star { module awt { module grid { - -//============================================================================= -interface XGridControlListener -{ - -}; - -//============================================================================= - -}; }; }; }; }; - -#endif +#ifndef INCLUDED_REGISTRY_TOOLS_FILEURL_HXX +#define INCLUDED_REGISTRY_TOOLS_FILEURL_HXX + +#include "rtl/ustring.hxx" + +namespace registry +{ +namespace tools +{ + +rtl::OUString convertToFileUrl(char const * filename, size_t length); + +} // namespace tools +} // namespace registry + +#endif /* INCLUDED_REGISTRY_TOOLS_FILEURL_HXX */ diff --git a/registry/tools/makefile.mk b/registry/tools/makefile.mk index bb7d448b8..06ca753ff 100644 --- a/registry/tools/makefile.mk +++ b/registry/tools/makefile.mk @@ -43,7 +43,7 @@ ENABLE_EXCEPTIONS := TRUE CDEFS += -DDLL_VERSION=$(EMQ)"$(DLLPOSTFIX)$(EMQ)" APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/regmerge.obj +APP1OBJS= $(OBJ)$/regmerge.obj $(OBJ)/fileurl.obj $(OBJ)/options.obj APP1RPATH= UREBIN APP1STDLIBS=\ @@ -51,7 +51,7 @@ APP1STDLIBS=\ $(REGLIB) APP2TARGET= regview -APP2OBJS= $(OBJ)$/regview.obj +APP2OBJS= $(OBJ)$/regview.obj $(OBJ)/fileurl.obj APP2RPATH= UREBIN APP2STDLIBS=\ @@ -59,7 +59,7 @@ APP2STDLIBS=\ $(REGLIB) APP3TARGET= regcompare -APP3OBJS= $(OBJ)$/regcompare.obj +APP3OBJS= $(OBJ)$/regcompare.obj $(OBJ)/fileurl.obj $(OBJ)/options.obj APP3RPATH= SDK APP3STDLIBS=\ @@ -68,13 +68,21 @@ APP3STDLIBS=\ $(REGLIB) APP4TARGET= checksingleton -APP4OBJS= $(OBJ)$/checksingleton.obj +APP4OBJS= $(OBJ)$/checksingleton.obj $(OBJ)/fileurl.obj $(OBJ)/options.obj APP4STDLIBS=\ $(SALLIB) \ $(SALHELPERLIB) \ $(REGLIB) -OBJFILES = $(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) +APP5TARGET= rdbedit +APP5OBJS= $(OBJ)$/rdbedit.obj + +APP5STDLIBS=\ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(REGLIB) + +OBJFILES = $(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) .INCLUDE : target.mk diff --git a/registry/tools/options.cxx b/registry/tools/options.cxx new file mode 100644 index 000000000..2e9868e98 --- /dev/null +++ b/registry/tools/options.cxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * 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 "options.hxx" + +#include "osl/diagnose.h" + +#include <stdio.h> +#include <string.h> + +namespace registry +{ +namespace tools +{ + +Options::Options (char const * program) + : m_program (program) +{} + +Options::~Options() +{} + +// static +bool Options::checkArgument(std::vector< std::string> & rArgs, char const * arg, size_t len) +{ + bool result = ((arg != 0) && (len > 0)); + OSL_PRECOND(result, "registry::tools::Options::checkArgument(): invalid arguments"); + if (result) + { + OSL_TRACE("registry::tools:Options::checkArgument(): \"%s\"", arg); + switch (arg[0]) + { + case '@': + if ((result = (len > 1)) == true) + { + // "@<cmdfile>" + result = Options::checkCommandFile(rArgs, &(arg[1])); + } + break; + case '-': + if ((result = (len > 1)) == true) + { + // "-<option>" + std::string option (&(arg[0]), 2); + rArgs.push_back(option); + if (len > 2) + { + // "-<option><param>" + std::string param(&(arg[2]), len - 2); + rArgs.push_back(param); + } + } + break; + default: + rArgs.push_back(std::string(arg, len)); + break; + } + } + return (result); +} + +// static +bool Options::checkCommandFile(std::vector< std::string > & rArgs, char const * filename) +{ + FILE * fp = fopen(filename, "r"); + if (fp == 0) + { + fprintf(stderr, "ERROR: Can't open command file \"%s\"\n", filename); + return (false); + } + + std::string buffer; + buffer.reserve(256); + + bool quoted = false; + int c = EOF; + while ((c = fgetc(fp)) != EOF) + { + switch(c) + { + case '\"': + quoted = !quoted; + break; + case ' ': + case '\t': + case '\r': + case '\n': + if (!quoted) + { + if (!buffer.empty()) + { + if (!checkArgument(rArgs, buffer.c_str(), buffer.size())) + { + // failure. + (void) fclose(fp); + return false; + } + buffer.clear(); + } + break; + } + default: + // quoted white-space fall through + buffer.push_back(sal::static_int_cast<char>(c)); + break; + } + } + return (fclose(fp) == 0); +} + +bool Options::initOptions (std::vector< std::string > & rArgs) +{ + return initOptions_Impl (rArgs); +} + +bool Options::badOption (char const * reason, char const * option) const +{ + (void) fprintf(stderr, "%s: %s option '%s'\n", m_program.c_str(), reason, option); + return printUsage(); +} + +bool Options::printUsage() const +{ + printUsage_Impl(); + return false; +} + +} // namespace tools +} // namespace registry diff --git a/registry/tools/options.hxx b/registry/tools/options.hxx new file mode 100644 index 000000000..c2524103c --- /dev/null +++ b/registry/tools/options.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_REGISTRY_TOOLS_OPTIONS_HXX +#define INCLUDED_REGISTRY_TOOLS_OPTIONS_HXX + +#include <string> +#include <vector> + +namespace registry +{ +namespace tools +{ +class Options +{ + std::string m_program; + + Options (Options const &); + Options & operator= (Options const &); + +public: + explicit Options (char const * program); + virtual ~Options(); + + static bool checkArgument (std::vector< std::string > & rArgs, char const * arg, size_t len); + + bool initOptions (std::vector< std::string > & rArgs); + bool badOption (char const * reason, char const * option) const; + + std::string const & getProgramName() const { return m_program; } + bool printUsage() const; + +protected: + static bool checkCommandFile(std::vector< std::string > & rArgs, char const * filename); + + virtual bool initOptions_Impl(std::vector< std::string > & rArgs) = 0; + virtual void printUsage_Impl() const = 0; +}; + +} // namespace tools +} // namespace registry + +#endif /* INCLUDED_REGISTRY_TOOLS_OPTIONS_HXX */ diff --git a/registry/tools/rdbedit.cxx b/registry/tools/rdbedit.cxx new file mode 100644 index 000000000..11e3e06cc --- /dev/null +++ b/registry/tools/rdbedit.cxx @@ -0,0 +1,318 @@ +/************************************************************************* + * + * 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_registry.hxx" + +#include <stdio.h> +#include <string.h> + +#include "registry/registry.hxx" +#include "registry/reflread.hxx" +#include <rtl/ustring.hxx> +#include <rtl/alloc.h> +#include <osl/process.h> +#include <osl/diagnose.h> +#include <osl/thread.h> +#include <osl/file.hxx> + +#ifdef SAL_UNX +#define SEPARATOR '/' +#else +#define SEPARATOR '\\' +#endif + +using namespace ::rtl; +using namespace ::osl; + +sal_Bool isFileUrl(const OString& fileName) +{ + if (fileName.indexOf("file://") == 0 ) + return sal_True; + return sal_False; +} + +OUString convertToFileUrl(const OString& fileName) +{ + if ( isFileUrl(fileName) ) + { + return OStringToOUString(fileName, osl_getThreadTextEncoding()); + } + + OUString uUrlFileName; + OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); + if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) + { + OUString uWorkingDir; + if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) + { + OSL_ASSERT(false); + } + if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) + != FileBase::E_None) + { + OSL_ASSERT(false); + } + } else + { + if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) + != FileBase::E_None) + { + OSL_ASSERT(false); + } + } + + return uUrlFileName; +} + +#define U2S( s ) \ + OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() +#define S2U( s ) \ + OStringToOUString(s, RTL_TEXTENCODING_UTF8) + +struct LessString +{ + sal_Bool operator()(const OUString& str1, const OUString& str2) const + { + return (str1 < str2); + } +}; + +enum Command { + DELETEKEY +}; + +class Options +{ +public: + Options() + : m_bVerbose(false) + {} + ~Options() + {} + + bool initOptions(int ac, char* av[]); + + OString prepareHelp(); + OString prepareVersion(); + + const OString& getProgramName() + { return m_program; } + const OString& getTypeReg() + { return m_typeRegName; } + const OString& getKeyName() + { return m_keyName; } + const Command getCommand() + { return m_command; } + bool verbose() + { return m_bVerbose; } +protected: + OString m_program; + OString m_typeRegName; + OString m_keyName; + Command m_command; + bool m_bVerbose; +}; + +bool Options::initOptions(int ac, char* av[]) +{ + bool bRet = true; + sal_uInt16 i=1; + + if (ac < 2) + { + fprintf(stderr, "%s", prepareHelp().getStr()); + bRet = sal_False; + } + + m_program = av[0]; + sal_Int32 index = -1; + if ((index=m_program.lastIndexOf(SEPARATOR)) > 0) + m_program = av[0]+index+1; + + char *s=NULL; + for (; i < ac; i++) + { + if (av[i][0] == '-') + { + switch (av[i][1]) + { + case 'r': + case 'R': + if (av[i][2] == '\0') + { + if (i < ac - 1 && av[i+1][0] != '-') + { + i++; + s = av[i]; + } else + { + fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); + bRet = sal_False; + break; + } + } else + { + s = av[i] + 2; + } + m_typeRegName = OString(s); + break; + case 'd': + case 'D': + if (av[i][2] == '\0') + { + if (i < ac - 1 && av[i+1][0] != '-') + { + i++; + s = av[i]; + } else + { + fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); + bRet = sal_False; + break; + } + } else + { + s = av[i] + 2; + } + m_keyName = OString(s); + break; + case 'v': + case 'V': + if (av[i][2] != '\0') + { + fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); + bRet = sal_False; + } + m_bVerbose = true; + break; + case 'h': + case '?': + if (av[i][2] != '\0') + { + fprintf(stderr, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); + bRet = false; + } else + { + fprintf(stdout, "%s", prepareHelp().getStr()); + exit(0); + } + break; + default: + fprintf(stderr, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); + bRet = false; + break; + } + } else + { + fprintf(stderr, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); + bRet = false; + } + } + + return bRet; +} + +OString Options::prepareHelp() +{ + OString help("\nusing: "); + help += m_program + " -r<filename> <command>\n"; + help += " -r<filename> = filename specifies the name of the type registry.\n"; + help += "Commands:\n"; + help += " -d <keyname> = delete the specified key from the registry. Keyname\n"; + help += " specifies the name of the key that get deleted.\n"; + help += " -v = verbose output.\n"; + help += " -h|-? = print this help message and exit.\n"; + help += prepareVersion(); + + return help; +} + +OString Options::prepareVersion() +{ + OString version(m_program); + version += " Version 1.0\n\n"; + return version; +} + +static Options options; + + +#if (defined UNX) || (defined OS2) || (defined __MINGW32__) +int main( int argc, char * argv[] ) +#else +int _cdecl main( int argc, char * argv[] ) +#endif +{ + if ( !options.initOptions(argc, argv) ) + { + exit(1); + } + + OUString typeRegName( convertToFileUrl(options.getTypeReg()) ); + + Registry typeReg; + + if ( typeReg.open(typeRegName, REG_READWRITE) ) + { + fprintf(stderr, "%s: open registry \"%s\" failed\n", + options.getProgramName().getStr(), options.getTypeReg().getStr()); + exit(2); + } + + RegistryKey typeRoot; + if ( typeReg.openRootKey(typeRoot) ) + { + fprintf(stderr, "%s: open root key of registry \"%s\" failed\n", + options.getProgramName().getStr(), options.getTypeReg().getStr()); + exit(3); + } + + if ( options.getCommand() == DELETEKEY ) + { + if ( typeRoot.deleteKey(S2U(options.getKeyName())) ) + { + fprintf(stderr, "%s: delete key \"%s\" of registry \"%s\" failed\n", + options.getProgramName().getStr(), options.getKeyName().getStr(), options.getTypeReg().getStr()); + exit(4); + } else { + if (options.verbose()) + fprintf(stderr, "%s: delete key \"%s\" of registry \"%s\"\n", + options.getProgramName().getStr(), options.getKeyName().getStr(), options.getTypeReg().getStr()); + } + } + + typeRoot.releaseKey(); + if ( typeReg.close() ) + { + fprintf(stderr, "%s: closing registry \"%s\" failed\n", + options.getProgramName().getStr(), options.getTypeReg().getStr()); + exit(5); + } +} + + diff --git a/registry/tools/regcompare.cxx b/registry/tools/regcompare.cxx index b4b30e481..d283c6325 100644 --- a/registry/tools/regcompare.cxx +++ b/registry/tools/regcompare.cxx @@ -28,409 +28,266 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" -#include <stdio.h> -#include <string.h> - -#include <set> -#include <vector> #include "registry/registry.hxx" #include "registry/reader.hxx" #include "registry/version.h" +#include "fileurl.hxx" +#include "options.hxx" + #include <rtl/ustring.hxx> -#include <rtl/alloc.h> -#include <osl/process.h> #include <osl/diagnose.h> -#include <osl/thread.h> -#include <osl/file.hxx> - -#ifdef SAL_UNX -#define SEPARATOR '/' -#else -#define SEPARATOR '\\' -#endif - -using namespace ::rtl; -using namespace ::osl; - -OUString shortName(const OUString& fullName) -{ - return fullName.copy(fullName.lastIndexOf('/') + 1); -} - -sal_Bool isFileUrl(const OString& fileName) -{ - if (fileName.indexOf("file://") == 0 ) - return sal_True; - return sal_False; -} - -OUString convertToFileUrl(const OString& fileName) -{ - if ( isFileUrl(fileName) ) - { - return OStringToOUString(fileName, osl_getThreadTextEncoding()); - } - OUString uUrlFileName; - OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); - if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) - { - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) - { - OSL_ASSERT(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } else - { - if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } - - return uUrlFileName; -} +#include <stdio.h> +#include <string.h> -#define U2S( s ) \ - OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() -#define S2U( s ) \ - OStringToOUString(s, RTL_TEXTENCODING_UTF8) +#include <set> +#include <vector> +#include <string> -struct LessString -{ - sal_Bool operator()(const OUString& str1, const OUString& str2) const - { - return (str1 < str2); - } -}; +using namespace rtl; +using namespace registry::tools; -typedef ::std::set< OUString > StringSet; +typedef std::set< rtl::OUString > StringSet; -class Options +class Options_Impl : public Options { public: - Options() - : m_bFullCheck(sal_False) - , m_bForceOutput(sal_False) - , m_bUnoTypeCheck(sal_False) - , m_checkUnpublished(false) - {} - ~Options() + explicit Options_Impl(char const * program) + : Options(program), + m_bFullCheck(false), + m_bForceOutput(false), + m_bUnoTypeCheck(false), + m_checkUnpublished(false) {} - sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False); + std::string const & getRegName1() const { return m_regName1; } + std::string const & getRegName2() const { return m_regName2; } - OString prepareHelp(); - OString prepareVersion(); - - const OString& getProgramName() - { return m_program; } - const OString& getRegName1() - { return m_regName1; } - const OString& getRegName2() - { return m_regName2; } - sal_Bool isStartKeyValid() - { return (m_startKey.getLength() > 0); }; - const OString& getStartKey() - { return m_startKey; } - sal_Bool existsExcludeKeys() - { return !m_excludeKeys.empty(); }; - StringSet& getExcludeKeys() - { return m_excludeKeys; } - sal_Bool matchedWithExcludeKey( const OUString& keyName); - sal_Bool fullCheck() - { return m_bFullCheck; } - sal_Bool forceOutput() - { return m_bForceOutput; } - sal_Bool unoTypeCheck() - { return m_bUnoTypeCheck; } + bool isStartKeyValid() const { return (m_startKey.getLength() > 0); } + OUString const & getStartKey() const { return m_startKey; } + bool matchedWithExcludeKey( const OUString& keyName) const; + + bool fullCheck() const { return m_bFullCheck; } + bool forceOutput() const { return m_bForceOutput; } + bool unoTypeCheck() const { return m_bUnoTypeCheck; } bool checkUnpublished() const { return m_checkUnpublished; } + protected: - OString m_program; - OString m_regName1; - OString m_regName2; - OString m_startKey; + bool setRegName_Impl(char c, std::string const & param); + + virtual void printUsage_Impl() const; + virtual bool initOptions_Impl (std::vector< std::string > & rArgs); + + std::string m_regName1; + std::string m_regName2; + OUString m_startKey; StringSet m_excludeKeys; - sal_Bool m_bFullCheck; - sal_Bool m_bForceOutput; - sal_Bool m_bUnoTypeCheck; + bool m_bFullCheck; + bool m_bForceOutput; + bool m_bUnoTypeCheck; bool m_checkUnpublished; }; -sal_Bool Options::initOptions(int ac, char* av[], sal_Bool bCmdFile) +#define U2S( s ) OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr() + +inline rtl::OUString makeOUString (std::string const & s) { - sal_Bool bRet = sal_True; - sal_uInt16 i=0; + return rtl::OUString(s.c_str(), s.size(), RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS); +} - if (!bCmdFile) - { - bCmdFile = sal_True; - - m_program = av[0]; +inline rtl::OUString shortName(rtl::OUString const & fullName) +{ + return fullName.copy(fullName.lastIndexOf('/') + 1); +} - if (ac < 2) - { - fprintf(stdout, "%s", prepareHelp().getStr()); - bRet = sal_False; - } +bool Options_Impl::setRegName_Impl(char c, std::string const & param) +{ + bool one = (c == '1'), two = (c == '2'); + if (one) + m_regName1 = param; + if (two) + m_regName2 = param; + return (one || two); +} - i = 1; - } else - { - i = 0; - } +//virtual +void Options_Impl::printUsage_Impl() const +{ + std::string const & rProgName = getProgramName(); + fprintf(stderr, + "Usage: %s -r1<filename> -r2<filename> [-options] | @<filename>\n", rProgName.c_str() + ); + fprintf(stderr, + " -r1<filename> = filename specifies the name of the first registry.\n" + " -r2<filename> = filename specifies the name of the second registry.\n" + " @<filename> = filename specifies a command file.\n" + "Options:\n" + " -s<name> = name specifies the name of a start key. If no start key\n" + " |S<name> is specified the comparison starts with the root key.\n" + " -x<name> = name specifies the name of a key which won't be compared. All\n" + " |X<name> subkeys won't be compared also. This option can be used more than once.\n" + " -f|F = force the detailed output of any diffenrences. Default\n" + " is that only the number of differences is returned.\n" + " -c|C = make a complete check, that means any differences will be\n" + " detected. Default is only a compatibility check that means\n" + " only UNO typelibrary entries will be checked.\n" + " -t|T = make an UNO type compatiblity check. This means that registry 2\n" + " will be checked against registry 1. If a interface in r2 contains\n" + " more methods or the methods are in a different order as in r1, r2 is\n" + " incompatible to r1. But if a service in r2 supports more properties as\n" + " in r1 and the new properties are 'optional' it is compatible.\n" + " -u|U = additionally check types that are unpublished in registry 1.\n" + " -h|-? = print this help message and exit.\n" + ); + fprintf(stderr, + "\n%s Version 1.0\n\n", rProgName.c_str() + ); +} - char *s=NULL; - for (; i < ac; i++) +// virtual +bool Options_Impl::initOptions_Impl (std::vector< std::string > & rArgs) +{ + std::vector< std::string >::const_iterator first = rArgs.begin(), last = rArgs.end(); + for (; first != last; ++first) { - if (av[i][0] == '-') + if ((*first)[0] != '-') + { + return badOption("invalid", (*first).c_str()); + } + switch ((*first)[1]) { - switch (av[i][1]) + case 'r': + case 'R': { - case 'r': - case 'R': + if (!((++first != last) && ((*first)[0] != '-'))) { - sal_Bool bFirst = sal_True; - if (av[i][2] == '2') - { - bFirst = sal_False; - } else if (av[i][2] != '1') - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - } - if (av[i][3] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - - if ( bFirst ) - { - m_regName1 = OString(s); - } else - { - m_regName2 = OString(s); - } + return badOption("invalid", (*first).c_str()); } - break; - case 's': - case 'S': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_startKey = OString(s); - break; - case 'x': - case 'X': - if (av[i][2] == '\0') - { - if (i < ac - 1 && av[i+1][0] != '-') - { - i++; - s = av[i]; - } else - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; - } - } else - { - s = av[i] + 2; - } - m_excludeKeys.insert(S2U(s)); - break; - case 'c': - case 'C': - if (av[i][2] != '\0') - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - } - m_bFullCheck = sal_True; - break; - case 'f': - case 'F': - if (av[i][2] != '\0') - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - } - m_bForceOutput = sal_True; - break; - case 't': - case 'T': - if (av[i][2] != '\0') - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - } - m_bUnoTypeCheck = sal_True; - break; - case 'u': - case 'U': - if (av[i][2] != '\0') - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - } - m_checkUnpublished = true; - break; - case 'h': - case '?': - if (av[i][2] != '\0') - { - fprintf(stdout, "%s: invalid option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - } else + + std::string option(*first), param; + if (option.size() == 1) + { + // "-r<n><space><param>" + if (!((++first != last) && ((*first)[0] != '-'))) { - fprintf(stdout, "%s", prepareHelp().getStr()); - exit(0); + return badOption("invalid", (*first).c_str()); } - break; - default: - fprintf(stdout, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; - break; + param = (*first); + } + else + { + // "-r<n><param>" + param = std::string(&(option[1]), option.size() - 1); + } + if (!setRegName_Impl(option[0], param)) + { + return badOption("invalid", option.c_str()); + } + break; } - } else - { - if (av[i][0] == '@') + case 's': + case 'S': { - FILE* cmdFile = fopen(av[i]+1, "r"); - if( cmdFile == NULL ) - { - fprintf(stdout, "%s", prepareHelp().getStr()); - bRet = sal_False; - } else + if (!((++first != last) && ((*first)[0] != '-'))) { - int rargc=0; - char* rargv[512]; - char buffer[512]; - - while ( fscanf(cmdFile, "%s", buffer) != EOF ) - { - rargv[rargc]= strdup(buffer); - rargc++; - } - fclose(cmdFile); - - bRet = initOptions(rargc, rargv, bCmdFile); - - for (long j=0; j < rargc; j++) - { - free(rargv[j]); - } + return badOption("invalid", (*first).c_str()); + } + m_startKey = makeOUString(*first); + break; + } + case 'x': + case 'X': + { + if (!((++first != last) && ((*first)[0] != '-'))) + { + return badOption("invalid", (*first).c_str()); + } + m_excludeKeys.insert(makeOUString(*first)); + break; + } + case 'f': + case 'F': + { + if ((*first).size() > 2) + { + return badOption("invalid", (*first).c_str()); + } + m_bForceOutput = sal_True; + break; + } + case 'c': + case 'C': + { + if ((*first).size() > 2) + { + return badOption("invalid", (*first).c_str()); + } + m_bFullCheck = sal_True; + break; + } + case 't': + case 'T': + { + if ((*first).size() > 2) + { + return badOption("invalid", (*first).c_str()); + } + m_bUnoTypeCheck = sal_True; + break; + } + case 'u': + case 'U': + { + if ((*first).size() > 2) + { + return badOption("invalid", (*first).c_str()); } - } else + m_checkUnpublished = true; + break; + } + case 'h': + case '?': { - fprintf(stdout, "%s: unknown option '%s'\n", m_program.getStr(), av[i]); - bRet = sal_False; + if ((*first).size() > 2) + { + return badOption("invalid", (*first).c_str()); + } + return printUsage(); + // break; // Unreachable + } + default: + { + return badOption("unknown", (*first).c_str()); + // break; // Unreachable } } } - if ( bRet ) + if ( m_regName1.size() == 0 ) { - if ( m_regName1.getLength() == 0 ) - { - fprintf(stdout, "%s: missing option '-r1'\n", m_program.getStr()); - bRet = sal_False; - } - if ( m_regName2.getLength() == 0 ) - { - fprintf(stdout, "%s: missing option '-r2'\n", m_program.getStr()); - bRet = sal_False; - } + return badOption("missing", "-r1"); } - - return bRet; + if ( m_regName2.size() == 0 ) + { + return badOption("missing", "-r2"); + } + return true; } -OString Options::prepareHelp() -{ - OString help("\nusing: "); - help += m_program + " -r1<filename> -r2<filename> [-options] | @<filename>\n"; - help += " -r1<filename> = filename specifies the name of the first registry.\n"; - help += " -r2<filename> = filename specifies the name of the second registry.\n"; - help += " @<filename> = filename specifies a command file.\n"; - help += "Options:\n"; - help += " -s<name> = name specifies the name of a start key. If no start key\n"; - help += " |S<name> is specified the comparison starts with the root key.\n"; - help += " -x<name> = name specifies the name of a key which won't be compared. All\n"; - help += " |X<name> subkeys won't be compared also. This option can be used more than once.\n"; - help += " -f|F = force the detailed output of any diffenrences. Default\n"; - help += " is that only the number of differences is returned.\n"; - help += " -c|C = make a complete check, that means any differences will be\n"; - help += " detected. Default is only a compatibility check that means\n"; - help += " only UNO typelibrary entries will be checked.\n"; - help += " -t|T = make an UNO type compatiblity check. This means that registry 2\n"; - help += " will be checked against registry 1. If a interface in r2 contains\n"; - help += " more methods or the methods are in a different order as in r1, r2 is\n"; - help += " incompatible to r1. But if a service in r2 supports more properties as\n"; - help += " in r1 and the new properties are 'optonal' it is compatible.\n"; - help += " -u|U = additionally check types that are unpublished in registry 1.\n"; - help += " -h|-? = print this help message and exit.\n"; - help += prepareVersion(); - - return help; -} - -OString Options::prepareVersion() -{ - OString version("\nSun Microsystems (R) "); - version += m_program + " Version 1.0\n\n"; - return version; -} - -sal_Bool Options::matchedWithExcludeKey( const OUString& keyName) +bool Options_Impl::matchedWithExcludeKey( const OUString& keyName) const { - if ( m_excludeKeys.empty() ) - return sal_False; - - StringSet::const_iterator iter = m_excludeKeys.begin(); - StringSet::const_iterator end = m_excludeKeys.end(); - - while ( iter != end ) + if (!m_excludeKeys.empty()) { - if ( keyName.indexOf(*iter) == 0) - return sal_True; - - ++iter; + StringSet::const_iterator first = m_excludeKeys.begin(), last = m_excludeKeys.end(); + for (; first != last; ++first) + { + if (keyName.indexOf(*first) == 0) + return true; + } } - - return sal_False; + return false; } -static Options options; - static char const * getTypeClass(RTTypeClass typeClass) { switch (typeClass) @@ -550,6 +407,7 @@ static char const * getConstValueType(RTConstValue& constValue) return "NONE"; } } + static void printConstValue(RTConstValue& constValue) { switch (constValue.m_type) @@ -599,12 +457,20 @@ static void printConstValue(RTConstValue& constValue) break; default: break; - } -} + } +} -static sal_uInt32 checkConstValue(const OUString& keyName, +static void dumpTypeClass(sal_Bool & rbDump, RTTypeClass typeClass, OUString const & keyName) +{ + if (rbDump) + fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); + rbDump = sal_False; +} + +static sal_uInt32 checkConstValue(Options_Impl const & options, + const OUString& keyName, RTTypeClass typeClass, - sal_Bool& bDump, + sal_Bool & bDump, RTConstValue& constValue1, RTConstValue& constValue2, sal_uInt16 index1) @@ -618,11 +484,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %s != Value2 = %s\n", index1, constValue1.m_value.aBool ? "TRUE" : "FALSE", constValue2.m_value.aBool ? "TRUE" : "FALSE"); @@ -635,11 +497,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %d != Value2 = %d\n", index1, constValue1.m_value.aByte, constValue2.m_value.aByte); } @@ -651,11 +509,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %d != Value2 = %d\n", index1, constValue1.m_value.aShort, constValue2.m_value.aShort); } @@ -667,11 +521,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %d != Value2 = %d\n", index1, constValue1.m_value.aUShort, constValue2.m_value.aUShort); } @@ -683,11 +533,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %ld != Value2 = %ld\n", index1, sal::static_int_cast< long >(constValue1.m_value.aLong), sal::static_int_cast< long >(constValue2.m_value.aLong)); @@ -700,11 +546,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %lu != Value2 = %lu\n", index1, sal::static_int_cast< unsigned long >(constValue1.m_value.aULong), sal::static_int_cast< unsigned long >(constValue2.m_value.aULong)); @@ -717,11 +559,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf( stdout, " Field %d: Value1 = %s != Value2 = %s\n", index1, @@ -740,11 +578,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf( stdout, " Field %d: Value1 = %s != Value2 = %s\n", index1, @@ -769,11 +603,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %f != Value2 = %f\n", index1, constValue1.m_value.aFloat, constValue2.m_value.aFloat); } @@ -785,11 +615,7 @@ static sal_uInt32 checkConstValue(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Field %d: Value1 = %f != Value2 = %f\n", index1, constValue1.m_value.aDouble, constValue2.m_value.aDouble); } @@ -803,45 +629,37 @@ static sal_uInt32 checkConstValue(const OUString& keyName, return 0; } -static sal_uInt32 checkField(const OUString& keyName, +static sal_uInt32 checkField(Options_Impl const & options, + const OUString& keyName, RTTypeClass typeClass, - sal_Bool& bDump, + sal_Bool & bDump, typereg::Reader& reader1, typereg::Reader& reader2, sal_uInt16 index1, sal_uInt16 index2) { sal_uInt32 nError = 0; - if ( reader1.getFieldName(index1) != - reader2.getFieldName(index2) ) + if ( reader1.getFieldName(index1) != reader2.getFieldName(index2) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Field %d: Name1 = %s != Name2 = %s\n", index1, U2S(reader1.getFieldName(index1)), U2S(reader2.getFieldName(index2))); } nError++; } - if ( reader1.getFieldTypeName(index1) != - reader2.getFieldTypeName(index2) ) + if ( reader1.getFieldTypeName(index1) != reader2.getFieldTypeName(index2) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Field %d: Type1 = %s != Type2 = %s\n", index1, U2S(reader1.getFieldTypeName(index1)), U2S(reader2.getFieldTypeName(index2))); } nError++; - } else + } + else { RTConstValue constValue1 = reader1.getFieldValue(index1); RTConstValue constValue2 = reader2.getFieldValue(index2); @@ -849,11 +667,7 @@ static sal_uInt32 checkField(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Field %d: Access1 = %s != Access2 = %s\n", index1, getConstValueType(constValue1), getConstValueType(constValue2)); fprintf(stdout, " Field %d: Value1 = ", index1); @@ -863,9 +677,10 @@ static sal_uInt32 checkField(const OUString& keyName, fprintf(stdout, "\n;"); } nError++; - } else + } + else { - nError += checkConstValue(keyName, typeClass, bDump, constValue1, constValue2, index1); + nError += checkConstValue(options, keyName, typeClass, bDump, constValue1, constValue2, index1); } } @@ -873,11 +688,7 @@ static sal_uInt32 checkField(const OUString& keyName, { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Field %d: FieldAccess1 = %s != FieldAccess2 = %s\n", index1, getFieldAccess(reader1.getFieldFlags(index1)).getStr(), getFieldAccess(reader1.getFieldFlags(index2)).getStr()); @@ -885,16 +696,11 @@ static sal_uInt32 checkField(const OUString& keyName, nError++; } - if ( options.fullCheck() && - (reader1.getFieldDocumentation(index1) != reader2.getFieldDocumentation(index2)) ) + if ( options.fullCheck() && (reader1.getFieldDocumentation(index1) != reader2.getFieldDocumentation(index2)) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Field %d: Doku1 = %s\n Doku2 = %s\n", index1, U2S(reader1.getFieldDocumentation(index1)), U2S(reader2.getFieldDocumentation(index2))); } @@ -935,24 +741,20 @@ static char const * getParamMode(RTParamMode paramMode) } } -static sal_uInt32 checkMethod(const OUString& keyName, +static sal_uInt32 checkMethod(Options_Impl const & options, + const OUString& keyName, RTTypeClass typeClass, - sal_Bool& bDump, + sal_Bool & bDump, typereg::Reader& reader1, typereg::Reader& reader2, sal_uInt16 index) { sal_uInt32 nError = 0; - if ( reader1.getMethodName(index) != - reader2.getMethodName(index) ) + if ( reader1.getMethodName(index) != reader2.getMethodName(index) ) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method1 %d: Name1 = %s != Name2 = %s\n", index, U2S(reader1.getMethodName(index)), U2S(reader2.getMethodName(index))); @@ -960,16 +762,11 @@ static sal_uInt32 checkMethod(const OUString& keyName, nError++; } - if ( reader1.getMethodReturnTypeName(index) != - reader2.getMethodReturnTypeName(index) ) + if ( reader1.getMethodReturnTypeName(index) != reader2.getMethodReturnTypeName(index) ) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method1 %d: ReturnType1 = %s != ReturnType2 = %s\n", index, U2S(reader1.getMethodReturnTypeName(index)), U2S(reader2.getMethodReturnTypeName(index))); @@ -983,11 +780,7 @@ static sal_uInt32 checkMethod(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d : nParameters1 = %d != nParameters2 = %d\n", index, nParams1, nParams2); } nError++; @@ -999,27 +792,18 @@ static sal_uInt32 checkMethod(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d, Parameter %d: Type1 = %s != Type2 = %s\n", index, i, U2S(reader1.getMethodParameterTypeName(index, i)), U2S(reader2.getMethodParameterTypeName(index, i))); } nError++; } - if ( options.fullCheck() && - (reader1.getMethodParameterName(index, i) != reader2.getMethodParameterName(index, i)) ) + if ( options.fullCheck() && (reader1.getMethodParameterName(index, i) != reader2.getMethodParameterName(index, i)) ) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d, Parameter %d: Name1 = %s != Name2 = %s\n", index, i, U2S(reader1.getMethodParameterName(index, i)), U2S(reader2.getMethodParameterName(index, i))); @@ -1030,11 +814,7 @@ static sal_uInt32 checkMethod(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d, Parameter %d: Mode1 = %s != Mode2 = %s\n", index, i, getParamMode(reader1.getMethodParameterFlags(index, i)), getParamMode(reader2.getMethodParameterFlags(index, i))); @@ -1044,20 +824,12 @@ static sal_uInt32 checkMethod(const OUString& keyName, } if ( i < nParams1 && options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Registry1: Method %d contains %d more parameters\n", index, nParams1 - i); } if ( i < nParams2 && options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Registry2: Method %d contains %d more parameters\n", index, nParams2 - i); } @@ -1067,11 +839,7 @@ static sal_uInt32 checkMethod(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " nExceptions1 = %d != nExceptions2 = %d\n", nExcep1, nExcep2); } nError++; @@ -1082,11 +850,7 @@ static sal_uInt32 checkMethod(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d, Exception %d: Name1 = %s != Name2 = %s\n", index, i, U2S(reader1.getMethodExceptionTypeName(index, i)), U2S(reader2.getMethodExceptionTypeName(index, i))); @@ -1096,20 +860,12 @@ static sal_uInt32 checkMethod(const OUString& keyName, } if ( i < nExcep1 && options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Registry1: Method %d contains %d more exceptions\n", index, nExcep1 - i); } if ( i < nExcep2 && options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Registry2: Method %d contains %d more exceptions\n", index, nExcep2 - i); } @@ -1117,11 +873,7 @@ static sal_uInt32 checkMethod(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d: Mode1 = %s != Mode2 = %s\n", index, getMethodMode(reader1.getMethodFlags(index)), getMethodMode(reader2.getMethodFlags(index))); @@ -1129,16 +881,11 @@ static sal_uInt32 checkMethod(const OUString& keyName, nError++; } - if ( options.fullCheck() && - (reader1.getMethodDocumentation(index) != reader2.getMethodDocumentation(index)) ) + if ( options.fullCheck() && (reader1.getMethodDocumentation(index) != reader2.getMethodDocumentation(index)) ) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Method %d: Doku1 = %s\n Doku2 = %s\n", index, U2S(reader1.getMethodDocumentation(index)), U2S(reader2.getMethodDocumentation(index))); @@ -1165,73 +912,54 @@ static char const * getReferenceType(RTReferenceType refType) } } -static sal_uInt32 checkReference(const OUString& keyName, +static sal_uInt32 checkReference(Options_Impl const & options, + const OUString& keyName, RTTypeClass typeClass, - sal_Bool& bDump, + sal_Bool & bDump, typereg::Reader& reader1, typereg::Reader& reader2, sal_uInt16 index1, sal_uInt16 index2) { sal_uInt32 nError = 0; - if ( reader1.getReferenceTypeName(index1) != - reader2.getReferenceTypeName(index2) ) + if ( reader1.getReferenceTypeName(index1) != reader2.getReferenceTypeName(index2) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Reference %d: Name1 = %s != Name2 = %s\n", index1, U2S(reader1.getReferenceTypeName(index1)), U2S(reader2.getReferenceTypeName(index2))); } nError++; } - if ( reader1.getReferenceTypeName(index1) != - reader2.getReferenceTypeName(index2) ) + if ( reader1.getReferenceTypeName(index1) != reader2.getReferenceTypeName(index2) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Reference %d: Type1 = %s != Type2 = %s\n", index1, getReferenceType(reader1.getReferenceSort(index1)), getReferenceType(reader2.getReferenceSort(index2))); } nError++; } - if ( options.fullCheck() && - (reader1.getReferenceDocumentation(index1) != reader2.getReferenceDocumentation(index2)) ) + if ( options.fullCheck() && (reader1.getReferenceDocumentation(index1) != reader2.getReferenceDocumentation(index2)) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Reference %d: Doku1 = %s\n Doku2 = %s\n", index1, U2S(reader1.getReferenceDocumentation(index1)), U2S(reader2.getReferenceDocumentation(index2))); } nError++; } - if ( reader1.getReferenceFlags(index1) != - reader2.getReferenceFlags(index2) ) + if ( reader1.getReferenceFlags(index1) != reader2.getReferenceFlags(index2) ) { if ( options.forceOutput() && !options.unoTypeCheck() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " Reference %d: Access1 = %s != Access2 = %s\n", index1, getFieldAccess(reader1.getReferenceFlags(index1)).getStr(), getFieldAccess(reader1.getReferenceFlags(index2)).getStr()); @@ -1241,9 +969,10 @@ static sal_uInt32 checkReference(const OUString& keyName, return nError; } -static sal_uInt32 checkFieldsWithoutOrder(const OUString& keyName, +static sal_uInt32 checkFieldsWithoutOrder(Options_Impl const & options, + const OUString& keyName, RTTypeClass typeClass, - sal_Bool& bDump, + sal_Bool & bDump, typereg::Reader& reader1, typereg::Reader& reader2) { @@ -1257,13 +986,9 @@ static sal_uInt32 checkFieldsWithoutOrder(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } - fprintf(stdout, " %s1 contains %d more properties as %s2\n", - getTypeClass(typeClass), nFields1-nFields2, getTypeClass(typeClass)); + dumpTypeClass (bDump, typeClass, keyName); + fprintf(stdout, " %s1 contains %d more properties as %s2\n", + getTypeClass(typeClass), nFields1-nFields2, getTypeClass(typeClass)); } } @@ -1274,7 +999,7 @@ static sal_uInt32 checkFieldsWithoutOrder(const OUString& keyName, { for (j=0; j < nFields2; j++) { - if (!checkField(keyName, typeClass, bDump, reader1, reader2, i, j)) + if (!checkField(options, keyName, typeClass, bDump, reader1, reader2, i, j)) { bFound = sal_True; moreProps.insert(j); @@ -1285,16 +1010,13 @@ static sal_uInt32 checkFieldsWithoutOrder(const OUString& keyName, { if (options.forceOutput()) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass (bDump, typeClass, keyName); fprintf(stdout, " incompatible change: Field %d ('%s') of r1 is not longer a property of this %s in r2\n", i, U2S(shortName(reader1.getFieldName(i))), getTypeClass(typeClass)); } nError++; - } else + } + else { bFound = sal_False; } @@ -1310,12 +1032,10 @@ static sal_uInt32 checkFieldsWithoutOrder(const OUString& keyName, { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } - fprintf(stdout, " incompatible change: Field %d ('%s') of r2 is a new property compared to this %s in r1 and is not 'optional'\n", + dumpTypeClass (bDump, typeClass, keyName); + fprintf(stdout, + " incompatible change: Field %d ('%s') of r2 is a new property" + " compared to this %s in r1 and is not 'optional'\n", j, U2S(shortName(reader2.getFieldName(j))), getTypeClass(typeClass)); } nError++; @@ -1327,8 +1047,11 @@ static sal_uInt32 checkFieldsWithoutOrder(const OUString& keyName, return nError; } -static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, sal_uInt32 size1, - typereg::Reader& reader2, sal_uInt32 size2) +static sal_uInt32 checkBlob( + Options_Impl const & options, + const OUString& keyName, + typereg::Reader& reader1, sal_uInt32 size1, + typereg::Reader& reader2, sal_uInt32 size2) { sal_uInt32 nError = 0; sal_Bool bDump = sal_True; @@ -1343,28 +1066,27 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s sal::static_int_cast< unsigned long >(size2)); } } - if (reader1.isPublished()) { - if (!reader2.isPublished()) { - if (options.forceOutput()) { - if (bDump) { - fprintf(stdout, "?: %s\n", U2S(keyName)); - bDump = false; - } + if (reader1.isPublished()) + { + if (!reader2.isPublished()) + { + if (options.forceOutput()) + { + dumpTypeClass(bDump, /*"?"*/ reader1.getTypeClass(), keyName); fprintf(stdout, " published in 1 but unpublished in 2\n"); } ++nError; } - } else if (!options.checkUnpublished()) { + } + else if (!options.checkUnpublished()) + { return nError; } if ( reader1.getTypeClass() != reader2.getTypeClass() ) { if ( options.forceOutput() ) { - if (bDump) { - fprintf(stdout, "?: %s\n", U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, /*"?"*/ reader1.getTypeClass(), keyName); fprintf(stdout, " TypeClass1 = %s != TypeClass2 = %s\n", getTypeClass(reader1.getTypeClass()), getTypeClass(reader2.getTypeClass())); @@ -1373,16 +1095,11 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s } RTTypeClass typeClass = reader1.getTypeClass(); - if ( reader1.getTypeName() != reader2.getTypeName() ) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " TypeName1 = %s != TypeName2 = %s\n", U2S(reader1.getTypeName()), U2S(reader2.getTypeName())); } @@ -1392,28 +1109,23 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s typeClass == RT_TYPE_STRUCT || typeClass == RT_TYPE_EXCEPTION) ) { - if (reader1.getSuperTypeCount() != reader2.getSuperTypeCount()) { - if (bDump) { - fprintf( - stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = false; - } + if (reader1.getSuperTypeCount() != reader2.getSuperTypeCount()) + { + dumpTypeClass(bDump, typeClass, keyName); fprintf( stdout, " SuperTypeCount1 = %d != SuperTypeCount2 = %d\n", static_cast< int >(reader1.getSuperTypeCount()), static_cast< int >(reader2.getSuperTypeCount())); ++nError; - } else { - for (sal_Int16 i = 0; i < reader1.getSuperTypeCount(); ++i) { + } else + { + for (sal_Int16 i = 0; i < reader1.getSuperTypeCount(); ++i) + { if (reader1.getSuperTypeName(i) != reader2.getSuperTypeName(i)) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " SuperTypeName1 = %s != SuperTypeName2 = %s\n", U2S(reader1.getSuperTypeName(i)), U2S(reader2.getSuperTypeName(i))); } @@ -1422,6 +1134,7 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s } } } + sal_uInt16 nFields1 = (sal_uInt16)reader1.getFieldCount(); sal_uInt16 nFields2 = (sal_uInt16)reader2.getFieldCount(); sal_Bool bCheckNormal = sal_True; @@ -1439,41 +1152,31 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " nFields1 = %d != nFields2 = %d\n", nFields1, nFields2); } nError++; } + sal_uInt16 i; for (i=0; i < nFields1 && i < nFields2; i++) { - nError += checkField(keyName, typeClass, bDump, reader1, reader2, i, i); + nError += checkField(options, keyName, typeClass, bDump, reader1, reader2, i, i); } if ( i < nFields1 && options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Registry1 contains %d more fields\n", nFields1 - i); } if ( i < nFields2 && options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Registry2 contains %d more fields\n", nFields2 - i); } - } else + } + else { - nError += checkFieldsWithoutOrder(keyName, typeClass, bDump, reader1, reader2); + nError += checkFieldsWithoutOrder(options, keyName, typeClass, bDump, reader1, reader2); } if ( typeClass == RT_TYPE_INTERFACE ) @@ -1484,19 +1187,16 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " nMethods1 = %d != nMethods2 = %d\n", nMethods1, nMethods2); } nError++; } + sal_uInt16 i; for (i=0; i < nMethods1 && i < nMethods2; i++) { - nError += checkMethod(keyName, typeClass, bDump, reader1, reader2, i); + nError += checkMethod(options, keyName, typeClass, bDump, reader1, reader2, i); } if ( i < nMethods1 && options.forceOutput() ) { @@ -1520,11 +1220,7 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " service1 contains %d more references as service2\n", nReference1-nReference2); } @@ -1537,7 +1233,7 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { for (j=0; j < nReference2; j++) { - if (!checkReference(keyName, typeClass, bDump, reader1, reader2, i, j)) + if (!checkReference(options, keyName, typeClass, bDump, reader1, reader2, i, j)) { bFound = sal_True; moreReferences.insert(j); @@ -1548,16 +1244,15 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { if (options.forceOutput()) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } - fprintf(stdout, " incompatible change: Reference %d ('%s') in 'r1' is not longer a reference of this service in 'r2'\n", + dumpTypeClass(bDump, typeClass, keyName); + fprintf(stdout, + " incompatible change: Reference %d ('%s') in 'r1' is not longer a reference" + " of this service in 'r2'\n", i, U2S(shortName(reader1.getReferenceTypeName(i)))); } nError++; - } else + } + else { bFound = sal_False; } @@ -1573,12 +1268,10 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } - fprintf(stdout, " incompatible change: Reference %d ('%s') of r2 is a new reference compared to this service in r1 and is not 'optional'\n", + dumpTypeClass(bDump, typeClass, keyName); + fprintf(stdout, + " incompatible change: Reference %d ('%s') of r2 is a new reference" + " compared to this service in r1 and is not 'optional'\n", j, U2S(shortName(reader2.getReferenceTypeName(j)))); } nError++; @@ -1586,25 +1279,23 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s } } } - } else + } + else { if ( nReference1 != nReference2 ) { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " nReferences1 = %d != nReferences2 = %d\n", nReference1, nReference2); } nError++; } + sal_uInt16 i; for (i=0; i < nReference1 && i < nReference2; i++) { - nError += checkReference(keyName, typeClass, bDump, reader1, reader2, i, i); + nError += checkReference(options, keyName, typeClass, bDump, reader1, reader2, i, i); } if ( i < nReference1 && options.forceOutput() ) { @@ -1621,38 +1312,19 @@ static sal_uInt32 checkBlob(const OUString& keyName, typereg::Reader& reader1, s { if ( options.forceOutput() ) { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } + dumpTypeClass(bDump, typeClass, keyName); fprintf(stdout, " Doku1 = %s\n Doku2 = %s\n", U2S(reader1.getDocumentation()), U2S(reader2.getDocumentation())); } nError++; } -/* - if ( nError && - (!keyName.compareTo(OUString::createFromAscii("/UCR/drafts"), 11) || - !keyName.compareTo(OUString::createFromAscii("/drafts"), 7)) ) - { - if ( options.forceOutput() ) - { - if ( bDump ) - { - fprintf(stdout, "%s: %s\n", getTypeClass(typeClass), U2S(keyName)); - bDump = sal_False; - } - fprintf(stdout, " Note: \"drafts\" type changed incompatible, no effect to the final API\n"); - } - return 0; - } -*/ return nError; } -static sal_uInt32 checkValueDifference(RegistryKey& key1, RegValueType valueType1, sal_uInt32 size1, - RegistryKey& key2, RegValueType valueType2, sal_uInt32 size2) +static sal_uInt32 checkValueDifference( + Options_Impl const & options, + RegistryKey& key1, RegValueType valueType1, sal_uInt32 size1, + RegistryKey& key2, RegValueType valueType2, sal_uInt32 size2) { OUString tmpName; sal_uInt32 nError = 0; @@ -1737,39 +1409,31 @@ static sal_uInt32 checkValueDifference(RegistryKey& key1, RegValueType valueType if ( bEqual) { - RegValue value1 = rtl_allocateMemory(size1); - RegValue value2 = rtl_allocateMemory(size2); + std::vector< sal_uInt8 > value1(size1); + key1.getValue(tmpName, &value1[0]); - key1.getValue(tmpName, value1); - key2.getValue(tmpName, value2); + std::vector< sal_uInt8 > value2(size2); + key2.getValue(tmpName, &value2[0]); - bEqual = (rtl_compareMemory(value1, value2, size1) == 0 ); - + bEqual = (rtl_compareMemory(&value1[0], &value2[0], value1.size()) == 0 ); if ( !bEqual && valueType1 == RG_VALUETYPE_BINARY && valueType2 == RG_VALUETYPE_BINARY ) { - typereg::Reader reader1( - value1, size1, false, TYPEREG_VERSION_1); - typereg::Reader reader2( - value2, size2, false, TYPEREG_VERSION_1); - + typereg::Reader reader1(&value1[0], value1.size(), false, TYPEREG_VERSION_1); + typereg::Reader reader2(&value2[0], value2.size(), false, TYPEREG_VERSION_1); if ( reader1.isValid() && reader2.isValid() ) { - return checkBlob(key1.getName(), reader1, size1, reader2, size2); + return checkBlob(options, key1.getName(), reader1, size1, reader2, size2); } } - - rtl_freeMemory(value1); - rtl_freeMemory(value2); - if ( bEqual ) { return 0; - } else + } + else { if ( options.forceOutput() ) { - fprintf(stdout, "Difference: key values of key \"%s\" are different\n", - U2S(key1.getName())); + fprintf(stdout, "Difference: key values of key \"%s\" are different\n", U2S(key1.getName())); } nError++; } @@ -1784,102 +1448,98 @@ static sal_uInt32 checkValueDifference(RegistryKey& key1, RegValueType valueType fprintf(stdout, " Registry 1: key has no value\n"); break; case RG_VALUETYPE_LONG: - case RG_VALUETYPE_STRING: - case RG_VALUETYPE_UNICODE: - { - RegValue value1 = rtl_allocateMemory(size1); - key1.getValue(tmpName, value1); - - switch (valueType1) { - case RG_VALUETYPE_LONG: + std::vector< sal_uInt8 > value1(size1); + key1.getValue(tmpName, &value1[0]); + fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_LONG\n"); fprintf( stdout, " Size = %lu\n", sal::static_int_cast< unsigned long >(size1)); - fprintf(stdout, " Data = %p\n", value1); - break; - case RG_VALUETYPE_STRING: + fprintf(stdout, " Data = %p\n", &value1[0]); + } + break; + case RG_VALUETYPE_STRING: + { + std::vector< sal_uInt8 > value1(size1); + key1.getValue(tmpName, &value1[0]); + fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_STRING\n"); fprintf( stdout, " Size = %lu\n", sal::static_int_cast< unsigned long >(size1)); - fprintf(stdout, " Data = \"%s\"\n", (sal_Char*)value1); - break; - case RG_VALUETYPE_UNICODE: - { - OUString uStrValue((sal_Unicode*)value1); + fprintf(stdout, " Data = \"%s\"\n", reinterpret_cast<char const*>(&value1[0])); + } + break; + case RG_VALUETYPE_UNICODE: + { + std::vector< sal_uInt8 > value1(size1); + key1.getValue(tmpName, &value1[0]); + + OUString uStrValue(reinterpret_cast<sal_Unicode const*>(&value1[0])); fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_UNICODE\n"); fprintf( stdout, " Size = %lu\n", sal::static_int_cast< unsigned long >(size1)); fprintf(stdout, " Data = \"%s\"\n", U2S(uStrValue)); - } - break; - default: - OSL_ASSERT(false); - break; } - - rtl_freeMemory(value1); - } break; case RG_VALUETYPE_BINARY: fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_BINARY\n"); break; case RG_VALUETYPE_LONGLIST: { - RegistryValueList<sal_Int32> valueList; - key1.getLongListValue(tmpName, valueList); - fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_LONGLIST\n"); - fprintf( - stdout, " Size = %lu\n", - sal::static_int_cast< unsigned long >(size1)); - sal_uInt32 length = valueList.getLength(); - for (sal_uInt32 i=0; i<length; i++) - { + RegistryValueList<sal_Int32> valueList; + key1.getLongListValue(tmpName, valueList); + fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_LONGLIST\n"); fprintf( - stdout, " Data[%lu] = %ld\n", - sal::static_int_cast< unsigned long >(i), - sal::static_int_cast< long >(valueList.getElement(i))); - } + stdout, " Size = %lu\n", + sal::static_int_cast< unsigned long >(size1)); + sal_uInt32 length = valueList.getLength(); + for (sal_uInt32 i=0; i<length; i++) + { + fprintf( + stdout, " Data[%lu] = %ld\n", + sal::static_int_cast< unsigned long >(i), + sal::static_int_cast< long >(valueList.getElement(i))); + } } break; case RG_VALUETYPE_STRINGLIST: { - RegistryValueList<sal_Char*> valueList; - key1.getStringListValue(tmpName, valueList); - fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_STRINGLIST\n"); - fprintf( - stdout, " Size = %lu\n", - sal::static_int_cast< unsigned long >(size1)); - sal_uInt32 length = valueList.getLength(); - for (sal_uInt32 i=0; i<length; i++) - { + RegistryValueList<sal_Char*> valueList; + key1.getStringListValue(tmpName, valueList); + fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_STRINGLIST\n"); fprintf( - stdout, " Data[%lu] = \"%s\"\n", - sal::static_int_cast< unsigned long >(i), - valueList.getElement(i)); - } + stdout, " Size = %lu\n", + sal::static_int_cast< unsigned long >(size1)); + sal_uInt32 length = valueList.getLength(); + for (sal_uInt32 i=0; i<length; i++) + { + fprintf( + stdout, " Data[%lu] = \"%s\"\n", + sal::static_int_cast< unsigned long >(i), + valueList.getElement(i)); + } } break; case RG_VALUETYPE_UNICODELIST: { - RegistryValueList<sal_Unicode*> valueList; - key1.getUnicodeListValue(tmpName, valueList); - fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_UNICODELIST\n"); - fprintf( - stdout, " Size = %lu\n", - sal::static_int_cast< unsigned long >(size1)); - sal_uInt32 length = valueList.getLength(); - OUString uStrValue; - for (sal_uInt32 i=0; i<length; i++) - { - uStrValue = OUString(valueList.getElement(i)); + RegistryValueList<sal_Unicode*> valueList; + key1.getUnicodeListValue(tmpName, valueList); + fprintf(stdout, " Registry 1: Value: Type = RG_VALUETYPE_UNICODELIST\n"); fprintf( - stdout, " Data[%lu] = \"%s\"\n", - sal::static_int_cast< unsigned long >(i), U2S(uStrValue)); - } + stdout, " Size = %lu\n", + sal::static_int_cast< unsigned long >(size1)); + sal_uInt32 length = valueList.getLength(); + OUString uStrValue; + for (sal_uInt32 i=0; i<length; i++) + { + uStrValue = OUString(valueList.getElement(i)); + fprintf( + stdout, " Data[%lu] = \"%s\"\n", + sal::static_int_cast< unsigned long >(i), U2S(uStrValue)); + } } break; } @@ -1890,102 +1550,98 @@ static sal_uInt32 checkValueDifference(RegistryKey& key1, RegValueType valueType fprintf(stdout, " Registry 2: key has no value\n"); break; case RG_VALUETYPE_LONG: - case RG_VALUETYPE_STRING: - case RG_VALUETYPE_UNICODE: - { - RegValue value2 = rtl_allocateMemory(size2); - key2.getValue(tmpName, value2); - - switch (valueType2) { - case RG_VALUETYPE_LONG: + std::vector< sal_uInt8 > value2(size2); + key2.getValue(tmpName, &value2[0]); + fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_LONG\n"); fprintf( stdout, " Size = %lu\n", sal::static_int_cast< unsigned long >(size2)); - fprintf(stdout, " Data = %p\n", value2); - break; - case RG_VALUETYPE_STRING: + fprintf(stdout, " Data = %p\n", &value2[0]); + } + break; + case RG_VALUETYPE_STRING: + { + std::vector< sal_uInt8 > value2(size2); + key2.getValue(tmpName, &value2[0]); + fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_STRING\n"); fprintf( stdout, " Size = %lu\n", sal::static_int_cast< unsigned long >(size2)); - fprintf(stdout, " Data = \"%s\"\n", (sal_Char*)value2); - break; - case RG_VALUETYPE_UNICODE: - { - OUString uStrValue((sal_Unicode*)value2); + fprintf(stdout, " Data = \"%s\"\n", reinterpret_cast<char const*>(&value2[0])); + } + break; + case RG_VALUETYPE_UNICODE: + { + std::vector< sal_uInt8 > value2(size2); + key2.getValue(tmpName, &value2[0]); + + OUString uStrValue(reinterpret_cast<sal_Unicode const*>(&value2[0])); fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_UNICODE\n"); fprintf( stdout, " Size = %lu\n", sal::static_int_cast< unsigned long >(size2)); fprintf(stdout, " Data = \"%s\"\n", U2S(uStrValue)); - } - break; - default: - OSL_ASSERT(false); - break; } - - rtl_freeMemory(value2); - } break; case RG_VALUETYPE_BINARY: fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_BINARY\n"); break; case RG_VALUETYPE_LONGLIST: { - RegistryValueList<sal_Int32> valueList; - key2.getLongListValue(tmpName, valueList); - fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_LONGLIST\n"); - fprintf( - stdout, " Size = %lu\n", - sal::static_int_cast< unsigned long >(size2)); - sal_uInt32 length = valueList.getLength(); - for (sal_uInt32 i=0; i<length; i++) - { + RegistryValueList<sal_Int32> valueList; + key2.getLongListValue(tmpName, valueList); + fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_LONGLIST\n"); fprintf( - stdout, " Data[%lu] = %ld\n", - sal::static_int_cast< unsigned long >(i), - sal::static_int_cast< long >(valueList.getElement(i))); - } + stdout, " Size = %lu\n", + sal::static_int_cast< unsigned long >(size2)); + sal_uInt32 length = valueList.getLength(); + for (sal_uInt32 i=0; i<length; i++) + { + fprintf( + stdout, " Data[%lu] = %ld\n", + sal::static_int_cast< unsigned long >(i), + sal::static_int_cast< long >(valueList.getElement(i))); + } } break; case RG_VALUETYPE_STRINGLIST: { - RegistryValueList<sal_Char*> valueList; - key2.getStringListValue(tmpName, valueList); - fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_STRINGLIST\n"); - fprintf( - stdout, " Size = %lu\n", - sal::static_int_cast< unsigned long >(size2)); - sal_uInt32 length = valueList.getLength(); - for (sal_uInt32 i=0; i<length; i++) - { + RegistryValueList<sal_Char*> valueList; + key2.getStringListValue(tmpName, valueList); + fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_STRINGLIST\n"); fprintf( - stdout, " Data[%lu] = \"%s\"\n", - sal::static_int_cast< unsigned long >(i), - valueList.getElement(i)); - } + stdout, " Size = %lu\n", + sal::static_int_cast< unsigned long >(size2)); + sal_uInt32 length = valueList.getLength(); + for (sal_uInt32 i=0; i<length; i++) + { + fprintf( + stdout, " Data[%lu] = \"%s\"\n", + sal::static_int_cast< unsigned long >(i), + valueList.getElement(i)); + } } break; case RG_VALUETYPE_UNICODELIST: { - RegistryValueList<sal_Unicode*> valueList; - key2.getUnicodeListValue(tmpName, valueList); - fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_UNICODELIST\n"); - fprintf( - stdout, " Size = %lu\n", - sal::static_int_cast< unsigned long >(size2)); - sal_uInt32 length = valueList.getLength(); - OUString uStrValue; - for (sal_uInt32 i=0; i<length; i++) - { - uStrValue = OUString(valueList.getElement(i)); + RegistryValueList<sal_Unicode*> valueList; + key2.getUnicodeListValue(tmpName, valueList); + fprintf(stdout, " Registry 2: Value: Type = RG_VALUETYPE_UNICODELIST\n"); fprintf( - stdout, " Data[%lu] = \"%s\"\n", - sal::static_int_cast< unsigned long >(i), U2S(uStrValue)); - } + stdout, " Size = %lu\n", + sal::static_int_cast< unsigned long >(size2)); + sal_uInt32 length = valueList.getLength(); + OUString uStrValue; + for (sal_uInt32 i=0; i<length; i++) + { + uStrValue = OUString(valueList.getElement(i)); + fprintf( + stdout, " Data[%lu] = \"%s\"\n", + sal::static_int_cast< unsigned long >(i), U2S(uStrValue)); + } } break; } @@ -1993,58 +1649,67 @@ static sal_uInt32 checkValueDifference(RegistryKey& key1, RegValueType valueType return nError; } -static bool hasPublishedChildren(RegistryKey & key) { +static bool hasPublishedChildren(Options_Impl const & options, RegistryKey & key) +{ RegistryKeyNames subKeyNames; key.getKeyNames(rtl::OUString(), subKeyNames); - for (sal_uInt32 i = 0; i < subKeyNames.getLength(); ++i) { + for (sal_uInt32 i = 0; i < subKeyNames.getLength(); ++i) + { rtl::OUString keyName(subKeyNames.getElement(i)); - if (!options.matchedWithExcludeKey(keyName)) { + if (!options.matchedWithExcludeKey(keyName)) + { keyName = keyName.copy(keyName.lastIndexOf('/') + 1); RegistryKey subKey; - if (!key.openKey(keyName, subKey)) { - if (options.forceOutput()) { + if (!key.openKey(keyName, subKey)) + { + if (options.forceOutput()) + { fprintf( stdout, ("WARNING: could not open key \"%s\" in registry" " \"%s\"\n"), U2S(subKeyNames.getElement(i)), - options.getRegName1().getStr()); + options.getRegName1().c_str()); } } - if (subKey.isValid()) { + if (subKey.isValid()) + { RegValueType type; sal_uInt32 size; - if (subKey.getValueInfo(rtl::OUString(), &type, &size) - != REG_NO_ERROR) + if (subKey.getValueInfo(rtl::OUString(), &type, &size) != REG_NO_ERROR) { - if (options.forceOutput()) { + if (options.forceOutput()) + { fprintf( stdout, ("WARNING: could not read key \"%s\" in registry" " \"%s\"\n"), U2S(subKeyNames.getElement(i)), - options.getRegName1().getStr()); + options.getRegName1().c_str()); } - } else if (type == RG_VALUETYPE_BINARY) { - char * value = new char[size]; + } + else if (type == RG_VALUETYPE_BINARY) + { bool published = false; - if (subKey.getValue(rtl::OUString(), value) != REG_NO_ERROR) + std::vector< sal_uInt8 > value(size); + if (subKey.getValue(rtl::OUString(), &value[0]) != REG_NO_ERROR) { - if (options.forceOutput()) { + if (options.forceOutput()) + { fprintf( stdout, ("WARNING: could not read key \"%s\" in" " registry \"%s\"\n"), U2S(subKeyNames.getElement(i)), - options.getRegName1().getStr()); + options.getRegName1().c_str()); } - } else { - published = typereg::Reader( - value, size, false, TYPEREG_VERSION_1). - isPublished(); } - delete[] value; - if (published) { + else + { + published = typereg::Reader(&value[0], value.size(), false, TYPEREG_VERSION_1).isPublished(); + } + if (published) + { return true; } } @@ -2055,7 +1720,9 @@ static bool hasPublishedChildren(RegistryKey & key) { } static sal_uInt32 checkDifferences( - RegistryKey& key, StringSet& keys, RegistryKeyNames& subKeyNames1, + Options_Impl const & options, + RegistryKey& key, StringSet& keys, + RegistryKeyNames& subKeyNames1, RegistryKeyNames& subKeyNames2) { sal_uInt32 nError = 0; @@ -2082,81 +1749,89 @@ static sal_uInt32 checkDifferences( if ( options.forceOutput() ) { fprintf(stdout, "EXISTENCE: key \"%s\" exists only in registry \"%s\"\n", - U2S(subKeyNames1.getElement(i)), options.getRegName1().getStr()); + U2S(subKeyNames1.getElement(i)), options.getRegName1().c_str()); } nError++; } else { rtl::OUString keyName(subKeyNames1.getElement(i)); - if (!options.matchedWithExcludeKey(keyName)) { + if (!options.matchedWithExcludeKey(keyName)) + { keyName = keyName.copy(keyName.lastIndexOf('/') + 1); RegistryKey subKey; - if (key.openKey(keyName, subKey)) { - if (options.forceOutput()) { + if (key.openKey(keyName, subKey)) + { + if (options.forceOutput()) + { fprintf( stdout, ("ERROR: could not open key \"%s\" in registry" " \"%s\"\n"), U2S(subKeyNames1.getElement(i)), - options.getRegName1().getStr()); + options.getRegName1().c_str()); } ++nError; } - if (subKey.isValid()) { + if (subKey.isValid()) + { RegValueType type; sal_uInt32 size; - if (subKey.getValueInfo(rtl::OUString(), &type, &size) - != REG_NO_ERROR) + if (subKey.getValueInfo(rtl::OUString(), &type, &size) != REG_NO_ERROR) { - if (options.forceOutput()) { + if (options.forceOutput()) + { fprintf( stdout, ("ERROR: could not read key \"%s\" in" " registry \"%s\"\n"), U2S(subKeyNames1.getElement(i)), - options.getRegName1().getStr()); + options.getRegName1().c_str()); } ++nError; - } else if (type == RG_VALUETYPE_BINARY) { - char * value = new char[size]; - if (subKey.getValue(rtl::OUString(), value) - != REG_NO_ERROR) + } + else if (type == RG_VALUETYPE_BINARY) + { + std::vector< sal_uInt8 > value(size); + if (subKey.getValue(rtl::OUString(), &value[0]) != REG_NO_ERROR) { - if (options.forceOutput()) { + if (options.forceOutput()) + { fprintf( stdout, ("ERROR: could not read key \"%s\" in" " registry \"%s\"\n"), U2S(subKeyNames1.getElement(i)), - options.getRegName1().getStr()); + options.getRegName1().c_str()); } ++nError; - } else { - typereg::Reader reader( - value, size, false, TYPEREG_VERSION_1); - if (reader.getTypeClass() == RT_TYPE_MODULE) { - if (options.checkUnpublished() - || hasPublishedChildren(subKey)) + } + else + { + typereg::Reader reader(&value[0], value.size(), false, TYPEREG_VERSION_1); + if (reader.getTypeClass() == RT_TYPE_MODULE) + { + if (options.checkUnpublished() || hasPublishedChildren(options, subKey)) { - if (options.forceOutput()) { + if (options.forceOutput()) + { fprintf( stdout, ("EXISTENCE: module \"%s\"" " %sexists only in registry" " 1\n"), - U2S(subKeyNames1.getElement( - i)), + U2S(subKeyNames1.getElement(i)), (options.checkUnpublished() ? "" : "with published children ")); } ++nError; } - } else if (options.checkUnpublished() - || reader.isPublished()) + } + else if (options.checkUnpublished() || reader.isPublished()) { - if (options.forceOutput()) { + if (options.forceOutput()) + { fprintf( stdout, ("EXISTENCE: %spublished key \"%s\"" @@ -2167,7 +1842,6 @@ static sal_uInt32 checkDifferences( ++nError; } } - delete[] value; } } } @@ -2192,7 +1866,7 @@ static sal_uInt32 checkDifferences( if ( options.forceOutput() ) { fprintf(stdout, "EXISTENCE: key \"%s\" exists only in registry \"%s\"\n", - U2S(subKeyNames2.getElement(i)), options.getRegName2().getStr()); + U2S(subKeyNames2.getElement(i)), options.getRegName2().c_str()); } nError++; } @@ -2200,7 +1874,10 @@ static sal_uInt32 checkDifferences( return nError; } -static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2) +static sal_uInt32 compareKeys( + Options_Impl const & options, + RegistryKey& key1, + RegistryKey& key2) { sal_uInt32 nError = 0; @@ -2208,16 +1885,17 @@ static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2) RegValueType valueType2 = RG_VALUETYPE_NOT_DEFINED; sal_uInt32 size1 = 0; sal_uInt32 size2 = 0; + OUString tmpName; RegError e1 = key1.getValueInfo(tmpName, &valueType1, &size1); RegError e2 = key2.getValueInfo(tmpName, &valueType2, &size2); - - if ( e1 == e2 && e1 != REG_VALUE_NOT_EXISTS && e1 != REG_INVALID_VALUE ) + if ( (e1 == e2) && (e1 != REG_VALUE_NOT_EXISTS) && (e1 != REG_INVALID_VALUE) ) { - nError += checkValueDifference(key1, valueType1, size1, key2, valueType2, size2); - } else + nError += checkValueDifference(options, key1, valueType1, size1, key2, valueType2, size2); + } + else { - if ( e1 != REG_INVALID_VALUE || e2 != REG_INVALID_VALUE ) + if ( (e1 != REG_INVALID_VALUE) || (e2 != REG_INVALID_VALUE) ) { if ( options.forceOutput() ) { @@ -2234,16 +1912,14 @@ static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2) key2.getKeyNames(tmpName, subKeyNames2); StringSet keys; - nError += checkDifferences(key1, keys, subKeyNames1, subKeyNames2); + nError += checkDifferences(options, key1, keys, subKeyNames1, subKeyNames2); StringSet::iterator iter = keys.begin(); StringSet::iterator end = keys.end(); - RegistryKey subKey1, subKey2; - OUString keyName; while ( iter != end ) { - keyName = OUString(*iter); + OUString keyName(*iter); if ( options.matchedWithExcludeKey(keyName) ) { ++iter; @@ -2252,30 +1928,33 @@ static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2) sal_Int32 nPos = keyName.lastIndexOf( '/' ); keyName = keyName.copy( nPos != -1 ? nPos+1 : 0 ); + + RegistryKey subKey1; if ( key1.openKey(keyName, subKey1) ) { if ( options.forceOutput() ) { fprintf(stdout, "ERROR: could not open key \"%s\" in registry \"%s\"\n", - U2S(*iter), options.getRegName1().getStr()); + U2S(*iter), options.getRegName1().c_str()); } nError++; } + + RegistryKey subKey2; if ( key2.openKey(keyName, subKey2) ) { if ( options.forceOutput() ) { fprintf(stdout, "ERROR: could not open key \"%s\" in registry \"%s\"\n", - U2S(*iter), options.getRegName2().getStr()); + U2S(*iter), options.getRegName2().c_str()); } nError++; } + if ( subKey1.isValid() && subKey2.isValid() ) { - nError += compareKeys(subKey1, subKey2); + nError += compareKeys(options, subKey1, subKey2); } - subKey1.releaseKey(); - subKey2.releaseKey(); ++iter; } @@ -2288,93 +1967,107 @@ int main( int argc, char * argv[] ) int _cdecl main( int argc, char * argv[] ) #endif { - if ( !options.initOptions(argc, argv) ) + std::vector< std::string > args; + + Options_Impl options(argv[0]); + for (int i = 1; i < argc; i++) { - exit(1); + if (!Options::checkArgument(args, argv[i], strlen(argv[i]))) + { + // failure. + options.printUsage(); + return (1); + } + } + if (!options.initOptions(args)) + { + return (1); } - OUString regName1( convertToFileUrl(options.getRegName1()) ); - OUString regName2( convertToFileUrl(options.getRegName2()) ); + OUString regName1( convertToFileUrl(options.getRegName1().c_str(), options.getRegName1().size()) ); + OUString regName2( convertToFileUrl(options.getRegName2().c_str(), options.getRegName2().size()) ); - Registry reg1; - Registry reg2; - + Registry reg1, reg2; if ( reg1.open(regName1, REG_READONLY) ) { fprintf(stdout, "%s: open registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName1().getStr()); - exit(2); + options.getProgramName().c_str(), options.getRegName1().c_str()); + return (2); } if ( reg2.open(regName2, REG_READONLY) ) { fprintf(stdout, "%s: open registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName2().getStr()); - exit(3); + options.getProgramName().c_str(), options.getRegName2().c_str()); + return (3); } RegistryKey key1, key2; if ( reg1.openRootKey(key1) ) { fprintf(stdout, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName1().getStr()); - exit(4); + options.getProgramName().c_str(), options.getRegName1().c_str()); + return (4); } if ( reg2.openRootKey(key2) ) { fprintf(stdout, "%s: open root key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName2().getStr()); - exit(5); + options.getProgramName().c_str(), options.getRegName2().c_str()); + return (5); } + if ( options.isStartKeyValid() ) { - if ( options.matchedWithExcludeKey( S2U(options.getStartKey()) ) ) + if ( options.matchedWithExcludeKey( options.getStartKey() ) ) { fprintf(stdout, "%s: start key is equal to one of the exclude keys\n", - options.getProgramName().getStr()); - exit(6); + options.getProgramName().c_str()); + return (6); } RegistryKey sk1, sk2; - if ( key1.openKey(S2U(options.getStartKey()), sk1) ) + if ( key1.openKey(options.getStartKey(), sk1) ) { fprintf(stdout, "%s: open start key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName1().getStr()); - exit(7); + options.getProgramName().c_str(), options.getRegName1().c_str()); + return (7); } - if ( key2.openKey(S2U(options.getStartKey()), sk2) ) + if ( key2.openKey(options.getStartKey(), sk2) ) { fprintf(stdout, "%s: open start key of registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName2().getStr()); - exit(8); + options.getProgramName().c_str(), options.getRegName2().c_str()); + return (8); } key1 = sk1; key2 = sk2; } - sal_uInt32 nError = compareKeys(key1, key2); + sal_uInt32 nError = compareKeys(options, key1, key2); if ( nError ) { if ( options.unoTypeCheck() ) { fprintf(stdout, "%s: registries are incompatible: %lu differences!\n", - options.getProgramName().getStr(), + options.getProgramName().c_str(), sal::static_int_cast< unsigned long >(nError)); - } else + } + else { fprintf(stdout, "%s: registries contain %lu differences!\n", - options.getProgramName().getStr(), + options.getProgramName().c_str(), sal::static_int_cast< unsigned long >(nError)); } - } else + } + else { if ( options.unoTypeCheck() ) { fprintf(stdout, "%s: registries are compatible!\n", - options.getProgramName().getStr()); - } else + options.getProgramName().c_str()); + } + else { fprintf(stdout, "%s: registries are equal!\n", - options.getProgramName().getStr()); + options.getProgramName().c_str()); } } @@ -2383,17 +2076,15 @@ int _cdecl main( int argc, char * argv[] ) if ( reg1.close() ) { fprintf(stdout, "%s: closing registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName1().getStr()); - exit(9); + options.getProgramName().c_str(), options.getRegName1().c_str()); + return (9); } if ( reg2.close() ) { fprintf(stdout, "%s: closing registry \"%s\" failed\n", - options.getProgramName().getStr(), options.getRegName2().getStr()); - exit(10); + options.getProgramName().c_str(), options.getRegName2().c_str()); + return (10); } - return nError > 0 ? 11 : 0; + return ((nError > 0) ? 11 : 0); } - - diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx index 8c310d733..409ceb505 100644 --- a/registry/tools/regmerge.cxx +++ b/registry/tools/regmerge.cxx @@ -28,70 +28,35 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" -#include <stdio.h> -#include <string.h> - #include "registry/registry.hxx" -#include <rtl/ustring.hxx> -#include <rtl/alloc.h> -#include <osl/process.h> -#include <osl/diagnose.h> -#include <osl/thread.h> -#include <osl/file.hxx> +#include "fileurl.hxx" +#include "options.hxx" -#ifdef SAL_UNX -#define SEPARATOR '/' -#else -#define SEPARATOR '\\' -#endif +#include "rtl/ustring.hxx" +#include "osl/diagnose.h" -using namespace ::rtl; -using namespace ::osl; +#include <stdio.h> +#include <string.h> -sal_Bool isFileUrl(const OString& fileName) -{ - if (fileName.indexOf("file://") == 0 ) - return sal_True; - return sal_False; -} +using namespace rtl; +using namespace registry::tools; -OUString convertToFileUrl(const OString& fileName) +class Options_Impl : public Options { - if ( isFileUrl(fileName) ) - { - return OStringToOUString(fileName, osl_getThreadTextEncoding()); - } - - OUString uUrlFileName; - OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); - if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) - { - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) - { - OSL_ASSERT(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } else - { - if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } + bool m_bVerbose; - return uUrlFileName; -} +public: + explicit Options_Impl (char const * program) + : Options(program), m_bVerbose(false) + {} + bool isVerbose() const { return m_bVerbose; } -int realargc; -char* realargv[2048]; +protected: + virtual void printUsage_Impl() const; + virtual bool initOptions_Impl(std::vector< std::string > & rArgs); +}; -static void dumpHelp() +void Options_Impl::printUsage_Impl() const { fprintf(stderr, "using: regmerge [-v|--verbose] mergefile mergeKeyName regfile_1 ... regfile_n\n"); fprintf(stderr, " regmerge @regcmds\nOptions:\n"); @@ -103,100 +68,28 @@ static void dumpHelp() fprintf(stderr, " regfile_1..n : specifies one or more registry files which are merged.\n"); } -static bool checkCommandFile(char* cmdfile) +bool Options_Impl::initOptions_Impl (std::vector< std::string > & rArgs) { - FILE *commandfile; - char option[256]; - bool bVerbose = false; - - commandfile = fopen(cmdfile+1, "r"); - if( commandfile == NULL ) + std::vector< std::string >::iterator first = rArgs.begin(), last = rArgs.end(); + if ((first != last) && ((*first)[0] == '-')) { - fprintf(stderr, "ERROR: Can't open command file \"%s\"\n", cmdfile); - } else - { - while ( fscanf(commandfile, "%s", option) != EOF ) + std::string option(*first); + if ((option.compare("-v") == 0) || (option.compare("--verbose") == 0)) { - if (option[0]== '@') - { - bool bRet = checkCommandFile(option); - // ensure that the option will not be overwritten - if ( !bRet ) - bVerbose = bRet; - } else { - if (option[0]== '-') { - if (strncmp(option, "-v", 2) == 0 || - strncmp(option, "--verbose", 9) == 0) - { - bVerbose = true; - } else { - fprintf(stderr, "ERROR: unknown option \"%s\"\n", option); - dumpHelp(); - exit(-1); - } - }else - { - realargv[realargc]= strdup(option); - realargc++; - } - } - if (realargc == 2047) - { - fprintf(stderr, "ERROR: more than 2048 arguments.\n"); - break; - } + m_bVerbose = true; } - fclose(commandfile); - } - - return bVerbose; -} - -static bool checkCommandArgs(int argc, char **argv) -{ - bool bVerbose = false; - - realargc = 0; - - for (int i=0; i<argc; i++) - { - if (argv[i][0]== '@') + else if ((option.compare("-h") == 0) || (option.compare("-?") == 0)) { - bool bRet = checkCommandFile(argv[i]); - // ensure that the option will not be overwritten - if ( !bRet ) - bVerbose = bRet; - } else { - if (argv[i][0]== '-') { - if (strncmp(argv[i], "-v", 2) == 0 || - strncmp(argv[i], "--verbose", 9) == 0) - { - bVerbose = true; - } else { - fprintf(stderr, "ERROR: unknown option \"%s\"\n", argv[i]); - dumpHelp(); - exit(-1); - } - } else - { - realargv[realargc]= strdup(argv[i]); - realargc++; - } + return printUsage(); } + else + { + return badOption("unknown", option.c_str()); + } + (void) rArgs.erase(first); } - - return bVerbose; -} - -static void cleanCommandArgs() -{ - for (int i=0; i<realargc; i++) - { - free(realargv[i]); - } -} - - + return true; +} #if (defined UNX) || (defined OS2) int main( int argc, char * argv[] ) @@ -204,79 +97,83 @@ int main( int argc, char * argv[] ) int _cdecl main( int argc, char * argv[] ) #endif { - bool bVerbose = checkCommandArgs(argc, argv); + Options_Impl options(argv[0]); - if (realargc < 4) + std::vector< std::string > args; + for (int i = 1; i < argc; i++) { - dumpHelp(); - cleanCommandArgs(); - exit(1); + if (!Options::checkArgument(args, argv[i], strlen(argv[i]))) + { + options.printUsage(); + return (1); + } + } + if (!options.initOptions(args)) + { + return (1); + } + if (args.size() < 3) + { + options.printUsage(); + return (1); } - - ::rtl::OUString regName( convertToFileUrl(realargv[1]) ); Registry reg; + OUString regName( convertToFileUrl(args[0].c_str(), args[0].size()) ); if (reg.open(regName, REG_READWRITE) != REG_NO_ERROR) { if (reg.create(regName) != REG_NO_ERROR) { - if (bVerbose) - fprintf(stderr, "open registry \"%s\" failed\n", realargv[1]); - cleanCommandArgs(); - exit(-1); + if (options.isVerbose()) + fprintf(stderr, "open registry \"%s\" failed\n", args[0].c_str()); + return (-1); } } RegistryKey rootKey; - if (reg.openRootKey(rootKey) == REG_NO_ERROR) + if (reg.openRootKey(rootKey) != REG_NO_ERROR) { - ::rtl::OUString mergeKeyName( ::rtl::OUString::createFromAscii(realargv[2]) ); - ::rtl::OUString targetRegName; - for (int i = 3; i < realargc; i++) + if (options.isVerbose()) + fprintf(stderr, "open root key of registry \"%s\" failed\n", args[0].c_str()); + return (-4); + } + + OUString mergeKeyName( OUString::createFromAscii(args[1].c_str()) ); + for (size_t i = 2; i < args.size(); i++) + { + OUString targetRegName( convertToFileUrl(args[i].c_str(), args[i].size()) ); + RegError _ret = reg.mergeKey(rootKey, mergeKeyName, targetRegName, sal_False, options.isVerbose()); + if (_ret != REG_NO_ERROR) { - targetRegName = convertToFileUrl(realargv[i]); - RegError _ret = reg.mergeKey(rootKey, mergeKeyName, targetRegName, sal_False, bVerbose); - if (_ret != REG_NO_ERROR) - { - if (_ret == REG_MERGE_CONFLICT) - { - if (bVerbose) - fprintf(stderr, "merging registry \"%s\" under key \"%s\" in registry \"%s\".\n", - realargv[i], realargv[2], realargv[1]); - } else - { - if (bVerbose) - fprintf(stderr, "ERROR: merging registry \"%s\" under key \"%s\" in registry \"%s\" failed.\n", - realargv[i], realargv[2], realargv[1]); - exit(-2); - } - } else + if (_ret == REG_MERGE_CONFLICT) { - if (bVerbose) + if (options.isVerbose()) fprintf(stderr, "merging registry \"%s\" under key \"%s\" in registry \"%s\".\n", - realargv[i], realargv[2], realargv[1]); + args[i].c_str(), args[1].c_str(), args[0].c_str()); + } + else + { + if (options.isVerbose()) + fprintf(stderr, "ERROR: merging registry \"%s\" under key \"%s\" in registry \"%s\" failed.\n", + args[i].c_str(), args[1].c_str(), args[0].c_str()); + return (-2); } } - - rootKey.releaseKey(); - } else - { - if (bVerbose) - fprintf(stderr, "open root key of registry \"%s\" failed\n", - realargv[1]); - exit(-4); + else + { + if (options.isVerbose()) + fprintf(stderr, "merging registry \"%s\" under key \"%s\" in registry \"%s\".\n", + args[i].c_str(), args[1].c_str(), args[0].c_str()); + } } + rootKey.releaseKey(); if (reg.close() != REG_NO_ERROR) { - if (bVerbose) - fprintf(stderr, "closing registry \"%s\" failed\n", realargv[1]); - cleanCommandArgs(); - exit(-5); + if (options.isVerbose()) + fprintf(stderr, "closing registry \"%s\" failed\n", args[0].c_str()); + return (-5); } - cleanCommandArgs(); return(0); } - - diff --git a/registry/tools/regview.cxx b/registry/tools/regview.cxx index 480772b11..d68461e9d 100644 --- a/registry/tools/regview.cxx +++ b/registry/tools/regview.cxx @@ -28,65 +28,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_registry.hxx" -#include <stdio.h> - #include "registry/registry.h" -#include <rtl/ustring.hxx> -#include <rtl/alloc.h> -#include <osl/process.h> -#include <osl/diagnose.h> -#include <osl/thread.h> -#include <osl/file.hxx> - -#ifdef SAL_UNX -#define SEPARATOR '/' -#else -#define SEPARATOR '\\' -#endif - -using namespace ::rtl; -using namespace ::osl; - -sal_Bool isFileUrl(const OString& fileName) -{ - if (fileName.indexOf("file://") == 0 ) - return sal_True; - return sal_False; -} +#include "fileurl.hxx" -OUString convertToFileUrl(const OString& fileName) -{ - if ( isFileUrl(fileName) ) - { - return OStringToOUString(fileName, osl_getThreadTextEncoding()); - } +#include "rtl/ustring.hxx" - OUString uUrlFileName; - OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); - if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) - { - OUString uWorkingDir; - if (osl_getProcessWorkingDir(&uWorkingDir.pData) != osl_Process_E_None) - { - OSL_ASSERT(false); - } - if (FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } else - { - if (FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) - != FileBase::E_None) - { - OSL_ASSERT(false); - } - } - - return uUrlFileName; -} +#include <stdio.h> +#include <string.h> +using rtl::OUString; +using namespace registry::tools; #if (defined UNX) || (defined OS2) int main( int argc, char * argv[] ) @@ -103,7 +54,7 @@ int _cdecl main( int argc, char * argv[] ) exit(1); } - OUString regName( convertToFileUrl(argv[1]) ); + OUString regName( convertToFileUrl(argv[1], strlen(argv[1])) ); if (reg_openRegistry(regName.pData, &hReg, REG_READONLY)) { fprintf(stderr, "open registry \"%s\" failed\n", argv[1]); @@ -127,12 +78,14 @@ int _cdecl main( int argc, char * argv[] ) fprintf(stderr, "closing key \"%s\" of registry \"%s\" failed\n", argv[2], argv[1]); } - } else + } + else { fprintf(stderr, "key \"%s\" not exists in registry \"%s\"\n", argv[2], argv[1]); } - } else + } + else { if (reg_dumpRegistry(hRootKey)) { @@ -144,7 +97,8 @@ int _cdecl main( int argc, char * argv[] ) { fprintf(stderr, "closing root key of registry \"%s\" failed\n", argv[1]); } - } else + } + else { fprintf(stderr, "open root key of registry \"%s\" failed\n", argv[1]); } diff --git a/remotebridges/prj/build.lst b/remotebridges/prj/build.lst index a1f16dbd6..5f2a661dd 100644 --- a/remotebridges/prj/build.lst +++ b/remotebridges/prj/build.lst @@ -1,6 +1,2 @@ -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 +rb remotebridges : LIBXSLT:libxslt cppu cppuhelper offuh rdbmaker sal NULL rb remotebridges\source\unourl_resolver nmake - all rb_urlresolv NULL -rb remotebridges\source\dynamicloader nmake - all rb_dynloader NULL diff --git a/remotebridges/prj/d.lst b/remotebridges/prj/d.lst index b304680e2..b8b46ae70 100644..100755 --- a/remotebridges/prj/d.lst +++ b/remotebridges/prj/d.lst @@ -1,20 +1,4 @@ -..\%__SRC%\bin\bridgefa*.dll %_DEST%\bin%_EXT%\bridgefa*.dll -..\%__SRC%\bin\remotebr*.dll %_DEST%\bin%_EXT%\remotebr*.dll -..\%__SRC%\bin\dynamicl*.dll %_DEST%\bin%_EXT%\dynamicl*.dll -..\%__SRC%\bin\uuresolv*.dll %_DEST%\bin%_EXT%\uuresolv*.dll -..\%__SRC%\bin\brdgfctr.rdb %_DEST%\rdb%_EXT%\brdgfctr.rdb -..\%__SRC%\bin\remotebridge.rdb %_DEST%\rdb%_EXT%\remotebridge.rdb -..\%__SRC%\bin\dynamicloader.rdb %_DEST%\rdb%_EXT%\dynamicloader.rdb -..\%__SRC%\bin\uuresolver.rdb %_DEST%\rdb%_EXT%\uuresolver.rdb -..\source\factory\brdgfctr.xml %_DEST%\xml%_EXT%\bridgefac.uno.xml -..\source\bridge\remotebridge.xml %_DEST%\xml%_EXT%\remotebridge.uno.xml -..\source\dynamicloader\dynamicloader.xml %_DEST%\xml%_EXT%\dynamicloader.uno.xml -..\source\unourl_resolver\uuresolver.xml %_DEST%\xml%_EXT%\uuresolver.uno.xml -..\%__SRC%\lib\bridgefac.uno.so %_DEST%\lib%_EXT%\bridgefac.uno.so -..\%__SRC%\lib\remotebridge.uno.so %_DEST%\lib%_EXT%\remotebridge.uno.so -..\%__SRC%\lib\dynamicloader.uno.so %_DEST%\lib%_EXT%\dynamicloader.uno.so +..\%__SRC%\bin\uuresolver.uno.dll %_DEST%\bin%_EXT%\uuresolver.uno.dll +..\%__SRC%\lib\uuresolver.uno.dylib %_DEST%\lib%_EXT%\uuresolver.uno.dylib ..\%__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/bridge_connection.cxx b/remotebridges/source/bridge/bridge_connection.cxx deleted file mode 100644 index 40d2c1926..000000000 --- a/remotebridges/source/bridge/bridge_connection.cxx +++ /dev/null @@ -1,139 +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 "bridge_connection.hxx" -#include "remote_bridge.hxx" -#include <rtl/byteseq.hxx> -#include <string.h> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::connection; - -namespace remotebridges_bridge -{ - OConnectionWrapper::OConnectionWrapper( const Reference < XConnection > &r ) : - m_r( r ), - m_nRef( 0 ) - { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - acquire = thisAcquire; - release = thisRelease; - read = thisRead; - write = thisWrite; - flush = thisFlush; - close = thisClose; - } - - OConnectionWrapper::~OConnectionWrapper() - { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); -} - - void OConnectionWrapper::thisAcquire( remote_Connection *p) - { - OConnectionWrapper * m = ( OConnectionWrapper * ) p; - osl_incrementInterlockedCount( &(m->m_nRef ) ); - } - - void OConnectionWrapper::thisRelease( remote_Connection * p) - { - OConnectionWrapper * m = ( OConnectionWrapper * ) p; - if( ! osl_decrementInterlockedCount( &( m->m_nRef ) ) ) - { - delete m; - } - } - - sal_Int32 OConnectionWrapper::thisRead( remote_Connection *p , sal_Int8 *pDest , sal_Int32 nSize ) - { - // guard the C-Code - OConnectionWrapper * m = ( OConnectionWrapper * ) p; - try - { - // TODO possible optimization : give - Sequence<sal_Int8> seq = toUnoSequence( ::rtl::ByteSequence(nSize, ::rtl::BYTESEQ_NODEFAULT) ); - sal_Int32 nRead = m->m_r->read( seq , nSize ); - memcpy( pDest , seq.getConstArray() , nRead ); - return nRead; - } - catch ( Exception & ) - { - return 0; - } - catch (::std::bad_alloc &) - { - return 0; - } - } - - sal_Int32 OConnectionWrapper::thisWrite( remote_Connection *p , - const sal_Int8 *pSource , - sal_Int32 nSize ) - { - // guard the C-Code - OConnectionWrapper * m = ( OConnectionWrapper * ) p; - try - { - Sequence< sal_Int8 > seq( pSource , nSize ); - m->m_r->write( seq ); - return nSize; - } - catch ( Exception & ) - { - return 0; - } - } - - void OConnectionWrapper::thisFlush( remote_Connection *p ) - { - // guard the C-Code - try - { - OConnectionWrapper * m = ( OConnectionWrapper * ) p; - m->m_r->flush(); - } - catch ( Exception & ) - { - } - } - - void OConnectionWrapper::thisClose( remote_Connection * p) - { - // guard the C-Code - try - { - OConnectionWrapper * m = ( OConnectionWrapper * ) p; - m->m_r->close(); - } - catch( Exception & ) - { - - } - } -} - - - diff --git a/remotebridges/source/bridge/bridge_connection.hxx b/remotebridges/source/bridge/bridge_connection.hxx deleted file mode 100644 index ca9044b9d..000000000 --- a/remotebridges/source/bridge/bridge_connection.hxx +++ /dev/null @@ -1,57 +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 <osl/interlck.h> - -#include <bridges/remote/connection.h> - -#include <com/sun/star/connection/XConnection.hpp> - -namespace remotebridges_bridge -{ - - class OConnectionWrapper : - public remote_Connection - { - public: - OConnectionWrapper( const ::com::sun::star::uno::Reference < - ::com::sun::star::connection::XConnection > & ); - ~OConnectionWrapper(); - - static void SAL_CALL thisAcquire( remote_Connection *); - static void SAL_CALL thisRelease( remote_Connection *); - static sal_Int32 SAL_CALL thisRead( remote_Connection * , sal_Int8 *pDest , sal_Int32 nSize ); - static sal_Int32 SAL_CALL thisWrite( remote_Connection * , - const sal_Int8 *pSource , - sal_Int32 nSize ); - static void SAL_CALL thisFlush( remote_Connection * ); - static void SAL_CALL thisClose( remote_Connection * ); - - ::com::sun::star::uno::Reference < ::com::sun::star::connection::XConnection > m_r; - oslInterlockedCount m_nRef; - }; -} - diff --git a/remotebridges/source/bridge/bridge_provider.cxx b/remotebridges/source/bridge/bridge_provider.cxx deleted file mode 100644 index a33d14f64..000000000 --- a/remotebridges/source/bridge/bridge_provider.cxx +++ /dev/null @@ -1,179 +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 "remote_bridge.hxx" - -#include <osl/diagnose.h> -#include <rtl/ustrbuf.hxx> - -#include <uno/mapping.hxx> -#include <uno/environment.h> - -#include <bridges/remote/remote.h> - -using namespace ::rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::bridge; - -namespace remotebridges_bridge -{ - - OInstanceProviderWrapper::OInstanceProviderWrapper( - const Reference <XInstanceProvider > & rProvider, - ORemoteBridge * pBridgeCallback ) : - m_rProvider( rProvider ), - m_nRef( 0 ), - m_pBridgeCallback( pBridgeCallback ) - { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - acquire = thisAcquire; - release = thisRelease; - getInstance = thisGetInstance; - } - - OInstanceProviderWrapper::~OInstanceProviderWrapper() - { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); - } - - void OInstanceProviderWrapper::thisAcquire( remote_InstanceProvider *p ) - { - OInstanceProviderWrapper * m = (OInstanceProviderWrapper *) p; - osl_incrementInterlockedCount( &(m->m_nRef ) ); - } - - void OInstanceProviderWrapper::thisRelease( remote_InstanceProvider *p ) - { - OInstanceProviderWrapper * m = ( OInstanceProviderWrapper *) p; - if( ! osl_decrementInterlockedCount( &(m->m_nRef ) ) ) - { - delete m; - } - } - - static void convertToRemoteRuntimeException ( uno_Any **ppException, - const ::rtl::OUString &sMessage, - const Reference< XInterface > &rContext, - Mapping &map ) - { - - uno_type_any_construct( *ppException , - 0 , - getCppuType( (RuntimeException *)0 ).getTypeLibType() , - 0 ); - - typelib_CompoundTypeDescription * pCompType = 0 ; - getCppuType( (Exception*)0 ).getDescription( (typelib_TypeDescription **) &pCompType ); - if( ! ((typelib_TypeDescription *)pCompType)->bComplete ) - { - typelib_typedescription_complete( (typelib_TypeDescription**) &pCompType ); - } - - char *pValue = (char*) (*ppException)->pData; - rtl_uString_assign( (rtl_uString ** ) pValue , sMessage.pData ); - - *((remote_Interface**) pValue+pCompType->pMemberOffsets[1]) = - (remote_Interface*) map.mapInterface( - rContext.get(), getCppuType( &rContext) ); - - typelib_typedescription_release( (typelib_TypeDescription *) pCompType ); - } - - void OInstanceProviderWrapper::thisGetInstance( - remote_InstanceProvider * pProvider , - uno_Environment *pEnvRemote, - remote_Interface **ppRemoteI, - rtl_uString *pInstanceName, - typelib_InterfaceTypeDescription *pType, - uno_Any **ppException - ) - { - OInstanceProviderWrapper * m = (OInstanceProviderWrapper *)pProvider; - - OSL_ASSERT( ppRemoteI ); - if( *ppRemoteI ) - { - (*ppRemoteI)->release( *ppRemoteI ); - *ppRemoteI = 0; - } - - OUString sCppuName( RTL_CONSTASCII_USTRINGPARAM( CPPU_CURRENT_LANGUAGE_BINDING_NAME ) ); - - uno_Environment *pEnvThis = 0; - uno_getEnvironment( &pEnvThis , - sCppuName.pData , - 0 ); - Mapping map( pEnvThis , pEnvRemote ); - pEnvThis->release( pEnvThis ); - - if( OUString( pType->aBase.pTypeName ) == - getCppuType( (Reference<XInterface>*)0).getTypeName() ) - { - try - { - Reference< XInterface > r = m->m_rProvider->getInstance( - OUString( pInstanceName ) ); - - *ppRemoteI = (remote_Interface*) map.mapInterface ( - r.get(), - getCppuType( (Reference< XInterface > *) 0 ) - ); - - if( *ppRemoteI && m->m_pBridgeCallback ) - { - m->m_pBridgeCallback->objectMappedSuccesfully(); - m->m_pBridgeCallback = 0; - } - *ppException = 0; - } - catch( ::com::sun::star::container::NoSuchElementException &e ) - { - // NoSuchElementException not specified, so convert it to a runtime exception - convertToRemoteRuntimeException( - ppException , e.Message.pData , e.Context.get(), map ); - } - catch( ::com::sun::star::uno::RuntimeException &e ) - { - convertToRemoteRuntimeException( - ppException , e.Message.pData , e.Context.get(), map ); - } - - } - else - { - OUStringBuffer msg; - msg.appendAscii( - RTL_CONSTASCII_STRINGPARAM( - "getInstance expected XInterface but got ")); - msg.append(pType->aBase.pTypeName); - convertToRemoteRuntimeException( - ppException, msg.getStr(), Reference< XInterface >(), map); - } - } -} diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk deleted file mode 100644 index 2a5ea130d..000000000 --- a/remotebridges/source/bridge/makefile.mk +++ /dev/null @@ -1,72 +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. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=remotebridges -TARGET = remotebridge.uno -ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST = remotebridge - -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk -.IF "$(L10N_framework)"=="" -DLLPRE = -# ------------------------------------------------------------------ - -SLOFILES= \ - $(SLO)$/remote_bridge.obj \ - $(SLO)$/bridge_connection.obj\ - $(SLO)$/bridge_provider.obj -SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map - -SHL1STDLIBS= \ - $(SALLIB) \ - $(CPPULIB) \ - $(CPPUHELPERLIB) \ - $(RMCXTLIB) - -SHL1DEPN= -SHL1IMPLIB= i$(TARGET) -SHL1LIBS= $(SLB)$/$(TARGET).lib -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1RPATH= URELIB - -DEF1NAME= $(SHL1TARGET) -.ENDIF # L10N_framework - -# --- 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 deleted file mode 100644 index 67272df80..000000000 --- a/remotebridges/source/bridge/remote_bridge.cxx +++ /dev/null @@ -1,470 +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 "remote_bridge.hxx" -#include "bridge_connection.hxx" -#include <cppuhelper/implementationentry.hxx> - -#include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/bridge/BridgeExistsException.hpp> - -#define IMPLEMENTATION_NAME "com.sun.star.comp.remotebridges.Bridge.various" - - -using namespace ::rtl; -using namespace ::cppu; -using namespace ::osl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::connection; - -namespace remotebridges_bridge -{ - rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; - - ORemoteBridge::ORemoteBridge() : - OComponentHelper( m_mutex ), - m_pContext( 0 ), - m_pEnvRemote(0 ) - { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - remote_DisposingListener::acquire = thisAcquire; - remote_DisposingListener::release = thisRelease; - remote_DisposingListener::disposing = thisDisposing; - } - - ORemoteBridge::~ORemoteBridge() - { - if( m_pContext ) - { - m_pContext->aBase.release( (uno_Context *) m_pContext ); - } - if( m_pEnvRemote ) - { - m_pEnvRemote->release( m_pEnvRemote ); - } - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); - } - - void ORemoteBridge::objectMappedSuccesfully() - { - MutexGuard guard( m_mutex ); - - if( m_pEnvRemote ) - { - m_pEnvRemote->release( m_pEnvRemote ); - m_pEnvRemote = 0; - } - } - - Any ORemoteBridge::queryInterface( const Type & aType ) throw(RuntimeException) - { - Any a = ::cppu::queryInterface( - aType , - SAL_STATIC_CAST( XInitialization * , this ) , - SAL_STATIC_CAST( XBridge * , this ), - SAL_STATIC_CAST( XTypeProvider * , this ) ); - if( a.hasValue() ) - { - return a; - } - - return OComponentHelper::queryInterface( aType ); - } - - - void ORemoteBridge::initialize( const Sequence< Any >& aArguments ) - throw( Exception, RuntimeException) - { - - MutexGuard guard( m_mutex ); - - if( 4 != aArguments.getLength() ) - { - throw IllegalArgumentException( rtl::OUString::createFromAscii("wrong number of arguments") , - Reference< XInterface >(), - 0 ); - } - - OUString swName; - OUString swProtocol; - Reference < XConnection > rConnection; - Reference < XInstanceProvider > rProvider; - - aArguments.getConstArray()[0] >>= swName; - aArguments.getConstArray()[1] >>= swProtocol; - aArguments.getConstArray()[2] >>= rConnection; - aArguments.getConstArray()[3] >>= rProvider; - - if( ! rConnection.is() ) - { - throw IllegalArgumentException( rtl::OUString::createFromAscii("connection is missing") , - Reference < XInterface > (), - 2 ); - } - - remote_Connection *pConnection = new OConnectionWrapper( rConnection ); - remote_InstanceProvider *pProvider = 0; - if( rProvider.is( )) - { - pProvider = new OInstanceProviderWrapper( rProvider , this ); - } - - OUString sName = swName; - m_sDescription = swProtocol; - m_sDescription += OUString( RTL_CONSTASCII_USTRINGPARAM(":")); - m_sDescription += rConnection->getDescription(); - - if( 0 == sName.getLength() ) - { - sName = m_sDescription; - } - else - { - m_sName = sName; - } - - m_pContext = remote_createContext( pConnection, - sName.pData, - m_sDescription.pData, - swProtocol.pData, - pProvider ); - if( ! m_pContext ) - { - throw BridgeExistsException(); - } - - m_pContext->addDisposingListener( m_pContext , - (remote_DisposingListener *) this ); - - // environment will be released by the first succesfull mapping - OUString sRemoteEnv; - if( swProtocol.indexOf( ',') == -1 ) - { - sRemoteEnv = swProtocol; - } - else - { - sRemoteEnv = swProtocol.copy( 0 , swProtocol.indexOf( ',' ) ); - } - m_sProtocol = sRemoteEnv; - uno_getEnvironment( &m_pEnvRemote , - sRemoteEnv.pData , - m_pContext ); - if( ! m_pEnvRemote ) - { - m_pContext->removeDisposingListener( m_pContext , - (remote_DisposingListener*) this ); - m_pContext->aBase.release( (uno_Context * ) m_pContext ); - m_pContext = 0; - - // forgotten exception when specifying the interface - throw RuntimeException( rtl::OUString::createFromAscii("couldn't create uno-remote-environment") , - Reference < XInterface > () ); - } - } - - Reference< XInterface > ORemoteBridge::getInstance( const ::rtl::OUString& sInstanceName ) - throw(::com::sun::star::uno::RuntimeException) - { - Reference < XInterface > rReturn; - - remote_Context *pContext = 0; - { - MutexGuard guard( m_mutex ); - if( m_pContext && m_pContext->getRemoteInstance ) - { - pContext = m_pContext; - pContext->aBase.acquire( (uno_Context*)pContext ); - } - } - if( pContext ) - { - // get the appropriate remote environment - uno_Environment *pEnvRemote = 0; - uno_getEnvironment( &pEnvRemote , m_sProtocol.pData , pContext ); - - if( ! pEnvRemote ) - { - pContext->aBase.release( (uno_Context*) pContext ); - throw RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "RemoteBridge: bridge already disposed" ) ), - Reference< XInterface > () ); - } - - Type type = getCppuType( (Reference < XInterface > * ) 0 ); - - remote_Interface *pRemoteI = 0; - uno_Any exception; - uno_Any *pException = &exception; - - pContext->getRemoteInstance( - pEnvRemote, - &pRemoteI, - sInstanceName.pData, - type.getTypeLibType(), - &pException ); - pContext->aBase.release( (uno_Context*) pContext ); - pContext = 0; - - uno_Environment *pEnvCpp =0; - OUString sCppuName( RTL_CONSTASCII_USTRINGPARAM( CPPU_CURRENT_LANGUAGE_BINDING_NAME ) ); - uno_getEnvironment( &pEnvCpp , - sCppuName.pData , - 0 ); - Mapping map( pEnvRemote , pEnvCpp ); - - pEnvCpp->release( pEnvCpp ); - pEnvRemote->release( pEnvRemote ); - - if( pException ) - { - typelib_CompoundTypeDescription * pCompType = 0 ; - getCppuType( (Exception*)0 ).getDescription( (typelib_TypeDescription **) &pCompType ); - - if( ! ((typelib_TypeDescription *)pCompType)->bComplete ) - { - typelib_typedescription_complete( (typelib_TypeDescription**) &pCompType ); - } - XInterface *pXInterface = (XInterface *) map.mapInterface( - *(remote_Interface**) ( ((char*)pException->pData)+pCompType->pMemberOffsets[1] ), - getCppuType( (Reference< XInterface > *)0 ) ); - RuntimeException myException( - *((rtl_uString **)pException->pData), - Reference< XInterface > ( pXInterface , SAL_NO_ACQUIRE) ); - uno_any_destruct( pException , 0 ); - - throw myException; - } - else if( pRemoteI ) - { - // got an interface ! - XInterface * pCppI = ( XInterface * ) map.mapInterface( pRemoteI, type ); - rReturn = Reference<XInterface > ( pCppI, SAL_NO_ACQUIRE ); - pRemoteI->release( pRemoteI ); - objectMappedSuccesfully(); - } - } - else - { - throw RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "RemoteBridge: bridge already disposed." ) ), - Reference< XInterface > () ); - } - - return rReturn; - } - - - ::rtl::OUString SAL_CALL ORemoteBridge::getName( ) - throw(::com::sun::star::uno::RuntimeException) - { - return m_sName; - } - - ::rtl::OUString SAL_CALL ORemoteBridge::getDescription( ) - throw(::com::sun::star::uno::RuntimeException) - { - return m_sDescription; - } - - // XTypeProvider - Sequence< Type > SAL_CALL ORemoteBridge::getTypes(void) throw( RuntimeException ) - { - static OTypeCollection *pCollection = 0; - if( ! pCollection ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pCollection ) - { - static OTypeCollection collection( - getCppuType( (Reference< XTypeProvider> * )0), - getCppuType( (Reference< XBridge > * ) 0 ), - getCppuType( (Reference< XInitialization > * ) 0 ), - OComponentHelper::getTypes() ); - pCollection = &collection; - } - } - - return (*pCollection).getTypes(); - } - - Sequence< sal_Int8 > SAL_CALL ORemoteBridge::getImplementationId( ) throw( RuntimeException) - { - static OImplementationId *pId = 0; - if( ! pId ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pId ) - { - static OImplementationId id( sal_False ); - pId = &id; - } - } - return (*pId).getImplementationId(); - } - - void ORemoteBridge::disposing() - { - MutexGuard guard( m_mutex ); - if( m_pContext ) - { - m_pContext->removeDisposingListener( m_pContext , ( remote_DisposingListener * )this); - if( ! m_pEnvRemote ) - { - if( m_pContext->m_pConnection ) - { - sal_Int32 nIndex = 0; - OUString sProtocol = OUString( m_pContext->m_pProtocol ).getToken( 0 , ',' , nIndex ); - uno_getEnvironment( &m_pEnvRemote , sProtocol.pData , m_pContext ); - OSL_ASSERT( m_pEnvRemote ); - } - else - { - // within disposing from the context, no further dispose necessary ! - } - } - - if( m_pEnvRemote ) - { - m_pEnvRemote->dispose( m_pEnvRemote ); - m_pEnvRemote->release( m_pEnvRemote ); - m_pEnvRemote = 0; - } - - m_pContext->aBase.release( (uno_Context*)m_pContext ); - m_pContext = 0; - } - } - - - //---------------------- - // static methods - //---------------------- - void ORemoteBridge::thisAcquire( remote_DisposingListener *p ) - { - ORemoteBridge *m = (ORemoteBridge * ) p; - m->acquire(); - } - - void ORemoteBridge::thisRelease( remote_DisposingListener *p ) - { - ORemoteBridge *m = (ORemoteBridge * ) p; - m->release(); - } - - void ORemoteBridge::thisDisposing( remote_DisposingListener * p, - rtl_uString * ) - { - ORemoteBridge *m = (ORemoteBridge * ) p; - m->dispose(); - } - - //--------------------------------- - // - //--------------------------------- - Reference< XInterface > SAL_CALL CreateInstance( const Reference< XComponentContext > &) - { - return Reference< XInterface > ( ( OWeakObject * ) new ORemoteBridge ); - } - - OUString getImplementationName() - { - static OUString *pImplName = 0; - if( ! pImplName ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pImplName ) - { - static OUString implName( - RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ); - pImplName = &implName; - } - } - return *pImplName; - } - - Sequence< OUString > getSupportedServiceNames() - { - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(3); - seqNames.getArray()[0] = OUString::createFromAscii( "com.sun.star.bridge.Bridge" ); - seqNames.getArray()[1] = OUString::createFromAscii( "com.sun.star.bridge.IiopBridge" ); - seqNames.getArray()[2] = OUString::createFromAscii( "com.sun.star.bridge.UrpBridge" ); - - pNames = &seqNames; - } - } - return *pNames; - } -} - -using namespace remotebridges_bridge; - -static struct ImplementationEntry g_entries[] = -{ - { - remotebridges_bridge::CreateInstance, remotebridges_bridge::getImplementationName, - remotebridges_bridge::getSupportedServiceNames, createSingleComponentFactory, - &g_moduleCount.modCnt , 0 - }, - { 0, 0, 0, 0, 0, 0 } -}; - -extern "C" -{ -sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) -{ - return g_moduleCount.canUnload( &g_moduleCount , pTime ); -} - -//================================================================================================== -void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== -void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -} -} - - - - - diff --git a/remotebridges/source/bridge/remote_bridge.hxx b/remotebridges/source/bridge/remote_bridge.hxx deleted file mode 100644 index ec4b86acb..000000000 --- a/remotebridges/source/bridge/remote_bridge.hxx +++ /dev/null @@ -1,147 +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 <osl/mutex.hxx> -#include <osl/diagnose.h> - -#include <uno/mapping.hxx> -#include <uno/environment.h> - -#include <bridges/remote/context.h> -#include <bridges/remote/remote.h> - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/component.hxx> -#include <cppuhelper/typeprovider.hxx> - -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XInitialization.hpp> - -#include <com/sun/star/bridge/XBridge.hpp> -#include <com/sun/star/bridge/XInstanceProvider.hpp> - - -namespace remotebridges_bridge -{ - extern rtl_StandardModuleCount g_moduleCount; - - struct MyMutex - { - ::osl::Mutex m_mutex; - }; - - class ORemoteBridge : - public MyMutex, - public remote_DisposingListener, - public ::com::sun::star::lang::XInitialization, - public ::com::sun::star::bridge::XBridge, - public ::cppu::OComponentHelper - { - public: - ORemoteBridge(); - ~ORemoteBridge(); - - // XInterface - public: - ::com::sun::star::uno::Any SAL_CALL - queryInterface( const ::com::sun::star::uno::Type & aType ) throw(::com::sun::star::uno::RuntimeException); - - void SAL_CALL acquire() throw() - { OComponentHelper::acquire(); } - void SAL_CALL release() throw() - { OComponentHelper::release(); } - - public: - virtual void SAL_CALL disposing(); // called by OComponentHelper - - public: - // Methods - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Any >& aArguments ) - throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - public: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - getInstance( const ::rtl::OUString& sInstanceName ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getName( ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDescription( ) - throw(::com::sun::star::uno::RuntimeException); - - public: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL - getTypes( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL - getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - public: - static void SAL_CALL thisAcquire( remote_DisposingListener * ); - static void SAL_CALL thisRelease( remote_DisposingListener * ); - static void SAL_CALL thisDisposing( remote_DisposingListener * , - rtl_uString * pBridgeName ); - - public: - void objectMappedSuccesfully(); - - public: - remote_Context *m_pContext; - uno_Environment *m_pEnvRemote; - ::rtl::OUString m_sName; - ::rtl::OUString m_sDescription; - ::rtl::OUString m_sProtocol; - }; - - class OInstanceProviderWrapper : - public remote_InstanceProvider - { - public: - OInstanceProviderWrapper( const ::com::sun::star::uno::Reference < - ::com::sun::star::bridge::XInstanceProvider > & rProvider , - ORemoteBridge * pBridgeCallback ); - - ~OInstanceProviderWrapper(); - public: - static void SAL_CALL thisAcquire( remote_InstanceProvider * ); - static void SAL_CALL thisRelease( remote_InstanceProvider * ); - static void SAL_CALL thisGetInstance( remote_InstanceProvider * pProvider , - uno_Environment *pEnvRemote, - remote_Interface **ppRemoteI, - rtl_uString *pInstanceName, - typelib_InterfaceTypeDescription *pType, - uno_Any **ppException ); - - private: - ::com::sun::star::uno::Reference < - ::com::sun::star::bridge::XInstanceProvider > m_rProvider; - oslInterlockedCount m_nRef; - ORemoteBridge *m_pBridgeCallback; - }; - -} - diff --git a/remotebridges/source/bridge/remotebridge.xml b/remotebridges/source/bridge/remotebridge.xml deleted file mode 100644 index dc0a32f43..000000000 --- a/remotebridges/source/bridge/remotebridge.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> remotebridge.uno </module-name> - <component-description> - <author> Joerg Budischewski </author> - <name> com.sun.star.comp.remotebridges.Bridge.various </name> - <description> - This component initializes the bridge between two processes - using either iiop or urp (UnoRemoteProtocol) protocol. - </description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="final"/> - <supported-service> com.sun.star.bridge.Bridge </supported-service> - <supported-service> com.sun.star.bridge.IiopBridge </supported-service> - <supported-service> com.sun.star.bridge.UrpBridge </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.bridge.XBridgeFactory </type> - <type> com.sun.star.bridge.XInstanceProvider </type> - <type> com.sun.star.bridge.XBridge </type> - <type> com.sun.star.bridge.BridgeExistsException </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XInitialization </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XInitialization </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.lang.XSingleComponentFactory </type> - <type> com.sun.star.uno.XComponentContext </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XAggregation </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> rmcxt </runtime-module-dependency> - <runtime-module-dependency> cppuhelper3 </runtime-module-dependency> - <runtime-module-dependency> cppu3 </runtime-module-dependency> - <runtime-module-dependency> sal3 </runtime-module-dependency> - <runtime-module-dependency> rmcxt3 </runtime-module-dependency> -</module-description> diff --git a/remotebridges/source/dynamicloader/dynamicloader.cxx b/remotebridges/source/dynamicloader/dynamicloader.cxx deleted file mode 100644 index 08001cb0b..000000000 --- a/remotebridges/source/dynamicloader/dynamicloader.cxx +++ /dev/null @@ -1,403 +0,0 @@ - -#include <stdio.h> - -#include <cppuhelper/factory.hxx> - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> - - -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/loader/XImplementationLoader.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> - - -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::loader; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; - - -using namespace ::cppu; -using namespace ::rtl; - -namespace dynamic_loader { - - class SingleServiceFactory : public WeakImplHelper2<XServiceInfo, XSingleServiceFactory> { - Reference<XMultiServiceFactory> _xServiceManager; - OUString _serviceName; - OUString _link; - OUString _resolver; - - Reference<XSingleServiceFactory> getRemoteFactory() throw(Exception, RuntimeException); - - public: - - SingleServiceFactory(const Reference<XMultiServiceFactory > & xServiceManager, - const OUString & serviceName, - const OUString & link, - const OUString & resolver) - : _xServiceManager(xServiceManager), - _serviceName(serviceName), - _link(link), - _resolver(resolver) - {} - - // XSingleServiceFactory - Reference<XInterface> SAL_CALL createInstance() throw(Exception, RuntimeException); - Reference<XInterface> SAL_CALL createInstanceWithArguments(const Sequence<Any>& Arguments) - throw(::com::sun::star::uno::Exception, - ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - OUString SAL_CALL getImplementationName() throw(RuntimeException); - sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(RuntimeException); - Sequence<OUString> SAL_CALL getSupportedServiceNames(void) throw(RuntimeException); - }; - - - Reference<XSingleServiceFactory> SingleServiceFactory::getRemoteFactory() throw(Exception, RuntimeException) { - Reference<XUnoUrlResolver> xResolver(_xServiceManager->createInstance(_resolver), UNO_QUERY); - if(!xResolver.is()) { - OUString message(RTL_CONSTASCII_USTRINGPARAM("dynamic_loader::singleServiceFactory.createInstance - couldn't create resolver: ")); - message += _resolver; - - throw Exception(message, Reference<XInterface>()); - } - - Reference<XInterface> remoteObject = xResolver->resolve(_link); - if(!remoteObject.is()) { - OUString message(RTL_CONSTASCII_USTRINGPARAM("dynamic_loader::singleServiceFactory.createInstance - couldn't resolve link: ")); - message += _link; - - throw Exception(message, Reference<XInterface>()); - } - - Reference<XSingleServiceFactory> remoteFactory(remoteObject, UNO_QUERY); - if(!remoteFactory.is()) { - OUString message(RTL_CONSTASCII_USTRINGPARAM("dynamic_loader::singleServiceFactory.createInstance - couldn't get XSingleServiceFactory from: ")); - message += _link; - - throw Exception(message, Reference<XInterface>()); - } - - return remoteFactory; - } - - // XSingleServiceFactory - Reference<XInterface> SAL_CALL SingleServiceFactory::createInstance() throw(Exception, RuntimeException) { - OSL_TRACE("dynamic_loader::singleServiceFactory::createInstance"); - - return getRemoteFactory()->createInstance(); - } - - Reference<XInterface> SAL_CALL SingleServiceFactory::createInstanceWithArguments(const Sequence<Any>& Arguments) - throw(Exception, RuntimeException) - { - OSL_TRACE("dynamic_loader::singleServiceFactory::createInstanceWithArguments"); - - return getRemoteFactory()->createInstanceWithArguments(Arguments); - } - - // XServiceInfo - OUString SAL_CALL SingleServiceFactory::getImplementationName() throw(RuntimeException) { - return _link; - } - - sal_Bool SAL_CALL SingleServiceFactory::supportsService(const OUString & ServiceName) throw(RuntimeException) { - return _serviceName.equals(ServiceName); - } - - Sequence<OUString> SAL_CALL SingleServiceFactory::getSupportedServiceNames(void) throw(RuntimeException) { - return Sequence<OUString>(&_serviceName, 1); - } - - - - class DynamicLoader : public WeakImplHelper2<XImplementationLoader, XServiceInfo> { - Reference<XMultiServiceFactory> _xSMgr; - - protected: - DynamicLoader(const Reference<XMultiServiceFactory> & rXSMgr) throw(RuntimeException); - ~DynamicLoader() throw(); - - public: - static const OUString implname; - static const OUString servname; - - static Reference<XInterface> SAL_CALL createInstance(const Reference<XMultiServiceFactory> & rSMgr) throw(Exception); - static Sequence<OUString> SAL_CALL getSupportedServiceNames_Static() throw(); - - static void parseUrl(const OUString & url, OUString * serviceName, OUString * link, OUString * resolver) throw(RuntimeException); - - // 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); - - // XImplementationLoader - virtual Reference<XInterface> SAL_CALL activate(const OUString & implementationName, - const OUString & implementationLoaderUrl, - const OUString& locationUrl, - const Reference<XRegistryKey>& xKey) throw(CannotActivateFactoryException, RuntimeException); - virtual sal_Bool SAL_CALL writeRegistryInfo(const Reference<XRegistryKey>& xKey, - const OUString& implementationLoaderUrl, - const OUString& locationUrl) throw(CannotRegisterImplementationException, RuntimeException); - }; - - const OUString DynamicLoader::implname = OUString::createFromAscii("com.sun.star.comp.stoc.DynamicLoader"); - const OUString DynamicLoader::servname = OUString::createFromAscii("com.sun.star.loader.Dynamic"); - - Sequence<OUString> SAL_CALL DynamicLoader::getSupportedServiceNames_Static() throw() { - return Sequence<OUString>(&servname, 1); - } - - Reference<XInterface> SAL_CALL DynamicLoader::createInstance(const Reference<XMultiServiceFactory> & rSMgr) throw(Exception) { - Reference<XInterface> xRet; - - try { - XImplementationLoader *pXLoader = (XImplementationLoader *)new DynamicLoader(rSMgr); - - xRet = Reference<XInterface>::query(pXLoader); - } - catch(RuntimeException & runtimeException) { - OString message = OUStringToOString(runtimeException.Message, RTL_TEXTENCODING_ASCII_US); - osl_trace("dynamic loader - could not init cause of %s", message.getStr()); - } - - OSL_TRACE("DynamicLoader - createInstance: %d", xRet.is()); - - - return xRet; - } - - DynamicLoader::DynamicLoader(const Reference<XMultiServiceFactory> & xSMgr) throw(RuntimeException) - : _xSMgr(xSMgr) - { - } - - - DynamicLoader::~DynamicLoader() throw() { - } - - // XServiceInfo - OUString SAL_CALL DynamicLoader::getImplementationName() throw(RuntimeException) { - return implname; - } - - sal_Bool SAL_CALL DynamicLoader::supportsService(const OUString & ServiceName) throw(RuntimeException) { - sal_Bool bSupport = sal_False; - - Sequence<OUString> aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getArray(); - for(sal_Int32 i = 0; i < aSNL.getLength() && !bSupport; ++ i) - bSupport = pArray[i] == ServiceName; - - return bSupport; - } - - Sequence<OUString> SAL_CALL DynamicLoader::getSupportedServiceNames() throw(RuntimeException) { - return getSupportedServiceNames_Static(); - } - - - void DynamicLoader::parseUrl(const OUString & locationUrl, OUString * serviceName, OUString * link, OUString * resolver) throw(RuntimeException) { -#if OSL_DEBUG_LEVEL > 1 - OString tmp = OUStringToOString(locationUrl, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE("DynamicLoader - locationUrl %s", tmp.getStr()); -#endif - - // This is the default resolver - *resolver = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.UnoUrlResolver")); - - const OUString bSlash(OUString(RTL_CONSTASCII_USTRINGPARAM("\\"))); - const OUString tuedle(OUString(RTL_CONSTASCII_USTRINGPARAM("\""))); - const OUString separator(OUString(RTL_CONSTASCII_USTRINGPARAM(","))); - const OUString emptyString(OUString(RTL_CONSTASCII_USTRINGPARAM(""))); - const OUString equalSign(OUString(RTL_CONSTASCII_USTRINGPARAM("="))); - - sal_Int32 index = 0; - sal_Bool left = sal_True; - sal_Bool quote = sal_False; - sal_Bool inString = sal_False; - - const sal_Unicode * raw_url = locationUrl.getStr(); - OUString token; - OUString attribute; - - while(index <= locationUrl.getLength()) { - if(index >= locationUrl.getLength() || (raw_url[index] == separator.getStr()[0] && !quote && !inString)) { // a separator or end? - OUString value; - - if(left) - attribute = token.trim(); - - else - value = token.trim(); - -#if OSL_DEBUG_LEVEL > 1 - OString attribute_tmp = OUStringToOString(attribute, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE("DynamicLoader - attribute %s", attribute_tmp.getStr()); - OString value_tmp = OUStringToOString(value, RTL_TEXTENCODING_ASCII_US); - OSL_TRACE("DynamicLoader - value %s", value_tmp.getStr()); -#endif - - if(attribute.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("servicename")))) - *serviceName = value; - - else if(attribute.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("link")))) - *link = value; - - else if(attribute.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("resolver")))) - *resolver = value; - - else { - OUString message(RTL_CONSTASCII_USTRINGPARAM("help called")); - - if(!attribute.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("help")))) { - message = OUString(RTL_CONSTASCII_USTRINGPARAM("DynamicLoader - unknown attribute: ")); - message += attribute; - } - - fprintf(stdout, "DynamicLoader - help\n"); - fprintf(stdout, "attributes:\n"); - fprintf(stdout, "\tservicename: service name of dynamic component\n"); - fprintf(stdout, "\tlink: link to a single service factory for dynamic component\n"); - fprintf(stdout, "\tresolver: the service which resolves the link\n"); - fprintf(stdout, "\thelp: this help\n"); - - throw RuntimeException(message, Reference<XInterface>()); - } - - left = sal_True; // reset state to be left - token = emptyString; - } - else if(raw_url[index] == bSlash.getStr()[0] && !quote) // a back slash? - quote = sal_True; - - else if(raw_url[index] == equalSign.getStr()[0] && !quote && !inString) { // equalSign (switch from left to right)? - left = sal_False; - - attribute = token.trim(); - token = emptyString; - } - else if(raw_url[index] == tuedle.getStr()[0] && !quote) // begin or end of string? - inString = !inString; - - else { // no special handling - token += OUString(raw_url + index, 1); - quote = sal_False; - } - - ++ index; - } - - // enshure, that attributes are set properly - if(!(*serviceName).getLength()) - throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("dynamic_loader::DynamicLoader.parseUrl - missing or empty attribute: servicename")), - Reference<XInterface>()); - - if(!(*link).getLength()) - throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("dynamic_loader::DynamicLoader.parseUrl - missing or empty attribute: link")), - Reference<XInterface>()); - - if(!(*resolver).getLength()) - throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("dynamic_loader::DynamicLoader.parseUrl - missing or empty attribute: resolver")), - Reference<XInterface>()); - } - - - // XImplementationLoader - sal_Bool SAL_CALL DynamicLoader::writeRegistryInfo(const Reference<XRegistryKey> & xKey, - const OUString & implementationLoaderUrl, - const OUString & locationUrl) - throw(CannotRegisterImplementationException, RuntimeException) - { - OSL_TRACE("DynamicLoader::writeRegistryInfo"); - - OUString serviceName; - OUString link; - OUString resolver; - - try { - parseUrl(locationUrl, &serviceName, &link, &resolver); - } - catch(RuntimeException & runtimeException) { - throw CannotRegisterImplementationException(runtimeException.Message, Reference<XInterface>()); - } - - // create the keys - OUString keyName = OUString::createFromAscii("/"); - keyName += implementationLoaderUrl; - keyName += OUString(RTL_CONSTASCII_USTRINGPARAM("_")); - keyName += serviceName; - keyName += OUString::createFromAscii("/UNO/SERVICES"); - - Reference<XRegistryKey> xNewKey(xKey->createKey(keyName)); - xNewKey->createKey(serviceName); - - sal_Bool bSuccess = sal_True; - - return bSuccess; - } - - Reference<XInterface> SAL_CALL DynamicLoader::activate(const OUString &, - const OUString &, - const OUString & locationUrl, - const Reference<XRegistryKey> &) - throw(CannotActivateFactoryException, RuntimeException) - { - OSL_TRACE("DynamicLoader::activate"); - - OUString serviceName; - OUString link; - OUString resolver; - - parseUrl(locationUrl, &serviceName, &link, &resolver); - - XSingleServiceFactory * xFactory = (XSingleServiceFactory *)new SingleServiceFactory(_xSMgr, - serviceName, - link, - resolver); - - Reference<XInterface> xReturn; - - if(xFactory) - xReturn = Reference<XInterface>::query(xFactory); - - return xReturn; - } -} - - - - -extern "C" { - void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment **) { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - void * SAL_CALL component_getFactory(const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, XRegistryKey *) { - void * pRet = 0; - - if (pServiceManager && OUString::createFromAscii(pImplName).equals(::dynamic_loader::DynamicLoader::implname)) { - Reference<XSingleServiceFactory> xFactory(createOneInstanceFactory(pServiceManager, - ::dynamic_loader::DynamicLoader::implname, - ::dynamic_loader::DynamicLoader::createInstance, - ::dynamic_loader::DynamicLoader::getSupportedServiceNames_Static())); - - if (xFactory.is()) { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - else - OSL_TRACE("DynamicLoader - warning - given wrong implName: %s", pImplName); - - return pRet; - } -} diff --git a/remotebridges/source/dynamicloader/dynamicloader.xml b/remotebridges/source/dynamicloader/dynamicloader.xml deleted file mode 100644 index 325c5d226..000000000 --- a/remotebridges/source/dynamicloader/dynamicloader.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> dynamicloader.uno </module-name> - <component-description> - <author> Kay Ramme </author> - <name> com.sun.star.loader.Dynamic </name> - <description> - This service allows the delegation of the resolution - of a SingleServiceFactory for a service to be - delegated to a resolver (e.g. UnoUrlResolver). - </description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="final"/> - <supported-service> com.sun.star.loader.Dynamic </supported-service> - <service-dependency> com.sun.star.bridge.UnoUrlResolver </service-dependency> - <type> com.sun.star.bridge.XUnoUrlResolver </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.lang.XSingleComponentFactory </type> - <type> com.sun.star.uno.XComponentContext </type> - <type> com.sun.star.loader.XImplementationLoader </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.XAggregation </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper3 </runtime-module-dependency> - <runtime-module-dependency> cppu3 </runtime-module-dependency> - <runtime-module-dependency> sal3 </runtime-module-dependency> -</module-description> diff --git a/remotebridges/source/dynamicloader/makefile.mk b/remotebridges/source/dynamicloader/makefile.mk deleted file mode 100755 index 9135d2fb2..000000000 --- a/remotebridges/source/dynamicloader/makefile.mk +++ /dev/null @@ -1,69 +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. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=remotebridges -TARGET = dynamicloader.uno -ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST = dynamicloader - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.IF "$(L10N_framework)"=="" -DLLPRE = - -# ------------------------------------------------------------------ - -# use for types from COMP1TYPELIST -NO_OFFUH=TRUE -CPPUMAKERFLAGS += -C - -SLOFILES= \ - $(SLO)$/dynamicloader.obj - -SHL1TARGET= $(TARGET) -SHL1VERSIONMAP = $(SOLARENV)$/src$/component.map - -SHL1STDLIBS=\ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1IMPLIB= i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib - -SHL1DEF=$(MISC)$/$(SHL1TARGET).def - -DEF1NAME= $(SHL1TARGET) - -.ENDIF # L10N_framework - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/remotebridges/source/factory/brdgfctr.xml b/remotebridges/source/factory/brdgfctr.xml deleted file mode 100644 index 5e663a063..000000000 --- a/remotebridges/source/factory/brdgfctr.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - <module-name> bridgefac.uno </module-name> - <component-description> - <author> Joerg Budischewski </author> - <name> com.sun.star.comp.remotebridges.BridgeFactory </name> - <description> - This component allows - to establish a connection to another process. - </description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> - <status value="final"/> - <supported-service> com.sun.star.bridge.BridgeFactory </supported-service> - <service-dependency> ... </service-dependency> - <type> com.sun.star.bridge.XBridgeFactory </type> - <type> com.sun.star.bridge.XInstanceProvider </type> - <type> com.sun.star.bridge.XBridge </type> - <type> com.sun.star.bridge.BridgeExistsException </type> - <type> com.sun.star.container.XContentEnumerationAccess </type> - <type> com.sun.star.lang.DisposedException </type> - <type> com.sun.star.lang.XMultiServiceFactory </type> - <type> com.sun.star.lang.XSingleServiceFactory </type> - <type> com.sun.star.lang.XInitialization </type> - <type> com.sun.star.lang.XComponent </type> - <type> com.sun.star.lang.XServiceInfo </type> - <type> com.sun.star.lang.XTypeProvider </type> - <type> com.sun.star.lang.IllegalArgumentException </type> - <type> com.sun.star.lang.XInitialization </type> - <type> com.sun.star.registry.XRegistryKey </type> - <type> com.sun.star.lang.XSingleComponentFactory </type> - <type> com.sun.star.uno.XComponentContext </type> - <type> com.sun.star.uno.XWeak </type> - <type> com.sun.star.uno.TypeClass </type> - <type> com.sun.star.uno.XAggregation </type> - </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper3 </runtime-module-dependency> - <runtime-module-dependency> cppu3 </runtime-module-dependency> - <runtime-module-dependency> sal3 </runtime-module-dependency> -</module-description> diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx deleted file mode 100644 index fbe39339c..000000000 --- a/remotebridges/source/factory/bridgefactory.cxx +++ /dev/null @@ -1,493 +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 <hash_map> - -#include <rtl/alloc.h> - -#include <uno/mapping.hxx> -#include <osl/mutex.hxx> - -#include <bridges/remote/context.h> - -#include <cppuhelper/implementationentry.hxx> -#include <cppuhelper/component.hxx> -#include <cppuhelper/typeprovider.hxx> -#include "cppuhelper/unourl.hxx" -#include "rtl/malformeduriexception.hxx" - -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> - -#include <com/sun/star/bridge/XBridgeFactory.hpp> - -#include <com/sun/star/registry/XRegistryKey.hpp> - -#include <com/sun/star/container/XContentEnumerationAccess.hpp> - - -#include "bridgeimpl.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::cppu; -using namespace ::std; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; -using namespace ::com::sun::star::connection; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::container; - -#define SERVICE_NAME "com.sun.star.bridge.BridgeFactory" -#define IMPLEMENTATION_NAME "com.sun.star.comp.remotebridges.BridgeFactory" - -namespace remotebridges_factory -{ - rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; - - struct hashOUString - { - size_t operator()(const OUString & s) const - { return s.hashCode(); } - }; - - struct equalOUString - { - sal_Bool operator()(const OUString & s1 , const OUString &s2 ) const - { - return s1 == s2; - } - }; - - typedef ::std::hash_map - < - OUString, - WeakReference< XBridge >, - hashOUString, - equalOUString - > BridgeHashMap; - - - typedef ::std::hash_map - < - OUString, - OUString, - hashOUString, - equalOUString - > ServiceHashMap; - - class OBridgeFactory : - public MyMutex, - public OComponentHelper, - public XBridgeFactory, - public XServiceInfo - { - public: - OBridgeFactory( const Reference < XComponentContext > &rCtx ); - ~OBridgeFactory(); - - public: // XInterface - ::com::sun::star::uno::Any SAL_CALL - queryInterface( const ::com::sun::star::uno::Type & aType ) throw(RuntimeException); - - void SAL_CALL acquire() throw() - { OComponentHelper::acquire(); } - void SAL_CALL release() throw() - { OComponentHelper::release(); } - - public: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XBridge > SAL_CALL - createBridge( - const ::rtl::OUString& sName, - const ::rtl::OUString& sProtocol, - const ::com::sun::star::uno::Reference< ::com::sun::star::connection::XConnection >& aConnection, - const ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XInstanceProvider >& anInstanceProvider ) - throw(::com::sun::star::bridge::BridgeExistsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XBridge > SAL_CALL - getBridge( const ::rtl::OUString& sName ) - throw(::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::bridge::XBridge > > SAL_CALL - getExistingBridges( ) throw(::com::sun::star::uno::RuntimeException); - - public: //XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL - getTypes( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL - getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - public: //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); - - public: - static OUString getImplementationNameStatic( ) SAL_THROW( () ); - static Sequence< OUString > getSupportedServiceNamesStatic() SAL_THROW( () ); - - private: - void init(); - OUString getServiceNameForProtocol( const OUString &sProtocol ); - - private: - Reference < XMultiComponentFactory > m_rSMgr; - Reference < XComponentContext > m_rCtx; - BridgeHashMap m_mapBridge; - ServiceHashMap m_mapProtocolToService; - sal_Bool m_bInitialized; - ::osl::Mutex m_mutexInit; - }; - - OBridgeFactory::OBridgeFactory( const Reference < XComponentContext > &rCtx ) - : OComponentHelper( m_mutex ) - , m_rSMgr( rCtx->getServiceManager() ) - , m_rCtx( rCtx ) - , m_bInitialized( sal_False ) - { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - } - - OBridgeFactory::~OBridgeFactory() - { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); - } - - void OBridgeFactory::init() - { - MutexGuard guard( m_mutexInit ); - if( ! m_bInitialized ) - { - Reference< XContentEnumerationAccess > rContent( m_rSMgr , UNO_QUERY ); - if( rContent.is() ) - { - OUString sMetaService = OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.Bridge" ) ); - Reference < XEnumeration > rEnum = - rContent->createContentEnumeration( sMetaService ); - if ( rEnum.is() ) - while( rEnum->hasMoreElements() ) - { - Any a = rEnum->nextElement(); - Reference <XServiceInfo> rInfo; - if( a >>= rInfo ) - { - Sequence< OUString > seq = rInfo->getSupportedServiceNames(); - sal_Int32 i; - for( i = 0 ; i < seq.getLength() ; i ++ ) - { - if( seq.getConstArray()[i] != sMetaService ) - { - sal_Int32 nIndex = seq.getConstArray()[i].lastIndexOf( '.' ); - OUString sSuffix = seq.getConstArray()[i].copy(nIndex+1); - if( sSuffix.getLength() > 6 && - 0 == sSuffix.copy( sSuffix.getLength() - 6 ).compareToAscii( "Bridge" ) ) - { - OUString sProtocol = sSuffix.copy(0 , sSuffix.getLength()-6 ).toAsciiLowerCase(); - m_mapProtocolToService[ sProtocol ] = seq.getConstArray()[i]; - } - } - } - } - } - } - m_bInitialized = sal_True; - } - } - - OUString OBridgeFactory::getServiceNameForProtocol( const OUString & sProtocol ) - { - init(); - OUString sService; - OUString sProtocolName; - try - { - sProtocolName = cppu::UnoUrlDescriptor(sProtocol).getName(); - } - catch (rtl::MalformedUriException &) - { - OSL_ENSURE(false, "MalformedUriException"); - } - ServiceHashMap::iterator ii = m_mapProtocolToService.find( sProtocolName ); - if( ii != m_mapProtocolToService.end() ) - { - sService = (*ii).second; - } - else - { - // fallback to the old solution, deprecated, should be removed ! - sService = OUString::createFromAscii( "com.sun.star.bridge.Bridge." ); - sService += sProtocolName; - } - return sService; - } - - Any OBridgeFactory::queryInterface( const Type &aType ) throw(RuntimeException) - { - Any a = ::cppu::queryInterface( - aType , - ( XBridgeFactory * ) this ); - if( a.hasValue() ) - { - return a; - } - - return OComponentHelper::queryInterface( aType ); - - } - - Reference< XBridge > OBridgeFactory::createBridge( - const OUString& sName, - const OUString& sProtocol, - const Reference< XConnection >& aConnection, - const Reference< XInstanceProvider >& anInstanceProvider ) - throw(::com::sun::star::bridge::BridgeExistsException, - ::com::sun::star::lang::IllegalArgumentException, - ::com::sun::star::uno::RuntimeException) - { - OUString sService = getServiceNameForProtocol( sProtocol ); - - Reference < XInterface > rXInterface = - m_rSMgr->createInstanceWithContext(sService, m_rCtx ); - Reference < XInitialization > rInit(rXInterface, UNO_QUERY ); - Reference < XBridge > rBridge( rInit , UNO_QUERY ); - - if( rInit.is() && rBridge.is() ) - { - Sequence < Any > seqAny( 4 ); - seqAny.getArray()[0] <<= sName; - seqAny.getArray()[1] <<= sProtocol; - seqAny.getArray()[2] <<= aConnection; - seqAny.getArray()[3] <<= anInstanceProvider; - - // let the Exceptions fly .... - rInit->initialize( seqAny ); - } - else - { - throw IllegalArgumentException(); - } - - if( sName.getLength() ) - { - MutexGuard guard( m_mutex ); - // put the bridge into the hashmap - m_mapBridge[ sName ] = rBridge; - } - return rBridge; - } - - Reference< XBridge > OBridgeFactory::getBridge( const ::rtl::OUString& sName ) - throw(::com::sun::star::uno::RuntimeException ) - - { - MutexGuard guard( m_mutex ); - BridgeHashMap::iterator ii = m_mapBridge.find( sName ); - - Reference < XBridge > rBridge; - - if( ii != m_mapBridge.end() ) - { - rBridge = (*ii).second; - if( ! rBridge.is() ) - { - m_mapBridge.erase( ii ); - } - } - - if( ! rBridge.is() ) - { - // try to get it via the C-Context - remote_Context * pRemoteC = remote_getContext( sName.pData ); - - if( pRemoteC ) - { - rBridge = Reference < XBridge > ((XBridge *) new OBridge( pRemoteC ) ); - pRemoteC->aBase.release( (uno_Context * )pRemoteC ); - m_mapBridge[ sName ] = rBridge; - } - } - return rBridge; - } - - Sequence< Reference< XBridge > > OBridgeFactory::getExistingBridges( ) - throw(::com::sun::star::uno::RuntimeException) - { - MutexGuard guard( m_mutex ); - - sal_Int32 nCount; - - rtl_uString **ppName = remote_getContextList( - &nCount, - rtl_allocateMemory ); - - Sequence < Reference < XBridge > > seq( nCount ); - if( nCount ) - { - - for( sal_Int32 i = 0; - i < nCount ; - i ++ ) - { - seq.getArray()[i] = getBridge( OUString( ppName[i]) ); - rtl_uString_release( ppName[i] ); - } - rtl_freeMemory( ppName ); - } - - return seq; - } - - // XTypeProvider - Sequence< Type > SAL_CALL OBridgeFactory::getTypes(void) throw( RuntimeException ) - { - static OTypeCollection *pCollection = 0; - if( ! pCollection ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pCollection ) - { - static OTypeCollection collection( - getCppuType( (Reference< XBridgeFactory > * ) 0 ), - OComponentHelper::getTypes() ); - pCollection = &collection; - } - } - return (*pCollection).getTypes(); - } - - Sequence< sal_Int8 > SAL_CALL OBridgeFactory::getImplementationId( ) throw( RuntimeException) - { - static OImplementationId *pId = 0; - if( ! pId ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pId ) - { - static OImplementationId id( sal_False ); - pId = &id; - } - } - return (*pId).getImplementationId(); - } - - OUString OBridgeFactory::getImplementationNameStatic() - { - static OUString *pName = 0; - if( ! pName ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pName ) - { - static OUString name( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ); - pName = &name; - } - } - return *pName; - } - - Sequence< OUString > OBridgeFactory::getSupportedServiceNamesStatic() - { - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString::createFromAscii( SERVICE_NAME ); - pNames = &seqNames; - } - } - return *pNames; - } - - OUString OBridgeFactory::getImplementationName( ) throw(RuntimeException) - { - return getImplementationNameStatic(); - } - - sal_Bool SAL_CALL OBridgeFactory::supportsService( const OUString& ServiceName ) throw(RuntimeException) - { - Sequence< OUString > seq = getSupportedServiceNamesStatic(); - sal_Bool bReturn = sal_False; - for( sal_Int32 i = 0 ; i < seq.getLength() ; i ++ ) - { - if( seq.getConstArray()[i] == ServiceName ) - { - bReturn = sal_True; - break; - } - } - return bReturn; - } - - Sequence< OUString > SAL_CALL OBridgeFactory::getSupportedServiceNames( ) throw(RuntimeException) - { - return getSupportedServiceNamesStatic(); - } - - - Reference< XInterface > SAL_CALL CreateInstance(Reference< XComponentContext > const & xContext) - { - return Reference < XInterface > ( *new OBridgeFactory( xContext ) ); - } -} - -using namespace remotebridges_factory; -static ImplementationEntry g_entries[] = -{ - { CreateInstance, OBridgeFactory::getImplementationNameStatic, - OBridgeFactory::getSupportedServiceNamesStatic, createSingleComponentFactory , - &g_moduleCount.modCnt , 0 - }, - { 0, 0, 0, 0, 0, 0 } -}; - -extern "C" -{ -sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) -{ - return g_moduleCount.canUnload( &g_moduleCount , pTime ); -} - -//================================================================================================== -void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== -void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) -{ - return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); -} -} - - - - diff --git a/remotebridges/source/factory/bridgeimpl.cxx b/remotebridges/source/factory/bridgeimpl.cxx deleted file mode 100644 index 78859adb3..000000000 --- a/remotebridges/source/factory/bridgeimpl.cxx +++ /dev/null @@ -1,270 +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 "bridgeimpl.hxx" - -using namespace ::rtl; -using namespace ::osl; -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::bridge; - -namespace remotebridges_factory { - - - OBridge::OBridge( remote_Context *pContext ) : - OComponentHelper( m_mutex ), - m_pContext( pContext ) - { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); - - remote_DisposingListener::acquire = thisAcquire; - remote_DisposingListener::release = thisRelease; - remote_DisposingListener::disposing = thisDisposing; - - m_pContext->aBase.acquire( (uno_Context*)m_pContext ); - m_pContext->addDisposingListener( m_pContext, ( remote_DisposingListener * ) this ); - } - - OBridge::~OBridge() - { - if( m_pContext ) - { - m_pContext->aBase.release( (uno_Context * ) m_pContext ); - } - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); - } - - ::com::sun::star::uno::Any OBridge::queryInterface( const ::com::sun::star::uno::Type & aType ) throw(RuntimeException) - { - Any a = ::cppu::queryInterface( - aType , - SAL_STATIC_CAST( XBridge * , this ), - SAL_STATIC_CAST( XTypeProvider * , this ) ); - if( a.hasValue() ) - { - return a; - } - - return OComponentHelper::queryInterface( aType ); - } - - void OBridge::disposing() - { - if( m_pContext ) - { - m_pContext->removeDisposingListener( m_pContext , ( remote_DisposingListener * )this); - - uno_Environment *pEnvRemote = 0; - if( m_pContext->m_pConnection ) - { - sal_Int32 nIndex = 0; - OUString sProtocol = OUString( m_pContext->m_pProtocol ).getToken( 0 , ',' , nIndex ); - uno_getEnvironment( &pEnvRemote , sProtocol.pData , m_pContext ); - OSL_ASSERT( pEnvRemote ); - } - else - { - // within disposing from the context, no further dispose necessary ! - } - - if( pEnvRemote ) - { - pEnvRemote->dispose( pEnvRemote ); - pEnvRemote->release( pEnvRemote ); - pEnvRemote = 0; - } - - m_pContext->aBase.release( (uno_Context*)m_pContext ); - m_pContext = 0; - } - } - - - Reference< XInterface > OBridge::getInstance( const ::rtl::OUString& sInstanceName ) - throw(::com::sun::star::uno::RuntimeException) - { - Reference < XInterface > rReturn; - - remote_Context *pContext = 0; - { - MutexGuard guard( m_mutex ); - if( m_pContext && m_pContext->getRemoteInstance ) - { - pContext = m_pContext; - pContext->aBase.acquire( (uno_Context*)pContext ); - } - } - if( pContext ) - { - sal_Int32 nIndex = 0; - OUString sProtocol = OUString( m_pContext->m_pProtocol ).getToken( 0 , ',' , nIndex ); - - // get the appropriate remote environment - uno_Environment *pEnvRemote = 0; - uno_getEnvironment( &pEnvRemote , sProtocol.pData , pContext ); - - if( ! pEnvRemote ) - { - pContext->aBase.release( (uno_Context*) pContext ); - throw RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "RemoteBridge: bridge already disposed" ) ), - Reference< XInterface > () ); - } - - Type type = getCppuType( (Reference < XInterface > * ) 0 ); - - remote_Interface *pRemoteI = 0; - uno_Any exception; - uno_Any *pException = &exception; - - pContext->getRemoteInstance( - pEnvRemote, - &pRemoteI, - sInstanceName.pData, - type.getTypeLibType(), - &pException ); - pContext->aBase.release( (uno_Context*) pContext ); - pContext = 0; - - uno_Environment *pEnvCpp =0; - OUString sCppuName( RTL_CONSTASCII_USTRINGPARAM( CPPU_CURRENT_LANGUAGE_BINDING_NAME ) ); - uno_getEnvironment( &pEnvCpp , - sCppuName.pData , - 0 ); - Mapping map( pEnvRemote , pEnvCpp ); - - pEnvCpp->release( pEnvCpp ); - pEnvRemote->release( pEnvRemote ); - - if( pException ) - { - typelib_CompoundTypeDescription * pCompType = 0 ; - getCppuType( (Exception*)0 ).getDescription( (typelib_TypeDescription **) &pCompType ); - - if( ! ((typelib_TypeDescription *)pCompType)->bComplete ) - { - typelib_typedescription_complete( (typelib_TypeDescription**) &pCompType ); - } - XInterface *pXInterface = (XInterface *) map.mapInterface( - *(remote_Interface**) ( ((char*)pException->pData)+pCompType->pMemberOffsets[1] ), - getCppuType( (Reference< XInterface > *)0 ) ); - RuntimeException myException( - *((rtl_uString **)pException->pData), - Reference< XInterface > ( pXInterface , SAL_NO_ACQUIRE) ); - uno_any_destruct( pException , 0 ); - - throw myException; - } - else if( pRemoteI ) - { - // got an interface ! - XInterface * pCppI = ( XInterface * ) map.mapInterface( pRemoteI, type ); - rReturn = Reference<XInterface > ( pCppI, SAL_NO_ACQUIRE ); - pRemoteI->release( pRemoteI ); - } - } - else - { - throw RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "RemoteBridge: bridge already disposed." ) ), - Reference< XInterface > () ); - } - - return rReturn; - } - - ::rtl::OUString SAL_CALL OBridge::getName( ) - throw(::com::sun::star::uno::RuntimeException) - - { - return OUString( m_pContext->m_pName ); - } - - ::rtl::OUString OBridge::getDescription( ) - throw(::com::sun::star::uno::RuntimeException) - { - return OUString( m_pContext->m_pDescription ); - } - - // XTypeProvider - Sequence< Type > SAL_CALL OBridge::getTypes(void) throw( RuntimeException ) - { - static OTypeCollection *pCollection = 0; - if( ! pCollection ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pCollection ) - { - static OTypeCollection collection( - getCppuType( (Reference< XTypeProvider> * )0), - getCppuType( (Reference< XBridge > * ) 0 ), - OComponentHelper::getTypes() ); - pCollection = &collection; - } - } - - return (*pCollection).getTypes(); - } - - Sequence< sal_Int8 > SAL_CALL OBridge::getImplementationId( ) throw( RuntimeException) - { - static OImplementationId *pId = 0; - if( ! pId ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pId ) - { - static OImplementationId id( sal_False ); - pId = &id; - } - } - return (*pId).getImplementationId(); - } - - //---------------------- - // static methods - //---------------------- - void OBridge::thisAcquire( remote_DisposingListener *p ) - { - OBridge *m = (OBridge * ) p; - m->acquire(); - } - - void OBridge::thisRelease( remote_DisposingListener *p ) - { - OBridge *m = (OBridge * ) p; - m->release(); - } - - void OBridge::thisDisposing( remote_DisposingListener * p, rtl_uString * ) - { - OBridge *m = (OBridge * ) p; - m->dispose(); - } -} diff --git a/remotebridges/source/factory/bridgeimpl.hxx b/remotebridges/source/factory/bridgeimpl.hxx deleted file mode 100644 index 3e462213e..000000000 --- a/remotebridges/source/factory/bridgeimpl.hxx +++ /dev/null @@ -1,106 +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 <osl/mutex.hxx> -#include <osl/diagnose.h> - -#include <uno/mapping.hxx> -#include <uno/environment.h> - -#include <bridges/remote/context.h> -#include <bridges/remote/remote.h> - -#include <cppuhelper/factory.hxx> -#include <cppuhelper/component.hxx> -#include <cppuhelper/typeprovider.hxx> - -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/lang/XInitialization.hpp> - -#include <com/sun/star/bridge/XBridge.hpp> -#include <com/sun/star/bridge/XInstanceProvider.hpp> - -namespace remotebridges_factory { - extern rtl_StandardModuleCount g_moduleCount; - - struct MyMutex - { - ::osl::Mutex m_mutex; - }; - - class OBridge : - public MyMutex, - public remote_DisposingListener, - public ::com::sun::star::bridge::XBridge, - public ::cppu::OComponentHelper - { - public: - OBridge( remote_Context *pContext ); - ~OBridge(); - - // XInterface - public: - ::com::sun::star::uno::Any SAL_CALL - queryInterface( const ::com::sun::star::uno::Type & aType ) throw(com::sun::star::uno::RuntimeException); - - void SAL_CALL acquire() throw() - { OComponentHelper::acquire(); } - void SAL_CALL release() throw() - { OComponentHelper::release(); } - - public: - virtual void SAL_CALL disposing(); // called by OComponentHelper - - public: - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - getInstance( const ::rtl::OUString& sInstanceName ) - throw(::com::sun::star::uno::RuntimeException); - - virtual ::rtl::OUString SAL_CALL getName( ) - throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getDescription( ) - throw(::com::sun::star::uno::RuntimeException); - - public: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL - getTypes( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL - getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - public: - static void SAL_CALL thisAcquire( remote_DisposingListener * ); - static void SAL_CALL thisRelease( remote_DisposingListener * ); - static void SAL_CALL thisDisposing( remote_DisposingListener * , - rtl_uString * pBridgeName ); - - public: - remote_Context *m_pContext; - ::rtl::OString m_sName; - ::rtl::OString m_sDescription; - }; -} - diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index ac99601f5..c89a350d6 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -30,6 +30,20 @@ #include <cstdlib> #include <iostream> +#include <limits> +#include <string> + +#include "cppunittester/protectorfactory.hxx" +#include "osl/module.h" +#include "osl/module.hxx" +#include "osl/thread.h" +#include "rtl/process.h" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textcvt.h" +#include "rtl/ustring.hxx" +#include "sal/main.h" +#include "sal/types.h" #include "preextstl.h" #include "cppunit/CompilerOutputter.h" @@ -40,25 +54,87 @@ #include "cppunit/plugin/PlugInManager.h" #include "cppunit/portability/Stream.h" #include "postextstl.h" -#include "osl/thread.h" -#include "rtl/process.h" -#include "rtl/string.hxx" -#include "rtl/ustring.hxx" -#include "sal/main.h" + +namespace { + +void usageFailure() { + std::cerr + << ("Usage: cppunittester (--protector <shared-library-path>" + " <function-symbol>)* <shared-library-path>") + << std::endl; + std::exit(EXIT_FAILURE); +} + +rtl::OUString getArgument(sal_Int32 index) { + rtl::OUString arg; + rtl_getAppCommandArg(index, &arg.pData); + return arg; +} + +std::string convertLazy(rtl::OUString const & s16) { + rtl::OString s8(rtl::OUStringToOString(s16, osl_getThreadTextEncoding())); + return std::string( + s8.getStr(), + ((static_cast< sal_uInt32 >(s8.getLength()) + > std::numeric_limits< std::string::size_type >::max()) + ? std::numeric_limits< std::string::size_type >::max() + : static_cast< std::string::size_type >(s8.getLength()))); +} + +std::string convertStrict(rtl::OUString const & s16) { + rtl::OString s8; + if (!s16.convertToString( + &s8, osl_getThreadTextEncoding(), + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR + | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)) + || (static_cast< sal_uInt32 >(s8.getLength()) + > std::numeric_limits< std::string::size_type >::max())) + { + std::cerr + << "Failure converting argument from UTF-16 back to system encoding" + << std::endl; + std::exit(EXIT_FAILURE); + } + return std::string( + s8.getStr(), static_cast< std::string::size_type >(s8.getLength())); +} + +} SAL_IMPLEMENT_MAIN() { - if (rtl_getAppCommandArgCount() != 1) { - std::cerr << "Usage: cppunittester <shared-library-path>" << std::endl; - return EXIT_FAILURE; + CppUnit::TestResult result; + sal_uInt32 index = 0; + for (; index < rtl_getAppCommandArgCount(); index += 3) { + if (!getArgument(index).equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("--protector"))) + { + break; + } + if (rtl_getAppCommandArgCount() - index < 3) { + usageFailure(); + } + rtl::OUString lib(getArgument(index + 1)); + rtl::OUString sym(getArgument(index + 2)); + oslGenericFunction fn = (new osl::Module(lib, SAL_LOADMODULE_GLOBAL)) + ->getFunctionSymbol(sym); + CppUnit::Protector * p = fn == 0 + ? 0 + : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))(); + if (p == 0) { + std::cerr + << "Failure instantiating protector \"" << convertLazy(lib) + << "\", \"" << convertLazy(sym) << '"' << std::endl; + std::exit(EXIT_FAILURE); + } + result.pushProtector(p); + } + if (rtl_getAppCommandArgCount() - index != 1) { + usageFailure(); } - rtl::OUString path; - rtl_getAppCommandArg(0, &path.pData); CppUnit::PlugInManager manager; - manager.load( - rtl::OUStringToOString(path, osl_getThreadTextEncoding()).getStr()); + manager.load(convertStrict(getArgument(index))); CppUnit::TestRunner runner; runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest()); - CppUnit::TestResult result; CppUnit::TestResultCollector collector; result.addListener(&collector); runner.run(result); diff --git a/remotebridges/source/bridge/remotebridge.component b/sal/inc/cppunittester/protectorfactory.hxx index bbc6bede1..c309dbe8a 100644 --- a/remotebridges/source/bridge/remotebridge.component +++ b/sal/inc/cppunittester/protectorfactory.hxx @@ -1,9 +1,8 @@ -<?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. +* Copyright 2000, 2011 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * @@ -24,13 +23,23 @@ * <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> +#ifndef INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX +#define INCLUDED_CPPUNITTESTER_PROTECTORFACTORY_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +namespace CppUnit { class Protector; } + +namespace cppunittester { + +// The type of CppUnit::Protector factory functions that can be plugged into +// cppunittester: +extern "C" typedef CppUnit::Protector * SAL_CALL ProtectorFactory(); + +} + +#endif diff --git a/sal/inc/osl/thread.h b/sal/inc/osl/thread.h index 2b8cd34fb..57f80ae0b 100644 --- a/sal/inc/osl/thread.h +++ b/sal/inc/osl/thread.h @@ -159,6 +159,18 @@ sal_Bool SAL_CALL osl_scheduleThread(oslThread Thread); */ void SAL_CALL osl_yieldThread(void); +/** Attempts to set the name of the current thread. + + The name of a thread is usually evaluated for debugging purposes. Not all + platforms support this. On Linux, a set thread name can be observed with + "ps -L". On Windows with the Microsoft compiler, a thread name set while a + debugger is attached can be observed within the debugger. + + @param name the name of the thread; must not be null; on Linux, only the + first 16 characters are used +*/ +void SAL_CALL osl_setThreadName(char const * name); + /* Callback when data stored in a thread key is no longer needed */ typedef void (SAL_CALL *oslThreadKeyCallbackFunction)(void *); diff --git a/sal/inc/osl/thread.hxx b/sal/inc/osl/thread.hxx index 2ba156e21..2b140571a 100644 --- a/sal/inc/osl/thread.hxx +++ b/sal/inc/osl/thread.hxx @@ -149,7 +149,10 @@ public: { osl_yieldThread(); } - + + static inline void setName(char const * name) throw () { + osl_setThreadName(name); + } virtual sal_Bool SAL_CALL schedule() { diff --git a/sal/osl/os2/diagnose.c b/sal/osl/os2/diagnose.c index eabb3eae5..8d63e2daa 100644 --- a/sal/osl/os2/diagnose.c +++ b/sal/osl/os2/diagnose.c @@ -124,7 +124,8 @@ sal_Bool SAL_CALL osl_assertFailedLine( const sal_Char* pszFileName, sal_Int32 n fputs(szMessage, stderr); - return sal_True; /* abort */ + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); + return ( ( env != NULL ) && ( *env != '\0' ) ); } /*----------------------------------------------------------------------------*/ diff --git a/sal/osl/os2/thread.c b/sal/osl/os2/thread.c index e41ca7dd7..4865a6709 100644 --- a/sal/osl/os2/thread.c +++ b/sal/osl/os2/thread.c @@ -549,6 +549,10 @@ void SAL_CALL osl_yieldThread() DosSleep(0); } +void osl_setThreadName(char const * name) { + (void) name; +} + typedef struct _TLS { PULONG pulPtr; diff --git a/sal/osl/unx/diagnose.c b/sal/osl/unx/diagnose.c index 07341e1ec..b4baf647f 100644 --- a/sal/osl/unx/diagnose.c +++ b/sal/osl/unx/diagnose.c @@ -218,6 +218,11 @@ sal_Bool SAL_CALL osl_assertFailedLine ( oslDebugMessageFunc f = g_pDebugMessageFunc; char szMessage[1024]; + // after reporting the assertion, abort if told so by SAL_DIAGNOSE_ABORT, but *not* if + // assertions are routed to some external instance + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); + sal_Bool const doAbort = ( ( env != NULL ) && ( *env != '\0' ) && ( f == NULL ) ); + /* If there's a callback for detailed messages, use it */ if ( g_pDetailedDebugMessageFunc != NULL ) { @@ -227,7 +232,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( /* if SAL assertions are disabled in general, stop here */ if ( getenv("DISABLE_SAL_DBGBOX") ) - return sal_False; + return doAbort; /* format message into buffer */ if (pszMessage != 0) @@ -252,9 +257,10 @@ sal_Bool SAL_CALL osl_assertFailedLine ( /* output backtrace */ osl_diagnose_backtrace_Impl(f); - /* release lock and leave, w/o calling osl_breakDebug() */ + /* release lock and leave */ pthread_mutex_unlock(&g_mutex); - return sal_False; + + return doAbort; } /************************************************************************/ @@ -262,7 +268,7 @@ sal_Bool SAL_CALL osl_assertFailedLine ( /************************************************************************/ void SAL_CALL osl_breakDebug() { - exit(0); + abort(); } /************************************************************************/ diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 7f0ef6d62..4ecc7ef53 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -215,7 +215,8 @@ FileHandle_Impl::Allocator::~Allocator() void FileHandle_Impl::Allocator::allocate (sal_uInt8 ** ppBuffer, size_t * pnSize) { OSL_PRECOND((0 != ppBuffer) && (0 != pnSize), "FileHandle_Impl::Allocator::allocate(): contract violation"); - *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)), *pnSize = m_bufsiz; + if ((0 != ppBuffer) && (0 != pnSize)) + *ppBuffer = static_cast< sal_uInt8* >(rtl_cache_alloc(m_cache)), *pnSize = m_bufsiz; } void FileHandle_Impl::Allocator::deallocate (sal_uInt8 * pBuffer) { diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 708b01d3c..49ebba415 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -334,10 +334,8 @@ oslFileError SAL_CALL osl_getDirectoryItem( rtl_uString* ustrFileURL, oslDirecto rtl_uString* ustrSystemPath = NULL; oslFileError osl_error = osl_File_E_INVAL; - OSL_ASSERT(ustrFileURL); - OSL_ASSERT(pItem); - - if (0 == ustrFileURL->length || NULL == pItem) + OSL_ASSERT((0 != ustrFileURL) && (0 != pItem)); + if ((0 == ustrFileURL) || (0 == ustrFileURL->length) || (0 == pItem)) return osl_File_E_INVAL; osl_error = osl_getSystemPathFromFileURL_Ex(ustrFileURL, &ustrSystemPath, sal_False); diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index 4869424a8..93ec29f1e 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -73,19 +73,21 @@ void SAL_CALL osl_systemPathRemoveSeparator(rtl_uString* pustrPath) { - OSL_PRECOND(pustrPath, "osl_systemPathRemoveSeparator: Invalid parameter"); - - // maybe there are more than one separator at end - // so we run in a loop - while ((pustrPath->length > 1) && (FPH_CHAR_PATH_SEPARATOR == pustrPath->buffer[pustrPath->length - 1])) + OSL_PRECOND(0 != pustrPath, "osl_systemPathRemoveSeparator: Invalid parameter"); + if (0 != pustrPath) { - pustrPath->length--; - pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0'; - } + // maybe there are more than one separator at end + // so we run in a loop + while ((pustrPath->length > 1) && (FPH_CHAR_PATH_SEPARATOR == pustrPath->buffer[pustrPath->length - 1])) + { + pustrPath->length--; + pustrPath->buffer[pustrPath->length] = (sal_Unicode)'\0'; + } - OSL_POSTCOND((0 == pustrPath->length) || (1 == pustrPath->length) || \ - (pustrPath->length > 1 && pustrPath->buffer[pustrPath->length - 1] != FPH_CHAR_PATH_SEPARATOR), \ - "osl_systemPathRemoveSeparator: Post condition failed"); + OSL_POSTCOND((0 == pustrPath->length) || (1 == pustrPath->length) || \ + (pustrPath->length > 1 && pustrPath->buffer[pustrPath->length - 1] != FPH_CHAR_PATH_SEPARATOR), \ + "osl_systemPathRemoveSeparator: Post condition failed"); + } } /******************************************* @@ -94,21 +96,22 @@ void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath) { - OSL_PRECOND(ppustrPath && (NULL != *ppustrPath), \ - "osl_systemPathEnsureSeparator: Invalid parameter"); + OSL_PRECOND((0 != ppustrPath) && (0 != *ppustrPath), "osl_systemPathEnsureSeparator: Invalid parameter"); + if ((0 != ppustrPath) && (0 != *ppustrPath)) + { + rtl::OUString path(*ppustrPath); + sal_Int32 lp = path.getLength(); + sal_Int32 i = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR); - rtl::OUString path(*ppustrPath); - sal_Int32 lp = path.getLength(); - sal_Int32 i = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR); - - if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0)) - { - path += FPH_PATH_SEPARATOR(); - rtl_uString_assign(ppustrPath, path.pData); - } + if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0)) + { + path += FPH_PATH_SEPARATOR(); + rtl_uString_assign(ppustrPath, path.pData); + } - OSL_POSTCOND(path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR) == (path.getLength() - 1), \ - "osl_systemPathEnsureSeparator: Post condition failed"); + OSL_POSTCOND(path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR) == (path.getLength() - 1), \ + "osl_systemPathEnsureSeparator: Post condition failed"); + } } /******************************************* @@ -117,8 +120,8 @@ sal_Bool SAL_CALL osl_systemPathIsRelativePath(const rtl_uString* pustrPath) { - OSL_PRECOND(pustrPath, "osl_systemPathIsRelativePath: Invalid parameter"); - return ((0 == pustrPath->length) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR)); + OSL_PRECOND(0 != pustrPath, "osl_systemPathIsRelativePath: Invalid parameter"); + return ((0 == pustrPath) || (0 == pustrPath->length) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR)); } /****************************************** @@ -177,21 +180,16 @@ sal_Bool SAL_CALL osl_systemPathIsHiddenFileOrDirectoryEntry( const rtl_uString* pustrPath) { - OSL_PRECOND(pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter"); + OSL_PRECOND(0 != pustrPath, "osl_systemPathIsHiddenFileOrDirectoryEntry: Invalid parameter"); + if ((0 == pustrPath) || (0 == pustrPath->length)) + return sal_False; - sal_Bool is_hidden = sal_False; - - if (pustrPath->length > 0) - { - rtl::OUString fdp; - - osl_systemPathGetFileNameOrLastDirectoryPart(pustrPath, &fdp.pData); + rtl::OUString fdp; + osl_systemPathGetFileNameOrLastDirectoryPart(pustrPath, &fdp.pData); - is_hidden = ((fdp.pData->length > 0) && (fdp.pData->buffer[0] == FPH_CHAR_DOT) && - !osl_systemPathIsLocalOrParentDirectoryEntry(fdp.pData)); - } - - return is_hidden; + return ((fdp.pData->length > 0) && + (fdp.pData->buffer[0] == FPH_CHAR_DOT) && + !osl_systemPathIsLocalOrParentDirectoryEntry(fdp.pData)); } diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index cfcefda25..55f662ac8 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -486,7 +486,7 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, (sal_Char*)pBuffer, BytesToRead, 0); - if ( nRet <= 0 ) + if ( nRet < 0 ) { OSL_TRACE("osl_receivePipe failed : %i '%s'",nRet,strerror(errno)); } diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 6b34f532e..b7ce28f74 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -483,17 +483,20 @@ extern "C" int _imp_setProcessLocale( rtl_Locale * ); *********************************************/ oslProcessError SAL_CALL osl_getProcessLocale( rtl_Locale ** ppLocale ) { + oslProcessError result = osl_Process_E_Unknown; OSL_PRECOND(ppLocale, "osl_getProcessLocale(): Invalid parameter."); + if (ppLocale) + { + pthread_mutex_lock(&(g_process_locale.m_mutex)); - pthread_mutex_lock(&(g_process_locale.m_mutex)); - - if (g_process_locale.m_pLocale == 0) - _imp_getProcessLocale (&(g_process_locale.m_pLocale)); - *ppLocale = g_process_locale.m_pLocale; - - pthread_mutex_unlock (&(g_process_locale.m_mutex)); + if (g_process_locale.m_pLocale == 0) + _imp_getProcessLocale (&(g_process_locale.m_pLocale)); + *ppLocale = g_process_locale.m_pLocale; + result = osl_Process_E_None; - return (osl_Process_E_None); + pthread_mutex_unlock (&(g_process_locale.m_mutex)); + } + return (result); } /********************************************** diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c index 95e960637..f84550e7f 100644 --- a/sal/osl/unx/profile.c +++ b/sal/osl/unx/profile.c @@ -514,7 +514,6 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile, if ( pTmpProfile->m_bIsValid == sal_False ) { - OSL_ASSERT(pProfile->m_bIsValid); pthread_mutex_unlock(&(pTmpProfile->m_AccessLock)); #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_readProfileString [not valid]\n"); diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index 7f7a2b2a6..737c732fa 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -605,16 +605,16 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr ( oslSocketAddr Addr1, oslSocketAddr Addr2) { - struct sockaddr* pAddr1= &(Addr1->m_sockaddr); - struct sockaddr* pAddr2= &(Addr2->m_sockaddr); - - OSL_ASSERT(pAddr1); - OSL_ASSERT(pAddr2); - - if (pAddr1->sa_family == pAddr2->sa_family) + OSL_ASSERT((0 != Addr1) && (0 != Addr2)); + if ((0 != Addr1) || (0 != Addr2)) { - switch (pAddr1->sa_family) - { + struct sockaddr* pAddr1= &(Addr1->m_sockaddr); + struct sockaddr* pAddr2= &(Addr2->m_sockaddr); + + if (pAddr1->sa_family == pAddr2->sa_family) + { + switch (pAddr1->sa_family) + { case AF_INET: { struct sockaddr_in* pInetAddr1= (struct sockaddr_in*)pAddr1; @@ -623,16 +623,16 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr ( if ((pInetAddr1->sin_family == pInetAddr2->sin_family) && (pInetAddr1->sin_addr.s_addr == pInetAddr2->sin_addr.s_addr) && (pInetAddr1->sin_port == pInetAddr2->sin_port)) - return (sal_True); + return (sal_True); } default: { - return (memcmp(pAddr1, Addr2, sizeof(struct sockaddr)) == 0); + return (memcmp(pAddr1, pAddr2, sizeof(struct sockaddr)) == 0); } - } + } + } } - return (sal_False); } @@ -1173,7 +1173,6 @@ oslHostAddr SAL_CALL osl_createHostAddr ( rtl_string_release(strHostname); } - return HostAddr; } @@ -1197,7 +1196,7 @@ oslHostAddr SAL_CALL osl_psz_createHostAddr ( pHostAddr= (oslHostAddr) malloc(sizeof(struct oslHostAddrImpl)); OSL_ASSERT(pHostAddr); - if (pAddr == NULL) + if (pHostAddr == NULL) { free (cn); return ((oslHostAddr)NULL); @@ -2530,7 +2529,10 @@ sal_Bool __osl_socket_poll ( int timeout; int result; - OSL_ASSERT(pSocket); + OSL_ASSERT(0 != pSocket); + if (0 == pSocket) + return sal_False; /* EINVAL */ + pSocket->m_nLastError = 0; fds.fd = pSocket->m_Socket; @@ -2573,7 +2575,10 @@ sal_Bool __osl_socket_poll ( struct timeval tv; int result; - OSL_ASSERT(pSocket); + OSL_ASSERT(0 != pSocket); + if (0 == pSocket) + return sal_False; /* EINVAL */ + pSocket->m_nLastError = 0; FD_ZERO(&fds); diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 3f96f70e7..76545b369 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -34,6 +34,10 @@ #include <rtl/textenc.h> #endif +#if defined LINUX +#include <sys/prctl.h> +#endif + /**************************************************************************** * @@@ TODO @@@ * @@ -566,6 +570,18 @@ void SAL_CALL osl_yieldThread() sched_yield(); } +void SAL_CALL osl_setThreadName(char const * name) { +#if defined LINUX + if (prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0) != 0) { + OSL_TRACE( + "%s prctl(PR_SET_NAME) failed with errno %d", OSL_LOG_PREFIX, + errno); + } +#else + (void) name; +#endif +} + /*****************************************************************************/ /* osl_getThreadIdentifier @@@ see TODO @@@ */ /*****************************************************************************/ diff --git a/sal/osl/w32/diagnose.c b/sal/osl/w32/diagnose.c index 97fe8d275..0e1f1d864 100755 --- a/sal/osl/w32/diagnose.c +++ b/sal/osl/w32/diagnose.c @@ -93,6 +93,7 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL /* get app name or NULL if unknown (don't call assert) */ LPCSTR lpszAppName = "Error"; sal_Char szMessage[512]; + char const * env = getenv( "SAL_DIAGNOSE_ABORT" ); /* format message into buffer */ szMessage[sizeof(szMessage)-1] = '\0'; /* zero terminate always */ @@ -105,39 +106,44 @@ sal_Bool SAL_CALL osl_assertFailedLine(const sal_Char* pszFileName, sal_Int32 nL _pPrintDetailedDebugMessage( pszFileName, nLine, pszMessage ); else if ( _pPrintDebugMessage ) _pPrintDebugMessage( szMessage ); - else if ( !getenv( "DISABLE_SAL_DBGBOX" ) ) + else { - TCHAR szBoxMessage[1024]; - - /* active popup window for the current thread */ - hWndParent = GetActiveWindow(); - if (hWndParent != NULL) - hWndParent = GetLastActivePopup(hWndParent); - - /* set message box flags */ - nFlags = MB_TASKMODAL | MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_SETFOREGROUND; - if (hWndParent == NULL) - nFlags |= MB_SERVICE_NOTIFICATION; - - /* display the assert */ - - szBoxMessage[sizeof(szBoxMessage)-1] = 0; - _snprintf(szBoxMessage, sizeof(szBoxMessage)-1, "%s\n( Yes=Abort / No=Ignore / Cancel=Debugger )", - szMessage); - - nCode = MessageBox(hWndParent, szBoxMessage, "Assertion Failed!", nFlags); - - if (nCode == IDYES) - FatalExit(-1); - - if (nCode == IDNO) - return sal_False; /* ignore */ - - if (nCode == IDCANCEL) - return sal_True; /* will cause oslDebugBreak */ + if ( !getenv( "DISABLE_SAL_DBGBOX" ) ) + { + TCHAR szBoxMessage[1024]; + + /* active popup window for the current thread */ + hWndParent = GetActiveWindow(); + if (hWndParent != NULL) + hWndParent = GetLastActivePopup(hWndParent); + + /* set message box flags */ + nFlags = MB_TASKMODAL | MB_ICONWARNING | MB_YESNOCANCEL | MB_DEFBUTTON2 | MB_SETFOREGROUND; + if (hWndParent == NULL) + nFlags |= MB_SERVICE_NOTIFICATION; + + /* display the assert */ + + szBoxMessage[sizeof(szBoxMessage)-1] = 0; + _snprintf(szBoxMessage, sizeof(szBoxMessage)-1, "%s\n( Yes=Abort / No=Ignore / Cancel=Debugger )", + szMessage); + + nCode = MessageBox(hWndParent, szBoxMessage, "Assertion Failed!", nFlags); + + if (nCode == IDYES) + FatalExit(-1); + + if (nCode == IDNO) + return sal_False; /* ignore */ + + if (nCode == IDCANCEL) + return sal_True; /* will cause oslDebugBreak */ + } + return ( ( env != NULL ) && ( *env != '\0' ) ); } + + return sal_False; #endif /* NO_DEBUG_CRT */ - return sal_False; /* not shure, not care */ } sal_Int32 SAL_CALL osl_reportError(sal_uInt32 nType, const sal_Char* pszMessage) diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index c307a634c..355362eb4 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -155,7 +155,7 @@ namespace /* private */ void parse_UNC_path(const sal_Unicode* path, UNCComponents* puncc) { OSL_PRECOND(is_UNC_path(path), "Precondition violated: No UNC path"); - OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) != -1, "Path must not contain slashes"); + OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) == -1, "Path must not contain slashes"); const sal_Unicode* pend = path + rtl_ustr_getLength(path); const sal_Unicode* ppos = path + 2; @@ -691,7 +691,7 @@ static int path_make_parent(sal_Unicode* path) If there are no more parents 0 will be returned, e.g. 'c:\' or '\\Share' have no more parents */ - OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) != -1, "Path must not contain slashes"); + OSL_PRECOND(rtl_ustr_indexOfChar(path, SLASH) == -1, "Path must not contain slashes"); OSL_PRECOND(has_path_parent(path), "Path must have a parent"); sal_Unicode* pos_last_backslash = path + rtl_ustr_lastIndexOfChar(path, BACKSLASH); diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx index be5a5b47a..8fc1dbb8b 100644..100755 --- a/sal/osl/w32/module.cxx +++ b/sal/osl/w32/module.cxx @@ -36,6 +36,7 @@ #include <osl/thread.h> #include <osl/file.h> #include <rtl/logfile.h> +#include <vector> /* under WIN32, we use the void* oslModule @@ -65,10 +66,32 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod rtl_uString_assign(&Module, strModuleName); hInstance = LoadLibraryW(reinterpret_cast<LPCWSTR>(Module->buffer)); + if (hInstance == NULL) hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + //In case of long path names (\\?\c:\...) try to shorten the filename. + //LoadLibrary cannot handle file names which exceed 260 letters. + //In case the path is to long, the function will fail. However, the error + //code can be different. For example, it returned ERROR_FILENAME_EXCED_RANGE + //on Windows XP and ERROR_INSUFFICIENT_BUFFER on Windows 7 (64bit) + if (hInstance == NULL && Module->length > 260) + { + std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec(Module->length + 1); + DWORD len = GetShortPathNameW(reinterpret_cast<LPCWSTR>(Module->buffer), + &vec[0], Module->length + 1); + if (len ) + { + hInstance = LoadLibraryW(&vec[0]); + + if (hInstance == NULL) + hInstance = LoadLibraryExW(&vec[0], NULL, + LOAD_WITH_ALTERED_SEARCH_PATH); + } + } + + if (hInstance <= (HINSTANCE)HINSTANCE_ERROR) hInstance = 0; diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index a2e645426..4fad3f225 100644..100755 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -299,7 +299,40 @@ namespace /* private */ return quoted.makeStringAndClear(); } - + + //The parameter path must be a system path. If it is longer than 260 characters + //then it is shortened using the GetShortPathName function. This function only + //works if the path exists. Because "path" can be the path to an executable, it + //may not have the file extension ".exe". However, if the file on disk has the + //".exe" extension, then the function will fail. In this case a second attempt + //is started by adding the parameter "extension" to "path". + rtl::OUString getShortPath(rtl::OUString const & path, rtl::OUString const & extension) + { + rtl::OUString ret(path); + if (path.getLength() > 260) + { + std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec(path.getLength() + 1); + //GetShortPathNameW only works if the file can be found! + const DWORD len = GetShortPathNameW( + path.getStr(), &vec[0], path.getLength() + 1); + + if (!len && GetLastError() == ERROR_FILE_NOT_FOUND + && extension.getLength()) + { + const rtl::OUString extPath(path + extension); + std::vector<sal_Unicode, rtl::Allocator<sal_Unicode> > vec2( + extPath.getLength() + 1); + const DWORD len2 = GetShortPathNameW( + extPath.getStr(), &vec2[0], extPath.getLength() + 1); + ret = rtl::OUString(&vec2[0], len2); + } + else + { + ret = rtl::OUString(&vec[0], len); + } + } + return ret; + } //########################################################## // Returns the system path of the executable which can either // be provided via the strImageName parameter or as first @@ -325,9 +358,11 @@ namespace /* private */ rtl::OUString exe_path; if (osl_File_E_None != osl::FileBase::getSystemPathFromFileURL(exe_url, exe_path)) return rtl::OUString(); + + exe_path = getShortPath(exe_path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".exe"))); if (exe_path.indexOf(' ') != -1) - exe_path = quote_string(exe_path); + exe_path = quote_string(exe_path); return exe_path; } diff --git a/sal/osl/w32/thread.c b/sal/osl/w32/thread.c index 90ff0d2dc..64297864f 100644..100755 --- a/sal/osl/w32/thread.c +++ b/sal/osl/w32/thread.c @@ -394,6 +394,31 @@ void SAL_CALL osl_yieldThread(void) Sleep(0); } +void SAL_CALL osl_setThreadName(char const * name) { +#ifdef _MSC_VER + /* See <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>: */ +#pragma pack(push, 8) + struct { + DWORD dwType; + LPCSTR szName; + DWORD dwThreadID; + DWORD dwFlags; + } info; +#pragma pack(pop) + info.dwType = 0x1000; + info.szName = name; + info.dwThreadID = (DWORD) -1; + info.dwFlags = 0; + __try { + RaiseException( + 0x406D1388, 0, sizeof info / sizeof (ULONG_PTR), + (ULONG_PTR *) &info); + } __except (EXCEPTION_EXECUTE_HANDLER) {} +#else + (void) name; +#endif +} + typedef struct _TLS { DWORD dwIndex; diff --git a/sal/prj/build.lst b/sal/prj/build.lst index 06e395844..b7786f604 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -20,4 +20,5 @@ sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util 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\osl\setthreadname nmake - all sa_qa_osl_setthreadname 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/prj/d.lst b/sal/prj/d.lst index 3ce270bbb..253d7ea7f 100644 --- a/sal/prj/d.lst +++ b/sal/prj/d.lst @@ -1,9 +1,11 @@ +mkdir: %_DEST%\inc%_EXT%\cppunittester mkdir: %_DEST%\inc%_EXT%\sal mkdir: %_DEST%\inc%_EXT%\osl mkdir: %_DEST%\inc%_EXT%\rtl mkdir: %_DEST%\inc%_EXT%\systools mkdir: %_DEST%\inc%_EXT%\systools\win32 +..\inc\cppunittester\protectorfactory.hxx %_DEST%\inc%_EXT%\protectorfactory.hxx ..\%__SRC%\inc\rtlbootstrap.mk %_DEST%\inc%_EXT%\rtlbootstrap.mk ..\inc\sal\*.h %_DEST%\inc%_EXT%\sal\*.h ..\%__SRC%\inc\sal\typesizes.h %_DEST%\inc%_EXT%\sal\typesizes.h diff --git a/offapi/drafts/com/sun/star/form/makefile.mk b/sal/qa/osl/setthreadname/makefile.mk index c5f68e0fe..f2d9da15c 100644 --- a/offapi/drafts/com/sun/star/form/makefile.mk +++ b/sal/qa/osl/setthreadname/makefile.mk @@ -1,8 +1,8 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -23,30 +23,35 @@ # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # -#************************************************************************* +#***********************************************************************/ + +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ..$/..$/.. +PRJNAME = sal +TARGET = qa_osl_setthreadname -PRJ=..$/..$/..$/..$/.. +ENABLE_EXCEPTIONS = TRUE -PRJNAME=offapi +.INCLUDE: settings.mk -TARGET=dcssform -PACKAGE=drafts$/com$/sun$/star$/form +CFLAGSCXX += $(CPPUNIT_CFLAGS) -# --- Settings ----------------------------------------------------- -.INCLUDE : $(PRJ)$/util$/makefile.pmk +DLLPRE = -# ------------------------------------------------------------------------ +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLO)/test-setthreadname.obj +SHL1RPATH = NONE +SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) +SHL1TARGET = test-setthreadname +SHL1VERSIONMAP = version.map +DEF1NAME = $(SHL1TARGET) -IDLFILES=\ - IncompatibleTypesException.idl \ - ListEntryEvent.idl \ - XBindableValue.idl \ - XValueBinding.idl \ - XListEntrySink.idl \ - XListEntrySource.idl \ - XListEntryListener.idl \ +SLOFILES = $(SHL1OBJS) -# ------------------------------------------------------------------ +.INCLUDE: target.mk +.INCLUDE: _cppunit.mk -.INCLUDE : target.mk -.INCLUDE : $(PRJ)$/util$/target.pmk +.END diff --git a/sal/qa/osl/setthreadname/test-setthreadname.cxx b/sal/qa/osl/setthreadname/test-setthreadname.cxx new file mode 100755 index 000000000..0f0f61839 --- /dev/null +++ b/sal/qa/osl/setthreadname/test-setthreadname.cxx @@ -0,0 +1,87 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2011 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 <cstdlib> +#include <iostream> +#include <limits> + +#include "boost/noncopyable.hpp" +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "osl/thread.hxx" + +namespace { + +class TestThread: public osl::Thread, private boost::noncopyable { +private: + virtual void SAL_CALL run(); +}; + +void TestThread::run() { +#if defined WNT + if (std::getenv("URE_TEST_SETTHREADNAME") != 0) { + // On Windows, setting thread names appears to only take effect when the + // process is being debugged, so attach a debugger now: + std::cout << "set: "; + std::cin.ignore(std::numeric_limits< int >::max(), '\n'); + } +#endif + setName("TestThread"); + if (std::getenv("URE_TEST_SETTHREADNAME") != 0) { + // On Linux, the thread name can now be observed with "ps -L"; on + // Windows with the Microsoft compiler, the thread name can now be + // observed in a debugger. + std::cout << "stop: "; + std::cin.ignore(std::numeric_limits< int >::max(), '\n'); + } +} + +class Test: public CppUnit::TestFixture { +private: + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test); + CPPUNIT_TEST_SUITE_END(); + + void test(); +}; + +void Test::test() { + TestThread t; + t.create(); + t.join(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/bridges/source/remote/static/makefile.mk b/sal/qa/osl/setthreadname/version.map index 9b3c2b795..ef2ab497c 100644 --- a/bridges/source/remote/static/makefile.mk +++ b/sal/qa/osl/setthreadname/version.map @@ -1,8 +1,8 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -23,39 +23,12 @@ # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=bridges -TARGET=bridges_remote_static -ENABLE_EXCEPTIONS=TRUE -USE_DEFFILE=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# ------------------------------------------------------------------ - -SLOFILES= \ - $(SLO)$/proxy.obj \ - $(SLO)$/stub.obj \ - $(SLO)$/remote.obj \ - $(SLO)$/mapping.obj \ - $(SLO)$/helper.obj \ - $(SLO)$/remote_types.obj - -# Forte6 update 1 on Solaris Intel dies with internal compiler error -# on stub.cxx if optimization is on. Switch it off for now. -# To be reevaluated on compiler upgrade -.IF "$(OS)$(CPU)"=="SOLARISI" -NOOPTFILES=\ - $(SLO)$/stub.obj -.ENDIF - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk +#***********************************************************************/ +UDK_3_0_0 { + global: + cppunitTestPlugIn; + local: + *; +}; diff --git a/sal/rtl/source/alloc.c b/sal/rtl/source/alloc.c deleted file mode 100644 index a694c6c34..000000000 --- a/sal/rtl/source/alloc.c +++ /dev/null @@ -1,1541 +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. - * - ************************************************************************/ - -#ifdef PROFILE -#undef OSL_DEBUG_LEVEL -#define OSL_DEBUG_LEVEL 0 -#endif /* PROFILE */ - -#include <sal/types.h> -#include <osl/diagnose.h> -#include <rtl/alloc.h> - -#ifndef INCLUDED_STDDEF_H -#include <stddef.h> -#define INCLUDED_STDDEF_H -#endif - -#ifndef INCLUDED_STDLIB_H -#include <stdlib.h> -#define INCLUDED_STDLIB_H -#endif - -#ifndef INCLUDED_STRING_H -#include <string.h> -#define INCLUDED_STRING_H -#endif - -#ifndef FORCE_SYSALLOC - -/*=========================================================================== - * - * rtl_memory (UNX) internals. - * - *=========================================================================*/ -#ifdef SAL_UNX - -#include <unistd.h> -#include <pthread.h> -#include <sys/mman.h> -#include <fcntl.h> - -typedef pthread_mutex_t mutex_type; - -#define RTL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER -#define RTL_MUTEX_ACQUIRE(a) pthread_mutex_lock((a)) -#define RTL_MUTEX_RELEASE(a) pthread_mutex_unlock((a)) - -#if defined(FREEBSD) || defined(NETBSD) || defined(MACOSX) -static sal_Size __rtl_memory_vmpagesize (void) -{ - /* xBSD */ - return (sal_Size)(getpagesize()); -} -#elif defined(LINUX) || defined(SOLARIS) -static sal_Size __rtl_memory_vmpagesize (void) -{ - /* POSIX */ - return (sal_Size)(sysconf(_SC_PAGESIZE)); -} -#else -static sal_Size __rtl_memory_vmpagesize (void) -{ - /* other */ - return (sal_Size)(0x2000); -} -#endif /* FREEBSD || NETBSD || MACOSX || LINUX || SOLARIS */ - -#ifndef PROT_HEAP -#define PROT_HEAP (PROT_READ | PROT_WRITE | PROT_EXEC) -#endif - -/* #95880# building on Solaris 8 provides MAP_ANON, but it - is not available on Solaris 7 */ -#if defined (SOLARIS) -#ifdef MAP_ANON -#undef MAP_ANON -#endif -#endif - -#ifndef MAP_ANON -static void* __rtl_memory_vmalloc (sal_Size n) -{ - /* SYSV */ - int fd = open("/dev/zero", O_RDWR); - if (!(fd < 0)) - { - void * p = mmap(NULL, n, PROT_HEAP, MAP_PRIVATE, fd, 0); - close(fd); - return ((p == MAP_FAILED) ? NULL : p); - } - return (NULL); -} -#else /* MAP_ANON */ -static void* __rtl_memory_vmalloc (sal_Size n) -{ - /* xBSD */ - void * p = mmap(NULL, n, PROT_HEAP, MAP_PRIVATE | MAP_ANON, -1, 0); - return ((p == MAP_FAILED) ? NULL : p); -} -#endif /* MAP_ANON */ - -#define RTL_MEMORY_ALLOC(n) __rtl_memory_vmalloc((sal_Size)(n)) -#define RTL_MEMORY_FREE(p, n) munmap((void*)(p), (sal_Size)(n)) - -#endif /* SAL_UNX */ - -/*=========================================================================== - * - * rtl_memory (W32) internals. - * - *=========================================================================*/ -#ifdef SAL_W32 - -#define WIN32_LEAN_AND_MEAN -#ifdef _MSC_VER -#pragma warning(push,1) /* disable warnings within system headers */ -#endif -#include <windows.h> -#include <wchar.h> - -typedef CRITICAL_SECTION mutex_type; - -/* Static initializer (struct declared in WINNT.H). */ -#define RTL_MUTEX_INITIALIZER { NULL, -1, 0, NULL, NULL, 0 } - -/* - * __rtl_mutex_init (dynamic initialization). - * - * Static initialization (with DebugInfo == NULL) - * leads to Access Violation upon first contention. - */ -static void __rtl_mutex_init (LPCRITICAL_SECTION lpCriticalSection) -{ - static LONG g_spinlock = 0; - - while (InterlockedExchange (&g_spinlock, 1) == 1) - { - /* Already locked, spin */ - Sleep (0); - } - if (!(lpCriticalSection->DebugInfo)) - { - /* Dynamic initialization */ - InitializeCriticalSection (lpCriticalSection); - } - InterlockedExchange (&g_spinlock, 0); -} - -#define RTL_MUTEX_INIT(a) __rtl_mutex_init((LPCRITICAL_SECTION)(a)) -#define RTL_MUTEX_ACQUIRE(a) EnterCriticalSection((a)) -#define RTL_MUTEX_RELEASE(a) LeaveCriticalSection((a)) - -static sal_Size __rtl_memory_vmpagesize (void) -{ - SYSTEM_INFO info; - GetSystemInfo (&info); - return ((sal_Size)(info.dwPageSize)); -} - -#define RTL_MEMORY_ALLOC(n) \ -(void*)(VirtualAlloc (NULL, (SIZE_T)(n), MEM_COMMIT, PAGE_READWRITE)) - -#define RTL_MEMORY_FREE(p, n) \ -(void)(VirtualFree ((LPVOID)(p), (SIZE_T)(0), MEM_RELEASE)) - -#endif /* SAL_W32 */ - -/*=========================================================================== - * - * rtl_memory (OS2) internals. - * - *=========================================================================*/ -#ifdef SAL_OS2 - -#define INCL_DOS -#include <os2.h> - -typedef HMTX mutex_type; - -/* Static initializer */ -#define RTL_MUTEX_INITIALIZER -1 - -/* - * __rtl_mutex_init (dynamic initialization). - * - * Static initialization (with DebugInfo == NULL) - * leads to Access Violation upon first contention. - */ -static void __rtl_mutex_init (mutex_type* mutex) -{ - APIRET rc = 0; - - rc = DosCreateMutexSem(NULL,mutex,0,0); - -} - -static int __rtl_mutex_destroy (mutex_type* mutex) -{ - APIRET rc = 0; - - - do { - rc = DosCloseMutexSem(*mutex); - if (rc == 301) DosReleaseMutexSem(*mutex); - } while (rc == 301); - - *mutex = 0; - - /* Return the completion status: */ - return (0); -} - - -static int __rtl_mutex_acquire(mutex_type* mutex) -{ - int ret = 0; - int status = 0; - APIRET rc = 0; - - // initialize static semaphores created with PTHREAD_MUTEX_INITIALIZER state. - if (*mutex == -1) - __rtl_mutex_init( mutex); - - rc = DosRequestMutexSem(*mutex,SEM_INDEFINITE_WAIT); - if (rc) - return(1); - - /* Return the completion status: */ - return (0); -} - -static int __rtl_mutex_release(mutex_type* mutex) -{ - int ret = 0; - APIRET rc = 0; - int status; - - - // initialize static semaphores created with PTHREAD_MUTEX_INITIALIZER state. - if (*mutex == -1) - __rtl_mutex_init( mutex); - - rc = DosReleaseMutexSem(*mutex); - - /* Return the completion status: */ - return (0); -} - -#define RTL_MUTEX_INIT(a) __rtl_mutex_init((mutex_type*)(a)) -#define RTL_MUTEX_ACQUIRE(a) __rtl_mutex_acquire((mutex_type*)(a)) -#define RTL_MUTEX_RELEASE(a) __rtl_mutex_release((mutex_type*)(a)) - -static sal_Size __rtl_memory_vmpagesize (void) -{ - return (sal_Size)(getpagesize()); -} - -#define RTL_MEMORY_ALLOC(n) (void*)(malloc(n)) - -#define RTL_MEMORY_FREE(p, n) (void)(free(p)) - -#endif /* SAL_OS2 */ - -/*=========================================================================== - * - * rtl_memory (global) internals. - * - *=========================================================================*/ -#define __L__ 32 -#define __P__ 24 -#define __N__ ((__L__) + (__P__)) -#define __M__ 0x10000 - -static const sal_Size __T__ = (__M__) * 2 / 3; - -typedef struct __rtl_memory_desc_st memory_type; -struct __rtl_memory_desc_st -{ - sal_Size m_length; - sal_Size m_offset; - memory_type *m_flink; - memory_type *m_blink; -}; - -static const int __C__ = 2 * sizeof(sal_Size); -static const int __Q__ = 2 * sizeof(memory_type*); - -typedef struct __rtl_memory_stat_st memory_stat; -struct __rtl_memory_stat_st -{ - sal_uInt64 m_dequeue; - sal_uInt64 m_enqueue; - sal_Int32 m_delta_q; - - sal_uInt64 m_deqsize; - sal_uInt64 m_enqsize; - sal_Int32 m_delta_n; -}; - -#define RTL_MEMORY_ALIGN(n, m) (((n) + ((m) - 1)) & ~((m) - 1)) -#define RTL_MEMORY_SIZEOF(a) RTL_MEMORY_ALIGN(sizeof(a), sizeof(memory_type)) - -struct __rtl_memory_global_st -{ - sal_Size m_magic; - sal_Size m_align; - - union { - mutex_type m_lock; - char m_data[RTL_MEMORY_SIZEOF(mutex_type)]; - } m_mutex; - - memory_type m_alloc_head; - memory_type m_spare_head; - memory_type m_queue_head[__N__]; - -#if OSL_DEBUG_LEVEL > 0 - memory_stat m_queue_stat[__N__]; -#endif /* OSL_DEBUG_LEVEL */ -}; - -static struct __rtl_memory_global_st g_memory = -{ - 0, 0, { RTL_MUTEX_INITIALIZER }, - { 0, 0, NULL, NULL }, { 0, 0, NULL, NULL }, { { 0, 0, NULL, NULL } }, -#if OSL_DEBUG_LEVEL > 0 - { { 0, 0, 0, 0, 0, 0 } } -#endif /* OSL_DEBUG_LEVEL */ -}; - -void SAL_CALL ___rtl_memory_init (void); -void SAL_CALL ___rtl_memory_fini (void); - -#define RTL_MEMORY_ENTER() \ -{ \ - if (!(g_memory.m_align)) ___rtl_memory_init(); \ - RTL_MUTEX_ACQUIRE(&(g_memory.m_mutex.m_lock)); \ -} - -#define RTL_MEMORY_LEAVE() \ -{ \ - RTL_MUTEX_RELEASE(&(g_memory.m_mutex.m_lock)); \ -} - -/*=========================================================================== - * - * rtl_memory (queue) internals. - * - *=========================================================================*/ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static sal_Size queue (sal_Size n) -{ - /* k = n div __C__ */ - register sal_Size k = n / __C__, m = __L__; - - OSL_PRECOND((__L__ == 32), - "__rtl_memory_queue(): internal logic error"); - if (k > m) - { - /* k = k div __L__ = k div 32 */ - k >>= 5; - while ((k >>= 1) > 0) m++; - k = m; - } - - OSL_POSTCOND((0 < k) && (k < __N__), - "__rtl_memory_queue(): " - "internal error: index out of bounds"); - return (k); -} -#else /* PRODUCT */ -#define queue(k, n) \ -{ \ - (k) = ((n) / __C__); \ - if ((k) > __L__) \ - { \ - register sal_Size m = __L__; \ - (k) >>= 5; \ - while (((k) >>= 1) > 0) m++; \ - (k) = m; \ - } \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -#define queue_start(entry) \ -{ \ - (entry)->m_flink = (entry); \ - (entry)->m_blink = (entry); \ -} - -#define queue_remove(entry) \ -{ \ - (entry)->m_blink->m_flink = (entry)->m_flink; \ - (entry)->m_flink->m_blink = (entry)->m_blink; \ - queue_start(entry); \ -} - -#define queue_insert_head(head, entry) \ -{ \ - (entry)->m_blink = (head); \ - (entry)->m_flink = (head)->m_flink; \ - (head)->m_flink = (entry); \ - (entry)->m_flink->m_blink = (entry); \ -} - -#define queue_insert_tail(head, entry) \ -{ \ - (entry)->m_flink = (head); \ - (entry)->m_blink = (head)->m_blink; \ - (head)->m_blink = (entry); \ - (entry)->m_blink->m_flink = (entry); \ -} - -/*=========================================================================== - * - * rtl_memory (debug) internals. - * - *=========================================================================*/ -#if OSL_DEBUG_LEVEL > 0 - -#define __dbg_memory_succ(entry, length) \ -(memory_type*)((char*)((entry)) + ((length) & ~0x1)) - -#define __dbg_memory_pred(entry, offset) \ -(memory_type*)((char*)((entry)) - ((offset) & ~0x1)) - -#define __dbg_memory_ensure(entry) (!((sal_Size)(entry) & 0x7)) - -/* - * __dbg_memory_dequeue. - */ -static void __dbg_memory_dequeue (sal_Size n) -{ - register sal_Size k = queue(n); - - g_memory.m_queue_stat[k].m_dequeue += 1; - g_memory.m_queue_stat[k].m_delta_q += 1; - - g_memory.m_queue_stat[k].m_deqsize += n; - g_memory.m_queue_stat[k].m_delta_n += n; -} - -/* - * __dbg_memory_enqueue. - */ -static void __dbg_memory_enqueue (sal_Size n) -{ - register sal_Size k = queue(n); - - g_memory.m_queue_stat[k].m_enqueue += 1; - g_memory.m_queue_stat[k].m_delta_q -= 1; - - g_memory.m_queue_stat[k].m_enqsize += n; - g_memory.m_queue_stat[k].m_delta_n -= n; -} - -/* - * __dbg_memory_insert. - */ -static void __dbg_memory_insert (memory_type **ppMemory) -{ - register memory_type * succ; - succ = __dbg_memory_succ (*ppMemory, sizeof(memory_type)); - - succ->m_length = (*ppMemory)->m_length - sizeof(memory_type); - succ->m_offset = (*ppMemory)->m_offset; - - queue_insert_tail (&(g_memory.m_alloc_head), (*ppMemory)); - (*ppMemory) = succ; -} - -/* - * __dbg_memory_remove. - */ -static void __dbg_memory_remove (memory_type **ppMemory) -{ - (*ppMemory) = __dbg_memory_pred (*ppMemory, sizeof(memory_type)); - queue_remove (*ppMemory); -} - -/* - * __dbg_memory_verify_chain. - */ -static int __dbg_memory_verify_chain (memory_type * x) -{ - if (!__dbg_memory_ensure(x)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): invalid pointer alignment."); - return (0); - } - if (!__dbg_memory_ensure(x->m_length & ~0x1)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): dynamic memory corruption"); - return (0); - } - if (!__dbg_memory_ensure(x->m_offset & ~0x1)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): dynamic memory corruption"); - return (0); - } - if (!(x->m_length & ~0x1)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): dynamic memory corruption"); - return (0); - } - return (1); -} - -/* - * __dbg_memory_verify_queue. - */ -static int __dbg_memory_verify_queue (memory_type * x) -{ - if (!__dbg_memory_ensure(x)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): invalid pointer alignment."); - return (0); - } - if (!__dbg_memory_ensure(x->m_flink)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): free memory corruption"); - return (0); - } - if (!__dbg_memory_ensure(x->m_blink)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): free memory corruption"); - return (0); - } - if ((x == x->m_flink) || (x == x->m_blink)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): internal logic error"); - return (0); - } - return (1); -} - -/* - * __dbg_memory_verify_alloc. - */ -static int __dbg_memory_verify_alloc (memory_type * x) -{ - register memory_type *head, *entry; - head = entry = &(g_memory.m_alloc_head); - - if (!__dbg_memory_ensure(x)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): invalid pointer alignment."); - return (0); - } - while (!((entry = entry->m_flink) == head)) - { - if ((entry < x) && (x < __dbg_memory_succ(entry, entry->m_length))) - { - head = entry = __dbg_memory_succ(entry, sizeof(memory_type)); - while (!((x == entry) || (entry->m_offset & 0x1))) - { - /* no match, not last */ - if (!__dbg_memory_verify_chain (entry)) - return (0); - entry = __dbg_memory_succ(entry, entry->m_length); - } - - /* match, or last */ - if (!__dbg_memory_verify_chain (entry)) - return (0); - break; - } - } - if (!(x == entry)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): memory not allocated."); - return (0); - } - return (1); -} - -/* - * __dbg_memory_verify. - */ -static int __dbg_memory_verify (memory_type * x, int debug) -{ - /* dispatch upon 'debug' level */ - if (debug) - { - /* verify allocation */ - if (!__dbg_memory_verify_alloc (x)) - return (0); - } - else - { - /* verify 'chain' fields */ - if (!__dbg_memory_verify_chain (x)) - return (0); - } - - /* verify 'used' bit */ - if (!(x->m_length & 0x1)) - { - OSL_ENSURE(0, "__rtl_memory_verify(): memory not used."); - return (0); - } - return (1); -} - -#if OSL_DEBUG_LEVEL > 1 -/* - * __dbg_memory_usage_update. - */ -static sal_Size __dbg_memory_usage_update (memory_stat * stat, sal_Size length) -{ - register sal_Size n = (length & ~0x1), k = queue(n); - - stat[k].m_dequeue += 1; - stat[k].m_deqsize += n; - - if (!(length & 0x1)) - { - /* not used */ - stat[k].m_enqueue += 1; - stat[k].m_enqsize += n; - return (n); - } - else - { - /* used */ - stat[k].m_delta_q += 1; - stat[k].m_delta_n += n; - return (0); - } -} - -/* - * __dbg_memory_usage. - */ -static void __dbg_memory_usage (memory_stat * total) -{ - register memory_type *head, *entry, *memory; - memory_stat stat[__N__]; - - memset (stat, 0, __N__ * sizeof(memory_stat)); - - head = entry = &(g_memory.m_alloc_head); - while (!((entry = entry->m_flink) == head)) - { - register sal_Size k = 0, n = entry->m_length - sizeof(memory_type); - - memory = __dbg_memory_succ(entry, sizeof(memory_type)); - while (!(memory->m_offset & 0x1)) - { - /* not last */ - k += __dbg_memory_usage_update (stat, memory->m_length); - memory = __dbg_memory_succ(memory, memory->m_length); - } - - k += __dbg_memory_usage_update (stat, memory->m_length); - OSL_TRACE("%x %10d %10d", (sal_Size)(entry), n, k); - } - - if (total) - { - sal_Size i; - - memset (total, 0, sizeof(memory_stat)); - for (i = 0; i < __N__; i++) - { - total->m_dequeue += stat[i].m_dequeue; - total->m_enqueue += stat[i].m_enqueue; - total->m_delta_q += stat[i].m_delta_q; - - total->m_deqsize += stat[i].m_deqsize; - total->m_enqsize += stat[i].m_enqsize; - total->m_delta_n += stat[i].m_delta_n; - } - } -} -#endif /* OSL_DEBUG_LEVEL */ - -#endif /* OSL_DEBUG_LEVEL */ -#if OSL_DEBUG_LEVEL > 0 - -#define DBG_MEMORY_DEQUEUE(n) __dbg_memory_dequeue((sal_Size)(n) & ~0x1) -#define DBG_MEMORY_ENQUEUE(n) __dbg_memory_enqueue((sal_Size)(n) & ~0x1) - -#define DBG_MEMORY_DEQFILL(entry, offset, length) \ - memset(((char*)(entry) + (offset)), 0x77777777, (length)) -#define DBG_MEMORY_ENQFILL(entry, offset, length) \ - memset(((char*)(entry) + (offset)), 0x33333333, (length)) - -#define DBG_MEMORY_INSERT(entry) __dbg_memory_insert((entry)) -#define DBG_MEMORY_REMOVE(entry) __dbg_memory_remove((entry)) - -#if OSL_DEBUG_LEVEL > 1 -#define DBG_MEMORY_VERIFY(entry) __dbg_memory_verify((entry), 1) -#else /* OSL_DEBUG_LEVEL > 0 */ -#define DBG_MEMORY_VERIFY(entry) __dbg_memory_verify((entry), 0) -#endif /* OSL_DEBUG_LEVEL */ - -#define DBG_MEMORY_VERIFY_CHAIN(entry) __dbg_memory_verify_chain((entry)) -#define DBG_MEMORY_VERIFY_QUEUE(entry) __dbg_memory_verify_queue((entry)) - -#else /* PRODUCT */ - -#define DBG_MEMORY_DEQUEUE(n) -#define DBG_MEMORY_ENQUEUE(n) - -#define DBG_MEMORY_DEQFILL(entry, offset, length) -#define DBG_MEMORY_ENQFILL(entry, offset, length) - -#define DBG_MEMORY_INSERT(entry) -#define DBG_MEMORY_REMOVE(entry) - -#define DBG_MEMORY_VERIFY(entry) -#define DBG_MEMORY_VERIFY_CHAIN(entry) -#define DBG_MEMORY_VERIFY_QUEUE(entry) - -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -/*=========================================================================== - * - * rtl_memory (manager) internals. - * - *=========================================================================*/ -#define queue_cast(entry, offset) \ -((memory_type*)((char*)(entry) + (ptrdiff_t)(offset))) - -#define __rtl_memory_used(entry) ((entry)->m_length & 0x1) -#define __rtl_memory_last(entry) ((entry)->m_offset & 0x1) -#define __rtl_memory_offset(entry) \ - ((ptrdiff_t)((entry)->m_offset & ~0x1)) - -/* - * ___rtl_memory_init. - */ -void SAL_CALL ___rtl_memory_init (void) -{ -#if defined(RTL_MUTEX_INIT) - RTL_MUTEX_INIT (&(g_memory.m_mutex.m_lock)); -#endif /* RTL_MUTEX_INIT */ - - RTL_MUTEX_ACQUIRE(&(g_memory.m_mutex.m_lock)); - if (!(g_memory.m_align)) - { - sal_Size pagesize; - int i; - - queue_start (&(g_memory.m_alloc_head)); - queue_start (&(g_memory.m_spare_head)); - - for (i = 0; i < __N__; i++) - queue_start (&(g_memory.m_queue_head[i])); - for (i = 1; i <= __L__; i++) - g_memory.m_queue_head[i].m_length = i * __C__; - for (i = __L__ + 1; i < __N__; i++) - g_memory.m_queue_head[i].m_length = - 2 * g_memory.m_queue_head[i - 1].m_length; - - pagesize = __rtl_memory_vmpagesize(); - g_memory.m_align = RTL_MEMORY_ALIGN(__M__, pagesize); - } - RTL_MUTEX_RELEASE(&(g_memory.m_mutex.m_lock)); -} - -/* - * ___rtl_memory_fini. - */ -void SAL_CALL ___rtl_memory_fini (void) -{ -#if OSL_DEBUG_LEVEL > 1 - - memory_stat total; - - __dbg_memory_usage (&total); - if (total.m_delta_n > 0) - { - OSL_TRACE("___rtl_memory_fini(): " - "Leak: %10d (Alloc: %10d, Free: %10d)", - total.m_delta_n, - (sal_uInt32)(total.m_deqsize & 0xffffffff), - (sal_uInt32)(total.m_enqsize & 0xffffffff)); - } - -#endif /* OSL_DEBUG_LEVEL */ -} - -/* - * __rtl_memory_merge. - */ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static void __rtl_memory_merge (memory_type * prev, memory_type * next) -{ - /* adjust length */ - prev->m_length += next->m_length; - if (!__rtl_memory_last(next)) - { - /* not last, adjust offset */ - register memory_type * succ = queue_cast(prev, prev->m_length); - DBG_MEMORY_VERIFY_CHAIN (succ); - succ->m_offset = prev->m_length | __rtl_memory_last(succ); - } - - /* propagate 'last' bit */ - prev->m_offset |= __rtl_memory_last(next); -} -#else /* PRODUCT */ -#define __rtl_memory_merge(prev, next) \ -{ \ - (prev)->m_length += (next)->m_length; \ - if (!__rtl_memory_last((next))) \ - { \ - register memory_type * succ = queue_cast((prev), (prev)->m_length); \ - succ->m_offset = (prev)->m_length | __rtl_memory_last(succ); \ - } \ - (prev)->m_offset |= __rtl_memory_last((next)); \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -/* - * __rtl_memory_split. - */ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static void __rtl_memory_split (memory_type * prev, memory_type * next) -{ - /* adjust length */ - prev->m_length -= next->m_length; - if (!__rtl_memory_last(prev)) - { - /* not last, adjust offset */ - register memory_type * succ = queue_cast(next, next->m_length); - DBG_MEMORY_VERIFY_CHAIN (succ); - succ->m_offset = next->m_length | __rtl_memory_last(succ); - } - - /* propagate 'last' bit */ - next->m_offset |= __rtl_memory_last(prev); - prev->m_offset &= ~0x1; -} -#else /* PRODUCT */ -#define __rtl_memory_split(prev, next) \ -{ \ - (prev)->m_length -= (next)->m_length; \ - if (!__rtl_memory_last((prev))) \ - { \ - register memory_type * succ = queue_cast((next), (next)->m_length); \ - succ->m_offset = (next)->m_length | __rtl_memory_last(succ); \ - } \ -\ - (next)->m_offset |= __rtl_memory_last((prev)); \ - (prev)->m_offset &= ~0x1; \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -/* - * __rtl_memory_insert. - */ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static void __rtl_memory_insert (memory_type * memory, sal_Size n) -{ - /* obtain queue head */ - register memory_type *head; - - head = &(g_memory.m_queue_head[queue(n)]); - DBG_MEMORY_VERIFY_CHAIN (head); - - /* insert at queue tail (first-in first-out) */ - queue_insert_tail (head, memory); -} -#else /* PRODUCT */ -#define __rtl_memory_insert(memory, n) \ -{ \ - register sal_Size h; \ -\ - queue(h, (n)); \ - queue_insert_tail (&(g_memory.m_queue_head[h]), (memory)); \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -/* - * __rtl_memory_resize. - */ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static void __rtl_memory_resize (memory_type * memory, sal_Size n) -{ - register sal_Size k = (memory->m_length - n); - - OSL_ENSURE(!(memory->m_length & 0x1), - "__rtl_memory_resize(): " - "internal logic error."); - - if ((k >= sizeof(memory_type)) && (n <= __T__)) - { - /* split */ - register memory_type * remain = queue_cast(memory, n); - - remain->m_length = k; remain->m_offset = n; - __rtl_memory_split (memory, remain); - - /* check postcond */ - if (!__rtl_memory_last(remain)) - { - /* not last, verify used next entry */ - register memory_type *next; - - next = queue_cast(remain, remain->m_length); - DBG_MEMORY_VERIFY_CHAIN (next); - - OSL_POSTCOND(__rtl_memory_used(next), - "__rtl_memory_resize(): " - "internal logic error."); - } - - /* enqueue */ - __rtl_memory_insert (remain, k); - DBG_MEMORY_VERIFY_QUEUE (remain); - } - - DBG_MEMORY_DEQUEUE(memory->m_length); -} -#else /* PRODUCT */ -#define __rtl_memory_resize(memory, n) \ -{ \ - register sal_Size kn = ((memory)->m_length - (n)); \ - if ((kn >= sizeof(memory_type)) && (n <= __T__)) \ - { \ - register memory_type * remain = queue_cast((memory), (n)); \ -\ - remain->m_length = kn; remain->m_offset = (n); \ - __rtl_memory_split ((memory), remain); \ -\ - __rtl_memory_insert (remain, kn); \ - } \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -/* - * __rtl_memory_dequeue. - */ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static void __rtl_memory_dequeue (memory_type **ppMemory, sal_Size n) -{ - register memory_type *head, *entry; - register sal_Size k, m = n; - - OSL_PRECOND(!*ppMemory, "__rtl_memory_dequeue(): internal logic error."); - for (k = queue(m); k < __N__; k++) - { - /* first fit (equals best fit w/ ascending insert) */ - head = &(g_memory.m_queue_head[k]); - for (entry = head->m_flink; entry != head; entry = entry->m_flink) - { - /* queue not empty */ - DBG_MEMORY_VERIFY_CHAIN (entry); - if (entry->m_length >= m) - { - /* remove entry */ - DBG_MEMORY_VERIFY_QUEUE (entry); - queue_remove (entry); - - /* assign result */ - *ppMemory = entry; - goto dequeue_leave; - } - } - } - - head = &(g_memory.m_spare_head); - for (entry = head->m_flink; entry != head; entry = entry->m_flink) - { - /* queue not empty */ - DBG_MEMORY_VERIFY_CHAIN (entry); - if (entry->m_length >= m) - { - /* remove entry */ - DBG_MEMORY_VERIFY_QUEUE (entry); - queue_remove (entry); - - /* assign result */ - *ppMemory = entry; - goto dequeue_leave; - } - } - -#if OSL_DEBUG_LEVEL > 0 - /* adjust for DBG_MEMORY_INSERT() overhead */ - m += sizeof(memory_type); -#endif /* OSL_DEBUG_LEVEL */ - - k = RTL_MEMORY_ALIGN((m > __M__) ? m : __M__, g_memory.m_align); - if (!((entry = RTL_MEMORY_ALLOC(k)) == 0)) - { - entry->m_length = k; - entry->m_offset = 0x1; /* set 'last' bit */ - - *ppMemory = entry; - DBG_MEMORY_INSERT(ppMemory); - } - -dequeue_leave: - OSL_POSTCOND(*ppMemory, "__rtl_memory_dequeue(): out of memory."); - if ((entry = *ppMemory) != 0) - { - /* adjust length */ - __rtl_memory_resize (entry, n); - - /* fill w/ 'uninitialized' pattern */ - DBG_MEMORY_DEQFILL (entry, __C__, entry->m_length - __C__); - } -#if OSL_DEBUG_LEVEL > 1 - if (!entry) - { - memory_stat total; - __dbg_memory_usage (&total); - } -#endif /* OSL_DEBUG_LEVEL */ -} -#else /* PRODUCT */ -#define __rtl_memory_dequeue(ppMemory, n, label) \ -{ \ - register memory_type *head, *entry; \ - register sal_Size h, m = (n); \ -\ - queue (h, m); \ - for (; h < __N__; h++) \ - { \ - head = &(g_memory.m_queue_head[h]); \ - for (entry = head->m_flink; entry != head; entry = entry->m_flink) \ - { \ - if (entry->m_length >= m) \ - { \ - queue_remove (entry); \ - goto label; \ - } \ - } \ - } \ -\ - head = &(g_memory.m_spare_head); \ - for (entry = head->m_flink; entry != head; entry = entry->m_flink) \ - { \ - if (entry->m_length >= m) \ - { \ - queue_remove (entry); \ - goto label; \ - } \ - } \ -\ - h = RTL_MEMORY_ALIGN((m > __M__) ? m : __M__, g_memory.m_align); \ - if (!((entry = RTL_MEMORY_ALLOC(h)) == 0)) \ - { \ - entry->m_length = h; \ - entry->m_offset = 0x1; \ - } \ -\ -label: \ - if (entry) \ - { \ - __rtl_memory_resize (entry, (n)); \ - *(ppMemory) = entry; \ - } \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -#define RTL_MEMORY_DEQUEUE(m, n, l) __rtl_memory_dequeue((m), (n)) -#else /* PRODUCT */ -#define RTL_MEMORY_DEQUEUE(m, n, l) __rtl_memory_dequeue(m, n, l) -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -/* - * __rtl_memory_enqueue. - */ -#if defined(PROFILE) || (OSL_DEBUG_LEVEL > 0) -static void __rtl_memory_enqueue (memory_type **ppMemory) -{ - register memory_type *head = *ppMemory; - - OSL_ENSURE(!__rtl_memory_used(head), - "__rtl_memory_enqueue(): " - "internal logic error."); - DBG_MEMORY_ENQUEUE (head->m_length); - - /* fill w/ 'deinitialized' pattern */ - DBG_MEMORY_ENQFILL (head, __C__, head->m_length - __C__); - - /* try merge w/ next entry */ - if (!__rtl_memory_last(head)) - { - /* not last, check next in chain */ - register memory_type * next; - - next = queue_cast(head, head->m_length); - DBG_MEMORY_VERIFY_CHAIN (next); - - if (!__rtl_memory_used(next)) - { - /* next not used */ - DBG_MEMORY_VERIFY_QUEUE (next); - queue_remove (next); - - /* merge w/ next */ - __rtl_memory_merge (head, next); - DBG_MEMORY_ENQFILL (next, 0, sizeof(memory_type)); - } - } - - /* try merge w/ prev entry */ - if (__rtl_memory_offset(head) > 0) - { - /* not first, check prev in chain */ - register memory_type * prev; - - prev = queue_cast(head, -(__rtl_memory_offset(head))); - DBG_MEMORY_VERIFY_CHAIN (prev); - - if (!__rtl_memory_used(prev)) - { - /* prev not used */ - DBG_MEMORY_VERIFY_QUEUE (prev); - queue_remove (prev); - - /* merge w/ prev */ - __rtl_memory_merge (prev, head); - DBG_MEMORY_ENQFILL (head, 0, sizeof(memory_type)); - head = prev; - } - } - - if (!(head->m_offset == 0x1)) - { - /* page still used, enqueue */ - __rtl_memory_insert (head, head->m_length); - head = 0; - } - else if (head->m_length <= g_memory.m_align) - { - /* small page unused, check spare page */ - register memory_type * spare; - - spare = &(g_memory.m_spare_head); - if (spare->m_flink == spare) - { - /* keep as spare page */ - queue_insert_tail (spare, head); - head = 0; - } - } - if ((*ppMemory = head) != 0) - { - /* page unused, remove */ - DBG_MEMORY_REMOVE(ppMemory); - } -} -#else /* PRODUCT */ -#define __rtl_memory_enqueue(ppMemory) \ -{ \ - register memory_type *head = *(ppMemory); \ -\ - if (!__rtl_memory_last(head)) \ - { \ - register memory_type * next; \ - next = queue_cast(head, head->m_length); \ - if (!__rtl_memory_used(next)) \ - { \ - queue_remove (next); \ - __rtl_memory_merge (head, next); \ - } \ - } \ -\ - if (__rtl_memory_offset(head) > 0) \ - { \ - register memory_type * prev; \ - prev = queue_cast(head, -(__rtl_memory_offset(head))); \ - if (!__rtl_memory_used(prev)) \ - { \ - queue_remove (prev); \ - __rtl_memory_merge (prev, head); \ - head = prev; \ - } \ - } \ -\ - if (!(head->m_offset == 0x1)) \ - { \ - register memory_type * used = head; \ - __rtl_memory_insert (used, used->m_length); \ - head = 0; \ - } \ - else if (head->m_length <= g_memory.m_align) \ - { \ - register memory_type * spare; \ - spare = &(g_memory.m_spare_head); \ - if (spare->m_flink == spare) \ - { \ - queue_insert_tail (spare, head); \ - head = 0; \ - } \ - } \ -\ - *(ppMemory) = head; \ -} -#endif /* OSL_DEBUG_LEVEL || PRODUCT */ - -#define RTL_MEMORY_ENQUEUE(m) __rtl_memory_enqueue((m)) - -#endif /* FORCE_SYSALLOC */ - -/*=========================================================================== - * - * rtl_memory (manager) implementation. - * - *=========================================================================*/ -/* - * rtl_reallocateMemory. - */ -#ifndef FORCE_SYSALLOC -void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C() -{ - memory_type * memory; - if (!(!p || !n)) - { - /* reallocate */ - register sal_Size datlen; - - memory = queue_cast(p, -(__C__)); p = 0; - n = RTL_MEMORY_ALIGN(n, __Q__) + __C__; - - RTL_MEMORY_ENTER(); - DBG_MEMORY_VERIFY(memory); - - /* clear 'used' bit */ - DBG_MEMORY_ENQUEUE (memory->m_length); - memory->m_length &= ~0x1; - - /* amount of data to be moved or copied */ - datlen = ((memory->m_length < n) ? memory->m_length : n); - - /* try merge w/ next entry */ - if (!__rtl_memory_last(memory)) - { - /* not last, check next in chain */ - register memory_type * next; - - next = queue_cast(memory, memory->m_length); - DBG_MEMORY_VERIFY_CHAIN(next); - - if (!__rtl_memory_used(next)) - { - /* next not used */ - DBG_MEMORY_VERIFY_QUEUE(next); - queue_remove (next); - - /* merge w/ next */ - __rtl_memory_merge (memory, next); - } - } - - /* try merge w/ prev entry */ - if (__rtl_memory_offset(memory) > 0) - { - /* not first, check prev in chain */ - register memory_type * prev; - - prev = queue_cast(memory, -(__rtl_memory_offset(memory))); - DBG_MEMORY_VERIFY_CHAIN (prev); - - if (!__rtl_memory_used(prev)) - { - /* prev not used, try merge, move */ - if ((memory->m_length + prev->m_length) >= n) - { - /* prev does fit */ - DBG_MEMORY_VERIFY_QUEUE (prev); - queue_remove (prev); - - /* merge w/ prev */ - __rtl_memory_merge (prev, memory); - - /* move to prev */ - memmove ( - queue_cast(prev, __C__), - queue_cast(memory, __C__), - datlen - __C__); - memory = prev; - } - } - } - - if (memory->m_length >= n) - { - /* adjust, set 'used' bit */ - __rtl_memory_resize (memory, n); - memory->m_length |= 0x1; - - /* assign result */ - p = queue_cast(memory, __C__); - } - else - { - /* allocate */ - memory_type * result = 0; - - /* restore 'used' bit */ - DBG_MEMORY_DEQUEUE (memory->m_length); - memory->m_length |= 0x80000000; - - RTL_MEMORY_DEQUEUE (&result, n, realloc_label_1); - if (result) - { - /* set 'used' bit */ - result->m_length |= 0x1; - - /* copy */ - memcpy ( - queue_cast(result, __C__), - queue_cast(memory, __C__), - datlen - __C__); - - /* clear 'used' bit, enqueue */ - memory->m_length &= 0x7fffffff; - RTL_MEMORY_ENQUEUE (&memory); - if (memory) - { - /* free memory page */ - RTL_MEMORY_FREE(memory, memory->m_length); - } - - /* assign result */ - p = queue_cast(result, __C__); - } - } - RTL_MEMORY_LEAVE(); - } - else if (!p) - { - /* allocate */ - memory = 0; - n = RTL_MEMORY_ALIGN(n, __Q__) + __C__; - - RTL_MEMORY_ENTER(); - RTL_MEMORY_DEQUEUE (&memory, n, realloc_label_2); - if (memory) - { - /* set 'used' bit */ - memory->m_length |= 0x1; - - /* assign result */ - p = queue_cast(memory, __C__); - } - RTL_MEMORY_LEAVE(); - } - else if (!n) - { - /* free */ - memory = queue_cast(p, -(__C__)); p = 0; - - RTL_MEMORY_ENTER(); - DBG_MEMORY_VERIFY(memory); - - /* clear 'used' bit, enqueue */ - memory->m_length &= ~0x1; - - RTL_MEMORY_ENQUEUE (&memory); - if (memory) - { - /* free memory page */ - RTL_MEMORY_FREE(memory, memory->m_length); - } - RTL_MEMORY_LEAVE(); - } - return (p); -} -#else /* FORCE_SYSALLOC */ -void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C() -{ - return realloc(p, (sal_Size)(n)); -} -#endif /* FORCE_SYSALLOC */ - -/* - * rtl_allocateMemory. - */ -#ifndef FORCE_SYSALLOC -void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C() -{ - void * p = 0; - if (n > 0) - { - memory_type * memory = 0; - n = RTL_MEMORY_ALIGN(n, __Q__) + __C__; - - RTL_MEMORY_ENTER(); - RTL_MEMORY_DEQUEUE (&memory, n, alloc_label); - if (memory) - { - /* set 'used' bit */ - memory->m_length |= 0x1; - - /* assign result */ - p = queue_cast(memory, __C__); - } - RTL_MEMORY_LEAVE(); - } - return (p); -} -#else /* FORCE_SYSALLOC */ -void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C() -{ - return malloc((sal_Size)(n)); -} -#endif /* FORCE_SYSALLOC */ - -/* - * rtl_freeMemory. - */ -#ifndef FORCE_SYSALLOC -void SAL_CALL rtl_freeMemory (void * p) SAL_THROW_EXTERN_C() -{ - if (p) - { - memory_type * memory = queue_cast(p, -(__C__)); - - RTL_MEMORY_ENTER(); - DBG_MEMORY_VERIFY(memory); - - /* clear 'used' bit, enqueue */ - memory->m_length &= ~0x1; - - RTL_MEMORY_ENQUEUE (&memory); - if (memory) - { - /* free memory page */ - RTL_MEMORY_FREE(memory, memory->m_length); - } - RTL_MEMORY_LEAVE(); - } -} -#else /* FORCE_SYSALLOC */ -void SAL_CALL rtl_freeMemory (void * p) SAL_THROW_EXTERN_C() -{ - free(p); -} -#endif /* FORCE_SYSALLOC */ - -/* - * rtl_allocateZeroMemory. - */ -#ifndef FORCE_SYSALLOC -void* SAL_CALL rtl_allocateZeroMemory (sal_Size n) SAL_THROW_EXTERN_C() -{ - void * p = 0; - if (n > 0) - { - memory_type * memory = 0; - n = RTL_MEMORY_ALIGN(n, __Q__) + __C__; - - RTL_MEMORY_ENTER(); - RTL_MEMORY_DEQUEUE (&memory, n, alloc_label); /* NYI: demand zero */ - if (memory) - { - /* zero, set 'used' bit */ - memset ((char*)memory + __C__, 0, memory->m_length - __C__); - memory->m_length |= 0x1; - - /* assign result */ - p = queue_cast(memory, __C__); - } - RTL_MEMORY_LEAVE(); - } - return (p); -} -#else /* FORCE_SYSALLOC */ -void* SAL_CALL rtl_allocateZeroMemory (sal_Size n) SAL_THROW_EXTERN_C() -{ - return calloc((sal_Size)(n), 1); -} -#endif /* FORCE_SYSALLOC */ - -/* - * rtl_freeZeroMemory. - */ -#ifndef FORCE_SYSALLOC -void SAL_CALL rtl_freeZeroMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C() -{ - (void) n; /* unused */ - if (p) - { - memory_type * memory = queue_cast(p, -(__C__)); - - RTL_MEMORY_ENTER(); - DBG_MEMORY_VERIFY(memory); - - /* clear 'used' bit, zero, enqueue */ - memory->m_length &= ~0x1; - memset ((char*)memory + __C__, 0, memory->m_length - __C__); - - RTL_MEMORY_ENQUEUE (&memory); /* NYI: demand zero */ - if (memory) - { - /* free memory page */ - RTL_MEMORY_FREE(memory, memory->m_length); - } - RTL_MEMORY_LEAVE(); - } -} -#else /* FORCE_SYSALLOC */ -void SAL_CALL rtl_freeZeroMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C() -{ - if (p) - { - memset(p, 0, n); - free(p); - } -} -#endif /* FORCE_SYSALLOC */ - -/*=========================================================================== - * - * The End. - * - *=========================================================================*/ diff --git a/sal/rtl/source/alloc_arena.c b/sal/rtl/source/alloc_arena.c index 9291e9eca..ebb5dac1d 100644 --- a/sal/rtl/source/alloc_arena.c +++ b/sal/rtl/source/alloc_arena.c @@ -28,22 +28,13 @@ #define _BSD_SOURCE /* sys/mman.h: MAP_ANON */ #include "alloc_arena.h" -#ifndef INCLUDED_RTL_ARENA_IMPL_H #include "alloc_impl.h" -#endif #include "internal/once.h" #include "sal/macros.h" #include "osl/diagnose.h" -#ifndef INCLUDED_STRING_H #include <string.h> -#endif - -#ifndef INCLUDED_STDIO_H #include <stdio.h> -#endif - -#include "sal/types.h" #ifdef OS2 #undef OSL_TRACE @@ -967,6 +958,7 @@ try_alloc: if (result != 0) { rtl_arena_type * arena = result; + VALGRIND_CREATE_MEMPOOL(arena, 0, 0); rtl_arena_constructor (arena); if (!source_arena) @@ -989,6 +981,7 @@ try_alloc: { rtl_arena_deactivate (arena); rtl_arena_destructor (arena); + VALGRIND_DESTROY_MEMPOOL(arena); rtl_arena_free (gp_arena_arena, arena, size); } } @@ -1014,6 +1007,7 @@ SAL_CALL rtl_arena_destroy ( { rtl_arena_deactivate (arena); rtl_arena_destructor (arena); + VALGRIND_DESTROY_MEMPOOL(arena); rtl_arena_free (gp_arena_arena, arena, sizeof(rtl_arena_type)); } } @@ -1069,6 +1063,10 @@ SAL_CALL rtl_arena_alloc ( rtl_arena_hash_insert (arena, segment); + /* DEBUG ONLY: mark allocated, undefined */ + OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x77777777, segment->m_size)); + VALGRIND_MEMPOOL_ALLOC(arena, segment->m_addr, segment->m_size); + (*pSize) = segment->m_size; addr = (void*)(segment->m_addr); } @@ -1112,6 +1110,11 @@ SAL_CALL rtl_arena_free ( { rtl_arena_segment_type *next, *prev; + /* DEBUG ONLY: mark unallocated, undefined */ + VALGRIND_MEMPOOL_FREE(arena, segment->m_addr); + /* OSL_DEBUG_ONLY() */ VALGRIND_MAKE_MEM_UNDEFINED(segment->m_addr, segment->m_size); + OSL_DEBUG_ONLY(memset((void*)(segment->m_addr), 0x33333333, segment->m_size)); + /* coalesce w/ adjacent free segment(s) */ rtl_arena_segment_coalesce (arena, segment); @@ -1303,6 +1306,7 @@ rtl_arena_once_init (void) static rtl_arena_type g_machdep_arena; OSL_ASSERT(gp_machdep_arena == 0); + VALGRIND_CREATE_MEMPOOL(&g_machdep_arena, 0, 0); rtl_arena_constructor (&g_machdep_arena); gp_machdep_arena = rtl_arena_activate ( @@ -1319,6 +1323,7 @@ rtl_arena_once_init (void) static rtl_arena_type g_default_arena; OSL_ASSERT(gp_default_arena == 0); + VALGRIND_CREATE_MEMPOOL(&g_default_arena, 0, 0); rtl_arena_constructor (&g_default_arena); gp_default_arena = rtl_arena_activate ( @@ -1337,6 +1342,7 @@ rtl_arena_once_init (void) static rtl_arena_type g_arena_arena; OSL_ASSERT(gp_arena_arena == 0); + VALGRIND_CREATE_MEMPOOL(&g_arena_arena, 0, 0); rtl_arena_constructor (&g_arena_arena); gp_arena_arena = rtl_arena_activate ( @@ -1362,7 +1368,18 @@ rtl_arena_init (void) /* ================================================================= */ -#if defined(__GNUC__) +/* + Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 + + Mac OS X does not seem to support "__cxa__atexit", thus leading + to the situation that "__attribute__((destructor))__" functions + (in particular "rtl_{memory|cache|arena}_fini") become called + _before_ global C++ object d'tors. + + Delegated the call to "rtl_arena_fini()" into a dummy C++ object, + see alloc_fini.cxx . +*/ +#if defined(__GNUC__) && !defined(MACOSX) static void rtl_arena_fini (void) __attribute__((destructor)); #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) #pragma fini(rtl_arena_fini) diff --git a/sal/rtl/source/alloc_cache.c b/sal/rtl/source/alloc_cache.c index 51de21f4e..47d08ed1c 100644 --- a/sal/rtl/source/alloc_cache.c +++ b/sal/rtl/source/alloc_cache.c @@ -507,6 +507,10 @@ rtl_cache_slab_alloc ( addr = (void*)rtl_cache_hash_insert (cache, bufctl); else addr = bufctl; + + /* DEBUG ONLY: mark allocated, undefined */ + OSL_DEBUG_ONLY(memset(addr, 0x77777777, cache->m_type_size)); + VALGRIND_MEMPOOL_ALLOC(cache, addr, cache->m_type_size); } RTL_MEMORY_LOCK_RELEASE(&(cache->m_slab_lock)); @@ -529,6 +533,11 @@ rtl_cache_slab_free ( RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_slab_lock)); + /* DEBUG ONLY: mark unallocated, undefined */ + VALGRIND_MEMPOOL_FREE(cache, addr); + /* OSL_DEBUG_ONLY() */ VALGRIND_MAKE_MEM_UNDEFINED(addr, cache->m_type_size); + OSL_DEBUG_ONLY(memset(addr, 0x33333333, cache->m_type_size)); + /* determine slab from addr */ if (cache->m_features & RTL_CACHE_FEATURE_HASH) { @@ -635,8 +644,13 @@ rtl_cache_magazine_clear ( void * obj = mag->m_objects[mag->m_mag_used - 1]; mag->m_objects[mag->m_mag_used - 1] = 0; + /* DEBUG ONLY: mark cached object allocated, undefined */ + VALGRIND_MEMPOOL_ALLOC(cache, obj, cache->m_type_size); if (cache->m_destructor != 0) { + /* DEBUG ONLY: keep constructed object defined */ + VALGRIND_MAKE_MEM_DEFINED(obj, cache->m_type_size); + /* destruct object */ (cache->m_destructor)(obj, cache->m_userarg); } @@ -965,11 +979,16 @@ rtl_cache_deactivate ( rtl_cache_type * cache ) { + int active = 1; + /* remove from cache list */ RTL_MEMORY_LOCK_ACQUIRE(&(g_cache_list.m_lock)); + active = QUEUE_STARTED_NAMED(cache, cache_) == 0; QUEUE_REMOVE_NAMED(cache, cache_); RTL_MEMORY_LOCK_RELEASE(&(g_cache_list.m_lock)); + OSL_PRECOND(active, "rtl_cache_deactivate(): orphaned cache."); + /* cleanup magazine layer */ if (cache->m_magazine_cache != 0) { @@ -1121,6 +1140,7 @@ try_alloc: if (result != 0) { rtl_cache_type * cache = result; + VALGRIND_CREATE_MEMPOOL(cache, 0, 0); (void) rtl_cache_constructor (cache); if (!source) @@ -1148,6 +1168,7 @@ try_alloc: /* activation failed */ rtl_cache_deactivate (cache); rtl_cache_destructor (cache); + VALGRIND_DESTROY_MEMPOOL(cache); rtl_arena_free (gp_cache_arena, cache, size); } } @@ -1172,6 +1193,7 @@ void SAL_CALL rtl_cache_destroy ( { rtl_cache_deactivate (cache); rtl_cache_destructor (cache); + VALGRIND_DESTROY_MEMPOOL(cache); rtl_arena_free (gp_cache_arena, cache, sizeof(rtl_cache_type)); } } @@ -1201,6 +1223,14 @@ SAL_CALL rtl_cache_alloc ( if ((curr != 0) && (curr->m_mag_used > 0)) { obj = curr->m_objects[--curr->m_mag_used]; +#if defined(HAVE_VALGRIND_MEMCHECK_H) + VALGRIND_MEMPOOL_ALLOC(cache, obj, cache->m_type_size); + if (cache->m_constructor != 0) + { + /* keep constructed object defined */ + VALGRIND_MAKE_MEM_DEFINED(obj, cache->m_type_size); + } +#endif /* HAVE_VALGRIND_MEMCHECK_H */ cache->m_cpu_stats.m_alloc += 1; RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); @@ -1244,7 +1274,6 @@ SAL_CALL rtl_cache_alloc ( rtl_cache_slab_free (cache, obj), obj = 0; } } - return (obj); } @@ -1269,6 +1298,9 @@ SAL_CALL rtl_cache_free ( if ((curr != 0) && (curr->m_mag_used < curr->m_mag_size)) { curr->m_objects[curr->m_mag_used++] = obj; +#if defined(HAVE_VALGRIND_MEMCHECK_H) + VALGRIND_MEMPOOL_FREE(cache, obj); +#endif /* HAVE_VALGRIND_MEMCHECK_H */ cache->m_cpu_stats.m_free += 1; RTL_MEMORY_LOCK_RELEASE(&(cache->m_depot_lock)); @@ -1582,6 +1614,7 @@ rtl_cache_once_init (void) static rtl_cache_type g_cache_magazine_cache; OSL_ASSERT(gp_cache_magazine_cache == 0); + VALGRIND_CREATE_MEMPOOL(&g_cache_magazine_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_magazine_cache); gp_cache_magazine_cache = rtl_cache_activate ( @@ -1606,6 +1639,7 @@ rtl_cache_once_init (void) static rtl_cache_type g_cache_slab_cache; OSL_ASSERT(gp_cache_slab_cache == 0); + VALGRIND_CREATE_MEMPOOL(&g_cache_slab_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_slab_cache); gp_cache_slab_cache = rtl_cache_activate ( @@ -1627,6 +1661,7 @@ rtl_cache_once_init (void) static rtl_cache_type g_cache_bufctl_cache; OSL_ASSERT(gp_cache_bufctl_cache == 0); + VALGRIND_CREATE_MEMPOOL(&g_cache_bufctl_cache, 0, 0); (void) rtl_cache_constructor (&g_cache_bufctl_cache); gp_cache_bufctl_cache = rtl_cache_activate ( @@ -1657,7 +1692,18 @@ rtl_cache_init (void) /* ================================================================= */ -#if defined(__GNUC__) +/* + Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 + + Mac OS X does not seem to support "__cxa__atexit", thus leading + to the situation that "__attribute__((destructor))__" functions + (in particular "rtl_{memory|cache|arena}_fini") become called + _before_ global C++ object d'tors. + + Delegated the call to "rtl_cache_fini()" into a dummy C++ object, + see alloc_fini.cxx . +*/ +#if defined(__GNUC__) && !defined(MACOSX) static void rtl_cache_fini (void) __attribute__((destructor)); #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) #pragma fini(rtl_cache_fini) @@ -1678,18 +1724,21 @@ rtl_cache_fini (void) cache = gp_cache_bufctl_cache, gp_cache_bufctl_cache = 0; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); + VALGRIND_DESTROY_MEMPOOL(cache); } if (gp_cache_slab_cache != 0) { cache = gp_cache_slab_cache, gp_cache_slab_cache = 0; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); + VALGRIND_DESTROY_MEMPOOL(cache); } if (gp_cache_magazine_cache != 0) { cache = gp_cache_magazine_cache, gp_cache_magazine_cache = 0; rtl_cache_deactivate (cache); rtl_cache_destructor (cache); + VALGRIND_DESTROY_MEMPOOL(cache); } if (gp_cache_arena != 0) { diff --git a/sal/rtl/source/memory_fini.cxx b/sal/rtl/source/alloc_fini.cxx index e6d2e4c10..123073b5c 100755 --- a/sal/rtl/source/memory_fini.cxx +++ b/sal/rtl/source/alloc_fini.cxx @@ -25,30 +25,31 @@ * ************************************************************************/ - /* Issue http://udk.openoffice.org/issues/show_bug.cgi?id=92388 Mac OS X does not seem to support "__cxa__atexit", thus leading to the situation that "__attribute__((destructor))__" functions - (in particular "rtl_memory_fini") become called _before_ global - C++ object d'tors. + (in particular "rtl_{memory|cache|arena}_fini") become called + _before_ global C++ object d'tors. Using a C++ dummy object instead. */ -#include <stdio.h> - extern "C" void rtl_memory_fini (void); +extern "C" void rtl_cache_fini (void); +extern "C" void rtl_arena_fini (void); - -struct RTL_Memory_Fini { - ~RTL_Memory_Fini() ; +struct RTL_Alloc_Fini +{ + ~RTL_Alloc_Fini() ; }; -RTL_Memory_Fini::~RTL_Memory_Fini() { +RTL_Alloc_Fini::~RTL_Alloc_Fini() +{ rtl_memory_fini(); + rtl_cache_fini(); + rtl_arena_fini(); } - -static RTL_Memory_Fini rtl_Memory_Fini; +static RTL_Alloc_Fini g_RTL_Alloc_Fini; diff --git a/sal/rtl/source/alloc_global.c b/sal/rtl/source/alloc_global.c index e3ba39223..de550a7e1 100644 --- a/sal/rtl/source/alloc_global.c +++ b/sal/rtl/source/alloc_global.c @@ -26,6 +26,7 @@ ************************************************************************/ #include "rtl/alloc.h" +#include "alloc_impl.h" #ifndef INCLUDED_STRING_H #include <string.h> @@ -44,7 +45,6 @@ #include <stdio.h> #define INCLUDED_STDIO_H #endif -#include "alloc_impl.h" #include "internal/once.h" #include "sal/macros.h" #include "osl/diagnose.h" @@ -151,11 +151,11 @@ rtl_memory_init (void) Mac OS X does not seem to support "__cxa__atexit", thus leading to the situation that "__attribute__((destructor))__" functions - (in particular "rtl_memory_fini") become called _before_ global - C++ object d'tors. + (in particular "rtl_{memory|cache|arena}_fini") become called + _before_ global C++ object d'tors. - Delegated the call to "rtl_memory_fini" into a dummy C++ object, - see memory_fini.cxx . + Delegated the call to "rtl_memory_fini()" into a dummy C++ object, + see alloc_fini.cxx . */ #if defined(__GNUC__) && !defined(MACOSX) static void rtl_memory_fini (void) __attribute__((destructor)); diff --git a/sal/rtl/source/alloc_impl.h b/sal/rtl/source/alloc_impl.h index 9966d2f53..8fa379c88 100644 --- a/sal/rtl/source/alloc_impl.h +++ b/sal/rtl/source/alloc_impl.h @@ -240,6 +240,30 @@ typedef CRITICAL_SECTION rtl_memory_lock_type; #define RTL_CACHE_FLAG_QUANTUMCACHE (2 << 13) /* used as arena quantum cache */ +/** Valgrind support macros. + */ +#if !defined(HAVE_MEMCHECK_H) || (OSL_DEBUG_LEVEL == 0) +#if !defined(NVALGRIND) +#define NVALGRIND 1 +#endif /* ! NVALGRIND */ +#endif /* ! HAVE_MEMCHECK_H || (OSL_DEBUG_LEVEL == 0) */ + +#if defined(NVALGRIND) +#define VALGRIND_MAKE_MEM_UNDEFINED(addr, size) +#define VALGRIND_MAKE_MEM_DEFINED(addr, size) +#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) +#define VALGRIND_FREELIKE_BLOCK(addr, rzB) +#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) +#define VALGRIND_DESTROY_MEMPOOL(pool) +#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) +#define VALGRIND_MEMPOOL_FREE(pool, addr) +#elif defined(HAVE_MEMCHECK_H) +#include <memcheck.h> +#if !defined(FORCE_SYSALLOC) +#define FORCE_SYSALLOC 1 +#endif /* !FORCE_SYSALLOC */ +#endif /* NVALGRIND || HAVE_MEMCHECK_H */ + #ifdef __cplusplus } #endif diff --git a/sal/rtl/source/makefile.mk b/sal/rtl/source/makefile.mk index 9968d8992..145aa50b8 100644 --- a/sal/rtl/source/makefile.mk +++ b/sal/rtl/source/makefile.mk @@ -46,6 +46,11 @@ TARGETTYPE=CUI .INCLUDE : settings.mk +.IF "$(VALGRIND_CFLAGS)" != "" +CFLAGS += $(VALGRIND_CFLAGS) +CDEFS += -DHAVE_MEMCHECK_H=1 +.ENDIF # VALGRIND_CFLAGS + .IF "$(ALLOC)" == "SYS_ALLOC" || "$(ALLOC)" == "TCMALLOC" || "$(ALLOC)" == "JEMALLOC" CDEFS+= -DFORCE_SYSALLOC .ENDIF @@ -96,7 +101,7 @@ SLOFILES= \ $(SLO)$/alloc_arena.obj .IF "$(OS)"=="MACOSX" -SLOFILES+=$(SLO)$/memory_fini.obj +SLOFILES+=$(SLO)$/alloc_fini.obj .ENDIF @@ -129,7 +134,7 @@ OBJFILES= \ $(OBJ)$/alloc_arena.obj .IF "$(OS)"=="MACOSX" -OBJFILES+=$(OBJ)$/memory_fini.obj +OBJFILES+=$(OBJ)$/alloc_fini.obj .ENDIF diff --git a/sal/util/sal.map b/sal/util/sal.map index 8b1c079ec..73ae44311 100755 --- a/sal/util/sal.map +++ b/sal/util/sal.map @@ -602,6 +602,7 @@ UDK_3.11 { # OOo 3.4 global: osl_setEnvironment; osl_clearEnvironment; + osl_setThreadName; } UDK_3.10; PRIVATE_1.0 { diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index dac197e6f..2ea9bb228 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -179,8 +179,6 @@ void IdlReflectionServiceImpl::dispose() MutexGuard aGuard( _aComponentMutex ); _aElements.clear(); - _xTDMgr.clear(); - _xMgr.clear(); #ifdef TEST_LIST_CLASSES OSL_ENSURE( g_aClassNames.size() == 0, "### idl classes still alive!" ); ClassNameList::const_iterator iPos( g_aClassNames.begin() ); diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx index e4f6e6855..3cf8f0899 100644 --- a/stoc/source/corereflection/lrucache.hxx +++ b/stoc/source/corereflection/lrucache.hxx @@ -177,9 +177,9 @@ template< class t_Key, class t_Val, class t_KeyHash, class t_KeyEqual > inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::setValue( const t_Key & rKey, const t_Val & rValue ) { + ::osl::MutexGuard aGuard( _aCacheMutex ); if (_nCachedElements > 0) { - ::osl::MutexGuard aGuard( _aCacheMutex ); const typename t_Key2Element::const_iterator iFind( _aKey2Element.find( rKey ) ); CacheEntry * pEntry; @@ -221,6 +221,7 @@ inline void LRU_Cache< t_Key, t_Val, t_KeyHash, t_KeyEqual >::clear() _pBlock[nPos].aKey = t_Key(); _pBlock[nPos].aVal = t_Val(); } + _nCachedElements = 0; #ifdef __CACHE_DIAGNOSE OSL_TRACE( "> cleared cache <\n" ); #endif diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 747d9dc0d..393f01d80 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -444,7 +444,6 @@ static OUString s_user = OUSTR("user"); static OUString s_permission = OUSTR("permission"); static OUString s_openBrace = OUSTR("{"); static OUString s_closingBrace = OUSTR("}"); -static OUString s_semi = OUSTR(";"); static OUString s_filePermission = OUSTR("com.sun.star.io.FilePermission"); static OUString s_socketPermission = OUSTR("com.sun.star.connection.SocketPermission"); diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index 2a65daf4f..08633c819 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -600,7 +600,8 @@ oslInterlockedCount SAL_CALL MappedLockBytes::release() void MappedLockBytes::allocate_Impl (void ** ppPage, sal_uInt16 * pnSize) { OSL_PRECOND((ppPage != 0) && (pnSize != 0), "contract violation"); - *ppPage = 0, *pnSize = m_nPageSize; + if ((ppPage != 0) && (pnSize != 0)) + *ppPage = 0, *pnSize = m_nPageSize; } void MappedLockBytes::deallocate_Impl (void * pPage) diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx index 24e36c0b4..2f7689f92 100644 --- a/store/source/lockbyte.hxx +++ b/store/source/lockbyte.hxx @@ -26,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_LOCKBYTE_HXX_ -#define _STORE_LOCKBYTE_HXX_ "$Revision: 1.1.2.1 $" +#define _STORE_LOCKBYTE_HXX_ #ifndef _SAL_TYPES_H_ #include "sal/types.h" diff --git a/store/source/object.hxx b/store/source/object.hxx index 6a494cfce..c5043dedc 100644 --- a/store/source/object.hxx +++ b/store/source/object.hxx @@ -26,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_OBJECT_HXX_ -#define _STORE_OBJECT_HXX_ "$Revision: 1.1.2.1 $" +#define _STORE_OBJECT_HXX_ #ifndef _SAL_TYPES_H_ #include "sal/types.h" diff --git a/store/source/storbase.cxx b/store/source/storbase.cxx index fcc7a0c06..6aecdf6e2 100644 --- a/store/source/storbase.cxx +++ b/store/source/storbase.cxx @@ -158,7 +158,8 @@ PageData::Allocator_Impl::~Allocator_Impl() void PageData::Allocator_Impl::allocate_Impl (void ** ppPage, sal_uInt16 * pnSize) { OSL_PRECOND((ppPage != 0) && (pnSize != 0), "contract violation"); - *ppPage = rtl_cache_alloc(m_page_cache), *pnSize = m_page_size; + if ((ppPage != 0) && (pnSize != 0)) + *ppPage = rtl_cache_alloc(m_page_cache), *pnSize = m_page_size; } void PageData::Allocator_Impl::deallocate_Impl (void * pPage) diff --git a/store/source/stordir.hxx b/store/source/stordir.hxx index 0a2c64d3e..0e0ed722f 100644 --- a/store/source/stordir.hxx +++ b/store/source/stordir.hxx @@ -26,7 +26,7 @@ ************************************************************************/ #ifndef _STORE_STORDIR_HXX_ -#define _STORE_STORDIR_HXX_ "$Revision: 1.1.2.2 $" +#define _STORE_STORDIR_HXX_ #ifndef _SAL_TYPES_H_ #include <sal/types.h> diff --git a/udkapi/com/sun/star/container/XStringKeyMap.idl b/udkapi/com/sun/star/container/XStringKeyMap.idl index a97e310d6..4ea66fd8a 100644 --- a/udkapi/com/sun/star/container/XStringKeyMap.idl +++ b/udkapi/com/sun/star/container/XStringKeyMap.idl @@ -56,7 +56,7 @@ module com { module sun { module star { module container { /** maps strings to anys. - @since OOo 2.3.0 + @since OOo 2.3 */ interface XStringKeyMap diff --git a/udkapi/com/sun/star/io/XAsyncOutputMonitor.idl b/udkapi/com/sun/star/io/XAsyncOutputMonitor.idl index ca064817c..ff21541dd 100644 --- a/udkapi/com/sun/star/io/XAsyncOutputMonitor.idl +++ b/udkapi/com/sun/star/io/XAsyncOutputMonitor.idl @@ -59,7 +59,7 @@ module com { module sun { module star { module io { should be called after the series of calls to <member scope="com::sun::star::io">XOutputStream::writeBytes</member>.</p> - @since OOo2.0.0 + @since OOo 2.0 */ interface XAsyncOutputMonitor { /** diff --git a/udkapi/com/sun/star/java/InvalidJavaSettingsException.idl b/udkapi/com/sun/star/java/InvalidJavaSettingsException.idl index 17859f243..ef4609bb2 100755 --- a/udkapi/com/sun/star/java/InvalidJavaSettingsException.idl +++ b/udkapi/com/sun/star/java/InvalidJavaSettingsException.idl @@ -41,7 +41,7 @@ module com { module sun { module star { module java { by distributors to determine what versions are supported. If this file is modified, then the current settings are regarded as invalid.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ exception InvalidJavaSettingsException: JavaInitializationException { diff --git a/udkapi/com/sun/star/java/JavaNotFoundException.idl b/udkapi/com/sun/star/java/JavaNotFoundException.idl index dfd34e275..520afcfde 100644 --- a/udkapi/com/sun/star/java/JavaNotFoundException.idl +++ b/udkapi/com/sun/star/java/JavaNotFoundException.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module java { /** indicates that no suitable JRE was found. - @since OOo 2.0.0 + @since OOo 2.0 */ exception JavaNotFoundException: JavaInitializationException { diff --git a/udkapi/com/sun/star/java/RestartRequiredException.idl b/udkapi/com/sun/star/java/RestartRequiredException.idl index 4f3e1f648..11a19977c 100755 --- a/udkapi/com/sun/star/java/RestartRequiredException.idl +++ b/udkapi/com/sun/star/java/RestartRequiredException.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module java { /** indicates that the office must be restarted before a JRE can be used. - @since OOo 2.0.0 + @since OOo 2.0 */ exception RestartRequiredException: JavaInitializationException { diff --git a/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl b/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl index 36f6a63fc..47525140a 100644 --- a/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl +++ b/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl @@ -41,7 +41,7 @@ interface XCompoundTypeDescription; <p>This type supersedes <type>XInterfaceAttributeTypeDescription</type>, which does not support extended attributes.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XInterfaceAttributeTypeDescription2: XInterfaceAttributeTypeDescription diff --git a/udkapi/com/sun/star/reflection/XInterfaceTypeDescription2.idl b/udkapi/com/sun/star/reflection/XInterfaceTypeDescription2.idl index 44356aafd..fcef27e27 100644 --- a/udkapi/com/sun/star/reflection/XInterfaceTypeDescription2.idl +++ b/udkapi/com/sun/star/reflection/XInterfaceTypeDescription2.idl @@ -39,7 +39,7 @@ interface XTypeDescription; <p>This type supersedes <type>XInterfaceTypeDescription</type>, which only supported single inheritance.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XInterfaceTypeDescription2: XInterfaceTypeDescription { /** Returns a sequence of all directly inherited (mandatory) base interface diff --git a/udkapi/com/sun/star/reflection/XParameter.idl b/udkapi/com/sun/star/reflection/XParameter.idl index 3298432c6..6b7476036 100644 --- a/udkapi/com/sun/star/reflection/XParameter.idl +++ b/udkapi/com/sun/star/reflection/XParameter.idl @@ -38,7 +38,7 @@ module com { module sun { module star { module reflection { <p>This type supersedes <type>XMethodParameter</type>, which only supports parameters of interface methods (which cannot have rest parameters).</p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XParameter: XMethodParameter { /** diff --git a/udkapi/com/sun/star/reflection/XPublished.idl b/udkapi/com/sun/star/reflection/XPublished.idl index 87c3078f0..76e26b6c3 100644 --- a/udkapi/com/sun/star/reflection/XPublished.idl +++ b/udkapi/com/sun/star/reflection/XPublished.idl @@ -96,7 +96,7 @@ module com { module sun { module star { module reflection { supported.</li> </ul> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XPublished { /** diff --git a/udkapi/com/sun/star/reflection/XServiceConstructorDescription.idl b/udkapi/com/sun/star/reflection/XServiceConstructorDescription.idl index c6c9d587c..c58e4b3ad 100644 --- a/udkapi/com/sun/star/reflection/XServiceConstructorDescription.idl +++ b/udkapi/com/sun/star/reflection/XServiceConstructorDescription.idl @@ -38,7 +38,7 @@ interface XParameter; /** Reflects a service constructor. - @since OOo 2.0.0 + @since OOo 2.0 */ interface XServiceConstructorDescription { /** diff --git a/udkapi/com/sun/star/reflection/XServiceTypeDescription2.idl b/udkapi/com/sun/star/reflection/XServiceTypeDescription2.idl index 542c5e9d8..fab74ef82 100644 --- a/udkapi/com/sun/star/reflection/XServiceTypeDescription2.idl +++ b/udkapi/com/sun/star/reflection/XServiceTypeDescription2.idl @@ -41,7 +41,7 @@ interface XTypeDescription; <p>This type supersedes <type>XServiceTypeDescription</type>, which only supports obsolete, accumulation-based services.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XServiceTypeDescription2: XServiceTypeDescription { /** diff --git a/udkapi/com/sun/star/reflection/XSingletonTypeDescription2.idl b/udkapi/com/sun/star/reflection/XSingletonTypeDescription2.idl index c08889f1d..046b59d0c 100644 --- a/udkapi/com/sun/star/reflection/XSingletonTypeDescription2.idl +++ b/udkapi/com/sun/star/reflection/XSingletonTypeDescription2.idl @@ -40,7 +40,7 @@ interface XTypeDescription; <p>This type supersedes <type>XSingletonTypeDescription</type>, which only supports obsolete, service-based singletons.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XSingletonTypeDescription2: XSingletonTypeDescription { /** diff --git a/udkapi/com/sun/star/reflection/XStructTypeDescription.idl b/udkapi/com/sun/star/reflection/XStructTypeDescription.idl index 5ca1f044c..ac601a94a 100644 --- a/udkapi/com/sun/star/reflection/XStructTypeDescription.idl +++ b/udkapi/com/sun/star/reflection/XStructTypeDescription.idl @@ -66,7 +66,7 @@ interface XTypeDescription; sequence.</li> </ul> - @since OOo 2.0.0 + @since OOo 2.0 */ interface XStructTypeDescription: XCompoundTypeDescription { /** diff --git a/udkapi/com/sun/star/script/BasicErrorException.idl b/udkapi/com/sun/star/script/BasicErrorException.idl index bb219cab0..53f45fc8c 100644 --- a/udkapi/com/sun/star/script/BasicErrorException.idl +++ b/udkapi/com/sun/star/script/BasicErrorException.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module script { /** is thrown in order to transport an error to Basic. - @since OOo 2.0.0 + @since OOo 2.0 */ published exception BasicErrorException: com::sun::star::uno::Exception { diff --git a/udkapi/com/sun/star/uri/ExternalUriReferenceTranslator.idl b/udkapi/com/sun/star/uri/ExternalUriReferenceTranslator.idl index ce6e47907..25889e62d 100644 --- a/udkapi/com/sun/star/uri/ExternalUriReferenceTranslator.idl +++ b/udkapi/com/sun/star/uri/ExternalUriReferenceTranslator.idl @@ -35,7 +35,7 @@ published interface XExternalUriReferenceTranslator; /** translates between external and internal URI references. - @since OOo 2.0.0 + @since OOo 2.0 */ published service ExternalUriReferenceTranslator: XExternalUriReferenceTranslator; diff --git a/udkapi/com/sun/star/uri/RelativeUriExcessParentSegments.idl b/udkapi/com/sun/star/uri/RelativeUriExcessParentSegments.idl index 37a555fce..0b36fdafd 100644 --- a/udkapi/com/sun/star/uri/RelativeUriExcessParentSegments.idl +++ b/udkapi/com/sun/star/uri/RelativeUriExcessParentSegments.idl @@ -37,7 +37,7 @@ module com { module sun { module star { module uri { @see com::sun::star::uri::XUriReferenceFactory::makeAbsolute for a method that uses this enumeration. - @since OOo 2.0.0 + @since OOo 2.0 */ published enum RelativeUriExcessParentSegments { /** diff --git a/udkapi/com/sun/star/uri/UriReferenceFactory.idl b/udkapi/com/sun/star/uri/UriReferenceFactory.idl index ed8780ccc..b5831bea4 100644 --- a/udkapi/com/sun/star/uri/UriReferenceFactory.idl +++ b/udkapi/com/sun/star/uri/UriReferenceFactory.idl @@ -68,7 +68,7 @@ published interface XUriReferenceFactory; service does not support <type scope="com::sun::star::uri">XUriSchemeParser</type>.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published service UriReferenceFactory: XUriReferenceFactory; diff --git a/udkapi/com/sun/star/uri/UriSchemeParser_vndDOTsunDOTstarDOTscript.idl b/udkapi/com/sun/star/uri/UriSchemeParser_vndDOTsunDOTstarDOTscript.idl index bf0c95e53..3df306c43 100644 --- a/udkapi/com/sun/star/uri/UriSchemeParser_vndDOTsunDOTstarDOTscript.idl +++ b/udkapi/com/sun/star/uri/UriSchemeParser_vndDOTsunDOTstarDOTscript.idl @@ -48,7 +48,7 @@ published interface XUriSchemeParser; Rather, it should be used indirectly through the <type scope="com::sun::star::uri">UriReferenceFactory</type> service.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published service UriSchemeParser_vndDOTsunDOTstarDOTscript: XUriSchemeParser {}; diff --git a/udkapi/com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.idl b/udkapi/com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.idl index 944c6bde1..d440124e9 100644 --- a/udkapi/com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.idl +++ b/udkapi/com/sun/star/uri/VndSunStarPkgUrlReferenceFactory.idl @@ -35,7 +35,7 @@ published interface XVndSunStarPkgUrlReferenceFactory; /** creates “vnd.sun.star.pkg” URL references. - @since OOo 2.0.0 + @since OOo 2.0 */ published service VndSunStarPkgUrlReferenceFactory: XVndSunStarPkgUrlReferenceFactory; diff --git a/udkapi/com/sun/star/uri/XExternalUriReferenceTranslator.idl b/udkapi/com/sun/star/uri/XExternalUriReferenceTranslator.idl index ec5d5a0ac..976627fbe 100644 --- a/udkapi/com/sun/star/uri/XExternalUriReferenceTranslator.idl +++ b/udkapi/com/sun/star/uri/XExternalUriReferenceTranslator.idl @@ -54,7 +54,7 @@ module com { module sun { module star { module uri { references (that do not include a scheme) are left unmodified by the translation process.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XExternalUriReferenceTranslator { /** diff --git a/udkapi/com/sun/star/uri/XUriReference.idl b/udkapi/com/sun/star/uri/XUriReference.idl index 75591f3fe..0a0855018 100644 --- a/udkapi/com/sun/star/uri/XUriReference.idl +++ b/udkapi/com/sun/star/uri/XUriReference.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module uri { <type scope="com::sun::star::uri">XUriReference</type> and additional, scheme-specific interfaces. - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XUriReference: com::sun::star::uno::XInterface { /** diff --git a/udkapi/com/sun/star/uri/XUriReferenceFactory.idl b/udkapi/com/sun/star/uri/XUriReferenceFactory.idl index cf4c1cb56..e8e1cc6ae 100644 --- a/udkapi/com/sun/star/uri/XUriReferenceFactory.idl +++ b/udkapi/com/sun/star/uri/XUriReferenceFactory.idl @@ -40,7 +40,7 @@ module com { module sun { module star { module uri { <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for a description of URI references and related terms.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XUriReferenceFactory: com::sun::star::uno::XInterface { /** diff --git a/udkapi/com/sun/star/uri/XUriSchemeParser.idl b/udkapi/com/sun/star/uri/XUriSchemeParser.idl index 7a86ba9fd..f77f4f9b2 100644 --- a/udkapi/com/sun/star/uri/XUriSchemeParser.idl +++ b/udkapi/com/sun/star/uri/XUriSchemeParser.idl @@ -39,7 +39,7 @@ module com { module sun { module star { module uri { <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a> for a description of URIs and related terms.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XUriSchemeParser: com::sun::star::uno::XInterface { /** diff --git a/udkapi/com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.idl b/udkapi/com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.idl index cc777e6fa..c7bf4421a 100644 --- a/udkapi/com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.idl +++ b/udkapi/com/sun/star/uri/XVndSunStarPkgUrlReferenceFactory.idl @@ -37,7 +37,7 @@ published interface XUriReference; /** creates “vnd.sun.star.pkg” URL references. - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XVndSunStarPkgUrlReferenceFactory { /** diff --git a/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl b/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl index ed9e0a23c..addac2708 100644 --- a/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl +++ b/udkapi/com/sun/star/uri/XVndSunStarScriptUrl.idl @@ -61,7 +61,7 @@ module com { module sun { module star { module uri { without considering case folding or normalization. There may be multiple parameters with equal keys.</p> - @since OOo 2.0.0 + @since OOo 2.0 */ published interface XVndSunStarScriptUrl: com::sun::star::uno::XInterface { /** diff --git a/unoil/climaker/version.txt b/unoil/climaker/version.txt index 2678d1bc0..f59c2f948 100644..100755 --- a/unoil/climaker/version.txt +++ b/unoil/climaker/version.txt @@ -25,8 +25,8 @@ # #************************************************************************* -CLI_OOOTYPES_NEW_VERSION=1.0.7.0 -CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.6.0 -CLI_OOOTYPES_POLICY_VERSION=7.0.0.0 +CLI_OOOTYPES_NEW_VERSION=1.0.8.0 +CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.7.0 +CLI_OOOTYPES_POLICY_VERSION=8.0.0.0 CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes diff --git a/unoil/util/makefile.mk b/unoil/util/makefile.mk index f5d8125b8..c2bd22ef2 100644 --- a/unoil/util/makefile.mk +++ b/unoil/util/makefile.mk @@ -35,7 +35,7 @@ TARGET = unoil MAXLINELENGTH = 100000 -JARCLASSDIRS = com drafts +JARCLASSDIRS = com JARTARGET = $(TARGET).jar JARCOMPRESS = TRUE diff --git a/ure/prj/build.lst b/ure/prj/build.lst index 1f9b694ed..7618bf329 100644 --- a/ure/prj/build.lst +++ b/ure/prj/build.lst @@ -1,2 +1,2 @@ -ur ure : LIBXSLT:libxslt cli_ure io javaunohelper remotebridges solenv stoc NULL +ur ure : LIBXSLT:libxslt binaryurp cli_ure io javaunohelper remotebridges solenv stoc NULL ur ure\source nmake - all ur_source NULL diff --git a/ure/source/README b/ure/source/README index 3bbdaa43d..fdf1c7e85 100644 --- a/ure/source/README +++ b/ure/source/README @@ -63,7 +63,6 @@ Linux x86, Solaris x86, and Solaris SPARC: /opt/openoffice.org/ure/bin/regcomp.bin [private] /opt/openoffice.org/ure/lib/unorc [private] /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] @@ -75,7 +74,6 @@ Linux x86, Solaris x86, and Solaris SPARC: /opt/openoffice.org/ure/lib/libgcc3_uno.so [private; Linux x86 only] /opt/openoffice.org/ure/lib/libsunpro5_uno.so [private; Solaris only] /opt/openoffice.org/ure/lib/libjava_uno.so [private] -/opt/openoffice.org/ure/lib/liburp_uno.so [private] /opt/openoffice.org/ure/lib/libunsafe_uno_uno.so [private] /opt/openoffice.org/ure/lib/libaffine_uno_uno.so [private] /opt/openoffice.org/ure/lib/liblog_uno_uno.so [private] @@ -83,8 +81,8 @@ Linux x86, Solaris x86, and Solaris SPARC: /opt/openoffice.org/ure/lib/libjuh.so [private] /opt/openoffice.org/ure/lib/libjuhx.so [private] /opt/openoffice.org/ure/lib/acceptor.uno.so [private] +/opt/openoffice.org/ure/lib/binaryurp.uno.so [private] /opt/openoffice.org/ure/lib/bootstrap.uno.so [private] -/opt/openoffice.org/ure/lib/bridgefac.uno.so [private] /opt/openoffice.org/ure/lib/connector.uno.so [private] /opt/openoffice.org/ure/lib/introspection.uno.so [private] /opt/openoffice.org/ure/lib/invocadapt.uno.so [private] @@ -94,7 +92,6 @@ Linux x86, Solaris x86, and Solaris SPARC: /opt/openoffice.org/ure/lib/namingservice.uno.so [private] /opt/openoffice.org/ure/lib/proxyfac.uno.so [private] /opt/openoffice.org/ure/lib/reflection.uno.so [private] -/opt/openoffice.org/ure/lib/remotebridge.uno.so [private] /opt/openoffice.org/ure/lib/streams.uno.so [private] /opt/openoffice.org/ure/lib/textinstream.uno.so [private] /opt/openoffice.org/ure/lib/textoutstream.uno.so [private] @@ -127,7 +124,6 @@ Program Files\URE\misc\services.rdb Program Files\URE\bin\libxml2.dll [external] 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] @@ -138,7 +134,6 @@ Program Files\URE\bin\jvmfwk3.ini [private] Program Files\URE\bin\msci_uno.dll [private] Program Files\URE\bin\java_uno.dll [private] Program Files\URE\bin\cli_uno.dll [private] -Program Files\URE\bin\urp_uno.dll [private] Program Files\URE\bin\unsafe_uno_uno.dll [private] Program Files\URE\bin\affine_uno_uno.dll [private] Program Files\URE\bin\log_uno_uno.dll [private] @@ -147,8 +142,8 @@ Program Files\URE\bin\jpipx.dll [private] Program Files\URE\bin\juh.dll [private] Program Files\URE\bin\juhx.dll [private] Program Files\URE\bin\acceptor.uno.dll [private] +Program Files\URE\bin\binaryurp.uno.dll [private] Program Files\URE\bin\bootstrap.uno.dll [private] -Program Files\URE\bin\bridgefac.uno.dll [private] Program Files\URE\bin\connector.uno.dll [private] Program Files\URE\bin\introspection.uno.dll [private] Program Files\URE\bin\invocadapt.uno.dll [private] @@ -158,7 +153,6 @@ Program Files\URE\bin\javavm.uno.dll [private] Program Files\URE\bin\namingservice.uno.dll [private] Program Files\URE\bin\proxyfac.uno.dll [private] Program Files\URE\bin\reflection.uno.dll [private] -Program Files\URE\bin\remotebridge.uno.dll [private] Program Files\URE\bin\streams.uno.dll [private] Program Files\URE\bin\textinstream.uno.dll [private] Program Files\URE\bin\textoutstream.uno.dll [private] diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk index cd6fab210..bdd43656b 100644 --- a/ure/source/makefile.mk +++ b/ure/source/makefile.mk @@ -35,8 +35,8 @@ ZIP1LIST = uretest my_components = \ acceptor \ + binaryurp \ bootstrap \ - bridgefac \ connector \ introspection \ invocadapt \ @@ -47,7 +47,6 @@ my_components = \ namingservice \ proxyfac \ reflection \ - remotebridge \ stocservices \ streams \ textinstream \ |