summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2013-07-26 22:10:15 +0200
committerJulien Nabet <serval2412@yahoo.fr>2013-07-26 22:10:30 +0200
commitc02b3f8517e159c462a288d82e3b62cc4b2ab682 (patch)
tree852f46b675c21518feaa168504ebf4e50292038d
parent225d50da607a8a4115f45b2c433cb280fac70361 (diff)
fdo#46037: less occurrences of comphelper/configurationhelper in sfx2/doc
Change-Id: Id1416ae6c1efaa251a979ac67e90b5261f64bd9a
-rw-r--r--sfx2/source/doc/docfile.cxx47
-rw-r--r--sfx2/source/doc/guisaveas.cxx51
-rw-r--r--sfx2/source/doc/objmisc.cxx1
-rw-r--r--sfx2/source/doc/objstor.cxx1
4 files changed, 17 insertions, 83 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index ef2f85e2f846..8a93ef20a36b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -88,7 +88,6 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/mediadescriptor.hxx>
-#include <comphelper/configurationhelper.hxx>
#include <comphelper/docpasswordhelper.hxx>
#include <tools/inetmime.hxx>
#include <unotools/ucblockbytes.hxx>
@@ -141,55 +140,13 @@ static const sal_Int8 LOCK_UI_TRY = 2;
bool IsSystemFileLockingUsed()
{
- // check whether system file locking has been used, the default value is false
- bool bUseSystemLock = false;
- try
- {
-
- uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
- ::comphelper::getProcessComponentContext(),
- OUString( "/org.openoffice.Office.Common" ),
- ::comphelper::ConfigurationHelper::E_STANDARD );
- if ( !xCommonConfig.is() )
- throw uno::RuntimeException();
-
- ::comphelper::ConfigurationHelper::readRelativeKey(
- xCommonConfig,
- OUString( "Misc/" ),
- OUString( "UseDocumentSystemFileLocking" ) ) >>= bUseSystemLock;
- }
- catch( const uno::Exception& )
- {
- }
-
- return bUseSystemLock;
+ return officecfg::Office::Common::Misc::UseDocumentSystemFileLocking::get();
}
//----------------------------------------------------------------
bool IsOOoLockFileUsed()
{
- // check whether system file locking has been used, the default value is false
- bool bOOoLockFileUsed = false;
- try
- {
-
- uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
- ::comphelper::getProcessComponentContext(),
- OUString( "/org.openoffice.Office.Common" ),
- ::comphelper::ConfigurationHelper::E_STANDARD );
- if ( !xCommonConfig.is() )
- throw uno::RuntimeException();
-
- ::comphelper::ConfigurationHelper::readRelativeKey(
- xCommonConfig,
- OUString( "Misc/" ),
- OUString( "UseDocumentOOoLockFile" ) ) >>= bOOoLockFileUsed;
- }
- catch( const uno::Exception& )
- {
- }
-
- return bOOoLockFileUsed;
+ return officecfg::Office::Common::Misc::UseDocumentOOoLockFile::get();
}
bool IsLockingUsed()
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index dcb233a14b4e..5afd2c1b5635 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -61,7 +61,6 @@
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/configurationhelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/window.hxx>
@@ -91,6 +90,8 @@
#include <com/sun/star/frame/Desktop.hpp>
+#include <officecfg/Office/Common.hxx>
+
// flags that specify requested operation
#define EXPORT_REQUESTED 1
#define PDFEXPORT_REQUESTED 2
@@ -646,42 +647,20 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
if ( nResult != STATUS_NO_ACTION && GetStorable()->hasLocation() )
{
- // check whether save is acceptable by the configuration
- // it is done only for documents that have persistence already
- uno::Reference< uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig(
- comphelper::getProcessComponentContext(),
- OUString( "/org.openoffice.Office.Common" ),
- ::comphelper::ConfigurationHelper::E_STANDARD );
- if ( !xCommonConfig.is() )
- throw uno::RuntimeException(); // should the saving proceed as usual instead?
-
- try
- {
- sal_Bool bAlwaysSaveAs = sal_False;
-
- // the saving is acceptable
- // in case the configuration entry is not set or set to false
- // or in case of version creation
- OUString aVersionCommentString = OUString("VersionComment");
- if ( ( ::comphelper::ConfigurationHelper::readRelativeKey(
- xCommonConfig,
- OUString( "Save/Document/" ),
- OUString( "AlwaysSaveAs" ) ) >>= bAlwaysSaveAs )
- && bAlwaysSaveAs
- && GetMediaDescr().find( aVersionCommentString ) == GetMediaDescr().end() )
- {
- // notify the user that SaveAs is going to be done
- Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel );
- QueryBox aMessageBox( pWin, WB_OK_CANCEL | WB_DEF_OK, SfxResId(STR_NEW_FILENAME_SAVE).toString() );
- if ( aMessageBox.Execute() == RET_OK )
- nResult = STATUS_SAVEAS;
- else
- nResult = STATUS_NO_ACTION;
- }
- }
- catch( const uno::Exception& )
+ // the saving is acceptable
+ // in case the configuration entry is not set or set to false
+ // or in case of version creation
+ OUString aVersionCommentString = OUString("VersionComment");
+ if ( officecfg::Office::Common::Save::Document::AlwaysSaveAs::get()
+ && GetMediaDescr().find( aVersionCommentString ) == GetMediaDescr().end() )
{
- // impossibility to get the configuration access means normal saving flow for now
+ // notify the user that SaveAs is going to be done
+ Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel );
+ QueryBox aMessageBox( pWin, WB_OK_CANCEL | WB_DEF_OK, SfxResId(STR_NEW_FILENAME_SAVE).toString() );
+ if ( aMessageBox.Execute() == RET_OK )
+ nResult = STATUS_SAVEAS;
+ else
+ nResult = STATUS_NO_ACTION;
}
}
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 71b6763717e4..efc3efedc9bc 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -63,7 +63,6 @@
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <unotools/securityoptions.hxx>
-#include <comphelper/configurationhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index d878cb8281a5..aadb1a91f954 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -72,7 +72,6 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <comphelper/processfactory.hxx>
-#include <comphelper/configurationhelper.hxx>
#include <comphelper/interaction.hxx>
#include <svtools/sfxecode.hxx>
#include <unotools/securityoptions.hxx>