Kaydet (Commit) 161c3f17 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Some more comphelper/configurationhelper clean up

üst 00717e85
......@@ -53,7 +53,6 @@
#include <tools/diagnose_ex.h>
#include <unotools/sharedunocomponent.hxx>
#include <comphelper/configurationhelper.hxx>
//.........................................................................
namespace dbtools
......
......@@ -138,7 +138,6 @@ struct LastPageSaver
// class OfaTreeOptionsDialog --------------------------------------------
namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
namespace com { namespace sun { namespace star { namespace container { class XNameAccess; } } } }
namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
namespace com { namespace sun { namespace star { namespace awt { class XContainerWindowProvider; } } } }
......@@ -192,12 +191,8 @@ private:
com::sun::star::lang::XMultiServiceFactory >& xMFac,
const com::sun::star::uno::Reference<
com::sun::star::frame::XFrame >& xFrame );
Module* LoadModule( const rtl::OUString& rModuleIdentifier,
const com::sun::star::uno::Reference<
com::sun::star::container::XNameAccess >& xRoot );
void LoadNodes( const com::sun::star::uno::Reference<
com::sun::star::container::XNameAccess >& xRoot,
Module* pModule,
Module* LoadModule( const rtl::OUString& rModuleIdentifier );
void LoadNodes( Module* pModule,
const rtl::OUString& rExtensionId,
VectorOfNodes& rOutNodeList );
void InsertNodes( const VectorOfNodes& rNodeList );
......
......@@ -50,7 +50,7 @@
#include "optpath.hrc"
#include <cuires.hrc>
#include "helpid.hrc"
#include <comphelper/configurationhelper.hxx>
#include <comphelper/configuration.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/uno/Exception.hpp>
......@@ -59,6 +59,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
#include <officecfg/Office/Common.hxx>
#include "optHeaderTabListbox.hxx"
#include <readonlyimage.hxx>
#include <vcl/help.hxx>
......@@ -532,13 +533,11 @@ void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder )
// Set configuration flag to notify file picker that it's necessary
// to take over the path provided.
Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
::comphelper::ConfigurationHelper::writeDirectKey(xFactory,
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")),
::com::sun::star::uno::makeAny(true),
::comphelper::ConfigurationHelper::E_STANDARD);
boost::shared_ptr< comphelper::ConfigurationChanges > batch(
comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Path::Info::WorkPathChanged::set(
true, batch);
batch->commit();
}
}
}
......
......@@ -67,11 +67,11 @@
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <comphelper/configurationhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx>
#include <linguistic/misc.hxx>
#include <officecfg/Office/OptionsDialog.hxx>
#include <osl/module.hxx>
#include <osl/process.h>
#include <rtl/bootstrap.hxx>
......@@ -2008,18 +2008,12 @@ void OfaTreeOptionsDialog::LoadExtensionOptions( const rtl::OUString& rExtension
{
Module* pModule = NULL;
Reference< XMultiServiceFactory > xMSFac = comphelper::getProcessServiceFactory();
// open optionsdialog.xcu
Reference< XNameAccess > xRoot(
::comphelper::ConfigurationHelper::openConfig(
xMSFac, C2U("org.openoffice.Office.OptionsDialog"),
::comphelper::ConfigurationHelper::E_READONLY ), UNO_QUERY );
DBG_ASSERT( xRoot.is(), "OfaTreeOptionsDialog::LoadExtensionOptions(): no config" );
// when called by Tools - Options then load nodes of active module
if ( rExtensionId.isEmpty() )
pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ), xRoot );
pModule = LoadModule( GetModuleIdentifier( xMSFac, Reference< XFrame >() ) );
VectorOfNodes aNodeList;
LoadNodes( xRoot, pModule, rExtensionId, aNodeList );
LoadNodes( pModule, rExtensionId, aNodeList );
InsertNodes( aNodeList );
}
......@@ -2058,16 +2052,12 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
}
Module* OfaTreeOptionsDialog::LoadModule(
const rtl::OUString& rModuleIdentifier, const Reference< XNameAccess >& xRoot )
const rtl::OUString& rModuleIdentifier )
{
Module* pModule = NULL;
Reference< XNameAccess > xSet;
Reference< XNameAccess > xSet(
officecfg::Office::OptionsDialog::Modules::get());
if ( xRoot->hasByName( C2U("Modules") ) )
{
xRoot->getByName( C2U("Modules") ) >>= xSet;
if ( xSet.is() )
{
Sequence< rtl::OUString > seqNames = xSet->getElementNames();
for ( int i = 0; i < seqNames.getLength(); ++i )
{
......@@ -2121,21 +2111,15 @@ Module* OfaTreeOptionsDialog::LoadModule(
}
}
}
}
}
return pModule;
}
void OfaTreeOptionsDialog::LoadNodes(
const Reference< XNameAccess >& xRoot, Module* pModule,
const rtl::OUString& rExtensionId, VectorOfNodes& rOutNodeList )
Module* pModule, const rtl::OUString& rExtensionId,
VectorOfNodes& rOutNodeList )
{
Reference< XNameAccess > xSet;
if ( xRoot->hasByName( C2U("Nodes") ) )
{
xRoot->getByName( C2U("Nodes") ) >>= xSet;
if ( xSet.is() )
{
Reference< XNameAccess > xSet(
officecfg::Office::OptionsDialog::Nodes::get());
VectorOfNodes aNodeList;
Sequence< rtl::OUString > seqNames = xSet->getElementNames();
......@@ -2271,8 +2255,6 @@ void OfaTreeOptionsDialog::LoadNodes(
for ( i = 0; i < aNodeList.size(); ++i )
rOutNodeList.push_back( aNodeList[i] );
}
}
}
}
sal_uInt16 lcl_getGroupId( const rtl::OUString& rGroupName, const SvTreeListBox& rTreeLB )
......
......@@ -68,10 +68,10 @@
#include <toolkit/unohlp.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <comphelper/configurationhelper.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/confignode.hxx>
#include <unotools/moduleoptions.hxx>
#include <officecfg/Office/Recovery.hxx>
#include <osl/file.hxx>
#include <osl/process.h>
#include <rtl/uri.hxx>
......@@ -1117,47 +1117,14 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError )
void Desktop::retrieveCrashReporterState()
{
static const ::rtl::OUString CFG_PACKAGE_RECOVERY(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Recovery/"));
static const ::rtl::OUString CFG_PATH_CRASHREPORTER(RTL_CONSTASCII_USTRINGPARAM("CrashReporter"));
static const ::rtl::OUString CFG_ENTRY_ENABLED(RTL_CONSTASCII_USTRINGPARAM("Enabled"));
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
sal_Bool bEnabled(sal_False);
if ( xSMGR.is() )
{
css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
xSMGR,
CFG_PACKAGE_RECOVERY,
CFG_PATH_CRASHREPORTER,
CFG_ENTRY_ENABLED,
::comphelper::ConfigurationHelper::E_READONLY);
aVal >>= bEnabled;
}
_bCrashReporterEnabled = bEnabled;
_bCrashReporterEnabled
= officecfg::Office::Recovery::CrashReporter::Enabled::get();
}
sal_Bool Desktop::isUIOnSessionShutdownAllowed()
{
static const ::rtl::OUString CFG_PACKAGE_RECOVERY(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Recovery/"));
static const ::rtl::OUString CFG_PATH_SESSION(RTL_CONSTASCII_USTRINGPARAM("SessionShutdown"));
static const ::rtl::OUString CFG_ENTRY_UIENABLED(RTL_CONSTASCII_USTRINGPARAM("DocumentStoreUIEnabled"));
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
sal_Bool bResult = sal_False;
if ( xSMGR.is() )
{
css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
xSMGR,
CFG_PACKAGE_RECOVERY,
CFG_PATH_SESSION,
CFG_ENTRY_UIENABLED,
::comphelper::ConfigurationHelper::E_READONLY);
aVal >>= bResult;
}
return bResult;
return officecfg::Office::Recovery::SessionShutdown::DocumentStoreUIEnabled
::get();
}
//-----------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment