diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2019-12-22 17:05:22 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-23 07:41:49 +0100 |
commit | f3e0595fcba689b07f6419c2fb540731a3aadecf (patch) | |
tree | 285e5f664a3ff1f9dbbb8c9096364271e3e1355d /framework | |
parent | 276a90c6b3fb046df13ae85dcdec5f28f23ee527 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/properties.h | 1 | ||||
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 34 |
2 files changed, 10 insertions, 25 deletions
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()) { |