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_OOX_OLE_OLESTORAGE_HXX
21 #define INCLUDED_OOX_OLE_OLESTORAGE_HXX
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <oox/dllapi.h>
27 #include <oox/helper/storagebase.hxx>
28 #include <rtl/ustring.hxx>
30 namespace com::sun::star
{
31 namespace container
{ class XNameContainer
; }
32 namespace embed
{ class XStorage
; }
33 namespace io
{ class XInputStream
; }
34 namespace io
{ class XOutputStream
; }
35 namespace io
{ class XStream
; }
36 namespace uno
{ class XComponentContext
; }
42 /** Implements stream access for binary OLE storages. */
43 class OOX_DLLPUBLIC OleStorage final
: public StorageBase
47 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
48 const css::uno::Reference
< css::io::XInputStream
>& rxInStream
,
49 bool bBaseStreamAccess
);
52 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
53 const css::uno::Reference
< css::io::XStream
>& rxOutStream
,
54 bool bBaseStreamAccess
);
56 virtual ~OleStorage() override
;
60 const OleStorage
& rParentStorage
,
61 const css::uno::Reference
< css::container::XNameContainer
>& rxStorage
,
62 const OUString
& rElementName
,
65 const OleStorage
& rParentStorage
,
66 const css::uno::Reference
< css::io::XStream
>& rxOutStream
,
67 const OUString
& rElementName
);
69 /** Initializes the API storage object for input. */
70 void initStorage( const css::uno::Reference
< css::io::XInputStream
>& rxInStream
);
71 /** Initializes the API storage object for input/output. */
72 void initStorage( const css::uno::Reference
< css::io::XStream
>& rxOutStream
);
74 /** Returns true, if the object represents a valid storage. */
75 virtual bool implIsStorage() const override
;
77 /** Returns the com.sun.star.embed.XStorage interface of the current storage.
80 This function is not implemented for binary OLE storages.
82 virtual css::uno::Reference
< css::embed::XStorage
>
83 implGetXStorage() const override
;
85 /** Returns the names of all elements of this storage. */
86 virtual void implGetElementNames( ::std::vector
< OUString
>& orElementNames
) const override
;
88 /** Opens and returns the specified sub storage from the storage. */
89 virtual StorageRef
implOpenSubStorage( const OUString
& rElementName
, bool bCreateMissing
) override
;
91 /** Opens and returns the specified input stream from the storage. */
92 virtual css::uno::Reference
< css::io::XInputStream
>
93 implOpenInputStream( const OUString
& rElementName
) override
;
95 /** Opens and returns the specified output stream from the storage. */
96 virtual css::uno::Reference
< css::io::XOutputStream
>
97 implOpenOutputStream( const OUString
& rElementName
) override
;
99 /** Commits the current storage. */
100 virtual void implCommit() const override
;
103 css::uno::Reference
< css::uno::XComponentContext
>
104 mxContext
; ///< Component context with service manager.
105 css::uno::Reference
< css::container::XNameContainer
>
106 mxStorage
; ///< Access to elements of this sub storage.
107 const OleStorage
* mpParentStorage
; ///< Parent OLE storage that contains this storage.
111 } // namespace oox::ole
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */