LibreOffice Module framework (master) 1
storageholder.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#pragma once
21
22#include <com/sun/star/embed/XStorage.hpp>
23
24#include <mutex>
25#include <unordered_map>
26#include <vector>
27
28namespace framework
29{
30
31class XMLBasedAcceleratorConfiguration;
35class StorageHolder final
36{
37
38 // types
39 public:
40
42 typedef ::std::vector< css::uno::Reference< css::embed::XStorage > > TStorageList;
43
44 typedef ::std::vector< XMLBasedAcceleratorConfiguration* > TStorageListenerList;
45
47 {
48 public:
49 css::uno::Reference< css::embed::XStorage > Storage;
50 sal_Int32 UseCount;
52
54 : UseCount(0)
55 {}
56 };
57
59 typedef std::unordered_map< OUString,
61
62 // member
63 private:
64 mutable std::mutex m_mutex;
65
67 css::uno::Reference< css::embed::XStorage > m_xRoot;
68
71
72 // interface
73 public:
74
78
82
86
89 void setRootStorage(const css::uno::Reference< css::embed::XStorage >& xRoot);
90
93 css::uno::Reference< css::embed::XStorage > getRootStorage() const;
94
98 css::uno::Reference< css::embed::XStorage > openPath(const OUString& sPath ,
99 sal_Int32 nOpenMode);
100
103 StorageHolder::TStorageList getAllPathStorages(const OUString& sPath);
104
107 void commitPath(const OUString& sPath);
108
111 void closePath(const OUString& sPath);
112
115 void notifyPath(const OUString& sPath);
116
120 const OUString& sPath );
121
125 const OUString& sPath );
126
129 OUString getPathOfStorage(const css::uno::Reference< css::embed::XStorage >& xStorage);
130
133 css::uno::Reference< css::embed::XStorage > getParentStorage(const css::uno::Reference< css::embed::XStorage >& xChild);
134
137 css::uno::Reference< css::embed::XStorage > getParentStorage(const OUString& sChildPath);
138
142
164 static css::uno::Reference< css::embed::XStorage > openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
165 const OUString& sSubStorage ,
166 sal_Int32 eOpenMode);
167
168 // helper
169 private:
170
173 static OUString impl_st_normPath(const OUString& sPath);
174
177 static std::vector<OUString> impl_st_parsePath(std::u16string_view sPath);
178};
179
180} // namespace framework
181
182/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void removeStorageListener(XMLBasedAcceleratorConfiguration *pListener, const OUString &sPath)
TODO.
static std::vector< OUString > impl_st_parsePath(std::u16string_view sPath)
TODO.
StorageHolder & operator=(const StorageHolder &rCopy)
TODO.
void commitPath(const OUString &sPath)
TODO.
css::uno::Reference< css::embed::XStorage > getRootStorage() const
TODO.
OUString getPathOfStorage(const css::uno::Reference< css::embed::XStorage > &xStorage)
TODO.
void forgetCachedStorages()
TODO.
StorageHolder::TStorageList getAllPathStorages(const OUString &sPath)
TODO.
void setRootStorage(const css::uno::Reference< css::embed::XStorage > &xRoot)
TODO.
void closePath(const OUString &sPath)
TODO.
css::uno::Reference< css::embed::XStorage > getParentStorage(const css::uno::Reference< css::embed::XStorage > &xChild)
TODO.
css::uno::Reference< css::embed::XStorage > m_xRoot
TODO.
std::unordered_map< OUString, TStorageInfo > TPath2StorageInfo
TODO.
::std::vector< XMLBasedAcceleratorConfiguration * > TStorageListenerList
void notifyPath(const OUString &sPath)
TODO.
static css::uno::Reference< css::embed::XStorage > openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage > &xBaseStorage, const OUString &sSubStorage, sal_Int32 eOpenMode)
opens a sub element of the specified base storage.
void addStorageListener(XMLBasedAcceleratorConfiguration *pListener, const OUString &sPath)
TODO.
::std::vector< css::uno::Reference< css::embed::XStorage > > TStorageList
TODO.
TPath2StorageInfo m_lStorages
TODO.
css::uno::Reference< css::embed::XStorage > openPath(const OUString &sPath, sal_Int32 nOpenMode)
TODO open or get!
static OUString impl_st_normPath(const OUString &sPath)
TODO.
implements a read/write access to the accelerator configuration.
css::uno::Reference< css::embed::XStorage > Storage