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 .
22 #include <com/sun/star/embed/XStorage.hpp>
25 #include <unordered_map>
31 class XMLBasedAcceleratorConfiguration
;
35 class StorageHolder final
42 typedef ::std::vector
< css::uno::Reference
< css::embed::XStorage
> > TStorageList
;
44 typedef ::std::vector
< XMLBasedAcceleratorConfiguration
* > TStorageListenerList
;
49 css::uno::Reference
< css::embed::XStorage
> Storage
;
51 TStorageListenerList Listener
;
59 typedef std::unordered_map
< OUString
,
60 TStorageInfo
> TPath2StorageInfo
;
64 mutable std::mutex m_mutex
;
67 css::uno::Reference
< css::embed::XStorage
> m_xRoot
;
70 TPath2StorageInfo m_lStorages
;
85 void forgetCachedStorages();
89 void setRootStorage(const css::uno::Reference
< css::embed::XStorage
>& xRoot
);
93 css::uno::Reference
< css::embed::XStorage
> getRootStorage() const;
98 css::uno::Reference
< css::embed::XStorage
> openPath(const OUString
& sPath
,
103 StorageHolder::TStorageList
getAllPathStorages(const OUString
& sPath
);
107 void commitPath(const OUString
& sPath
);
111 void closePath(const OUString
& sPath
);
115 void notifyPath(const OUString
& sPath
);
119 void addStorageListener( XMLBasedAcceleratorConfiguration
* pListener
,
120 const OUString
& sPath
);
124 void removeStorageListener( XMLBasedAcceleratorConfiguration
* pListener
,
125 const OUString
& sPath
);
129 OUString
getPathOfStorage(const css::uno::Reference
< css::embed::XStorage
>& xStorage
);
133 css::uno::Reference
< css::embed::XStorage
> getParentStorage(const css::uno::Reference
< css::embed::XStorage
>& xChild
);
137 css::uno::Reference
< css::embed::XStorage
> getParentStorage(const OUString
& sChildPath
);
141 StorageHolder
& operator=(const StorageHolder
& rCopy
);
143 /** @short opens a sub element of the specified base storage.
144 If eOpenMode contains an ELEMENT_WRITE flag remove it and try it with the rest of eOpenMode flags
147 @descr First this method try to open the requested sub element
148 using the given open mode. If it failed there is second step,
149 which tries to do the same again ... but removing a might existing
150 WRITE flag from the open mode. The user can suppress this fallback
151 handling by setting the parameter bAllowFallback to sal_False.
154 the storage, where the sub element should be searched.
157 the full name of the sub element.
161 a flag field, which set the open mode for this operation.
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
);
173 static OUString
impl_st_normPath(const OUString
& sPath
);
177 static std::vector
<OUString
> impl_st_parsePath(std::u16string_view sPath
);
180 } // namespace framework
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */