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
{ namespace sun
{ namespace 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
; }
43 /** Implements stream access for binary OLE storages. */
44 class OOX_DLLPUBLIC OleStorage
: public StorageBase
48 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
49 const css::uno::Reference
< css::io::XInputStream
>& rxInStream
,
50 bool bBaseStreamAccess
);
53 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
54 const css::uno::Reference
< css::io::XStream
>& rxOutStream
,
55 bool bBaseStreamAccess
);
57 virtual ~OleStorage() override
;
61 const OleStorage
& rParentStorage
,
62 const css::uno::Reference
< css::container::XNameContainer
>& rxStorage
,
63 const OUString
& rElementName
,
66 const OleStorage
& rParentStorage
,
67 const css::uno::Reference
< css::io::XStream
>& rxOutStream
,
68 const OUString
& rElementName
);
70 /** Initializes the API storage object for input. */
71 void initStorage( const css::uno::Reference
< css::io::XInputStream
>& rxInStream
);
72 /** Initializes the API storage object for input/output. */
73 void initStorage( const css::uno::Reference
< css::io::XStream
>& rxOutStream
);
75 /** Returns true, if the object represents a valid storage. */
76 virtual bool implIsStorage() const override
;
78 /** Returns the com.sun.star.embed.XStorage interface of the current storage.
81 This function is not implemented for binary OLE storages.
83 virtual css::uno::Reference
< css::embed::XStorage
>
84 implGetXStorage() const override
;
86 /** Returns the names of all elements of this storage. */
87 virtual void implGetElementNames( ::std::vector
< OUString
>& orElementNames
) const override
;
89 /** Opens and returns the specified sub storage from the storage. */
90 virtual StorageRef
implOpenSubStorage( const OUString
& rElementName
, bool bCreateMissing
) override
;
92 /** Opens and returns the specified input stream from the storage. */
93 virtual css::uno::Reference
< css::io::XInputStream
>
94 implOpenInputStream( const OUString
& rElementName
) override
;
96 /** Opens and returns the specified output stream from the storage. */
97 virtual css::uno::Reference
< css::io::XOutputStream
>
98 implOpenOutputStream( const OUString
& rElementName
) override
;
100 /** Commits the current storage. */
101 virtual void implCommit() const override
;
104 css::uno::Reference
< css::uno::XComponentContext
>
105 mxContext
; ///< Component context with service manager.
106 css::uno::Reference
< css::container::XNameContainer
>
107 mxStorage
; ///< Access to elements of this sub storage.
108 const OleStorage
* mpParentStorage
; ///< Parent OLE storage that contains this storage.
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */