framework/source/services/pathsettings.cxx | 14 ++++++++++++++ sw/source/core/unocore/unoportenum.cxx | 7 +++---- 2 files changed, 17 insertions(+), 4 deletions(-)
New commits: commit cb362d3b4a09f612e27036d5f994479c4fa808c3 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Nov 2 15:57:44 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Nov 21 12:11:33 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]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176904 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 38171ab974ab..fcb0edae07d6 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(); @@ -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 * commit e8fca750c4a8b2ac99c4f47b65d31a4f58ad43f9 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Nov 21 08:44:37 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Nov 21 12:11:18 2024 +0100 Related: cid#1634864 can use member list initialization here Change-Id: I39c56e381fda147b5dac885f95e93648c366225d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176901 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index d7078e09f30b..7e84c1948768 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -317,9 +317,8 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( const sal_Int32 nStart, const sal_Int32 nEnd, bool bOnlyTextFields) + : m_pUnoCursor(rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint())) { - m_pUnoCursor = rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint()); - OSL_ENSURE(nEnd == -1 || (nStart <= nEnd && nEnd <= m_pUnoCursor->Start()->GetNode().GetTextNode()->GetText().getLength()), "start or end value invalid!"); @@ -333,9 +332,9 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration( SwXTextPortionEnumeration::SwXTextPortionEnumeration( SwPaM& rParaCursor, TextRangeList_t && rPortions ) - : m_Portions( std::move(rPortions) ) + : m_Portions(std::move(rPortions)) + , m_pUnoCursor(rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint())) { - m_pUnoCursor = rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint()); } SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
