[Libreoffice-commits] core.git: framework/inc framework/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 23 06:42:41 UTC 2019


 framework/inc/properties.h           |    1 -
 framework/source/loadenv/loadenv.cxx |   34 ++++++++++------------------------
 2 files changed, 10 insertions(+), 25 deletions(-)

New commits:
commit f3e0595fcba689b07f6419c2fb540731a3aadecf
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sun Dec 22 17:05:22 2019 +0100
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Dec 23 07:41:49 2019 +0100

    tdf#46037: use officecfg/Setup
    
    + replace define OFFICEFACTORY_PROPNAME_ASCII_WINDOWATTRIBUTES used once
    
    Change-Id: I0930dc8a2d8df76b93e634a594cbfdf4a4cd634b
    Reviewed-on: https://gerrit.libreoffice.org/85706
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/framework/inc/properties.h b/framework/inc/properties.h
index 8cb35b1ac5f7..5977b7b760bb 100644
--- a/framework/inc/properties.h
+++ b/framework/inc/properties.h
@@ -119,7 +119,6 @@ namespace framework{
 
 /** properties for office module config (Setup.xcu) */
 
-#define OFFICEFACTORY_PROPNAME_ASCII_WINDOWATTRIBUTES   "ooSetupFactoryWindowAttributes"
 #define OFFICEFACTORY_PROPNAME_ASCII_UINAME             "ooSetupFactoryUIName"
 #define OFFICEFACTORY_PROPNAME_ASCII_ICON               "ooSetupFactoryIcon"
 
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 96e9b6f2a970..89c64e10a15c 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -35,10 +35,13 @@
 #include <framework/interaction.hxx>
 #include <comphelper/processfactory.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <officecfg/Setup.hxx>
 
 #include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
 #include <com/sun/star/document/MacroExecMode.hpp>
 #include <com/sun/star/document/XTypeDetection.hpp>
 #include <com/sun/star/document/XActionLockable.hpp>
@@ -915,21 +918,15 @@ bool LoadEnv::impl_furtherDocsAllowed()
 
     try
     {
-        css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
-                                xContext,
-                                "org.openoffice.Office.Common/",
-                                "Misc",
-                                "MaxOpenDocuments",
-                                ::comphelper::EConfigurationModes::ReadOnly);
+        o3tl::optional<sal_Int32> x(officecfg::Office::Common::Misc::MaxOpenDocuments::get(xContext));
 
         // NIL means: count of allowed documents = infinite !
-        //     => return sal_True
-        if ( ! aVal.hasValue())
+        //     => return true
+        if ( !x)
             bAllowed = true;
         else
         {
-            sal_Int32 nMaxOpenDocuments = 0;
-            aVal >>= nMaxOpenDocuments;
+            sal_Int32 nMaxOpenDocuments(*x);
 
             css::uno::Reference< css::frame::XFramesSupplier > xDesktop(
                 css::frame::Desktop::create(xContext),
@@ -1687,14 +1684,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X
         bool bForceFrontAndFocus(false);
         if ( !preview )
         {
-            css::uno::Any const a =
-                ::comphelper::ConfigurationHelper::readDirectKey(
-                  xContext,
-                  "org.openoffice.Office.Common/View",
-                  "NewDocumentHandling",
-                  "ForceFocusAndToFront",
-                  ::comphelper::EConfigurationModes::ReadOnly);
-            a >>= bForceFrontAndFocus;
+            bForceFrontAndFocus = officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext);
         }
 
         if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) )
@@ -1765,11 +1755,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
         OUString                 sModule = lProps.getUnpackedValueOrDefault(FILTER_PROPNAME_ASCII_DOCUMENTSERVICE, OUString());
 
         // get access to the configuration of this office module
-        css::uno::Reference< css::container::XNameAccess > xModuleCfg(::comphelper::ConfigurationHelper::openConfig(
-                                                                        xContext,
-                                                                        "/org.openoffice.Setup/Office/Factories",
-                                                                        ::comphelper::EConfigurationModes::ReadOnly),
-                                                                      css::uno::UNO_QUERY_THROW);
+        css::uno::Reference< css::container::XNameAccess > xModuleCfg(officecfg::Setup::Office::Factories::get(xContext));
 
         // read window state from the configuration
         // and apply it on the window.
@@ -1778,7 +1764,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
 
         // Don't look for persistent window attributes when used through LibreOfficeKit
         if( !comphelper::LibreOfficeKit::isActive() )
-            comphelper::ConfigurationHelper::readRelativeKey(xModuleCfg, sModule, OFFICEFACTORY_PROPNAME_ASCII_WINDOWATTRIBUTES) >>= sWindowState;
+            comphelper::ConfigurationHelper::readRelativeKey(xModuleCfg, sModule, "ooSetupFactoryWindowAttributes") >>= sWindowState;
 
         if (!sWindowState.isEmpty())
         {


More information about the Libreoffice-commits mailing list