diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-01-10 20:39:41 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-01-10 20:39:41 +0000 |
commit | 5c40918d075fc5fa393d18e73d16382540a3b20d (patch) | |
tree | 9c27ef0195a3f774c4ac89ed42c4687093c22104 /svl/source/misc/documentlockfile.cxx | |
parent | 571b26b82670dd6e5b34579d688d590a2da236af (diff) |
Related: rhbz#668057 Some Support locking files on more than just file
Diffstat (limited to 'svl/source/misc/documentlockfile.cxx')
-rw-r--r-- | svl/source/misc/documentlockfile.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx index 12f98ce326ea..286bf282ed7f 100644 --- a/svl/source/misc/documentlockfile.cxx +++ b/svl/source/misc/documentlockfile.cxx @@ -171,13 +171,11 @@ uno::Reference< io::XInputStream > DocumentLockFile::OpenStream() { ::osl::MutexGuard aGuard( m_aMutex ); - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( - xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), - uno::UNO_QUERY_THROW ); + uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; + ::ucbhelper::Content aSourceContent( m_aURL, xEnv ); // the file can be opened readonly, no locking will be done - return xSimpleFileAccess->openFileRead( m_aURL ); + return aSourceContent.openStream(); } // ---------------------------------------------------------------------- @@ -224,11 +222,10 @@ void DocumentLockFile::RemoveFile() || !aFileData[LOCKFILE_USERURL_ID].equals( aNewEntry[LOCKFILE_USERURL_ID] ) ) throw io::IOException(); // not the owner, access denied - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess( - xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), - uno::UNO_QUERY_THROW ); - xSimpleFileAccess->kill( m_aURL ); + uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; + ::ucbhelper::Content aCnt(m_aURL, xEnv); + aCnt.executeCommand(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), + uno::makeAny(sal_Bool(sal_True))); } } // namespace svt |