summaryrefslogtreecommitdiff
path: root/editeng/source/accessibility/AccessibleStaticTextBase.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/accessibility/AccessibleStaticTextBase.cxx')
-rw-r--r--editeng/source/accessibility/AccessibleStaticTextBase.cxx29
1 files changed, 13 insertions, 16 deletions
diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 1dcf37b8d54a..f7fd934dfc90 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -27,7 +27,6 @@
#include <algorithm>
#include <rtl/ustrbuf.hxx>
#include <tools/debug.hxx>
-#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/sequence.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
@@ -122,8 +121,7 @@ namespace accessibility
void SetEventSource( const uno::Reference< XAccessible >& rInterface )
{
-
- mxThis = rInterface;
+ mpThis = rInterface.get();
}
void SetOffset( const Point& );
@@ -164,8 +162,8 @@ namespace accessibility
// our frontend class (the one implementing the actual
// interface). That's not necessarily the one containing the impl
- // pointer
- uno::Reference< XAccessible > mxThis;
+ // pointer. Note that this is not an uno::Reference to prevent ref-counting cycles and leaks.
+ XAccessible* mpThis;
// implements our functionality, we're just an adapter (guarded by solar mutex)
mutable rtl::Reference<AccessibleEditableTextPara> mxTextParagraph;
@@ -178,9 +176,9 @@ namespace accessibility
// AccessibleStaticTextBase_Impl implementation
- AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl() :
- mxTextParagraph( new AccessibleEditableTextPara(nullptr) ),
- maEditSource()
+ AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl()
+ : mpThis(nullptr)
+ , mxTextParagraph(new AccessibleEditableTextPara(nullptr))
{
// TODO: this is still somewhat of a hack, all the more since
@@ -209,7 +207,7 @@ namespace accessibility
mxTextParagraph->Dispose();
// drop references
- mxThis = nullptr;
+ mpThis = nullptr;
mxTextParagraph.clear();
}
@@ -217,7 +215,7 @@ namespace accessibility
{
if( !mxTextParagraph.is() )
- throw lang::DisposedException ("object has been already disposed", mxThis );
+ throw lang::DisposedException ("object has been already disposed", mpThis );
// TODO: Have a different method on AccessibleEditableTextPara
// that does not care about state changes
@@ -275,7 +273,7 @@ namespace accessibility
if( nFlatIndex < 0 )
throw lang::IndexOutOfBoundsException("AccessibleStaticTextBase_Impl::Index2Internal: character index out of bounds",
- mxThis);
+ mpThis);
// gratuitously accepting larger indices here, AccessibleEditableTextPara will throw eventually
sal_Int32 nCurrPara, nCurrIndex, nParas, nCurrCount;
@@ -307,7 +305,7 @@ namespace accessibility
// not found? Out of bounds
throw lang::IndexOutOfBoundsException("AccessibleStaticTextBase_Impl::Index2Internal: character index out of bounds",
- mxThis);
+ mpThis);
}
bool AccessibleStaticTextBase_Impl::SetSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex,
@@ -467,13 +465,13 @@ namespace accessibility
}
// XAccessibleContext
- sal_Int32 AccessibleStaticTextBase::getAccessibleChildCount()
+ sal_Int64 AccessibleStaticTextBase::getAccessibleChildCount()
{
// no children at all
return 0;
}
- uno::Reference< XAccessible > AccessibleStaticTextBase::getAccessibleChild( sal_Int32 /*i*/ )
+ uno::Reference< XAccessible > AccessibleStaticTextBase::getAccessibleChild( sal_Int64 /*i*/ )
{
// no children at all
return uno::Reference< XAccessible >();
@@ -703,8 +701,7 @@ namespace accessibility
// paragraphs inbetween are fully included
for( ; i<aEndIndex.nPara; ++i )
{
- aRes.append(cNewLine);
- aRes.append(mpImpl->GetParagraph(i).getText());
+ aRes.append(OUStringChar(cNewLine) + mpImpl->GetParagraph(i).getText());
}
if( i<=aEndIndex.nPara )