1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xolesimplestorage.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __XOLESIMPLESTORAGE_HXX_
32 #define __XOLESIMPLESTORAGE_HXX_
34 #include <com/sun/star/embed/XOLESimpleStorage.hpp>
35 #include <com/sun/star/container/XNameContainer.hpp>
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/embed/XTransactedObject.hpp>
40 #include <com/sun/star/embed/XClassifiedObject.hpp>
43 #include <com/sun/star/io/XOutputStream.hpp>
44 #include <cppuhelper/implbase3.hxx>
45 #include <cppuhelper/interfacecontainer.h>
47 #include <osl/mutex.hxx>
52 class OLESimpleStorage
: public ::cppu::WeakImplHelper3
53 < ::com::sun::star::embed::XOLESimpleStorage
54 , ::com::sun::star::lang::XInitialization
55 , ::com::sun::star::lang::XServiceInfo
>
57 ::osl::Mutex m_aMutex
;
61 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
;
62 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xTempStream
;
64 BaseStorage
* m_pStorage
;
66 ::cppu::OInterfaceContainerHelper
* m_pListenersContainer
; // list of listeners
67 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
69 sal_Bool m_bNoTemporaryCopy
;
71 void UpdateOriginal_Impl();
73 static void InsertInputStreamToStorage_Impl( BaseStorage
* pStorage
, ::rtl::OUString aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInputStream
)
74 throw ( ::com::sun::star::uno::Exception
);
76 static void InsertNameAccessToStorage_Impl( BaseStorage
* pStorage
, ::rtl::OUString aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xNameAccess
)
77 throw ( ::com::sun::star::uno::Exception
);
81 OLESimpleStorage( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xFactory
);
83 virtual ~OLESimpleStorage();
85 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
impl_staticGetSupportedServiceNames();
86 static ::rtl::OUString SAL_CALL
impl_staticGetImplementationName();
87 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
88 impl_staticCreateSelfInstance(
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xServiceManager
);
92 //____________________________________________________________________________________________________
94 //____________________________________________________________________________________________________
96 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
97 throw ( ::com::sun::star::uno::Exception
,
98 ::com::sun::star::uno::RuntimeException
);
100 //____________________________________________________________________________________________________
102 //____________________________________________________________________________________________________
104 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
105 throw ( ::com::sun::star::lang::IllegalArgumentException
,
106 ::com::sun::star::container::ElementExistException
,
107 ::com::sun::star::lang::WrappedTargetException
,
108 ::com::sun::star::uno::RuntimeException
);
110 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& Name
)
111 throw ( ::com::sun::star::container::NoSuchElementException
,
112 ::com::sun::star::lang::WrappedTargetException
,
113 ::com::sun::star::uno::RuntimeException
);
115 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
116 throw ( ::com::sun::star::lang::IllegalArgumentException
,
117 ::com::sun::star::container::NoSuchElementException
,
118 ::com::sun::star::lang::WrappedTargetException
,
119 ::com::sun::star::uno::RuntimeException
);
121 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
122 throw ( ::com::sun::star::container::NoSuchElementException
,
123 ::com::sun::star::lang::WrappedTargetException
,
124 ::com::sun::star::uno::RuntimeException
);
126 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
127 throw ( ::com::sun::star::uno::RuntimeException
);
129 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
130 throw ( ::com::sun::star::uno::RuntimeException
);
132 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
133 throw ( ::com::sun::star::uno::RuntimeException
);
135 virtual sal_Bool SAL_CALL
hasElements()
136 throw ( ::com::sun::star::uno::RuntimeException
);
138 //____________________________________________________________________________________________________
140 //____________________________________________________________________________________________________
142 virtual void SAL_CALL
dispose()
143 throw ( ::com::sun::star::uno::RuntimeException
);
145 virtual void SAL_CALL
addEventListener(
146 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
147 throw ( ::com::sun::star::uno::RuntimeException
);
149 virtual void SAL_CALL
removeEventListener(
150 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
151 throw ( ::com::sun::star::uno::RuntimeException
);
153 //____________________________________________________________________________________________________
155 //____________________________________________________________________________________________________
157 virtual void SAL_CALL
commit()
158 throw ( ::com::sun::star::io::IOException
,
159 ::com::sun::star::lang::WrappedTargetException
,
160 ::com::sun::star::uno::RuntimeException
);
162 virtual void SAL_CALL
revert()
163 throw ( ::com::sun::star::io::IOException
,
164 ::com::sun::star::lang::WrappedTargetException
,
165 ::com::sun::star::uno::RuntimeException
);
167 //____________________________________________________________________________________________________
169 //____________________________________________________________________________________________________
171 virtual ::com::sun::star::uno::Sequence
< ::sal_Int8
> SAL_CALL
getClassID()
172 throw ( ::com::sun::star::uno::RuntimeException
);
174 virtual ::rtl::OUString SAL_CALL
getClassName()
175 throw ( ::com::sun::star::uno::RuntimeException
);
177 virtual void SAL_CALL
setClassInfo( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& aClassID
,
178 const ::rtl::OUString
& sClassName
)
179 throw ( ::com::sun::star::lang::NoSupportException
,
180 ::com::sun::star::uno::RuntimeException
);
182 //____________________________________________________________________________________________________
184 //____________________________________________________________________________________________________
186 virtual ::rtl::OUString SAL_CALL
getImplementationName()
187 throw ( ::com::sun::star::uno::RuntimeException
);
189 virtual ::sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
190 throw ( ::com::sun::star::uno::RuntimeException
);
192 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
193 throw ( ::com::sun::star::uno::RuntimeException
);