1bbfc4cc7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3bbfc4cc7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4bbfc4cc7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5bbfc4cc7SAndrew Rist * distributed with this work for additional information 6bbfc4cc7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7bbfc4cc7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8bbfc4cc7SAndrew Rist * "License"); you may not use this file except in compliance 9bbfc4cc7SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11bbfc4cc7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13bbfc4cc7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14bbfc4cc7SAndrew Rist * software distributed under the License is distributed on an 15bbfc4cc7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16bbfc4cc7SAndrew Rist * KIND, either express or implied. See the License for the 17bbfc4cc7SAndrew Rist * specific language governing permissions and limitations 18bbfc4cc7SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20bbfc4cc7SAndrew Rist *************************************************************/ 21bbfc4cc7SAndrew Rist 22bbfc4cc7SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __XOLESIMPLESTORAGE_HXX_ 25cdf0e10cSrcweir #define __XOLESIMPLESTORAGE_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/embed/XOLESimpleStorage.hpp> 28cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 29cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 30cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 32cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp> 33cdf0e10cSrcweir #include <com/sun/star/embed/XClassifiedObject.hpp> 34*641497eaSDamjan Jovanovic #include <com/sun/star/uno/XComponentContext.hpp> 35cdf0e10cSrcweir 36cdf0e10cSrcweir 37cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 38cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 39cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <osl/mutex.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <sot/stg.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir 46cdf0e10cSrcweir class OLESimpleStorage : public ::cppu::WeakImplHelper3 47cdf0e10cSrcweir < ::com::sun::star::embed::XOLESimpleStorage 48cdf0e10cSrcweir , ::com::sun::star::lang::XInitialization 49cdf0e10cSrcweir , ::com::sun::star::lang::XServiceInfo > 50cdf0e10cSrcweir { 51cdf0e10cSrcweir ::osl::Mutex m_aMutex; 52cdf0e10cSrcweir 53cdf0e10cSrcweir sal_Bool m_bDisposed; 54cdf0e10cSrcweir 55cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; 56cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xTempStream; 57cdf0e10cSrcweir SvStream* m_pStream; 58cdf0e10cSrcweir BaseStorage* m_pStorage; 59cdf0e10cSrcweir 60cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners 61*641497eaSDamjan Jovanovic ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 62cdf0e10cSrcweir 63cdf0e10cSrcweir sal_Bool m_bNoTemporaryCopy; 64cdf0e10cSrcweir 65cdf0e10cSrcweir void UpdateOriginal_Impl(); 66cdf0e10cSrcweir 67cdf0e10cSrcweir static void InsertInputStreamToStorage_Impl( BaseStorage* pStorage, ::rtl::OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream ) 68cdf0e10cSrcweir throw ( ::com::sun::star::uno::Exception ); 69cdf0e10cSrcweir 70cdf0e10cSrcweir static void InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::rtl::OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xNameAccess ) 71cdf0e10cSrcweir throw ( ::com::sun::star::uno::Exception ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir public: 74cdf0e10cSrcweir 75*641497eaSDamjan Jovanovic OLESimpleStorage( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir virtual ~OLESimpleStorage(); 78cdf0e10cSrcweir 79cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames(); 80cdf0e10cSrcweir static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); 81cdf0e10cSrcweir static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 82cdf0e10cSrcweir impl_staticCreateSelfInstance( 83*641497eaSDamjan Jovanovic const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir 86cdf0e10cSrcweir //____________________________________________________________________________________________________ 87cdf0e10cSrcweir // XInitialization 88cdf0e10cSrcweir //____________________________________________________________________________________________________ 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 91cdf0e10cSrcweir throw ( ::com::sun::star::uno::Exception, 92cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir 94cdf0e10cSrcweir //____________________________________________________________________________________________________ 95cdf0e10cSrcweir // XNameContainer 96cdf0e10cSrcweir //____________________________________________________________________________________________________ 97cdf0e10cSrcweir 98cdf0e10cSrcweir virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) 99cdf0e10cSrcweir throw ( ::com::sun::star::lang::IllegalArgumentException, 100cdf0e10cSrcweir ::com::sun::star::container::ElementExistException, 101cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 102cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir 104cdf0e10cSrcweir virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) 105cdf0e10cSrcweir throw ( ::com::sun::star::container::NoSuchElementException, 106cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 107cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir 109cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) 110cdf0e10cSrcweir throw ( ::com::sun::star::lang::IllegalArgumentException, 111cdf0e10cSrcweir ::com::sun::star::container::NoSuchElementException, 112cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 113cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir 115cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) 116cdf0e10cSrcweir throw ( ::com::sun::star::container::NoSuchElementException, 117cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 118cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() 121cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) 124cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() 127cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() 130cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir //____________________________________________________________________________________________________ 133cdf0e10cSrcweir // XComponent 134cdf0e10cSrcweir //____________________________________________________________________________________________________ 135cdf0e10cSrcweir 136cdf0e10cSrcweir virtual void SAL_CALL dispose() 137cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 138cdf0e10cSrcweir 139cdf0e10cSrcweir virtual void SAL_CALL addEventListener( 140cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) 141cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 142cdf0e10cSrcweir 143cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( 144cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) 145cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 146cdf0e10cSrcweir 147cdf0e10cSrcweir //____________________________________________________________________________________________________ 148cdf0e10cSrcweir // XTransactedObject 149cdf0e10cSrcweir //____________________________________________________________________________________________________ 150cdf0e10cSrcweir 151cdf0e10cSrcweir virtual void SAL_CALL commit() 152cdf0e10cSrcweir throw ( ::com::sun::star::io::IOException, 153cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 154cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir virtual void SAL_CALL revert() 157cdf0e10cSrcweir throw ( ::com::sun::star::io::IOException, 158cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 159cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 160cdf0e10cSrcweir 161cdf0e10cSrcweir //____________________________________________________________________________________________________ 162cdf0e10cSrcweir // XClassifiedObject 163cdf0e10cSrcweir //____________________________________________________________________________________________________ 164cdf0e10cSrcweir 165cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getClassID() 166cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 167cdf0e10cSrcweir 168cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getClassName() 169cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir virtual void SAL_CALL setClassInfo( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aClassID, 172cdf0e10cSrcweir const ::rtl::OUString& sClassName ) 173cdf0e10cSrcweir throw ( ::com::sun::star::lang::NoSupportException, 174cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir //____________________________________________________________________________________________________ 177cdf0e10cSrcweir // XServiceInfo 178cdf0e10cSrcweir //____________________________________________________________________________________________________ 179cdf0e10cSrcweir 180cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() 181cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 182cdf0e10cSrcweir 183cdf0e10cSrcweir virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 184cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 185cdf0e10cSrcweir 186cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 187cdf0e10cSrcweir throw ( ::com::sun::star::uno::RuntimeException ); 188cdf0e10cSrcweir 189cdf0e10cSrcweir }; 190cdf0e10cSrcweir 191cdf0e10cSrcweir #endif 192