bin/find-can-be-private-symbols.functions.results | 1 compilerplugins/clang/refcounting.cxx | 2 editeng/source/accessibility/AccessibleEditableTextPara.cxx | 3 include/editeng/AccessibleEditableTextPara.hxx | 8 + include/editeng/AccessibleParaManager.hxx | 51 ------------ 5 files changed, 11 insertions(+), 54 deletions(-)
New commits: commit e8d45fe35e6abb01d235aba263f6ff41a3efd5ed Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Apr 2 15:36:32 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Apr 3 22:30:58 2025 +0200 editeng a11y: Drop custom WeakCppRef, use unotools::WeakReference Use the existing unotools::WeakReference instead of the custom WeakCppRef template class to hold weak references to the AccessibleEditableTextPara objects in AccessibleParaManager. An AccessibleEditableTextPara forward-declaration is not sufficient to use unotools::WeakReference<AccessibleEditableTextPara>, so re-arrange includes/forward-declarations a bit. Drop the now unused WeakCppRef. Change-Id: I54553059a7cb36515109573c5b22d73738b1c46f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183672 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/bin/find-can-be-private-symbols.functions.results b/bin/find-can-be-private-symbols.functions.results index 9102813cc553..223f26a67015 100644 --- a/bin/find-can-be-private-symbols.functions.results +++ b/bin/find-can-be-private-symbols.functions.results @@ -10349,7 +10349,6 @@ accessibility::AccessibleParaManager::IsReferencable(int) const accessibility::AccessibleParaManager::IsReferencable(rtl::Reference<accessibility::AccessibleEditableTextPara> const&) accessibility::AccessibleParaManager::SetState(int, long) accessibility::AccessibleParaManager::SetState(long) -accessibility::AccessibleParaManager::ShutdownPara(std::pair<accessibility::WeakCppRef<com::sun::star::accessibility::XAccessible, accessibility::AccessibleEditableTextPara>, com::sun::star::awt::Rectangle> const&) accessibility::AccessibleParaManager::UnSetState(int, long) accessibility::AccessibleParaManager::UnSetState(long) accessibility::AccessibleShape::CreateAccessibleBaseName() diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index 4140b6a10688..3b4cea9d368c 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -135,8 +135,6 @@ bool containsXInterfaceSubclass(const clang::Type* pType0) { .Namespace("sun").Namespace("com").GlobalNamespace()) || (dc.Class("Sequence").Namespace("uno").Namespace("star") .Namespace("sun").Namespace("com").GlobalNamespace()) - || (dc.Class("WeakCppRef").Namespace("accessibility") - .GlobalNamespace()) || (dc.Class("OAutoRegistration").Namespace("dba") .GlobalNamespace()) || (dc.Class("OMultiInstanceAutoRegistration").Namespace("dbp") diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index ebc8b49a9e11..19ed64c8ab35 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -48,6 +48,7 @@ #include <vcl/settings.hxx> #include <i18nlangtag/languagetag.hxx> +#include <editeng/AccessibleParaManager.hxx> #include <editeng/editeng.hxx> #include <editeng/unoprnms.hxx> #include <editeng/unoipset.hxx> diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx index 7e9cae44a13b..423852e4427f 100644 --- a/include/editeng/AccessibleEditableTextPara.hxx +++ b/include/editeng/AccessibleEditableTextPara.hxx @@ -38,9 +38,9 @@ #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <comphelper/accessibletexthelper.hxx> -#include <editeng/AccessibleParaManager.hxx> #include <editeng/editdata.hxx> #include <editeng/editengdllapi.h> +#include <editeng/unoedprx.hxx> #include <unotools/weakref.hxx> class SvxViewForwarder; @@ -52,6 +52,8 @@ namespace accessibility { class AccessibleImageBullet; } namespace accessibility { +class AccessibleParaManager; + typedef ::comphelper::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleComponent, diff --git a/include/editeng/AccessibleParaManager.hxx b/include/editeng/AccessibleParaManager.hxx index b6df448c9a36..f6ec8cb53300 100644 --- a/include/editeng/AccessibleParaManager.hxx +++ b/include/editeng/AccessibleParaManager.hxx @@ -28,6 +28,8 @@ #include <com/sun/star/uno/Reference.hxx> #include <cppuhelper/weakref.hxx> #include <rtl/ref.hxx> +#include <unotools/weakref.hxx> +#include <editeng/AccessibleEditableTextPara.hxx> #include <editeng/editengdllapi.h> namespace com::sun::star::accessibility { class XAccessible; } @@ -37,60 +39,15 @@ class SvxEditSourceAdapter; namespace accessibility { -class AccessibleEditableTextPara; - -/** Helper class for weak object references plus implementation - - This class combines a weak reference (to facilitate automatic - object disposal if user drops last reference) and hard - reference to the c++ class (for fast access and bypassing of - the UNO interface) -*/ -template < class UnoType, class CppType > class WeakCppRef -{ -public: - - typedef UnoType UnoInterfaceType; - typedef CppType InterfaceType; - - WeakCppRef() : maWeakRef(), maUnsafeRef( nullptr ) {} - - WeakCppRef(rtl::Reference<InterfaceType> const & rImpl): - maWeakRef(rImpl.get()), - maUnsafeRef(rImpl.get()) - { - } - - // get object with c++ object and hard reference (which - // prevents the c++ object from destruction during use) - rtl::Reference<InterfaceType> get() const { - css::uno::Reference<UnoInterfaceType> ref(maWeakRef); - return ref.is() ? maUnsafeRef : rtl::Reference<InterfaceType>(); - } - - // default copy constructor and assignment will do - // WeakCppRef( const WeakCppRef& ); - // WeakCppRef& operator= ( const WeakCppRef& ); - -private: - - // the interface, hold weakly - css::uno::WeakReference< UnoInterfaceType > maWeakRef; - - // hard ref to c++ class, _only_ valid if maWeakRef.is() is true - InterfaceType* maUnsafeRef; -}; - - /** This class manages the paragraphs of an AccessibleTextHelper To facilitate automatic deletion of paragraphs no longer used, - this class uses the WeakCppRef helper to hold the objects weakly. + this class uses unotools::WeakReference to hold the objects weakly. */ class UNLESS_MERGELIBS(EDITENG_DLLPUBLIC) AccessibleParaManager { public: - typedef WeakCppRef < css::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara; + typedef unotools::WeakReference<AccessibleEditableTextPara> WeakPara; typedef ::std::pair< WeakPara, css::awt::Rectangle > WeakChild; typedef ::std::vector< WeakChild > VectorOfChildren; commit d6a34a8c5b20ebe31ff693465b1343c2210c52c5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Apr 2 15:15:36 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu Apr 3 22:30:49 2025 +0200 editeng a11y: Use unotools::WeakReference for bullet Replace use of the custom WeakCppRef template class for AccessibleEditableTextPara::maImageBullet by unotools::WeakReference which provides the same functionality (a weak reference and access to the the concrete implementation class). Change-Id: I333f467caeb4925d718313e679507f45c9c96e00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183671 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 23d90285f842..ebc8b49a9e11 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -651,7 +651,7 @@ uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessible aChild->SetParagraphIndex( GetParagraphIndex() ); aChild->SetIndexInParent( i ); - maImageBullet = aChild; + maImageBullet = aChild.get(); } return aChild; diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx index 420df1436769..7e9cae44a13b 100644 --- a/include/editeng/AccessibleEditableTextPara.hxx +++ b/include/editeng/AccessibleEditableTextPara.hxx @@ -41,6 +41,7 @@ #include <editeng/AccessibleParaManager.hxx> #include <editeng/editdata.hxx> #include <editeng/editengdllapi.h> +#include <unotools/weakref.hxx> class SvxViewForwarder; class MapMode; @@ -354,8 +355,7 @@ private: SvxEditSourceAdapter* mpEditSource; // the possible child (for image bullets, guarded by solar mutex) - typedef WeakCppRef < css::accessibility::XAccessible, AccessibleImageBullet > WeakBullet; - WeakBullet maImageBullet; + unotools::WeakReference<AccessibleImageBullet> maImageBullet; // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex) OUString maLastTextString;