summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-09-05 16:08:54 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-09-05 22:00:05 +0200
commit0c5deed0c5e1ca1e9a2a9315a38ab7b035d88bb9 (patch)
tree3c770003839945caa16dbb6718bc0161142e0d7f /accessibility
parent6d9b793512a60f18db624452d8773f0e52c00081 (diff)
use more concrete type in ParagraphInfo
and avoid some casting Change-Id: I22ff61a028c102b0b8b03b53ac9657af0fbe5acd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156569 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/inc/extended/textwindowaccessibility.hxx13
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx17
2 files changed, 13 insertions, 17 deletions
diff --git a/accessibility/inc/extended/textwindowaccessibility.hxx b/accessibility/inc/extended/textwindowaccessibility.hxx
index 47bb7be81a0c..db6e0f5423b0 100644
--- a/accessibility/inc/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/extended/textwindowaccessibility.hxx
@@ -39,6 +39,7 @@
#include <cppuhelper/compbase7.hxx>
#include <comphelper/accessibletexthelper.hxx>
#include <rtl/ref.hxx>
+#include <unotools/weakref.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <queue>
@@ -91,25 +92,25 @@ private:
VclPtr<vcl::Window> m_pNotifier;
};
+class Paragraph;
+
class ParagraphInfo
{
public:
ParagraphInfo(::sal_Int32 nHeight): m_nHeight(nHeight) {}
- css::uno::WeakReference< css::accessibility::XAccessible > const &
+ unotools::WeakReference< Paragraph > const &
getParagraph() const { return m_xParagraph; }
::sal_Int32 getHeight() const { return m_nHeight; }
- void setParagraph(
- css::uno::Reference< css::accessibility::XAccessible > const &
- rParagraph) { m_xParagraph = rParagraph; }
+ void setParagraph( rtl::Reference< Paragraph > const & rParagraph)
+ { m_xParagraph = rParagraph.get(); }
void changeHeight(::sal_Int32 nHeight) { m_nHeight = nHeight; }
private:
- css::uno::WeakReference< css::accessibility::XAccessible >
- m_xParagraph;
+ unotools::WeakReference< Paragraph > m_xParagraph;
::sal_Int32 m_nHeight;
};
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 9a092d8fd6b8..19c8d139c6c6 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1601,16 +1601,13 @@ void Document::init()
::rtl::Reference< Paragraph >
Document::getParagraph(Paragraphs::iterator const & rIt)
{
- return static_cast< Paragraph * >(
- css::uno::Reference< css::accessibility::XAccessible >(
- rIt->getParagraph()).get());
+ return rIt->getParagraph().get();
}
css::uno::Reference< css::accessibility::XAccessible >
Document::getAccessibleChild(Paragraphs::iterator const & rIt)
{
- css::uno::Reference< css::accessibility::XAccessible > xParagraph(
- rIt->getParagraph());
+ rtl::Reference< Paragraph > xParagraph(rIt->getParagraph());
if (!xParagraph.is())
{
xParagraph = new Paragraph(this, rIt - m_xParagraphs->begin());
@@ -1841,8 +1838,7 @@ void Document::handleParagraphNotifications()
xStrong;
if (bWasVisible)
xStrong = getAccessibleChild(aIt);
- css::uno::WeakReference<
- css::accessibility::XAccessible > xWeak(
+ unotools::WeakReference<Paragraph> xWeak(
aIt->getParagraph());
aIt = m_xParagraphs->erase(aIt);
@@ -1865,8 +1861,7 @@ void Document::handleParagraphNotifications()
css::uno::Any(xStrong),
css::uno::Any());
- css::uno::Reference< css::lang::XComponent > xComponent(
- xWeak.get(), css::uno::UNO_QUERY);
+ rtl::Reference< Paragraph > xComponent( xWeak.get() );
if (xComponent.is())
xComponent->dispose();
@@ -2197,8 +2192,8 @@ void Document::disposeParagraphs()
{
for (auto const& paragraph : *m_xParagraphs)
{
- css::uno::Reference< css::lang::XComponent > xComponent(
- paragraph.getParagraph().get(), css::uno::UNO_QUERY);
+ rtl::Reference< Paragraph > xComponent(
+ paragraph.getParagraph().get() );
if (xComponent.is())
xComponent->dispose();
}