summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-13 03:34:28 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-15 04:05:20 +0100
commit300b39cca53d770211312319338688bcbc3c4f28 (patch)
treea4eaa905dbdee35fd8514e8952f28b8d9b701c52 /sfx2
parentvcl: rename methods to crisp up a 'DisplayScreen' naming concept (diff)
downloadcore-300b39cca53d770211312319338688bcbc3c4f28.tar.gz
core-300b39cca53d770211312319338688bcbc3c4f28.zip
don't create lock files for unit tests
special thanks to Stephan for the configuration part
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/docfile.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index af6915890f89..d2089b2b9968 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -202,6 +202,31 @@ sal_Bool IsOOoLockFileUsed()
return bOOoLockFileUsed;
}
+bool IsLockingUsed()
+{
+ bool bLocking = true;
+ try
+ {
+
+ uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
+ ::comphelper::getProcessServiceFactory(),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+ ::comphelper::ConfigurationHelper::E_STANDARD );
+ if ( !xCommonConfig.is() )
+ throw uno::RuntimeException();
+
+ ::comphelper::ConfigurationHelper::readRelativeKey(
+ xCommonConfig,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ),
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseLocking" ) ) ) >>= bLocking;
+ }
+ catch( const uno::Exception& )
+ {
+ }
+
+ return bLocking;
+}
+
} // anonymous namespace
//==========================================================
@@ -996,6 +1021,11 @@ sal_Bool SfxMedium::LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI )
// if user cancel the loading the ERROR_ABORT is set
sal_Bool bResult = sal_False;
+ if (!IsLockingUsed())
+ {
+ return sal_True;
+ }
+
if ( !GetURLObject().HasError() ) try
{
if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )