diff options
Diffstat (limited to 'svl/source/misc/msodocumentlockfile.cxx')
-rw-r--r-- | svl/source/misc/msodocumentlockfile.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/svl/source/misc/msodocumentlockfile.cxx b/svl/source/misc/msodocumentlockfile.cxx index ddb5de6c5632..432fb6e07ecd 100644 --- a/svl/source/misc/msodocumentlockfile.cxx +++ b/svl/source/misc/msodocumentlockfile.cxx @@ -11,10 +11,13 @@ #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <algorithm> +#include <ucbhelper/content.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/io/IOException.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> namespace svt { @@ -179,6 +182,17 @@ void MSODocumentLockFile::WriteEntryToStream( xOutput->writeBytes(aData); } +css::uno::Reference<css::io::XInputStream> MSODocumentLockFile::OpenStream() +{ + ::osl::MutexGuard aGuard(m_aMutex); + + css::uno::Reference<css::ucb::XCommandEnvironment> xEnv; + ::ucbhelper::Content aSourceContent(GetURL(), xEnv, comphelper::getProcessComponentContext()); + + // the file can be opened readonly, no locking will be done + return aSourceContent.openStreamNoLock(); +} + LockFileEntry MSODocumentLockFile::GetLockData() { ::osl::MutexGuard aGuard(m_aMutex); |