summaryrefslogtreecommitdiff
path: root/framework/source
diff options
context:
space:
mode:
Diffstat (limited to 'framework/source')
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx8
-rw-r--r--framework/source/accelerators/storageholder.cxx49
-rw-r--r--framework/source/inc/accelerators/storageholder.hxx14
3 files changed, 9 insertions, 62 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 08aa8b548bf3..935d9f399fda 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -279,11 +279,9 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::store()
void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::Reference< css::embed::XStorage >& xStorage)
{
- css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback(
- xStorage,
- TARGET_CURRENT,
- css::embed::ElementModes::READWRITE,
- false); // False => no fallback from read/write to readonly!
+ // no fallback from read/write to readonly!
+ css::uno::Reference< css::io::XStream > xStream = xStorage->openStreamElement(TARGET_CURRENT, css::embed::ElementModes::READWRITE);
+
css::uno::Reference< css::io::XOutputStream > xOut;
if (xStream.is())
xOut = xStream->getOutputStream();
diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx
index 0b29d038d1b2..b444fa30da27 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -129,7 +129,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openPath(const OUStri
try
{
- xChild = StorageHolder::openSubStorageWithFallback(xParent, sChild, nOpenMode, true); // TODO think about delegating fallback decision to our own caller!
+ xChild = StorageHolder::openSubStorageWithFallback(xParent, sChild, nOpenMode); // TODO think about delegating fallback decision to our own caller!
}
catch(const css::uno::RuntimeException&)
{ throw; }
@@ -403,8 +403,7 @@ StorageHolder& StorageHolder::operator=(const StorageHolder& rCopy)
css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
const OUString& sSubStorage ,
- sal_Int32 eOpenMode ,
- bool bAllowFallback)
+ sal_Int32 eOpenMode)
{
// a) try it first with user specified open mode
// ignore errors ... but save it for later use!
@@ -421,10 +420,7 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFal
{ exResult = ex; }
// b) readonly already tried? => forward last error!
- if (
- (!bAllowFallback ) || // fallback allowed ?
- ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ?
- )
+ if ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ?
throw exResult;
// c) try it readonly
@@ -440,45 +436,6 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFal
return css::uno::Reference< css::embed::XStorage >();
}
-css::uno::Reference< css::io::XStream > StorageHolder::openSubStreamWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
- const OUString& sSubStream ,
- sal_Int32 eOpenMode ,
- bool bAllowFallback)
-{
- // a) try it first with user specified open mode
- // ignore errors ... but save it for later use!
- css::uno::Exception exResult;
- try
- {
- css::uno::Reference< css::io::XStream > xSubStream = xBaseStorage->openStreamElement(sSubStream, eOpenMode);
- if (xSubStream.is())
- return xSubStream;
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception& ex)
- { exResult = ex; }
-
- // b) readonly already tried? => forward last error!
- if (
- (!bAllowFallback ) || // fallback allowed ?
- ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ?
- )
- throw exResult;
-
- // c) try it readonly
- // don't catch exception here! Outside code wish to know, if operation failed or not.
- // Otherwise they work on NULL references ...
- sal_Int32 eNewMode = (eOpenMode & ~css::embed::ElementModes::WRITE);
- css::uno::Reference< css::io::XStream > xSubStream = xBaseStorage->openStreamElement(sSubStream, eNewMode);
- if (xSubStream.is())
- return xSubStream;
-
- // d) no chance!
- SAL_INFO("fwk", "openSubStreamWithFallbacks(): Unexpected situation! Got no exception for missing stream ...");
- return css::uno::Reference< css::io::XStream >();
-}
-
OUString StorageHolder::impl_st_normPath(const OUString& sPath)
{
// path must start without "/" but end with "/"!
diff --git a/framework/source/inc/accelerators/storageholder.hxx b/framework/source/inc/accelerators/storageholder.hxx
index 43d7e1ba75f8..5ccb443b18f0 100644
--- a/framework/source/inc/accelerators/storageholder.hxx
+++ b/framework/source/inc/accelerators/storageholder.hxx
@@ -141,6 +141,8 @@ class StorageHolder final
StorageHolder& operator=(const StorageHolder& rCopy);
/** @short opens a sub element of the specified base storage.
+ If eOpenMode contains an ELEMENT_WRITE flag remove it and try it with the rest of eOpenMode flags
+ again.
@descr First this method try to open the requested sub element
using the given open mode. If it failed there is second step,
@@ -158,20 +160,10 @@ class StorageHolder final
@param eOpenMode
a flag field, which set the open mode for this operation.
- @param bAllowFallback
- if eOpenMode contains an ELEMENT_WRITE flag this parameter
- allow to remove it and try it with the rest of eOpenMode flags
- again.
*/
static css::uno::Reference< css::embed::XStorage > openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
const OUString& sSubStorage ,
- sal_Int32 eOpenMode ,
- bool bAllowFallback);
-
- static css::uno::Reference< css::io::XStream > openSubStreamWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage ,
- const OUString& sSubStream ,
- sal_Int32 eOpenMode ,
- bool bAllowFallback);
+ sal_Int32 eOpenMode);
// helper
private: