24#include <com/sun/star/embed/ElementModes.hpp>
26#include <com/sun/star/embed/XTransactedObject.hpp>
28#include <rtl/ustrbuf.hxx>
34#define PATH_SEPARATOR_UNICODE u'/'
80 std::unique_lock aReadLock(
m_mutex);
81 css::uno::Reference< css::embed::XStorage > xParent =
m_xRoot;
85 css::uno::Reference< css::embed::XStorage > xChild;
88 for (
auto const& lFolder : lFolders)
97 TPath2StorageInfo::iterator pCheck =
m_lStorages.find(sCheckPath);
101 pInfo = &(pCheck->second);
117 catch(
const css::uno::RuntimeException&)
119 catch(
const css::uno::Exception&)
160 for (
auto const& lFolder : lFolders)
164 TPath2StorageInfo::iterator pCheck =
m_lStorages.find(sCheckPath);
169 lStoragesOfPath.clear();
170 return lStoragesOfPath;
174 lStoragesOfPath.push_back(rInfo.
Storage);
179 return lStoragesOfPath;
186 css::uno::Reference< css::embed::XTransactedObject > xCommit;
187 StorageHolder::TStorageList::reverse_iterator pIt;
188 for ( pIt = lStorages.rbegin();
189 pIt != lStorages.rend();
192 xCommit.set(*pIt, css::uno::UNO_QUERY);
200 std::unique_lock aReadLock(
m_mutex);
201 xCommit.set(
m_xRoot, css::uno::UNO_QUERY);
219 OUString sParentPath;
220 for (
auto & lFolder : lFolders)
223 lFolder = sCurrentRelPath;
224 sParentPath = sCurrentRelPath;
229 std::vector<OUString>::reverse_iterator pIt2;
230 for ( pIt2 = lFolders.rbegin();
231 pIt2 != lFolders.rend();
234 OUString sPath = *pIt2;
235 TPath2StorageInfo::iterator pPath =
m_lStorages.find(sPath);
255 TPath2StorageInfo::iterator pIt1 =
m_lStorages.find(sNormedPath);
260 for (
auto const& listener : rInfo.
Listener)
263 listener->changesOccurred();
268 const OUString& sPath )
274 TPath2StorageInfo::iterator pIt1 =
m_lStorages.find(sNormedPath);
279 TStorageListenerList::iterator pIt2 = ::std::find(rInfo.
Listener.begin(), rInfo.
Listener.end(), pListener);
281 rInfo.
Listener.push_back(pListener);
285 const OUString& sPath )
291 TPath2StorageInfo::iterator pIt1 =
m_lStorages.find(sNormedPath);
296 TStorageListenerList::iterator pIt2 = ::std::find(rInfo.
Listener.begin(), rInfo.
Listener.end(), pListener);
309 return lStorage.first;
326 sal_Int32 c = lFolders.size();
334 return css::uno::Reference< css::embed::XStorage >();
338 std::unique_lock aReadLock(
m_mutex);
345 OUStringBuffer sParentPath(64);
347 for (
i = 0;
i < c - 1; ++
i)
352 auto pParent =
m_lStorages.find(sParentPath.makeStringAndClear());
354 return pParent->second.Storage;
359 SAL_INFO(
"fwk",
"StorageHolder::getParentStorage(): Unexpected situation. Cached storage item seems to be wrong.");
360 return css::uno::Reference< css::embed::XStorage >();
372 const OUString& sSubStorage ,
379 css::uno::Reference< css::embed::XStorage > xSubStorage = xBaseStorage->openStorageElement(sSubStorage,
eOpenMode);
380 if (xSubStorage.is())
383 catch(
const css::uno::RuntimeException&)
387 catch(
const css::uno::Exception&)
390 if ((
eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE)
395 if ((
eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE)
396 throw css::uno::Exception();
401 sal_Int32 eNewMode = (
eOpenMode & ~css::embed::ElementModes::WRITE);
402 css::uno::Reference< css::embed::XStorage > xSubStorage = xBaseStorage->openStorageElement(sSubStorage, eNewMode);
403 if (xSubStorage.is())
407 SAL_INFO(
"fwk",
"openSubStorageWithFallback(): Unexpected situation! Got no exception for missing storage ...");
408 return css::uno::Reference< css::embed::XStorage >();
415 OUString sNormedPath = sPath;
421 if (sNormedPath.isEmpty())
433 std::vector<OUString> lToken;
440 lToken.push_back(sToken);
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.
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.
#define SAL_INFO(area, stream)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
#define PATH_SEPARATOR_UNICODE
constexpr OUStringLiteral PATH_SEPARATOR
TStorageListenerList Listener
css::uno::Reference< css::embed::XStorage > Storage
ElementOpenMode eOpenMode