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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176904
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-11-02 15:57:44 +00:00
parent e8fca750c4
commit cb362d3b4a

View file

@ -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();
@ -1410,6 +1416,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 *