LibreOffice Module oox (master) 1
zipstorage.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_OOX_HELPER_ZIPSTORAGE_HXX
21#define INCLUDED_OOX_HELPER_ZIPSTORAGE_HXX
22
23#include <vector>
24
25#include <com/sun/star/uno/Reference.hxx>
27#include <rtl/ustring.hxx>
28
29namespace 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; }
35}
36
37namespace oox {
38
39
41class ZipStorage final : public StorageBase
42{
43public:
44 explicit ZipStorage(
45 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
46 const css::uno::Reference< css::io::XInputStream >& rxInStream );
47
48 explicit ZipStorage(
49 const css::uno::Reference< css::uno::XComponentContext >& rxContext,
50 const css::uno::Reference< css::io::XStream >& rxStream );
51
52 virtual ~ZipStorage() override;
53
54private:
55 explicit ZipStorage(
56 const ZipStorage& rParentStorage,
57 const css::uno::Reference< css::embed::XStorage >& rxStorage,
58 const OUString& rElementName );
59
61 virtual bool implIsStorage() const override;
62
64 virtual css::uno::Reference< css::embed::XStorage >
65 implGetXStorage() const override;
66
68 virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const override;
69
71 virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing ) override;
72
74 virtual css::uno::Reference< css::io::XInputStream >
75 implOpenInputStream( const OUString& rElementName ) override;
76
78 virtual css::uno::Reference< css::io::XOutputStream >
79 implOpenOutputStream( const OUString& rElementName ) override;
80
82 virtual void implCommit() const override;
83
84private:
85 css::uno::Reference< css::embed::XStorage >
87};
88
89
90} // namespace oox
91
92#endif
93
94/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class for storage access implementations.
Definition: storagebase.hxx:52
Implements stream access for ZIP storages containing XML streams.
Definition: zipstorage.hxx:42
virtual css::uno::Reference< css::io::XOutputStream > implOpenOutputStream(const OUString &rElementName) override
Opens and returns the specified output stream from the storage.
Definition: zipstorage.cxx:175
virtual void implCommit() const override
Commits the current storage.
Definition: zipstorage.cxx:189
ZipStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::io::XInputStream > &rxInStream)
virtual css::uno::Reference< css::io::XInputStream > implOpenInputStream(const OUString &rElementName) override
Opens and returns the specified input stream from the storage.
Definition: zipstorage.cxx:161
virtual StorageRef implOpenSubStorage(const OUString &rElementName, bool bCreateMissing) override
Opens and returns the specified sub storage from the storage.
Definition: zipstorage.cxx:125
virtual void implGetElementNames(::std::vector< OUString > &orElementNames) const override
Returns the names of all elements of this storage.
Definition: zipstorage.cxx:111
virtual css::uno::Reference< css::embed::XStorage > implGetXStorage() const override
Returns the com.sun.star.embed.XStorage interface of the current storage.
Definition: zipstorage.cxx:106
css::uno::Reference< css::embed::XStorage > mxStorage
Storage based on input or output stream.
Definition: zipstorage.hxx:86
ZipStorage(const ZipStorage &rParentStorage, const css::uno::Reference< css::embed::XStorage > &rxStorage, const OUString &rElementName)
virtual bool implIsStorage() const override
Returns true, if the object represents a valid storage.
Definition: zipstorage.cxx:101
virtual ~ZipStorage() override
Definition: zipstorage.cxx:97
ZipStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::io::XStream > &rxStream)
std::shared_ptr< StorageBase > StorageRef
Definition: storagebase.hxx:42