xref: /trunk/main/connectivity/source/drivers/hsqldb/HStorage.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef CONNECTIVITY_HSQLDB_STORAGE_HXX
28 #define CONNECTIVITY_HSQLDB_STORAGE_HXX
29 
30 #include <cppuhelper/compbase6.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/io/XStream.hpp>
34 #include <com/sun/star/io/XInputStream.hpp>
35 #include <com/sun/star/io/XOutputStream.hpp>
36 #include <com/sun/star/io/XSeekable.hpp>
37 #include <com/sun/star/embed/XStorage.hpp>
38 #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
39 #include <com/sun/star/lang/XInitialization.hpp>
40 #include "connectivity/CommonTools.hxx"
41 #include <comphelper/broadcasthelper.hxx>
42 
43 
44 #define DECLARE_SERVICE_INFO_STATIC()   \
45     DECLARE_SERVICE_INFO(); \
46     static ::rtl::OUString SAL_CALL getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);   \
47     static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);  \
48     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >    \
49         SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)    \
50 
51 
52 namespace connectivity
53 {
54     namespace hsqldb
55     {
56         typedef ::cppu::WeakComponentImplHelper6<   ::com::sun::star::io::XStream
57                                         ,   ::com::sun::star::io::XInputStream
58                                         ,   ::com::sun::star::io::XOutputStream
59                                         ,   ::com::sun::star::io::XSeekable
60                                         ,   ::com::sun::star::lang::XInitialization
61                                         ,   ::com::sun::star::lang::XServiceInfo>   OStorage_Base;
62         class OStorage : public ::comphelper::OBaseMutex
63                         ,public OStorage_Base
64         {
65             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >            m_xServiceFactory;
66             ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentSubStorageSupplier>  m_xDS;
67 
68 
69             ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage>    m_xStorge;
70             ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >       m_xStream;
71             ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >  m_xIn;
72             ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOut;
73             ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable >     m_xSeek;
74 
75             OStorage();                         // never implemented
76             OStorage(const OStorage&);          // never implemented
77             int operator= (const OStorage&);    // never implemented
78 
79             OStorage(
80                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory);
81         protected:
82             /** this function is called upon disposing the component
83             */
84             virtual void SAL_CALL disposing();
85         public:
86             // ::com::sun::star::lang::XServiceInfo
87             DECLARE_SERVICE_INFO_STATIC();
88 
89             // XInitialization
90             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);
91 
92             // XStream
93             virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream(  ) throw (::com::sun::star::uno::RuntimeException);
94             virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream(  ) throw (::com::sun::star::uno::RuntimeException);
95 
96             // XInputStream
97             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);
98             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);
99             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);
100             virtual ::sal_Int32 SAL_CALL available(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
101             virtual void SAL_CALL closeInput(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
102 
103             // XOutputStream
104             virtual 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);
105             virtual 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);
106             virtual void SAL_CALL closeOutput(  ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
107 
108             // XSeekable
109             virtual void SAL_CALL seek( ::sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
110             virtual ::sal_Int64 SAL_CALL getPosition(  ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
111             virtual ::sal_Int64 SAL_CALL getLength(  ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
112         };
113     }
114 // .......................................................................
115 } // connectivity
116 // .......................................................................
117 #endif // CONNECTIVITY_HSQLDB_STORAGE_HXX
118 
119