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.weghorn@posteo.de>
This commit is contained in:
parent
d6a34a8c5b
commit
e8d45fe35e
@ -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()
|
||||
|
@ -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")
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user