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