[Libreoffice-commits] .: connectivity/source cui/source desktop/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Feb 14 05:25:55 PST 2012


 connectivity/source/commontools/dbtools2.cxx |    1 
 cui/source/inc/treeopt.hxx                   |    9 
 cui/source/options/optpath.cxx               |   15 -
 cui/source/options/treeopt.cxx               |  318 ++++++++++++---------------
 desktop/source/app/app.cxx                   |   43 ---
 5 files changed, 164 insertions(+), 222 deletions(-)

New commits:
commit 161c3f179f71eda2a32dabaf68ff6fb3ba487062
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 14:19:07 2012 +0100

    Some more comphelper/configurationhelper clean up

diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 7ea7bc9..e559847 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -53,7 +53,6 @@
 
 #include <tools/diagnose_ex.h>
 #include <unotools/sharedunocomponent.hxx>
-#include <comphelper/configurationhelper.hxx>
 
 //.........................................................................
 namespace dbtools
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index a107750..90777c8 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -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 );
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index cdecf06..4d8f8a9 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -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();
         }
     }
 }
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 51a8066..96a5999 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -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,64 +2052,58 @@ 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") ) )
+    Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+    for ( int i = 0; i < seqNames.getLength(); ++i )
     {
-        xRoot->getByName( C2U("Modules") ) >>= xSet;
-        if ( xSet.is() )
+        rtl::OUString sModule( seqNames[i] );
+        if ( rModuleIdentifier == sModule )
         {
-            Sequence< rtl::OUString > seqNames = xSet->getElementNames();
-            for ( int i = 0; i < seqNames.getLength(); ++i )
+            // current active module found
+            pModule = new Module( sModule );
+            pModule->m_bActive = true;
+
+            Reference< XNameAccess > xModAccess;
+            xSet->getByName( seqNames[i] ) >>= xModAccess;
+            if ( xModAccess.is() )
             {
-                rtl::OUString sModule( seqNames[i] );
-                if ( rModuleIdentifier == sModule )
+                // load the nodes of this module
+                Reference< XNameAccess > xNodeAccess;
+                xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess;
+                if ( xNodeAccess.is() )
                 {
-                    // current active module found
-                    pModule = new Module( sModule );
-                    pModule->m_bActive = true;
-
-                    Reference< XNameAccess > xModAccess;
-                    xSet->getByName( seqNames[i] ) >>= xModAccess;
-                    if ( xModAccess.is() )
+                    Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames();
+                    Reference< XNameAccess > xAccess;
+                    sal_Int32 nIndex = -1;
+                    for ( int x = 0; x < xTemp.getLength(); ++x )
                     {
-                        // load the nodes of this module
-                        Reference< XNameAccess > xNodeAccess;
-                        xModAccess->getByName( C2U("Nodes") ) >>= xNodeAccess;
-                        if ( xNodeAccess.is() )
+                        xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
+                        if ( xAccess.is() )
                         {
-                            Sequence< rtl::OUString > xTemp = xNodeAccess->getElementNames();
-                            Reference< XNameAccess > xAccess;
-                            sal_Int32 nIndex = -1;
-                            for ( int x = 0; x < xTemp.getLength(); ++x )
+                            xAccess->getByName( C2U("Index") ) >>= nIndex;
+                            if ( nIndex < 0 )
+                                // append nodes with index < 0
+                                pModule->m_aNodeList.push_back(
+                                    new OrderedEntry( nIndex, xTemp[x] ) );
+                            else
                             {
-                                xNodeAccess->getByName( xTemp[x] ) >>= xAccess;
-                                if ( xAccess.is() )
+                                // search position of the node
+                                sal_uInt32 y = 0;
+                                for ( ; y < pModule->m_aNodeList.size(); ++y )
                                 {
-                                    xAccess->getByName( C2U("Index") ) >>= nIndex;
-                                    if ( nIndex < 0 )
-                                        // append nodes with index < 0
-                                        pModule->m_aNodeList.push_back(
-                                            new OrderedEntry( nIndex, xTemp[x] ) );
-                                    else
-                                    {
-                                        // search position of the node
-                                        sal_uInt32 y = 0;
-                                        for ( ; y < pModule->m_aNodeList.size(); ++y )
-                                        {
-                                            sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
-                                            if ( nNodeIdx < 0 || nNodeIdx > nIndex )
-                                                break;
-                                        }
-                                        // and insert the node on this position
-                                        pModule->m_aNodeList.insert(
-                                            pModule->m_aNodeList.begin() + y,
-                                            new OrderedEntry( nIndex, xTemp[x] ) );
-                                    }
+                                    sal_Int32 nNodeIdx = pModule->m_aNodeList[y]->m_nIndex;
+                                    if ( nNodeIdx < 0 || nNodeIdx > nIndex )
+                                        break;
                                 }
+                                // and insert the node on this position
+                                pModule->m_aNodeList.insert(
+                                    pModule->m_aNodeList.begin() + y,
+                                    new OrderedEntry( nIndex, xTemp[x] ) );
                             }
                         }
                     }
@@ -2127,151 +2115,145 @@ Module* OfaTreeOptionsDialog::LoadModule(
 }
 
 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") ) )
+    Reference< XNameAccess > xSet(
+        officecfg::Office::OptionsDialog::Nodes::get());
+    VectorOfNodes aNodeList;
+    Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+
+    for ( int i = 0; i < seqNames.getLength(); ++i )
     {
-        xRoot->getByName( C2U("Nodes") ) >>= xSet;
-        if ( xSet.is() )
+        String sGroupName( seqNames[i] );
+        Reference< XNameAccess > xNodeAccess;
+        xSet->getByName( seqNames[i] ) >>= xNodeAccess;
+
+        if ( xNodeAccess.is() )
         {
-            VectorOfNodes aNodeList;
-            Sequence< rtl::OUString > seqNames = xSet->getElementNames();
+            rtl::OUString sNodeId, sLabel, sPageURL, sGroupId;
+            bool bAllModules = false;
+            sal_Int32 nGroupIndex = 0;
+
+            sNodeId = seqNames[i];
+            xNodeAccess->getByName( C2U("Label") ) >>= sLabel;
+            xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL;
+            xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules;
+            xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId;
+            xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex;
 
-            for ( int i = 0; i < seqNames.getLength(); ++i )
+            if ( sLabel.isEmpty() )
+                sLabel = sGroupName;
+            String sTemp = getGroupName( sLabel, !rExtensionId.isEmpty() );
+            if ( sTemp.Len() > 0 )
+                sLabel = sTemp;
+            OptionsNode* pNode =
+                new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex );
+
+            if ( rExtensionId.isEmpty() && !isNodeActive( pNode, pModule ) )
             {
-                String sGroupName( seqNames[i] );
-                Reference< XNameAccess > xNodeAccess;
-                xSet->getByName( seqNames[i] ) >>= xNodeAccess;
+                delete pNode;
+                continue;
+            }
 
-                if ( xNodeAccess.is() )
+            Reference< XNameAccess > xLeavesSet;
+            xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet;
+            if ( xLeavesSet.is() )
+            {
+                Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames();
+                for ( int j = 0; j < seqLeaves.getLength(); ++j )
                 {
-                    rtl::OUString sNodeId, sLabel, sPageURL, sGroupId;
-                    bool bAllModules = false;
-                    sal_Int32 nGroupIndex = 0;
-
-                    sNodeId = seqNames[i];
-                    xNodeAccess->getByName( C2U("Label") ) >>= sLabel;
-                    xNodeAccess->getByName( C2U("OptionsPage") ) >>= sPageURL;
-                    xNodeAccess->getByName( C2U("AllModules") ) >>= bAllModules;
-                    xNodeAccess->getByName( C2U("GroupId") ) >>= sGroupId;
-                    xNodeAccess->getByName( C2U("GroupIndex") ) >>= nGroupIndex;
-
-                    if ( sLabel.isEmpty() )
-                        sLabel = sGroupName;
-                    String sTemp = getGroupName( sLabel, !rExtensionId.isEmpty() );
-                    if ( sTemp.Len() > 0 )
-                        sLabel = sTemp;
-                    OptionsNode* pNode =
-                        new OptionsNode( sNodeId, sLabel, sPageURL, bAllModules, sGroupId, nGroupIndex );
-
-                    if ( rExtensionId.isEmpty() && !isNodeActive( pNode, pModule ) )
-                    {
-                        delete pNode;
-                        continue;
-                    }
+                    Reference< XNameAccess > xLeaveAccess;
+                    xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
 
-                    Reference< XNameAccess > xLeavesSet;
-                    xNodeAccess->getByName( C2U( "Leaves" ) ) >>= xLeavesSet;
-                    if ( xLeavesSet.is() )
+                    if ( xLeaveAccess.is() )
                     {
-                        Sequence< rtl::OUString > seqLeaves = xLeavesSet->getElementNames();
-                        for ( int j = 0; j < seqLeaves.getLength(); ++j )
-                        {
-                            Reference< XNameAccess > xLeaveAccess;
-                            xLeavesSet->getByName( seqLeaves[j] ) >>= xLeaveAccess;
+                        rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
+                        sal_Int32 nLeafGrpIdx = 0;
 
-                            if ( xLeaveAccess.is() )
-                            {
-                                rtl::OUString sId, sLeafLabel, sEventHdl, sLeafURL, sLeafGrpId;
-                                sal_Int32 nLeafGrpIdx = 0;
+                        xLeaveAccess->getByName( C2U("Id") ) >>= sId;
+                        xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel;
+                        xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL;
+                        xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl;
+                        xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId;
+                        xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx;
 
-                                xLeaveAccess->getByName( C2U("Id") ) >>= sId;
-                                xLeaveAccess->getByName( C2U("Label") ) >>= sLeafLabel;
-                                xLeaveAccess->getByName( C2U("OptionsPage") ) >>= sLeafURL;
-                                xLeaveAccess->getByName( C2U("EventHandlerService") ) >>= sEventHdl;
-                                xLeaveAccess->getByName( C2U("GroupId") ) >>= sLeafGrpId;
-                                xLeaveAccess->getByName( C2U("GroupIndex") ) >>= nLeafGrpIdx;
+                        if ( rExtensionId.isEmpty() || sId == rExtensionId )
+                        {
+                            OptionsLeaf* pLeaf = new OptionsLeaf(
+                                sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
 
-                                if ( rExtensionId.isEmpty() || sId == rExtensionId )
+                            if ( !sLeafGrpId.isEmpty() )
+                            {
+                                bool bAlreadyOpened = false;
+                                if ( pNode->m_aGroupedLeaves.size() > 0 )
                                 {
-                                    OptionsLeaf* pLeaf = new OptionsLeaf(
-                                        sId, sLeafLabel, sLeafURL, sEventHdl, sLeafGrpId, nLeafGrpIdx );
-
-                                    if ( !sLeafGrpId.isEmpty() )
+                                    for ( sal_uInt32 k = 0;
+                                          k < pNode->m_aGroupedLeaves.size(); ++k )
                                     {
-                                        bool bAlreadyOpened = false;
-                                        if ( pNode->m_aGroupedLeaves.size() > 0 )
+                                        if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
+                                             pNode->m_aGroupedLeaves[k][0]->m_sGroupId
+                                             == sLeafGrpId )
                                         {
-                                            for ( sal_uInt32 k = 0;
-                                                    k < pNode->m_aGroupedLeaves.size(); ++k )
+                                            sal_uInt32 l = 0;
+                                            for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
                                             {
-                                                if ( pNode->m_aGroupedLeaves[k].size() > 0 &&
-                                                     pNode->m_aGroupedLeaves[k][0]->m_sGroupId
-                                                        == sLeafGrpId )
-                                                {
-                                                    sal_uInt32 l = 0;
-                                                    for ( ; l < pNode->m_aGroupedLeaves[k].size(); ++l )
-                                                    {
-                                                        if ( pNode->m_aGroupedLeaves[k][l]->
-                                                                m_nGroupIndex >= nLeafGrpIdx )
-                                                            break;
-                                                    }
-                                                    pNode->m_aGroupedLeaves[k].insert(
-                                                        pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
-                                                    bAlreadyOpened = true;
+                                                if ( pNode->m_aGroupedLeaves[k][l]->
+                                                     m_nGroupIndex >= nLeafGrpIdx )
                                                     break;
-                                                }
                                             }
-                                        }
-                                        if ( !bAlreadyOpened )
-                                        {
-                                            VectorOfLeaves aGroupedLeaves;
-                                            aGroupedLeaves.push_back( pLeaf );
-                                            pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
+                                            pNode->m_aGroupedLeaves[k].insert(
+                                                pNode->m_aGroupedLeaves[k].begin() + l, pLeaf );
+                                            bAlreadyOpened = true;
+                                            break;
                                         }
                                     }
-                                    else
-                                        pNode->m_aLeaves.push_back(
-                                            new OptionsLeaf(
-                                                sId, sLeafLabel, sLeafURL,
-                                                sEventHdl, sLeafGrpId, nLeafGrpIdx ) );
+                                }
+                                if ( !bAlreadyOpened )
+                                {
+                                    VectorOfLeaves aGroupedLeaves;
+                                    aGroupedLeaves.push_back( pLeaf );
+                                    pNode->m_aGroupedLeaves.push_back( aGroupedLeaves );
                                 }
                             }
+                            else
+                                pNode->m_aLeaves.push_back(
+                                    new OptionsLeaf(
+                                        sId, sLeafLabel, sLeafURL,
+                                        sEventHdl, sLeafGrpId, nLeafGrpIdx ) );
                         }
                     }
-
-                    // do not insert nodes without leaves
-                    if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
-                    {
-                        pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
-                    }
                 }
             }
 
-            if ( pModule && aNodeList.size() > 0 )
+            // do not insert nodes without leaves
+            if ( pNode->m_aLeaves.size() > 0 || pNode->m_aGroupedLeaves.size() > 0 )
             {
-                sal_uInt32 i = 0, j = 0;
-                for ( ; i < pModule->m_aNodeList.size(); ++i )
+                pModule ? aNodeList.push_back( pNode ) : rOutNodeList.push_back( pNode );
+            }
+        }
+    }
+
+    if ( pModule && aNodeList.size() > 0 )
+    {
+        sal_uInt32 i = 0, j = 0;
+        for ( ; i < pModule->m_aNodeList.size(); ++i )
+        {
+            rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId;
+            for ( j = 0; j < aNodeList.size(); ++j )
+            {
+                OptionsNode* pNode = aNodeList[j];
+                if ( pNode->m_sId == sNodeId )
                 {
-                    rtl::OUString sNodeId = pModule->m_aNodeList[i]->m_sId;
-                    for ( j = 0; j < aNodeList.size(); ++j )
-                    {
-                        OptionsNode* pNode = aNodeList[j];
-                        if ( pNode->m_sId == sNodeId )
-                        {
-                            rOutNodeList.push_back( pNode );
-                            aNodeList.erase( aNodeList.begin() + j );
-                            break;
-                        }
-                    }
+                    rOutNodeList.push_back( pNode );
+                    aNodeList.erase( aNodeList.begin() + j );
+                    break;
                 }
-
-                for ( i = 0; i < aNodeList.size(); ++i )
-                    rOutNodeList.push_back( aNodeList[i] );
             }
         }
+
+        for ( i = 0; i < aNodeList.size(); ++i )
+            rOutNodeList.push_back( aNodeList[i] );
     }
 }
 
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c6cb535..a3dabd4 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -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();
 }
 
 //-----------------------------------------------


More information about the Libreoffice-commits mailing list