1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef __XOLESIMPLESTORAGE_HXX_
29 #define __XOLESIMPLESTORAGE_HXX_
31 #include <com/sun/star/embed/XOLESimpleStorage.hpp>
32 #include <com/sun/star/container/XNameContainer.hpp>
33 #include <com/sun/star/lang/XComponent.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/embed/XTransactedObject.hpp>
37 #include <com/sun/star/embed/XClassifiedObject.hpp>
40 #include <com/sun/star/io/XOutputStream.hpp>
41 #include <cppuhelper/implbase3.hxx>
42 #include <cppuhelper/interfacecontainer.h>
44 #include <osl/mutex.hxx>
49 class OLESimpleStorage
: public ::cppu::WeakImplHelper3
50 < ::com::sun::star::embed::XOLESimpleStorage
51 , ::com::sun::star::lang::XInitialization
52 , ::com::sun::star::lang::XServiceInfo
>
54 ::osl::Mutex m_aMutex
;
58 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
;
59 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xTempStream
;
61 BaseStorage
* m_pStorage
;
63 ::cppu::OInterfaceContainerHelper
* m_pListenersContainer
; // list of listeners
64 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> m_xFactory
;
66 sal_Bool m_bNoTemporaryCopy
;
68 void UpdateOriginal_Impl();
70 static void InsertInputStreamToStorage_Impl( BaseStorage
* pStorage
, ::rtl::OUString aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInputStream
)
71 throw ( ::com::sun::star::uno::Exception
);
73 static void InsertNameAccessToStorage_Impl( BaseStorage
* pStorage
, ::rtl::OUString aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& xNameAccess
)
74 throw ( ::com::sun::star::uno::Exception
);
78 OLESimpleStorage( ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
> xFactory
);
80 virtual ~OLESimpleStorage();
82 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
impl_staticGetSupportedServiceNames();
83 static ::rtl::OUString SAL_CALL
impl_staticGetImplementationName();
84 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
85 impl_staticCreateSelfInstance(
86 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& xServiceManager
);
89 //____________________________________________________________________________________________________
91 //____________________________________________________________________________________________________
93 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
94 throw ( ::com::sun::star::uno::Exception
,
95 ::com::sun::star::uno::RuntimeException
);
97 //____________________________________________________________________________________________________
99 //____________________________________________________________________________________________________
101 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
102 throw ( ::com::sun::star::lang::IllegalArgumentException
,
103 ::com::sun::star::container::ElementExistException
,
104 ::com::sun::star::lang::WrappedTargetException
,
105 ::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& Name
)
108 throw ( ::com::sun::star::container::NoSuchElementException
,
109 ::com::sun::star::lang::WrappedTargetException
,
110 ::com::sun::star::uno::RuntimeException
);
112 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const ::com::sun::star::uno::Any
& aElement
)
113 throw ( ::com::sun::star::lang::IllegalArgumentException
,
114 ::com::sun::star::container::NoSuchElementException
,
115 ::com::sun::star::lang::WrappedTargetException
,
116 ::com::sun::star::uno::RuntimeException
);
118 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
)
119 throw ( ::com::sun::star::container::NoSuchElementException
,
120 ::com::sun::star::lang::WrappedTargetException
,
121 ::com::sun::star::uno::RuntimeException
);
123 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames()
124 throw ( ::com::sun::star::uno::RuntimeException
);
126 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
)
127 throw ( ::com::sun::star::uno::RuntimeException
);
129 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
130 throw ( ::com::sun::star::uno::RuntimeException
);
132 virtual sal_Bool SAL_CALL
hasElements()
133 throw ( ::com::sun::star::uno::RuntimeException
);
135 //____________________________________________________________________________________________________
137 //____________________________________________________________________________________________________
139 virtual void SAL_CALL
dispose()
140 throw ( ::com::sun::star::uno::RuntimeException
);
142 virtual void SAL_CALL
addEventListener(
143 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
144 throw ( ::com::sun::star::uno::RuntimeException
);
146 virtual void SAL_CALL
removeEventListener(
147 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
148 throw ( ::com::sun::star::uno::RuntimeException
);
150 //____________________________________________________________________________________________________
152 //____________________________________________________________________________________________________
154 virtual void SAL_CALL
commit()
155 throw ( ::com::sun::star::io::IOException
,
156 ::com::sun::star::lang::WrappedTargetException
,
157 ::com::sun::star::uno::RuntimeException
);
159 virtual void SAL_CALL
revert()
160 throw ( ::com::sun::star::io::IOException
,
161 ::com::sun::star::lang::WrappedTargetException
,
162 ::com::sun::star::uno::RuntimeException
);
164 //____________________________________________________________________________________________________
166 //____________________________________________________________________________________________________
168 virtual ::com::sun::star::uno::Sequence
< ::sal_Int8
> SAL_CALL
getClassID()
169 throw ( ::com::sun::star::uno::RuntimeException
);
171 virtual ::rtl::OUString SAL_CALL
getClassName()
172 throw ( ::com::sun::star::uno::RuntimeException
);
174 virtual void SAL_CALL
setClassInfo( const ::com::sun::star::uno::Sequence
< ::sal_Int8
>& aClassID
,
175 const ::rtl::OUString
& sClassName
)
176 throw ( ::com::sun::star::lang::NoSupportException
,
177 ::com::sun::star::uno::RuntimeException
);
179 //____________________________________________________________________________________________________
181 //____________________________________________________________________________________________________
183 virtual ::rtl::OUString SAL_CALL
getImplementationName()
184 throw ( ::com::sun::star::uno::RuntimeException
);
186 virtual ::sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
187 throw ( ::com::sun::star::uno::RuntimeException
);
189 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
190 throw ( ::com::sun::star::uno::RuntimeException
);