1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski #ifndef CONNECTIVITY_HSQLDB_STORAGE_HXX 24*b1cdbd2cSJim Jagielski #define CONNECTIVITY_HSQLDB_STORAGE_HXX 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielski #include <cppuhelper/compbase6.hxx> 27*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XServiceInfo.hpp> 28*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XMultiServiceFactory.hpp> 29*b1cdbd2cSJim Jagielski #include <com/sun/star/io/XStream.hpp> 30*b1cdbd2cSJim Jagielski #include <com/sun/star/io/XInputStream.hpp> 31*b1cdbd2cSJim Jagielski #include <com/sun/star/io/XOutputStream.hpp> 32*b1cdbd2cSJim Jagielski #include <com/sun/star/io/XSeekable.hpp> 33*b1cdbd2cSJim Jagielski #include <com/sun/star/embed/XStorage.hpp> 34*b1cdbd2cSJim Jagielski #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp> 35*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XInitialization.hpp> 36*b1cdbd2cSJim Jagielski #include "connectivity/CommonTools.hxx" 37*b1cdbd2cSJim Jagielski #include <comphelper/broadcasthelper.hxx> 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski #define DECLARE_SERVICE_INFO_STATIC() \ 41*b1cdbd2cSJim Jagielski DECLARE_SERVICE_INFO(); \ 42*b1cdbd2cSJim Jagielski static ::rtl::OUString SAL_CALL getImplementationName_Static( ) throw (::com::sun::star::uno::RuntimeException); \ 43*b1cdbd2cSJim Jagielski static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) throw(::com::sun::star::uno::RuntimeException); \ 44*b1cdbd2cSJim Jagielski static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \ 45*b1cdbd2cSJim Jagielski SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&) \ 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski 48*b1cdbd2cSJim Jagielski namespace connectivity 49*b1cdbd2cSJim Jagielski { 50*b1cdbd2cSJim Jagielski namespace hsqldb 51*b1cdbd2cSJim Jagielski { 52*b1cdbd2cSJim Jagielski typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::io::XStream 53*b1cdbd2cSJim Jagielski , ::com::sun::star::io::XInputStream 54*b1cdbd2cSJim Jagielski , ::com::sun::star::io::XOutputStream 55*b1cdbd2cSJim Jagielski , ::com::sun::star::io::XSeekable 56*b1cdbd2cSJim Jagielski , ::com::sun::star::lang::XInitialization 57*b1cdbd2cSJim Jagielski , ::com::sun::star::lang::XServiceInfo> OStorage_Base; 58*b1cdbd2cSJim Jagielski class OStorage : public ::comphelper::OBaseMutex 59*b1cdbd2cSJim Jagielski ,public OStorage_Base 60*b1cdbd2cSJim Jagielski { 61*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; 62*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentSubStorageSupplier> m_xDS; 63*b1cdbd2cSJim Jagielski 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> m_xStorge; 66*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; 67*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xIn; 68*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOut; 69*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeek; 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski OStorage(); // never implemented 72*b1cdbd2cSJim Jagielski OStorage(const OStorage&); // never implemented 73*b1cdbd2cSJim Jagielski int operator= (const OStorage&); // never implemented 74*b1cdbd2cSJim Jagielski 75*b1cdbd2cSJim Jagielski OStorage( 76*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); 77*b1cdbd2cSJim Jagielski protected: 78*b1cdbd2cSJim Jagielski /** this function is called upon disposing the component 79*b1cdbd2cSJim Jagielski */ 80*b1cdbd2cSJim Jagielski virtual void SAL_CALL disposing(); 81*b1cdbd2cSJim Jagielski public: 82*b1cdbd2cSJim Jagielski // ::com::sun::star::lang::XServiceInfo 83*b1cdbd2cSJim Jagielski DECLARE_SERVICE_INFO_STATIC(); 84*b1cdbd2cSJim Jagielski 85*b1cdbd2cSJim Jagielski // XInitialization 86*b1cdbd2cSJim Jagielski 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); 87*b1cdbd2cSJim Jagielski 88*b1cdbd2cSJim Jagielski // XStream 89*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException); 90*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException); 91*b1cdbd2cSJim Jagielski 92*b1cdbd2cSJim Jagielski // XInputStream 93*b1cdbd2cSJim Jagielski 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); 94*b1cdbd2cSJim Jagielski 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); 95*b1cdbd2cSJim Jagielski 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); 96*b1cdbd2cSJim Jagielski virtual ::sal_Int32 SAL_CALL available( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 97*b1cdbd2cSJim Jagielski virtual void SAL_CALL closeInput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 98*b1cdbd2cSJim Jagielski 99*b1cdbd2cSJim Jagielski // XOutputStream 100*b1cdbd2cSJim Jagielski 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); 101*b1cdbd2cSJim Jagielski 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); 102*b1cdbd2cSJim Jagielski 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); 103*b1cdbd2cSJim Jagielski 104*b1cdbd2cSJim Jagielski // XSeekable 105*b1cdbd2cSJim Jagielski virtual void SAL_CALL seek( ::sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 106*b1cdbd2cSJim Jagielski virtual ::sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 107*b1cdbd2cSJim Jagielski virtual ::sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); 108*b1cdbd2cSJim Jagielski }; 109*b1cdbd2cSJim Jagielski } 110*b1cdbd2cSJim Jagielski // ....................................................................... 111*b1cdbd2cSJim Jagielski } // connectivity 112*b1cdbd2cSJim Jagielski // ....................................................................... 113*b1cdbd2cSJim Jagielski #endif // CONNECTIVITY_HSQLDB_STORAGE_HXX 114*b1cdbd2cSJim Jagielski 115