Kaydet (Commit) 74df5aff authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Thorsten Behrens

tdf#122056: Catch DisposedExceptions everywhere

Change-Id: I6bdb9aa89a8a5181b096f47f90ab6fb5711e7447
Reviewed-on: https://gerrit.libreoffice.org/69541
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
(cherry picked from commit 9e37ab4e)
Reviewed-on: https://gerrit.libreoffice.org/72661Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst f10c1c64
...@@ -136,6 +136,7 @@ public: ...@@ -136,6 +136,7 @@ public:
private: private:
css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; css::uno::Reference<css::accessibility::XAccessible> m_xAccessible;
css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleContextImpl() const;
}; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -71,11 +71,41 @@ Qt5AccessibleWidget::Qt5AccessibleWidget(const Reference<XAccessible> xAccessibl ...@@ -71,11 +71,41 @@ Qt5AccessibleWidget::Qt5AccessibleWidget(const Reference<XAccessible> xAccessibl
} }
} }
Reference<XAccessibleContext> Qt5AccessibleWidget::getAccessibleContextImpl() const
{
Reference<XAccessibleContext> xAc;
if (m_xAccessible.is())
{
try
{
xAc = m_xAccessible->getAccessibleContext();
}
catch (css::lang::DisposedException /*ex*/)
{
SAL_WARN("vcl.qt5", "Accessible context disposed already");
}
// sometimes getAccessibleContext throws also RuntimeException if context is no longer alive
catch (css::uno::RuntimeException /*ex*/)
{
// so let's catch it here, cuz otherwise soffice falls flat on its face
// with FatalError and nothing else
SAL_WARN("vcl.qt5", "Accessible context no longer alive");
}
}
return xAc;
}
QWindow* Qt5AccessibleWidget::window() const { return nullptr; } QWindow* Qt5AccessibleWidget::window() const { return nullptr; }
int Qt5AccessibleWidget::childCount() const int Qt5AccessibleWidget::childCount() const
{ {
return m_xAccessible->getAccessibleContext()->getAccessibleChildCount(); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return 0;
return xAc->getAccessibleChildCount();
} }
int Qt5AccessibleWidget::indexOfChild(const QAccessibleInterface* /* child */) const { return 0; } int Qt5AccessibleWidget::indexOfChild(const QAccessibleInterface* /* child */) const { return 0; }
...@@ -144,25 +174,29 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation>> ...@@ -144,25 +174,29 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation>>
Qt5AccessibleWidget::relations(QAccessible::Relation match) const Qt5AccessibleWidget::relations(QAccessible::Relation match) const
{ {
QVector<QPair<QAccessibleInterface*, QAccessible::Relation>> relations; QVector<QPair<QAccessibleInterface*, QAccessible::Relation>> relations;
Reference<XAccessibleRelationSet> xRelationSet
= m_xAccessible->getAccessibleContext()->getAccessibleRelationSet(); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xRelationSet.is()) if (!xAc.is())
return relations; return relations;
if (match == QAccessible::AllRelations) Reference<XAccessibleRelationSet> xRelationSet = xAc->getAccessibleRelationSet();
if (xRelationSet.is())
{ {
int count = xRelationSet->getRelationCount(); if (match == QAccessible::AllRelations)
for (int i = 0; i < count; i++) {
int count = xRelationSet->getRelationCount();
for (int i = 0; i < count; i++)
{
AccessibleRelation aRelation = xRelationSet->getRelation(i);
lcl_appendRelation(&relations, aRelation);
}
}
else
{ {
AccessibleRelation aRelation = xRelationSet->getRelation(i); AccessibleRelation aRelation = xRelationSet->getRelation(lcl_matchQtRelation(match));
lcl_appendRelation(&relations, aRelation); lcl_appendRelation(&relations, aRelation);
} }
} }
else
{
AccessibleRelation aRelation = xRelationSet->getRelation(lcl_matchQtRelation(match));
lcl_appendRelation(&relations, aRelation);
}
return relations; return relations;
} }
...@@ -177,8 +211,11 @@ QAccessibleInterface* Qt5AccessibleWidget::focusChild() const ...@@ -177,8 +211,11 @@ QAccessibleInterface* Qt5AccessibleWidget::focusChild() const
QRect Qt5AccessibleWidget::rect() const QRect Qt5AccessibleWidget::rect() const
{ {
Reference<XAccessibleComponent> xAccessibleComponent(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return QRect();
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
awt::Point aPoint = xAccessibleComponent->getLocation(); awt::Point aPoint = xAccessibleComponent->getLocation();
awt::Size aSize = xAccessibleComponent->getSize(); awt::Size aSize = xAccessibleComponent->getSize();
...@@ -187,24 +224,35 @@ QRect Qt5AccessibleWidget::rect() const ...@@ -187,24 +224,35 @@ QRect Qt5AccessibleWidget::rect() const
QAccessibleInterface* Qt5AccessibleWidget::parent() const QAccessibleInterface* Qt5AccessibleWidget::parent() const
{ {
return QAccessible::queryAccessibleInterface( Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
new Qt5XAccessible(m_xAccessible->getAccessibleContext()->getAccessibleParent())); if (!xAc.is())
return nullptr;
return QAccessible::queryAccessibleInterface(new Qt5XAccessible(xAc->getAccessibleParent()));
} }
QAccessibleInterface* Qt5AccessibleWidget::child(int index) const QAccessibleInterface* Qt5AccessibleWidget::child(int index) const
{ {
Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return nullptr;
return QAccessible::queryAccessibleInterface( return QAccessible::queryAccessibleInterface(
new Qt5XAccessible(m_xAccessible->getAccessibleContext()->getAccessibleChild(index))); new Qt5XAccessible(xAc->getAccessibleChild(index)));
} }
QString Qt5AccessibleWidget::text(QAccessible::Text text) const QString Qt5AccessibleWidget::text(QAccessible::Text text) const
{ {
Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QString();
switch (text) switch (text)
{ {
case QAccessible::Name: case QAccessible::Name:
return toQString(m_xAccessible->getAccessibleContext()->getAccessibleName()); return toQString(xAc->getAccessibleName());
case QAccessible::Description: case QAccessible::Description:
case QAccessible::DebugDescription: case QAccessible::DebugDescription:
return toQString(m_xAccessible->getAccessibleContext()->getAccessibleDescription()); return toQString(xAc->getAccessibleDescription());
case QAccessible::Value: case QAccessible::Value:
case QAccessible::Help: case QAccessible::Help:
case QAccessible::Accelerator: case QAccessible::Accelerator:
...@@ -215,10 +263,11 @@ QString Qt5AccessibleWidget::text(QAccessible::Text text) const ...@@ -215,10 +263,11 @@ QString Qt5AccessibleWidget::text(QAccessible::Text text) const
} }
QAccessible::Role Qt5AccessibleWidget::role() const QAccessible::Role Qt5AccessibleWidget::role() const
{ {
if (!m_xAccessible.is()) Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QAccessible::NoRole; return QAccessible::NoRole;
switch (m_xAccessible->getAccessibleContext()->getAccessibleRole()) switch (xAc->getAccessibleRole())
{ {
case AccessibleRole::UNKNOWN: case AccessibleRole::UNKNOWN:
return QAccessible::NoRole; return QAccessible::NoRole;
...@@ -589,10 +638,11 @@ QAccessible::State Qt5AccessibleWidget::state() const ...@@ -589,10 +638,11 @@ QAccessible::State Qt5AccessibleWidget::state() const
{ {
QAccessible::State state; QAccessible::State state;
if (!m_xAccessible.is()) Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return state; return state;
Reference<XAccessibleStateSet> xStateSet(
m_xAccessible->getAccessibleContext()->getAccessibleStateSet()); Reference<XAccessibleStateSet> xStateSet(xAc->getAccessibleStateSet());
if (!xStateSet.is()) if (!xStateSet.is())
return state; return state;
...@@ -609,14 +659,21 @@ QAccessible::State Qt5AccessibleWidget::state() const ...@@ -609,14 +659,21 @@ QAccessible::State Qt5AccessibleWidget::state() const
QColor Qt5AccessibleWidget::foregroundColor() const QColor Qt5AccessibleWidget::foregroundColor() const
{ {
Reference<XAccessibleComponent> xAccessibleComponent(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return QColor();
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
return toQColor(xAccessibleComponent->getForeground()); return toQColor(xAccessibleComponent->getForeground());
} }
QColor Qt5AccessibleWidget::backgroundColor() const QColor Qt5AccessibleWidget::backgroundColor() const
{ {
Reference<XAccessibleComponent> xAccessibleComponent(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return QColor();
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
return toQColor(xAccessibleComponent->getBackground()); return toQColor(xAccessibleComponent->getBackground());
} }
...@@ -637,22 +694,8 @@ void* Qt5AccessibleWidget::interface_cast(QAccessible::InterfaceType t) ...@@ -637,22 +694,8 @@ void* Qt5AccessibleWidget::interface_cast(QAccessible::InterfaceType t)
bool Qt5AccessibleWidget::isValid() const bool Qt5AccessibleWidget::isValid() const
{ {
if (m_xAccessible.is()) Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
{ return xAc.is();
try
{
// getAccessibleContext throws RuntimeException if context is no longer alive
Reference<XAccessibleContext> xAc = m_xAccessible->getAccessibleContext();
return xAc.is();
}
// so let's catch it here, cuz otherwise soffice falls flat on its face
// with FatalError and nothing else
catch (css::uno::RuntimeException /*ex*/)
{
return false;
}
}
return false;
} }
QObject* Qt5AccessibleWidget::object() const { return nullptr; } QObject* Qt5AccessibleWidget::object() const { return nullptr; }
...@@ -661,19 +704,10 @@ void Qt5AccessibleWidget::setText(QAccessible::Text /* t */, const QString& /* t ...@@ -661,19 +704,10 @@ void Qt5AccessibleWidget::setText(QAccessible::Text /* t */, const QString& /* t
QAccessibleInterface* Qt5AccessibleWidget::childAt(int x, int y) const QAccessibleInterface* Qt5AccessibleWidget::childAt(int x, int y) const
{ {
if (!m_xAccessible.is()) Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return nullptr; return nullptr;
Reference<XAccessibleContext> xAc;
try
{
xAc = m_xAccessible->getAccessibleContext();
}
catch (css::lang::DisposedException /*ex*/)
{
return nullptr;
}
Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY); Reference<XAccessibleComponent> xAccessibleComponent(xAc, UNO_QUERY);
return QAccessible::queryAccessibleInterface( return QAccessible::queryAccessibleInterface(
new Qt5XAccessible(xAccessibleComponent->getAccessibleAtPoint(awt::Point(x, y)))); new Qt5XAccessible(xAccessibleComponent->getAccessibleAtPoint(awt::Point(x, y))));
...@@ -925,8 +959,11 @@ QString Qt5AccessibleWidget::textBeforeOffset(int /* offset */, ...@@ -925,8 +959,11 @@ QString Qt5AccessibleWidget::textBeforeOffset(int /* offset */,
void Qt5AccessibleWidget::deleteText(int startOffset, int endOffset) void Qt5AccessibleWidget::deleteText(int startOffset, int endOffset)
{ {
Reference<XAccessibleEditableText> xEditableText(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return;
Reference<XAccessibleEditableText> xEditableText(xAc, UNO_QUERY);
if (!xEditableText.is()) if (!xEditableText.is())
return; return;
xEditableText->deleteText(startOffset, endOffset); xEditableText->deleteText(startOffset, endOffset);
...@@ -934,8 +971,11 @@ void Qt5AccessibleWidget::deleteText(int startOffset, int endOffset) ...@@ -934,8 +971,11 @@ void Qt5AccessibleWidget::deleteText(int startOffset, int endOffset)
void Qt5AccessibleWidget::insertText(int offset, const QString& text) void Qt5AccessibleWidget::insertText(int offset, const QString& text)
{ {
Reference<XAccessibleEditableText> xEditableText(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return;
Reference<XAccessibleEditableText> xEditableText(xAc, UNO_QUERY);
if (!xEditableText.is()) if (!xEditableText.is())
return; return;
xEditableText->insertText(toOUString(text), offset); xEditableText->insertText(toOUString(text), offset);
...@@ -943,8 +983,11 @@ void Qt5AccessibleWidget::insertText(int offset, const QString& text) ...@@ -943,8 +983,11 @@ void Qt5AccessibleWidget::insertText(int offset, const QString& text)
void Qt5AccessibleWidget::replaceText(int startOffset, int endOffset, const QString& text) void Qt5AccessibleWidget::replaceText(int startOffset, int endOffset, const QString& text)
{ {
Reference<XAccessibleEditableText> xEditableText(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return;
Reference<XAccessibleEditableText> xEditableText(xAc, UNO_QUERY);
if (!xEditableText.is()) if (!xEditableText.is())
return; return;
xEditableText->replaceText(startOffset, endOffset, toOUString(text)); xEditableText->replaceText(startOffset, endOffset, toOUString(text));
...@@ -953,7 +996,11 @@ void Qt5AccessibleWidget::replaceText(int startOffset, int endOffset, const QStr ...@@ -953,7 +996,11 @@ void Qt5AccessibleWidget::replaceText(int startOffset, int endOffset, const QStr
// QAccessibleValueInterface // QAccessibleValueInterface
QVariant Qt5AccessibleWidget::currentValue() const QVariant Qt5AccessibleWidget::currentValue() const
{ {
Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QVariant();
Reference<XAccessibleValue> xValue(xAc, UNO_QUERY);
if (!xValue.is()) if (!xValue.is())
return QVariant(); return QVariant();
double aDouble = 0; double aDouble = 0;
...@@ -962,7 +1009,11 @@ QVariant Qt5AccessibleWidget::currentValue() const ...@@ -962,7 +1009,11 @@ QVariant Qt5AccessibleWidget::currentValue() const
} }
QVariant Qt5AccessibleWidget::maximumValue() const QVariant Qt5AccessibleWidget::maximumValue() const
{ {
Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QVariant();
Reference<XAccessibleValue> xValue(xAc, UNO_QUERY);
if (!xValue.is()) if (!xValue.is())
return QVariant(); return QVariant();
double aDouble = 0; double aDouble = 0;
...@@ -972,7 +1023,11 @@ QVariant Qt5AccessibleWidget::maximumValue() const ...@@ -972,7 +1023,11 @@ QVariant Qt5AccessibleWidget::maximumValue() const
QVariant Qt5AccessibleWidget::minimumStepSize() const { return QVariant(); } QVariant Qt5AccessibleWidget::minimumStepSize() const { return QVariant(); }
QVariant Qt5AccessibleWidget::minimumValue() const QVariant Qt5AccessibleWidget::minimumValue() const
{ {
Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QVariant();
Reference<XAccessibleValue> xValue(xAc, UNO_QUERY);
if (!xValue.is()) if (!xValue.is())
return QVariant(); return QVariant();
double aDouble = 0; double aDouble = 0;
...@@ -981,7 +1036,11 @@ QVariant Qt5AccessibleWidget::minimumValue() const ...@@ -981,7 +1036,11 @@ QVariant Qt5AccessibleWidget::minimumValue() const
} }
void Qt5AccessibleWidget::setCurrentValue(const QVariant& value) void Qt5AccessibleWidget::setCurrentValue(const QVariant& value)
{ {
Reference<XAccessibleValue> xValue(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return;
Reference<XAccessibleValue> xValue(xAc, UNO_QUERY);
if (!xValue.is()) if (!xValue.is())
return; return;
xValue->setCurrentValue(Any(value.toDouble())); xValue->setCurrentValue(Any(value.toDouble()));
...@@ -990,7 +1049,11 @@ void Qt5AccessibleWidget::setCurrentValue(const QVariant& value) ...@@ -990,7 +1049,11 @@ void Qt5AccessibleWidget::setCurrentValue(const QVariant& value)
// QAccessibleTable // QAccessibleTable
QAccessibleInterface* Qt5AccessibleWidget::caption() const QAccessibleInterface* Qt5AccessibleWidget::caption() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return nullptr;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return nullptr; return nullptr;
return QAccessible::queryAccessibleInterface( return QAccessible::queryAccessibleInterface(
...@@ -999,7 +1062,11 @@ QAccessibleInterface* Qt5AccessibleWidget::caption() const ...@@ -999,7 +1062,11 @@ QAccessibleInterface* Qt5AccessibleWidget::caption() const
QAccessibleInterface* Qt5AccessibleWidget::cellAt(int row, int column) const QAccessibleInterface* Qt5AccessibleWidget::cellAt(int row, int column) const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return nullptr;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return nullptr; return nullptr;
return QAccessible::queryAccessibleInterface( return QAccessible::queryAccessibleInterface(
...@@ -1008,7 +1075,11 @@ QAccessibleInterface* Qt5AccessibleWidget::cellAt(int row, int column) const ...@@ -1008,7 +1075,11 @@ QAccessibleInterface* Qt5AccessibleWidget::cellAt(int row, int column) const
int Qt5AccessibleWidget::columnCount() const int Qt5AccessibleWidget::columnCount() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return 0;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return 0; return 0;
return xTable->getAccessibleColumnCount(); return xTable->getAccessibleColumnCount();
...@@ -1016,7 +1087,11 @@ int Qt5AccessibleWidget::columnCount() const ...@@ -1016,7 +1087,11 @@ int Qt5AccessibleWidget::columnCount() const
QString Qt5AccessibleWidget::columnDescription(int column) const QString Qt5AccessibleWidget::columnDescription(int column) const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QString();
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return QString(); return QString();
return toQString(xTable->getAccessibleColumnDescription(column)); return toQString(xTable->getAccessibleColumnDescription(column));
...@@ -1030,7 +1105,11 @@ void Qt5AccessibleWidget::modelChange(QAccessibleTableModelChangeEvent*) {} ...@@ -1030,7 +1105,11 @@ void Qt5AccessibleWidget::modelChange(QAccessibleTableModelChangeEvent*) {}
int Qt5AccessibleWidget::rowCount() const int Qt5AccessibleWidget::rowCount() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return 0;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return 0; return 0;
return xTable->getAccessibleRowCount(); return xTable->getAccessibleRowCount();
...@@ -1038,7 +1117,11 @@ int Qt5AccessibleWidget::rowCount() const ...@@ -1038,7 +1117,11 @@ int Qt5AccessibleWidget::rowCount() const
QString Qt5AccessibleWidget::rowDescription(int row) const QString Qt5AccessibleWidget::rowDescription(int row) const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QString();
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return QString(); return QString();
return toQString(xTable->getAccessibleRowDescription(row)); return toQString(xTable->getAccessibleRowDescription(row));
...@@ -1046,8 +1129,11 @@ QString Qt5AccessibleWidget::rowDescription(int row) const ...@@ -1046,8 +1129,11 @@ QString Qt5AccessibleWidget::rowDescription(int row) const
bool Qt5AccessibleWidget::selectColumn(int column) bool Qt5AccessibleWidget::selectColumn(int column)
{ {
Reference<XAccessibleTableSelection> xTableSelection(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return false;
Reference<XAccessibleTableSelection> xTableSelection(xAc, UNO_QUERY);
if (!xTableSelection.is()) if (!xTableSelection.is())
return false; return false;
return xTableSelection->selectColumn(column); return xTableSelection->selectColumn(column);
...@@ -1055,8 +1141,11 @@ bool Qt5AccessibleWidget::selectColumn(int column) ...@@ -1055,8 +1141,11 @@ bool Qt5AccessibleWidget::selectColumn(int column)
bool Qt5AccessibleWidget::selectRow(int row) bool Qt5AccessibleWidget::selectRow(int row)
{ {
Reference<XAccessibleTableSelection> xTableSelection(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return false;
Reference<XAccessibleTableSelection> xTableSelection(xAc, UNO_QUERY);
if (!xTableSelection.is()) if (!xTableSelection.is())
return false; return false;
return xTableSelection->selectRow(row); return xTableSelection->selectRow(row);
...@@ -1076,7 +1165,11 @@ QList<QAccessibleInterface*> Qt5AccessibleWidget::selectedCells() const ...@@ -1076,7 +1165,11 @@ QList<QAccessibleInterface*> Qt5AccessibleWidget::selectedCells() const
int Qt5AccessibleWidget::selectedColumnCount() const int Qt5AccessibleWidget::selectedColumnCount() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return 0;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return 0; return 0;
return xTable->getSelectedAccessibleColumns().getLength(); return xTable->getSelectedAccessibleColumns().getLength();
...@@ -1084,7 +1177,11 @@ int Qt5AccessibleWidget::selectedColumnCount() const ...@@ -1084,7 +1177,11 @@ int Qt5AccessibleWidget::selectedColumnCount() const
QList<int> Qt5AccessibleWidget::selectedColumns() const QList<int> Qt5AccessibleWidget::selectedColumns() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QList<int>();
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return QList<int>(); return QList<int>();
return toQList(xTable->getSelectedAccessibleColumns()); return toQList(xTable->getSelectedAccessibleColumns());
...@@ -1092,7 +1189,11 @@ QList<int> Qt5AccessibleWidget::selectedColumns() const ...@@ -1092,7 +1189,11 @@ QList<int> Qt5AccessibleWidget::selectedColumns() const
int Qt5AccessibleWidget::selectedRowCount() const int Qt5AccessibleWidget::selectedRowCount() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return 0;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return 0; return 0;
return xTable->getSelectedAccessibleRows().getLength(); return xTable->getSelectedAccessibleRows().getLength();
...@@ -1100,7 +1201,11 @@ int Qt5AccessibleWidget::selectedRowCount() const ...@@ -1100,7 +1201,11 @@ int Qt5AccessibleWidget::selectedRowCount() const
QList<int> Qt5AccessibleWidget::selectedRows() const QList<int> Qt5AccessibleWidget::selectedRows() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return QList<int>();
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return QList<int>(); return QList<int>();
return toQList(xTable->getSelectedAccessibleRows()); return toQList(xTable->getSelectedAccessibleRows());
...@@ -1108,7 +1213,11 @@ QList<int> Qt5AccessibleWidget::selectedRows() const ...@@ -1108,7 +1213,11 @@ QList<int> Qt5AccessibleWidget::selectedRows() const
QAccessibleInterface* Qt5AccessibleWidget::summary() const QAccessibleInterface* Qt5AccessibleWidget::summary() const
{ {
Reference<XAccessibleTable> xTable(m_xAccessible->getAccessibleContext(), UNO_QUERY); Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
if (!xAc.is())
return nullptr;
Reference<XAccessibleTable> xTable(xAc, UNO_QUERY);
if (!xTable.is()) if (!xTable.is())
return nullptr; return nullptr;
return QAccessible::queryAccessibleInterface( return QAccessible::queryAccessibleInterface(
...@@ -1117,8 +1226,11 @@ QAccessibleInterface* Qt5AccessibleWidget::summary() const ...@@ -1117,8 +1226,11 @@ QAccessibleInterface* Qt5AccessibleWidget::summary() const
bool Qt5AccessibleWidget::unselectColumn(int column) bool Qt5AccessibleWidget::unselectColumn(int column)
{ {
Reference<XAccessibleTableSelection> xTableSelection(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return false;
Reference<XAccessibleTableSelection> xTableSelection(xAc, UNO_QUERY);
if (!xTableSelection.is()) if (!xTableSelection.is())
return false; return false;
return xTableSelection->unselectColumn(column); return xTableSelection->unselectColumn(column);
...@@ -1126,8 +1238,11 @@ bool Qt5AccessibleWidget::unselectColumn(int column) ...@@ -1126,8 +1238,11 @@ bool Qt5AccessibleWidget::unselectColumn(int column)
bool Qt5AccessibleWidget::unselectRow(int row) bool Qt5AccessibleWidget::unselectRow(int row)
{ {
Reference<XAccessibleTableSelection> xTableSelection(m_xAccessible->getAccessibleContext(), Reference<XAccessibleContext> xAc = getAccessibleContextImpl();
UNO_QUERY); if (!xAc.is())
return false;
Reference<XAccessibleTableSelection> xTableSelection(xAc, UNO_QUERY);
if (!xTableSelection.is()) if (!xTableSelection.is())
return false; return false;
return xTableSelection->unselectRow(row); return xTableSelection->unselectRow(row);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment