1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVL_SOURCE_FSSTOR_FSSTORAGE_HXX
21 #define INCLUDED_SVL_SOURCE_FSSTOR_FSSTORAGE_HXX
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/embed/XStorage.hpp>
25 #include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/io/XStream.hpp>
28 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/lang/XTypeProvider.hpp>
31 #include <com/sun/star/lang/XComponent.hpp>
32 #include <com/sun/star/packages/NoEncryptionException.hpp>
33 #include <cppuhelper/weak.hxx>
34 #include <cppuhelper/interfacecontainer.h>
36 #include <ucbhelper/content.hxx>
38 struct FSStorage_Impl
;
39 class FSStorage
: public ::com::sun::star::lang::XTypeProvider
40 , public ::com::sun::star::embed::XStorage
41 , public ::com::sun::star::embed::XHierarchicalStorageAccess
42 , public ::com::sun::star::beans::XPropertySet
43 , public ::cppu::OWeakObject
45 ::osl::Mutex m_aMutex
;
46 FSStorage_Impl
* m_pImpl
;
52 FSStorage( const ::ucbhelper::Content
& aContent
,
54 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> xContext
);
58 ::ucbhelper::Content
* GetContent();
60 void CopyStreamToSubStream( const OUString
& aSourceURL
,
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
,
62 const OUString
& aNewEntryName
);
64 void CopyContentToStorage_Impl( ::ucbhelper::Content
* pContent
,
65 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
);
67 static sal_Bool
MakeFolderNoUI( const OUString
& rFolder
);
71 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
72 throw( ::com::sun::star::uno::RuntimeException
);
74 virtual void SAL_CALL
acquire() throw();
76 virtual void SAL_CALL
release() throw();
80 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
81 throw( ::com::sun::star::uno::RuntimeException
);
83 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
84 throw( ::com::sun::star::uno::RuntimeException
);
88 virtual void SAL_CALL
copyToStorage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
)
89 throw ( ::com::sun::star::embed::InvalidStorageException
,
90 ::com::sun::star::lang::IllegalArgumentException
,
91 ::com::sun::star::io::IOException
,
92 ::com::sun::star::embed::StorageWrappedTargetException
,
93 ::com::sun::star::uno::RuntimeException
);
95 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
openStreamElement(
96 const OUString
& aStreamName
, sal_Int32 nOpenMode
)
97 throw ( ::com::sun::star::embed::InvalidStorageException
,
98 ::com::sun::star::lang::IllegalArgumentException
,
99 ::com::sun::star::packages::WrongPasswordException
,
100 ::com::sun::star::io::IOException
,
101 ::com::sun::star::embed::StorageWrappedTargetException
,
102 ::com::sun::star::uno::RuntimeException
);
104 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
openEncryptedStreamElement(
105 const OUString
& aStreamName
, sal_Int32 nOpenMode
, const OUString
& aPass
)
106 throw ( ::com::sun::star::embed::InvalidStorageException
,
107 ::com::sun::star::lang::IllegalArgumentException
,
108 ::com::sun::star::packages::NoEncryptionException
,
109 ::com::sun::star::packages::WrongPasswordException
,
110 ::com::sun::star::io::IOException
,
111 ::com::sun::star::embed::StorageWrappedTargetException
,
112 ::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> SAL_CALL
openStorageElement(
115 const OUString
& aStorName
, sal_Int32 nStorageMode
)
116 throw ( ::com::sun::star::embed::InvalidStorageException
,
117 ::com::sun::star::lang::IllegalArgumentException
,
118 ::com::sun::star::io::IOException
,
119 ::com::sun::star::embed::StorageWrappedTargetException
,
120 ::com::sun::star::uno::RuntimeException
);
122 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
cloneStreamElement(
123 const OUString
& aStreamName
)
124 throw ( ::com::sun::star::embed::InvalidStorageException
,
125 ::com::sun::star::lang::IllegalArgumentException
,
126 ::com::sun::star::packages::WrongPasswordException
,
127 ::com::sun::star::io::IOException
,
128 ::com::sun::star::embed::StorageWrappedTargetException
,
129 ::com::sun::star::uno::RuntimeException
);
131 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
cloneEncryptedStreamElement(
132 const OUString
& aStreamName
, const OUString
& aPass
)
133 throw ( ::com::sun::star::embed::InvalidStorageException
,
134 ::com::sun::star::lang::IllegalArgumentException
,
135 ::com::sun::star::packages::NoEncryptionException
,
136 ::com::sun::star::packages::WrongPasswordException
,
137 ::com::sun::star::io::IOException
,
138 ::com::sun::star::embed::StorageWrappedTargetException
,
139 ::com::sun::star::uno::RuntimeException
);
141 virtual void SAL_CALL
copyLastCommitTo(
142 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xTargetStorage
)
143 throw ( ::com::sun::star::embed::InvalidStorageException
,
144 ::com::sun::star::lang::IllegalArgumentException
,
145 ::com::sun::star::io::IOException
,
146 ::com::sun::star::embed::StorageWrappedTargetException
,
147 ::com::sun::star::uno::RuntimeException
);
149 virtual void SAL_CALL
copyStorageElementLastCommitTo(
150 const OUString
& aStorName
,
151 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xTargetStorage
)
152 throw ( ::com::sun::star::embed::InvalidStorageException
,
153 ::com::sun::star::lang::IllegalArgumentException
,
154 ::com::sun::star::io::IOException
,
155 ::com::sun::star::embed::StorageWrappedTargetException
,
156 ::com::sun::star::uno::RuntimeException
);
158 virtual sal_Bool SAL_CALL
isStreamElement( const OUString
& aElementName
)
159 throw ( ::com::sun::star::container::NoSuchElementException
,
160 ::com::sun::star::lang::IllegalArgumentException
,
161 ::com::sun::star::embed::InvalidStorageException
,
162 ::com::sun::star::uno::RuntimeException
);
164 virtual sal_Bool SAL_CALL
isStorageElement( const OUString
& aElementName
)
165 throw ( ::com::sun::star::container::NoSuchElementException
,
166 ::com::sun::star::lang::IllegalArgumentException
,
167 ::com::sun::star::embed::InvalidStorageException
,
168 ::com::sun::star::uno::RuntimeException
);
170 virtual void SAL_CALL
removeElement( const OUString
& aElementName
)
171 throw ( ::com::sun::star::embed::InvalidStorageException
,
172 ::com::sun::star::lang::IllegalArgumentException
,
173 ::com::sun::star::container::NoSuchElementException
,
174 ::com::sun::star::io::IOException
,
175 ::com::sun::star::embed::StorageWrappedTargetException
,
176 ::com::sun::star::uno::RuntimeException
);
178 virtual void SAL_CALL
renameElement( const OUString
& rEleName
, const OUString
& rNewName
)
179 throw ( ::com::sun::star::embed::InvalidStorageException
,
180 ::com::sun::star::lang::IllegalArgumentException
,
181 ::com::sun::star::container::NoSuchElementException
,
182 ::com::sun::star::container::ElementExistException
,
183 ::com::sun::star::io::IOException
,
184 ::com::sun::star::embed::StorageWrappedTargetException
,
185 ::com::sun::star::uno::RuntimeException
);
187 virtual void SAL_CALL
copyElementTo( const OUString
& aElementName
,
188 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
,
189 const OUString
& aNewName
)
190 throw ( ::com::sun::star::embed::InvalidStorageException
,
191 ::com::sun::star::lang::IllegalArgumentException
,
192 ::com::sun::star::container::NoSuchElementException
,
193 ::com::sun::star::container::ElementExistException
,
194 ::com::sun::star::io::IOException
,
195 ::com::sun::star::embed::StorageWrappedTargetException
,
196 ::com::sun::star::uno::RuntimeException
);
198 virtual void SAL_CALL
moveElementTo( const OUString
& aElementName
,
199 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
,
200 const OUString
& rNewName
)
201 throw ( ::com::sun::star::embed::InvalidStorageException
,
202 ::com::sun::star::lang::IllegalArgumentException
,
203 ::com::sun::star::container::NoSuchElementException
,
204 ::com::sun::star::container::ElementExistException
,
205 ::com::sun::star::io::IOException
,
206 ::com::sun::star::embed::StorageWrappedTargetException
,
207 ::com::sun::star::uno::RuntimeException
);
211 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
212 throw ( ::com::sun::star::container::NoSuchElementException
,
213 ::com::sun::star::lang::WrappedTargetException
,
214 ::com::sun::star::uno::RuntimeException
);
216 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
217 throw ( ::com::sun::star::uno::RuntimeException
);
219 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
220 throw ( ::com::sun::star::uno::RuntimeException
);
222 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
223 throw ( ::com::sun::star::uno::RuntimeException
);
225 virtual sal_Bool SAL_CALL
hasElements()
226 throw ( ::com::sun::star::uno::RuntimeException
);
230 virtual void SAL_CALL
dispose()
231 throw ( ::com::sun::star::uno::RuntimeException
);
233 virtual void SAL_CALL
addEventListener(
234 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
235 throw ( ::com::sun::star::uno::RuntimeException
);
237 virtual void SAL_CALL
removeEventListener(
238 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
239 throw ( ::com::sun::star::uno::RuntimeException
);
243 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
244 throw ( ::com::sun::star::uno::RuntimeException
);
246 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
247 throw ( ::com::sun::star::beans::UnknownPropertyException
,
248 ::com::sun::star::beans::PropertyVetoException
,
249 ::com::sun::star::lang::IllegalArgumentException
,
250 ::com::sun::star::lang::WrappedTargetException
,
251 ::com::sun::star::uno::RuntimeException
);
253 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
254 throw ( ::com::sun::star::beans::UnknownPropertyException
,
255 ::com::sun::star::lang::WrappedTargetException
,
256 ::com::sun::star::uno::RuntimeException
);
258 virtual void SAL_CALL
addPropertyChangeListener(
259 const OUString
& aPropertyName
,
260 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
261 throw ( ::com::sun::star::beans::UnknownPropertyException
,
262 ::com::sun::star::lang::WrappedTargetException
,
263 ::com::sun::star::uno::RuntimeException
);
265 virtual void SAL_CALL
removePropertyChangeListener(
266 const OUString
& aPropertyName
,
267 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
268 throw ( ::com::sun::star::beans::UnknownPropertyException
,
269 ::com::sun::star::lang::WrappedTargetException
,
270 ::com::sun::star::uno::RuntimeException
);
272 virtual void SAL_CALL
addVetoableChangeListener(
273 const OUString
& PropertyName
,
274 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
275 throw ( ::com::sun::star::beans::UnknownPropertyException
,
276 ::com::sun::star::lang::WrappedTargetException
,
277 ::com::sun::star::uno::RuntimeException
);
279 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
280 throw ( ::com::sun::star::beans::UnknownPropertyException
,
281 ::com::sun::star::lang::WrappedTargetException
,
282 ::com::sun::star::uno::RuntimeException
);
284 // XHierarchicalStorageAccess
286 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XExtendedStorageStream
> SAL_CALL
openStreamElementByHierarchicalName( const OUString
& sStreamPath
, ::sal_Int32 nOpenMode
)
287 throw ( ::com::sun::star::embed::InvalidStorageException
,
288 ::com::sun::star::lang::IllegalArgumentException
,
289 ::com::sun::star::packages::WrongPasswordException
,
290 ::com::sun::star::io::IOException
,
291 ::com::sun::star::embed::StorageWrappedTargetException
,
292 ::com::sun::star::uno::RuntimeException
);
294 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XExtendedStorageStream
> SAL_CALL
openEncryptedStreamElementByHierarchicalName( const OUString
& sStreamName
, ::sal_Int32 nOpenMode
, const OUString
& sPassword
)
295 throw ( ::com::sun::star::embed::InvalidStorageException
,
296 ::com::sun::star::lang::IllegalArgumentException
,
297 ::com::sun::star::packages::NoEncryptionException
,
298 ::com::sun::star::packages::WrongPasswordException
,
299 ::com::sun::star::io::IOException
,
300 ::com::sun::star::embed::StorageWrappedTargetException
,
301 ::com::sun::star::uno::RuntimeException
);
303 virtual void SAL_CALL
removeStreamElementByHierarchicalName( const OUString
& sElementPath
)
304 throw ( ::com::sun::star::embed::InvalidStorageException
,
305 ::com::sun::star::lang::IllegalArgumentException
,
306 ::com::sun::star::container::NoSuchElementException
,
307 ::com::sun::star::io::IOException
,
308 ::com::sun::star::embed::StorageWrappedTargetException
,
309 ::com::sun::star::uno::RuntimeException
);
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */