Line data Source code
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_OLE_OLESTORAGE_HXX
21 : #define INCLUDED_OOX_OLE_OLESTORAGE_HXX
22 :
23 : #include <oox/helper/storagebase.hxx>
24 :
25 : namespace com { namespace sun { namespace star {
26 : namespace container { class XNameContainer; }
27 : namespace uno { class XComponentContext; }
28 : } } }
29 :
30 : namespace oox {
31 : namespace ole {
32 :
33 :
34 :
35 : /** Implements stream access for binary OLE storages. */
36 : class OOX_DLLPUBLIC OleStorage : public StorageBase
37 : {
38 : public:
39 : explicit OleStorage(
40 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
41 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
42 : bool bBaseStreamAccess );
43 :
44 : explicit OleStorage(
45 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
46 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
47 : bool bBaseStreamAccess );
48 :
49 : virtual ~OleStorage();
50 :
51 : private:
52 : explicit OleStorage(
53 : const OleStorage& rParentStorage,
54 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxStorage,
55 : const OUString& rElementName,
56 : bool bReadOnly );
57 : explicit OleStorage(
58 : const OleStorage& rParentStorage,
59 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream,
60 : const OUString& rElementName );
61 :
62 : /** Initializes the API storage object for input. */
63 : void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream );
64 : /** Initializes the API storage object for input/output. */
65 : void initStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream );
66 :
67 : /** Returns true, if the object represents a valid storage. */
68 : virtual bool implIsStorage() const SAL_OVERRIDE;
69 :
70 : /** Returns the com.sun.star.embed.XStorage interface of the current storage.
71 :
72 : @attention
73 : This function is not implemented for binary OLE storages.
74 : */
75 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
76 : implGetXStorage() const SAL_OVERRIDE;
77 :
78 : /** Returns the names of all elements of this storage. */
79 : virtual void implGetElementNames( ::std::vector< OUString >& orElementNames ) const SAL_OVERRIDE;
80 :
81 : /** Opens and returns the specified sub storage from the storage. */
82 : virtual StorageRef implOpenSubStorage( const OUString& rElementName, bool bCreateMissing ) SAL_OVERRIDE;
83 :
84 : /** Opens and returns the specified input stream from the storage. */
85 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
86 : implOpenInputStream( const OUString& rElementName ) SAL_OVERRIDE;
87 :
88 : /** Opens and returns the specified output stream from the storage. */
89 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
90 : implOpenOutputStream( const OUString& rElementName ) SAL_OVERRIDE;
91 :
92 : /** Commits the current storage. */
93 : virtual void implCommit() const SAL_OVERRIDE;
94 :
95 : private:
96 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
97 : mxContext; ///< Component context with service manager.
98 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
99 : mxStorage; ///< Access to elements of this sub storage.
100 : const OleStorage* mpParentStorage; ///< Parent OLE storage that contains this storage.
101 : };
102 :
103 :
104 :
105 : } // namespace ole
106 0 : } // namespace oox
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|