[Libreoffice-commits] .: Branch 'libreoffice-3-5' - officecfg/registry sfx2/source test/user-template
Fridrich Strba
fridrich at kemper.freedesktop.org
Tue Jan 17 03:47:10 PST 2012
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 +++
sfx2/source/doc/docfile.cxx | 30 +++++++++++++
test/user-template/registry/modifications.xcd | 13 +++++
3 files changed, 50 insertions(+)
New commits:
commit a8e838010cd167e0d709c03819e2f243b66f98a3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jan 13 03:34:28 2012 +0100
don't create lock files for unit tests
special thanks to Stephan for the configuration part
Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 2cee667..c74e508 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -6269,6 +6269,13 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="UseLocking" oor:type="xs:boolean">
+ <info>
+ <desc>Allows to specify whether locking should be used at all.
+ Use this setting only for debugging purpose.</desc>
+ </info>
+ <value>true</value>
+ </prop>
<prop oor:name="ShowLinkWarningDialog" oor:type="xs:boolean">
<info>
<author>THB</author>
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index fd2fb1e..b9aeb16 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 ) ) )
diff --git a/test/user-template/registry/modifications.xcd b/test/user-template/registry/modifications.xcd
index d323645..5291c82 100644
--- a/test/user-template/registry/modifications.xcd
+++ b/test/user-template/registry/modifications.xcd
@@ -27,6 +27,19 @@
* instead of those above.
-->
<oor:data xmlns:oor="http://openoffice.org/2001/registry">
+ <oor:component-data oor:name="Common" oor:package="org.openoffice.Office">
+ <node oor:name="Misc">
+ <prop oor:name="UseDocumentSystemFileLocking">
+ <value>false</value>
+ </prop>
+ <prop oor:name="UseDocumentOOoLockFile">
+ <value>false</value>
+ </prop>
+ <prop oor:name="UseLocking">
+ <value>false</value>
+ </prop>
+ </node>
+ </oor:component-data>
<oor:component-data oor:name="Paths" oor:package="org.openoffice.Office">
<node oor:name="Paths">
<node oor:name="UIConfig" oor:op="replace">
More information about the Libreoffice-commits
mailing list