diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-01-13 03:34:28 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-01-17 12:46:30 +0100 |
commit | a8e838010cd167e0d709c03819e2f243b66f98a3 (patch) | |
tree | 53c03917a99379f9215fd1d25418ac4895130783 /sfx2 | |
parent | 2fe402cefb5d06bc33b4e0794b7da0b62be68432 (diff) |
don't create lock files for unit tests
special thanks to Stephan for the configuration part
Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index fd2fb1ecfbc7..b9aeb16687e7 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -207,6 +207,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 //========================================================== @@ -1001,6 +1026,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 ) ) ) |