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_HELPER_ZIPSTORAGE_HXX
21 #define INCLUDED_OOX_HELPER_ZIPSTORAGE_HXX
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <oox/helper/storagebase.hxx>
27 #include <rtl/ustring.hxx>
29 namespace com::sun::star
{
30 namespace embed
{ class XStorage
; }
31 namespace io
{ class XInputStream
; }
32 namespace io
{ class XOutputStream
; }
33 namespace io
{ class XStream
; }
34 namespace uno
{ class XComponentContext
; }
40 /** Implements stream access for ZIP storages containing XML streams. */
41 class ZipStorage final
: public StorageBase
45 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
46 const css::uno::Reference
< css::io::XInputStream
>& rxInStream
);
49 const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
,
50 const css::uno::Reference
< css::io::XStream
>& rxStream
);
52 virtual ~ZipStorage() override
;
56 const ZipStorage
& rParentStorage
,
57 const css::uno::Reference
< css::embed::XStorage
>& rxStorage
,
58 const OUString
& rElementName
);
60 /** Returns true, if the object represents a valid storage. */
61 virtual bool implIsStorage() const override
;
63 /** Returns the com.sun.star.embed.XStorage interface of the current storage. */
64 virtual css::uno::Reference
< css::embed::XStorage
>
65 implGetXStorage() const override
;
67 /** Returns the names of all elements of this storage. */
68 virtual void implGetElementNames( ::std::vector
< OUString
>& orElementNames
) const override
;
70 /** Opens and returns the specified sub storage from the storage. */
71 virtual StorageRef
implOpenSubStorage( const OUString
& rElementName
, bool bCreateMissing
) override
;
73 /** Opens and returns the specified input stream from the storage. */
74 virtual css::uno::Reference
< css::io::XInputStream
>
75 implOpenInputStream( const OUString
& rElementName
) override
;
77 /** Opens and returns the specified output stream from the storage. */
78 virtual css::uno::Reference
< css::io::XOutputStream
>
79 implOpenOutputStream( const OUString
& rElementName
) override
;
81 /** Commits the current storage. */
82 virtual void implCommit() const override
;
85 css::uno::Reference
< css::embed::XStorage
>
86 mxStorage
; ///< Storage based on input or output stream.
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */