summaryrefslogtreecommitdiff
path: root/ucb/source
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2003-08-25 12:01:18 +0000
committerKurt Zenker <kz@openoffice.org>2003-08-25 12:01:18 +0000
commit7c9f0fabedf388cfb5fe2e48b82a583c7bd84043 (patch)
treed535341f1a67248610abc8c4f3dc5164d40cc497 /ucb/source
parente25185c8b244b0f393426e85e6ffb856f1cce170 (diff)
INTEGRATION: CWS abi4 (1.2.2); FILE ADDED
2003/08/21 10:55:48 abi 1.2.2.1: Retrieving odma
Diffstat (limited to 'ucb/source')
-rw-r--r--ucb/source/ucp/odma/odma_inputstream.cxx336
-rw-r--r--ucb/source/ucp/odma/odma_inputstream.hxx187
-rw-r--r--ucb/source/ucp/odma/odma_lib.cxx170
3 files changed, 693 insertions, 0 deletions
diff --git a/ucb/source/ucp/odma/odma_inputstream.cxx b/ucb/source/ucp/odma/odma_inputstream.cxx
new file mode 100644
index 000000000000..1e22ed813f67
--- /dev/null
+++ b/ucb/source/ucp/odma/odma_inputstream.cxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * $RCSfile: odma_inputstream.cxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: kz $ $Date: 2003-08-25 13:01:02 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef ODMA_INPUTSTREAM_HXX
+#include "odma_inputstream.hxx"
+#endif
+#ifndef _COM_SUN_STAR_IO_IOEXCEPTION_HPP_
+#include "com/sun/star/io/IOException.hpp"
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_
+#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UCB_OPENMODE_HPP_
+#include <com/sun/star/ucb/OpenMode.hpp>
+#endif
+#ifndef _UCBHELPER_CONTENT_HXX
+#include <ucbhelper/content.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASTREAMER_HPP_
+#include <com/sun/star/io/XActiveDataStreamer.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef ODMA_CONTENTPROPS_HXX
+#include "odma_contentprops.hxx"
+#endif
+#ifndef ODMA_PROVIDER_HXX
+#include "odma_provider.hxx"
+#endif
+
+using namespace odma;
+using namespace com::sun::star;
+
+class OActiveDataStreamer : public ::cppu::WeakImplHelper1< ::com::sun::star::io::XActiveDataStreamer>
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
+public:
+ OActiveDataStreamer(){}
+ virtual void SAL_CALL setStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& _rStream ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ m_xStream = _rStream;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL getStream( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return m_xStream;
+ }
+};
+// -----------------------------------------------------------------------------
+OOdmaStream::OOdmaStream(::ucb::Content* _pContent,
+ ContentProvider* _pProvider,
+ const ::vos::ORef<ContentProperties>& _rProp)
+ :m_pContent(_pContent)
+ ,m_bInputStreamCalled(sal_False)
+ ,m_bOutputStreamCalled(sal_False)
+ ,m_bModified(sal_False)
+ ,m_pProvider(_pProvider)
+ ,m_aProp(_rProp)
+{
+}
+// -----------------------------------------------------------------------------
+OOdmaStream::~OOdmaStream()
+{
+ try
+ {
+ closeStream();
+ delete m_pContent;
+ }
+ catch (io::IOException const &)
+ {
+ OSL_ENSURE(false, "unexpected situation");
+ }
+ catch (uno::RuntimeException const &)
+ {
+ OSL_ENSURE(false, "unexpected situation");
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< io::XInputStream > SAL_CALL OOdmaStream::getInputStream( ) throw( uno::RuntimeException)
+{
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ m_bInputStreamCalled = sal_True;
+ }
+ return uno::Reference< io::XInputStream >( this );
+}
+// -----------------------------------------------------------------------------
+uno::Reference< io::XOutputStream > SAL_CALL OOdmaStream::getOutputStream( ) throw( uno::RuntimeException )
+{
+ {
+ osl::MutexGuard aGuard( m_aMutex );
+ m_bOutputStreamCalled = sal_True;
+ }
+ return uno::Reference< io::XOutputStream >( this );
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL OOdmaStream::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
+ throw( io::NotConnectedException,
+ io::BufferSizeExceededException,
+ io::IOException,
+ uno::RuntimeException)
+{
+ ensureInputStream();
+
+ return m_xInput->readBytes(aData,nBytesToRead);
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL OOdmaStream::readSomeBytes( uno::Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead )
+ throw( io::NotConnectedException,
+ io::BufferSizeExceededException,
+ io::IOException,
+ uno::RuntimeException)
+{
+ return readBytes( aData,nMaxBytesToRead );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OOdmaStream::skipBytes( sal_Int32 nBytesToSkip )
+ throw( io::NotConnectedException,
+ io::BufferSizeExceededException,
+ io::IOException,
+ uno::RuntimeException )
+{
+ ensureInputStream();
+ m_xInput->skipBytes(nBytesToSkip );
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL OOdmaStream::available()
+ throw( io::NotConnectedException,
+ io::IOException,
+ uno::RuntimeException)
+{
+ ensureInputStream();
+ return m_xInput->available();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OOdmaStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
+ throw( io::NotConnectedException,
+ io::BufferSizeExceededException,
+ io::IOException,
+ uno::RuntimeException)
+{
+ ensureOutputStream();
+ m_xOutput->writeBytes(aData);
+ m_bModified = sal_True;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OOdmaStream::closeStream() throw( io::NotConnectedException,io::IOException,uno::RuntimeException )
+{
+ if( m_xInput.is() )
+ {
+ m_xInput->closeInput();
+ m_xInput = NULL;
+ m_xInputSeek = NULL;
+ }
+ if(m_xOutput.is())
+ {
+ m_xOutput->closeOutput();
+ m_xOutput = NULL;
+ m_xTruncate = NULL;
+ if(m_bModified)
+ m_pProvider->saveDocument(m_aProp->m_sDocumentId);
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OOdmaStream::closeInput()
+ throw( io::NotConnectedException,
+ io::IOException,
+ uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+ m_bInputStreamCalled = sal_False;
+
+ if( ! m_bOutputStreamCalled )
+ closeStream();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OOdmaStream::closeOutput()
+ throw( io::NotConnectedException,
+ io::IOException,
+ uno::RuntimeException )
+{
+ osl::MutexGuard aGuard( m_aMutex );
+ m_bOutputStreamCalled = sal_False;
+
+ if( ! m_bInputStreamCalled )
+ closeStream();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OOdmaStream::flush()
+ throw( io::NotConnectedException,
+ io::BufferSizeExceededException,
+ io::IOException,
+ uno::RuntimeException )
+{
+ ensureOutputStream();
+ m_xOutput->flush();
+}
+// -----------------------------------------------------------------------------
+void OOdmaStream::ensureInputStream() throw( io::IOException )
+{
+ try
+ {
+ if(!m_xInput.is())
+ {
+ m_xInput = m_pContent->openStream();
+ m_xInputSeek = uno::Reference< io::XSeekable>(m_xInput,uno::UNO_QUERY);
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ }
+ if(!m_xInput.is())
+ throw io::IOException();
+}
+// -----------------------------------------------------------------------------
+void OOdmaStream::ensureOutputStream() throw( io::IOException )
+{
+ try
+ {
+ if(!m_xOutput.is())
+ {
+ ::com::sun::star::ucb::OpenCommandArgument2 aCommand;
+ aCommand.Mode = ::com::sun::star::ucb::OpenMode::DOCUMENT;
+ uno::Reference< io::XActiveDataStreamer > xActiveStreamer = new OActiveDataStreamer();
+ aCommand.Sink = xActiveStreamer;
+ m_pContent->executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("open")),uno::makeAny(aCommand));
+ if(xActiveStreamer.is())
+ {
+ uno::Reference< io::XStream> xStream = xActiveStreamer->getStream();
+ if(xStream.is())
+ m_xOutput = xStream->getOutputStream();
+ }
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ }
+ if(!m_xOutput.is())
+ throw io::IOException();
+ m_xTruncate = uno::Reference< io::XTruncate>(m_xOutput,uno::UNO_QUERY);
+}
+// -----------------------------------------------------------------------------
+// XTruncate
+void SAL_CALL OOdmaStream::truncate( void )
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ if(m_xTruncate.is())
+ m_xTruncate->truncate();
+}
+// -----------------------------------------------------------------------------
+// XSeekable
+void SAL_CALL OOdmaStream::seek(sal_Int64 location )
+ throw( com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ ensureInputStream();
+ if(m_xInputSeek.is())
+ m_xInputSeek->seek(location);
+}
+// -----------------------------------------------------------------------------
+sal_Int64 SAL_CALL OOdmaStream::getPosition()
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ ensureInputStream();
+ return m_xInputSeek.is() ? m_xInputSeek->getPosition() : sal_Int64(0);
+}
+// -----------------------------------------------------------------------------
+sal_Int64 SAL_CALL OOdmaStream::getLength()
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException )
+{
+ ensureInputStream();
+ return m_xInputSeek.is() ? m_xInputSeek->getLength() : sal_Int64(0);
+}
+// ----------------------------------------------------------------------------- \ No newline at end of file
diff --git a/ucb/source/ucp/odma/odma_inputstream.hxx b/ucb/source/ucp/odma/odma_inputstream.hxx
new file mode 100644
index 000000000000..5970b1e44594
--- /dev/null
+++ b/ucb/source/ucp/odma/odma_inputstream.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: odma_inputstream.hxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: kz $ $Date: 2003-08-25 13:01:10 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef ODMA_INPUTSTREAM_HXX
+#define ODMA_INPUTSTREAM_HXX
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
+#include <com/sun/star/io/XInputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSTREAM_HPP_
+#include <com/sun/star/io/XStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XTRUNCATE_HPP_
+#include <com/sun/star/io/XTruncate.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_
+#include <com/sun/star/io/XSeekable.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase5.hxx>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+
+namespace ucb
+{
+ class Content;
+}
+namespace odma
+{
+ typedef ::cppu::WeakImplHelper5< ::com::sun::star::io::XInputStream,
+ ::com::sun::star::io::XStream,
+ ::com::sun::star::io::XTruncate,
+ ::com::sun::star::io::XSeekable,
+ ::com::sun::star::io::XOutputStream> OOdmaStreamBase;
+
+ class ContentProvider;
+ class ContentProperties;
+ class OOdmaStream : public OOdmaStreamBase
+ {
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream> m_xOutput;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate> m_xTruncate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream> m_xInput;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable> m_xInputSeek;
+
+ ::vos::ORef<ContentProperties> m_aProp;
+ ::ucb::Content* m_pContent;
+ ContentProvider* m_pProvider;
+ sal_Bool m_bInputStreamCalled;
+ sal_Bool m_bOutputStreamCalled;
+ sal_Bool m_bModified;
+
+ void ensureInputStream() throw( ::com::sun::star::io::IOException );
+ void ensureOutputStream() throw( ::com::sun::star::io::IOException );
+ void SAL_CALL closeStream() throw( ::com::sun::star::io::NotConnectedException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+ public:
+ OOdmaStream(::ucb::Content* _pContent,
+ ContentProvider* _pProvider,
+ const ::vos::ORef<ContentProperties>& _rProp);
+ virtual ~OOdmaStream();
+ // com::sun::star::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nBytesToRead )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL available( )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL closeInput( )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::io::XStream
+ virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw( com::sun::star::uno::RuntimeException );
+
+ // com::sun::star::io::XOutputStream
+ void SAL_CALL writeBytes( const com::sun::star::uno::Sequence< sal_Int8 >& aData )
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL flush()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::BufferSizeExceededException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException);
+ void SAL_CALL closeOutput()
+ throw( com::sun::star::io::NotConnectedException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+ // XTruncate
+ virtual void SAL_CALL truncate( void )
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+ // XSeekable
+ void SAL_CALL seek(sal_Int64 location )
+ throw( com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+
+ sal_Int64 SAL_CALL getPosition()
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+
+ sal_Int64 SAL_CALL getLength()
+ throw( com::sun::star::io::IOException,
+ com::sun::star::uno::RuntimeException );
+ };
+}
+#endif // ODMA_INPUTSTREAM_HXX
diff --git a/ucb/source/ucp/odma/odma_lib.cxx b/ucb/source/ucp/odma/odma_lib.cxx
new file mode 100644
index 000000000000..a32a5ce42898
--- /dev/null
+++ b/ucb/source/ucp/odma/odma_lib.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * $RCSfile: odma_lib.cxx,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: kz $ $Date: 2003-08-25 13:01:18 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+//#ifndef _OSL_PROCESS_H_
+//#include <osl/process.h>
+//#endif
+#ifndef _OSL_MODULE_H_
+#include <osl/module.h>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef ODMA_LIB_HXX
+#include "odma_lib.hxx"
+#endif
+
+
+namespace odma
+{
+
+ TODMRegisterApp pODMRegisterApp;
+ TODMUnRegisterApp pODMUnRegisterApp;
+ TODMSelectDoc pODMSelectDoc;
+ TODMOpenDoc pODMOpenDoc;
+ TODMSaveDoc pODMSaveDoc;
+ TODMCloseDoc pODMCloseDoc;
+ TODMNewDoc pODMNewDoc;
+ TODMSaveAs pODMSaveAs;
+ TODMActivate pODMActivate;
+ TODMGetDocInfo pODMGetDocInfo;
+ TODMSetDocInfo pODMSetDocInfo;
+ TODMGetDMSInfo pODMGetDMSInfo;
+ TODMGetDMSCount pODMGetDMSCount;
+ TODMGetDMSList pODMGetDMSList;
+ TODMGetDMS pODMGetDMS;
+ TODMSetDMS pODMSetDMS;
+ TODMQueryExecute pODMQueryExecute;
+ TODMQueryGetResults pODMQueryGetResults;
+ TODMQueryClose pODMQueryClose;
+ TODMCloseDocEx pODMCloseDocEx;
+ TODMSaveAsEx pODMSaveAsEx;
+ TODMSaveDocEx pODMSaveDocEx;
+ TODMSelectDocEx pODMSelectDocEx;
+ TODMQueryCapability pODMQueryCapability;
+ TODMSetDocEvent pODMSetDocEvent;
+ TODMGetAlternateContent pODMGetAlternateContent;
+ TODMSetAlternateContent pODMSetAlternateContent;
+ TODMGetDocRelation pODMGetDocRelation;
+ TODMSetDocRelation pODMSetDocRelation;
+
+ sal_Bool LoadFunctions(oslModule _pODMA);
+
+ sal_Bool LoadLibrary()
+ {
+ static sal_Bool bLoaded = sal_False;
+ static oslModule pODMA = NULL;
+
+ if (bLoaded)
+ return sal_True;
+ ::rtl::OUString sPath;
+ #ifdef WIN
+ sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA.DLL"));
+
+ #endif
+ #ifdef WNT
+ sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMA32.DLL"));
+ #endif
+ #ifdef UNX
+ sPath = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("libodma.so"));
+ #endif
+
+ pODMA = osl_loadModule( sPath.pData,SAL_LOADMODULE_NOW );
+ if( !pODMA)
+ return sal_False;
+
+ return bLoaded = LoadFunctions(pODMA);
+ }
+ // -------------------------------------------------------------------------
+
+ sal_Bool LoadFunctions(oslModule pODMA)
+ {
+ if ( ( pODMRegisterApp = (TODMRegisterApp)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMRegisterApp")).pData)) == NULL ) return sal_False;
+ if ( ( pODMUnRegisterApp = (TODMUnRegisterApp)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMUnRegisterApp")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSelectDoc = (TODMSelectDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDoc")).pData)) == NULL ) return sal_False;
+ if ( ( pODMOpenDoc = (TODMOpenDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMOpenDoc")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSaveDoc = (TODMSaveDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDoc")).pData)) == NULL ) return sal_False;
+ if ( ( pODMCloseDoc = (TODMCloseDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDoc")).pData)) == NULL ) return sal_False;
+ if ( ( pODMNewDoc = (TODMNewDoc)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMNewDoc")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSaveAs = (TODMSaveAs)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAs")).pData)) == NULL ) return sal_False;
+ if ( ( pODMActivate = (TODMActivate)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMActivate")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetDocInfo = (TODMGetDocInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocInfo")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSetDocInfo = (TODMSetDocInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocInfo")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetDMSInfo = (TODMGetDMSInfo)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSInfo")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetDMSCount = (TODMGetDMSCount)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSCount")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetDMSList = (TODMGetDMSList)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMSList")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetDMS = (TODMGetDMS)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDMS")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSetDMS = (TODMSetDMS)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDMS")).pData)) == NULL ) return sal_False;
+ if ( ( pODMQueryExecute = (TODMQueryExecute)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryExecute")).pData)) == NULL ) return sal_False;
+ if ( ( pODMQueryGetResults = (TODMQueryGetResults)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryGetResults")).pData)) == NULL ) return sal_False;
+ if ( ( pODMQueryClose = (TODMQueryClose)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryClose")).pData)) == NULL ) return sal_False;
+ if ( ( pODMCloseDocEx = (TODMCloseDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMCloseDocEx")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSaveAsEx = (TODMSaveAsEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveAsEx")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSaveDocEx = (TODMSaveDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSaveDocEx")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSelectDocEx = (TODMSelectDocEx)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSelectDocEx")).pData)) == NULL ) return sal_False;
+ if ( ( pODMQueryCapability = (TODMQueryCapability)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMQueryCapability")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSetDocEvent = (TODMSetDocEvent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocEvent")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetAlternateContent = (TODMGetAlternateContent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetAlternateContent")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSetAlternateContent = (TODMSetAlternateContent)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetAlternateContent")).pData)) == NULL ) return sal_False;
+ if ( ( pODMGetDocRelation = (TODMGetDocRelation)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMGetDocRelation")).pData)) == NULL ) return sal_False;
+ if ( ( pODMSetDocRelation = (TODMSetDocRelation)osl_getSymbol(pODMA,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ODMSetDocRelation")).pData)) == NULL ) return sal_False;
+ return sal_True;
+ }
+}