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