framework/source/services/pathsettings.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
New commits: commit af5554b94128a08b3bd5886ac682f61d1e5b607d Author: Caolán McNamara <[email protected]> AuthorDate: Sat Nov 2 15:57:44 2024 +0000 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Nov 6 15:15:10 2024 +0100 add XInitialization to PathSettings so PathSettings could be reinitialized if the underlying assumptions it made on initialization have changed, like the location where the application is installed, which affects the "Internal" paths for e.g. AutoText which are RO paths that aren't normall allowed to change. Change-Id: I3e056ddfbfdc3257561bd67c39163b48d3dde9a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175951 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 36237e824edc..6fcfd2de5970 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/util/XChangesNotifier.hpp> #include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #include <com/sun/star/util/XChangesListener.hpp> @@ -88,6 +89,7 @@ sal_Int32 impl_getPropGroup(sal_Int32 nID) typedef ::cppu::WeakComponentImplHelper< css::lang::XServiceInfo, + css::lang::XInitialization, css::util::XChangesListener, // => XEventListener css::util::XPathSettings> // => XPropertySet PathSettings_BASE; @@ -325,6 +327,10 @@ public: { ::cppu::OPropertySetHelper::addVetoableChangeListener(p1, p2); } virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override { ::cppu::OPropertySetHelper::removeVetoableChangeListener(p1, p2); } + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; + /** read all configured paths and create all needed internal structures. */ void impl_readAll(); @@ -1404,6 +1410,14 @@ css::uno::Reference< css::container::XNameAccess > PathSettings::fa_getCfgNew() return xCfg; } +// XInitialization +void SAL_CALL PathSettings::initialize(const css::uno::Sequence<css::uno::Any>& /*rArguments*/) +{ + // so we can reinitialize/reset all path variables to default + osl::MutexGuard g(cppu::WeakComponentImplHelperBase::rBHelper.rMutex); + impl_readAll(); +} + } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
