[Libreoffice-commits] .: svl/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Jan 10 12:39:52 PST 2011


 svl/source/misc/documentlockfile.cxx |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 28d658136b59513c0f253ec18e90b8c0031f9cc8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 10 20:39:41 2011 +0000

    Related: rhbz#668057 Some Support locking files on more than just file

diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx
index 7613cb8..d1c289a 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


More information about the Libreoffice-commits mailing list