sd/source/ui/view/sdwindow.cxx                                   |    9 
 solenv/clang-format/excludelist                                  |    4 
 toolkit/inc/controls/accessiblecontrolcontext.hxx                |  148 +--
 toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx    |  172 +--
 toolkit/source/controls/accessiblecontrolcontext.cxx             |  446 
++++------
 toolkit/source/controls/table/AccessibleGridControlTableCell.cxx |  425 
++++-----
 6 files changed, 591 insertions(+), 613 deletions(-)

New commits:
commit f3e3e9a065e34339a959b9ab70f26649120605a5
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jun 25 10:46:49 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jun 26 13:10:11 2025 +0200

    sd a11y: Simplify sd::Window::CreateAccessible
    
    As a vcl::Window::CreateAccessible override,
    it only gets called from vcl::Window::GetAccessible
    when no accessible has been set yet, so there's no
    need to check that inside of the method implementation
    again.
    
    Change-Id: Ibf3197e99bc554eedd72b8f2771c441e1f892729
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186956
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 8f71c17db957..5be821898053 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -962,14 +962,11 @@ css::uno::Reference<css::accessibility::XAccessible>
     {
         return vcl::Window::CreateAccessible ();
     }
-    css::uno::Reference< css::accessibility::XAccessible > xAcc = 
GetAccessible(false);
-    if (xAcc)
-    {
-        return xAcc;
-    }
+
     if (mpViewShell != nullptr)
     {
-        xAcc = mpViewShell->CreateAccessibleDocumentView (this);
+        css::uno::Reference<css::accessibility::XAccessible> xAcc
+            = mpViewShell->CreateAccessibleDocumentView(this);
         SetAccessible(xAcc);
         return xAcc;
     }
commit 9918013d3dac42876ef60ec80bde4b4212a5a667
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jun 25 10:35:03 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jun 26 13:10:04 2025 +0200

    toolkit a11y: clang-format AccessibleGridControlCell
    
    This in particular gets rid of one extra level of
    indentation.
    
    Change-Id: I6a97f022fb2f75747cabd470c1512ee624918a90
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186955
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index afb0233a8cdb..99e9b4b2b93b 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -13425,7 +13425,6 @@ 
toolkit/inc/controls/table/AccessibleGridControlHeader.hxx
 toolkit/inc/controls/table/AccessibleGridControlHeaderCell.hxx
 toolkit/inc/controls/table/AccessibleGridControlTable.hxx
 toolkit/inc/controls/table/AccessibleGridControlTableBase.hxx
-toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx
 toolkit/inc/controls/table/defaultinputhandler.hxx
 toolkit/inc/controls/table/gridtablerenderer.hxx
 toolkit/inc/controls/table/tablecontrol.hxx
@@ -13494,7 +13493,6 @@ 
toolkit/source/controls/table/AccessibleGridControlHeader.cxx
 toolkit/source/controls/table/AccessibleGridControlHeaderCell.cxx
 toolkit/source/controls/table/AccessibleGridControlTable.cxx
 toolkit/source/controls/table/AccessibleGridControlTableBase.cxx
-toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
 toolkit/source/controls/table/cellvalueconversion.cxx
 toolkit/source/controls/table/cellvalueconversion.hxx
 toolkit/source/controls/table/defaultinputhandler.cxx
diff --git a/toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx 
b/toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx
index 6c31f6729274..a618a33a09c2 100644
--- a/toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx
+++ b/toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx
@@ -27,101 +27,103 @@
 
 namespace accessibility
 {
-    class AccessibleGridControlCell : public AccessibleGridControlBase
-    {
-    private:
-        sal_Int32               m_nRowPos;      // the row number of the table 
cell
-        sal_Int32               m_nColPos;      // the column id of the table 
cell
-
-    protected:
-        // attribute access
-        sal_Int32    getRowPos( ) const { return m_nRowPos; }
-        sal_Int32    getColumnPos( ) const { return m_nColPos; }
-
-        // XAccessibleComponent
-        virtual void SAL_CALL grabFocus() override;
-
-    public:
-        // XAccessibleContext
-        virtual OUString SAL_CALL getAccessibleName() override;
-
-    protected:
-        AccessibleGridControlCell(
-            const css::uno::Reference< css::accessibility::XAccessible >& 
_rxParent,
-            svt::table::TableControl& _rTable,
-            sal_Int32 _nRowPos,
-            sal_uInt16 _nColPos,
-            AccessibleTableControlObjType _eType
-        );
-
-        virtual ~AccessibleGridControlCell() override = default;
-
-    private:
-        AccessibleGridControlCell( const AccessibleGridControlCell& ) = delete;
-        AccessibleGridControlCell& operator=( const AccessibleGridControlCell& 
) = delete;
-    };
-
-    // implementation of a table cell of GridControl
-    class AccessibleGridControlTableCell final
-        : public cppu::ImplInheritanceHelper<AccessibleGridControlCell, 
css::accessibility::XAccessibleText>,
-          public ::comphelper::OCommonAccessibleText
-    {
-    private:
-        // OCommonAccessibleText
-        virtual OUString                        implGetText() override;
-        virtual css::lang::Locale               implGetLocale() override;
-        virtual void                            implGetSelection( sal_Int32& 
nStartIndex, sal_Int32& nEndIndex ) override final;
-        virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() 
override;
-
-    public:
-        AccessibleGridControlTableCell( const css::uno::Reference< 
css::accessibility::XAccessible >& _rxParent,
-                                    svt::table::TableControl& _rTable,
-                                    sal_Int32 _nRowId,
-                                    sal_uInt16 _nColId);
-
-        /** @return  The index of this object among the parent's children. */
-        virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
-
-        /** @return
+class AccessibleGridControlCell : public AccessibleGridControlBase
+{
+private:
+    sal_Int32 m_nRowPos; // the row number of the table cell
+    sal_Int32 m_nColPos; // the column id of the table cell
+
+protected:
+    // attribute access
+    sal_Int32 getRowPos() const { return m_nRowPos; }
+    sal_Int32 getColumnPos() const { return m_nColPos; }
+
+    // XAccessibleComponent
+    virtual void SAL_CALL grabFocus() override;
+
+public:
+    // XAccessibleContext
+    virtual OUString SAL_CALL getAccessibleName() override;
+
+protected:
+    AccessibleGridControlCell(const 
css::uno::Reference<css::accessibility::XAccessible>& _rxParent,
+                              svt::table::TableControl& _rTable, sal_Int32 
_nRowPos,
+                              sal_uInt16 _nColPos, 
AccessibleTableControlObjType _eType);
+
+    virtual ~AccessibleGridControlCell() override = default;
+
+private:
+    AccessibleGridControlCell(const AccessibleGridControlCell&) = delete;
+    AccessibleGridControlCell& operator=(const AccessibleGridControlCell&) = 
delete;
+};
+
+// implementation of a table cell of GridControl
+class AccessibleGridControlTableCell final
+    : public cppu::ImplInheritanceHelper<AccessibleGridControlCell,
+                                         css::accessibility::XAccessibleText>,
+      public ::comphelper::OCommonAccessibleText
+{
+private:
+    // OCommonAccessibleText
+    virtual OUString implGetText() override;
+    virtual css::lang::Locale implGetLocale() override;
+    virtual void implGetSelection(sal_Int32& nStartIndex, sal_Int32& 
nEndIndex) override final;
+    virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override;
+
+public:
+    AccessibleGridControlTableCell(
+        const css::uno::Reference<css::accessibility::XAccessible>& _rxParent,
+        svt::table::TableControl& _rTable, sal_Int32 _nRowId, sal_uInt16 
_nColId);
+
+    /** @return  The index of this object among the parent's children. */
+    virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
+
+    /** @return
                 The name of this class.
         */
-        virtual OUString SAL_CALL getImplementationName() override;
+    virtual OUString SAL_CALL getImplementationName() override;
 
-        /** @return
+    /** @return
                 The count of visible children.
         */
-        virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
+    virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
 
-        /** @return
+    /** @return
                 The XAccessible interface of the specified child.
         */
-        virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
-            getAccessibleChild( sal_Int64 nChildIndex ) override;
+    virtual css::uno::Reference<css::accessibility::XAccessible>
+        SAL_CALL getAccessibleChild(sal_Int64 nChildIndex) override;
 
-        /** Return a bitset of states of the current object.
+    /** Return a bitset of states of the current object.
         */
-        sal_Int64 implCreateStateSet() override;
-
-        // XAccessibleText
-        virtual sal_Int32 SAL_CALL getCaretPosition() override;
-        virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) 
override;
-        virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
-        virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL 
getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& 
aRequestedAttributes ) override;
-        virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 
nIndex ) override;
-        virtual sal_Int32 SAL_CALL getCharacterCount() override;
-        virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& 
aPoint ) override;
-        virtual OUString SAL_CALL getSelectedText() override;
-        virtual sal_Int32 SAL_CALL getSelectionStart() override;
-        virtual sal_Int32 SAL_CALL getSelectionEnd() override;
-        virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, 
sal_Int32 nEndIndex ) override;
-        virtual OUString SAL_CALL getText() override;
-        virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, 
sal_Int32 nEndIndex ) override;
-        virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( 
sal_Int32 nIndex, sal_Int16 aTextType ) override;
-        virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( 
sal_Int32 nIndex, sal_Int16 aTextType ) override;
-        virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( 
sal_Int32 nIndex, sal_Int16 aTextType ) override;
-        virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 
nEndIndex ) override;
-        virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, 
sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) 
override;
-    };
+    sal_Int64 implCreateStateSet() override;
+
+    // XAccessibleText
+    virtual sal_Int32 SAL_CALL getCaretPosition() override;
+    virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override;
+    virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override;
+    virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL 
getCharacterAttributes(
+        sal_Int32 nIndex, const css::uno::Sequence<OUString>& 
aRequestedAttributes) override;
+    virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) 
override;
+    virtual sal_Int32 SAL_CALL getCharacterCount() override;
+    virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point& aPoint) 
override;
+    virtual OUString SAL_CALL getSelectedText() override;
+    virtual sal_Int32 SAL_CALL getSelectionStart() override;
+    virtual sal_Int32 SAL_CALL getSelectionEnd() override;
+    virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 
nEndIndex) override;
+    virtual OUString SAL_CALL getText() override;
+    virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 
nEndIndex) override;
+    virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 
nIndex,
+                                                                    sal_Int16 
aTextType) override;
+    virtual css::accessibility::TextSegment SAL_CALL
+    getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override;
+    virtual css::accessibility::TextSegment SAL_CALL
+    getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override;
+    virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 
nEndIndex) override;
+    virtual sal_Bool SAL_CALL
+    scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex,
+                      css::accessibility::AccessibleScrollType aScrollType) 
override;
+};
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx 
b/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
index 46bae992325c..998c7e10c809 100644
--- a/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControlTableCell.cxx
@@ -27,268 +27,263 @@
 
 namespace accessibility
 {
-    namespace
-    {
-        // FIXME this is a copy'n'paste from
-        // source/accessibility/AccessibleBrowseBoxTableCell.cxx, get rid of 
that...
-        /// @throws css::lang::IndexOutOfBoundsException
-        void checkIndex_Impl( sal_Int32 _nIndex, std::u16string_view _sText )
-        {
-            if ( _nIndex >= static_cast<sal_Int32>(_sText.size()) )
-                throw css::lang::IndexOutOfBoundsException();
-        }
-    }
-    using namespace ::com::sun::star::lang;
-    using namespace comphelper;
-    using namespace ::com::sun::star::uno;
-    using ::com::sun::star::accessibility::XAccessible;
-    using namespace ::com::sun::star::accessibility;
-    using namespace ::vcl;
-
-
-    // = AccessibleGridControlCell
-
-
-    AccessibleGridControlCell::AccessibleGridControlCell(
-            const css::uno::Reference< css::accessibility::XAccessible >& 
_rxParent, svt::table::TableControl& _rTable,
-            sal_Int32 _nRowPos, sal_uInt16 _nColPos, 
AccessibleTableControlObjType _eType )
-        :AccessibleGridControlBase( _rxParent, _rTable, _eType )
-        ,m_nRowPos( _nRowPos )
-        ,m_nColPos( _nColPos )
-    {
-        assert(((m_eObjType == AccessibleTableControlObjType::TABLECELL)
-                || ((m_eObjType == 
AccessibleTableControlObjType::ROWHEADERCELL) && _nColPos == 0)
-                || ((m_eObjType == 
AccessibleTableControlObjType::COLUMNHEADERCELL) && _nRowPos == 0))
-               && "Unhandled table cell type");
-    }
+namespace
+{
+// FIXME this is a copy'n'paste from
+// source/accessibility/AccessibleBrowseBoxTableCell.cxx, get rid of that...
+/// @throws css::lang::IndexOutOfBoundsException
+void checkIndex_Impl(sal_Int32 _nIndex, std::u16string_view _sText)
+{
+    if (_nIndex >= static_cast<sal_Int32>(_sText.size()))
+        throw css::lang::IndexOutOfBoundsException();
+}
+}
+using namespace ::com::sun::star::lang;
+using namespace comphelper;
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::accessibility::XAccessible;
+using namespace ::com::sun::star::accessibility;
+using namespace ::vcl;
+
+// = AccessibleGridControlCell
+
+AccessibleGridControlCell::AccessibleGridControlCell(
+    const css::uno::Reference<css::accessibility::XAccessible>& _rxParent,
+    svt::table::TableControl& _rTable, sal_Int32 _nRowPos, sal_uInt16 _nColPos,
+    AccessibleTableControlObjType _eType)
+    : AccessibleGridControlBase(_rxParent, _rTable, _eType)
+    , m_nRowPos(_nRowPos)
+    , m_nColPos(_nColPos)
+{
+    assert(((m_eObjType == AccessibleTableControlObjType::TABLECELL)
+            || ((m_eObjType == AccessibleTableControlObjType::ROWHEADERCELL) 
&& _nColPos == 0)
+            || ((m_eObjType == 
AccessibleTableControlObjType::COLUMNHEADERCELL) && _nRowPos == 0))
+           && "Unhandled table cell type");
+}
 
-    void SAL_CALL AccessibleGridControlCell::grabFocus()
-    {
-        SolarMutexGuard aSolarGuard;
+void SAL_CALL AccessibleGridControlCell::grabFocus()
+{
+    SolarMutexGuard aSolarGuard;
 
-        m_aTable.GoToCell( m_nColPos, m_nRowPos );
-    }
+    m_aTable.GoToCell(m_nColPos, m_nRowPos);
+}
 
-    OUString SAL_CALL AccessibleGridControlCell::getAccessibleName()
-    {
-        SolarMutexGuard g;
+OUString SAL_CALL AccessibleGridControlCell::getAccessibleName()
+{
+    SolarMutexGuard g;
 
-        ensureAlive();
-        return m_aTable.GetAccessibleObjectName(m_eObjType, m_nRowPos, 
m_nColPos);
-    }
+    ensureAlive();
+    return m_aTable.GetAccessibleObjectName(m_eObjType, m_nRowPos, m_nColPos);
+}
 
-    // implementation of a table cell
-    OUString AccessibleGridControlTableCell::implGetText()
-    {
-        ensureAlive();
-        return m_aTable.GetAccessibleCellText( getRowPos(),  getColumnPos() );
-    }
+// implementation of a table cell
+OUString AccessibleGridControlTableCell::implGetText()
+{
+    ensureAlive();
+    return m_aTable.GetAccessibleCellText(getRowPos(), getColumnPos());
+}
 
-    css::lang::Locale AccessibleGridControlTableCell::implGetLocale()
-    {
-        ensureAlive();
-        return m_aTable.GetAccessible()->getAccessibleContext()->getLocale();
-    }
+css::lang::Locale AccessibleGridControlTableCell::implGetLocale()
+{
+    ensureAlive();
+    return m_aTable.GetAccessible()->getAccessibleContext()->getLocale();
+}
 
-    void AccessibleGridControlTableCell::implGetSelection( sal_Int32& 
nStartIndex, sal_Int32& nEndIndex )
-    {
-        nStartIndex = 0;
-        nEndIndex = 0;
-    }
+void AccessibleGridControlTableCell::implGetSelection(sal_Int32& nStartIndex, 
sal_Int32& nEndIndex)
+{
+    nStartIndex = 0;
+    nEndIndex = 0;
+}
 
-    AccessibleGridControlTableCell::AccessibleGridControlTableCell(
-        const css::uno::Reference<XAccessible>& _rxParent, 
svt::table::TableControl& _rTable,
-        sal_Int32 _nRowPos, sal_uInt16 _nColPos)
-        : ImplInheritanceHelper(_rxParent, _rTable, _nRowPos, _nColPos,
-                                AccessibleTableControlObjType::TABLECELL)
-    {
-    }
+AccessibleGridControlTableCell::AccessibleGridControlTableCell(
+    const css::uno::Reference<XAccessible>& _rxParent, 
svt::table::TableControl& _rTable,
+    sal_Int32 _nRowPos, sal_uInt16 _nColPos)
+    : ImplInheritanceHelper(_rxParent, _rTable, _nRowPos, _nColPos,
+                            AccessibleTableControlObjType::TABLECELL)
+{
+}
 
-    css::awt::Rectangle SAL_CALL 
AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex )
-    {
-        SolarMutexGuard aSolarGuard;
+css::awt::Rectangle SAL_CALL 
AccessibleGridControlTableCell::getCharacterBounds(sal_Int32 nIndex)
+{
+    SolarMutexGuard aSolarGuard;
 
-        ensureAlive();
-        if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
-            throw IndexOutOfBoundsException();
+    ensureAlive();
+    if (!implIsValidIndex(nIndex, implGetText().getLength()))
+        throw IndexOutOfBoundsException();
 
-        return vcl::unohelper::ConvertToAWTRect(
-            m_aTable.GetCharacterBounds(nIndex));
-    }
+    return 
vcl::unohelper::ConvertToAWTRect(m_aTable.GetCharacterBounds(nIndex));
+}
 
-    sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const 
css::awt::Point& _aPoint )
-    {
-        SolarMutexGuard aSolarGuard;
+sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint(const 
css::awt::Point& _aPoint)
+{
+    SolarMutexGuard aSolarGuard;
 
-        ensureAlive();
+    ensureAlive();
 
-        return 
m_aTable.GetIndexForPoint(vcl::unohelper::ConvertToVCLPoint(_aPoint));
-    }
+    return 
m_aTable.GetIndexForPoint(vcl::unohelper::ConvertToVCLPoint(_aPoint));
+}
 
-    /** @return
+/** @return
             The name of this class.
     */
-    OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName()
-    {
-        return 
u"com.sun.star.accessibility.AccessibleGridControlTableCell"_ustr;
-    }
+OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName()
+{
+    return u"com.sun.star.accessibility.AccessibleGridControlTableCell"_ustr;
+}
 
-    /** @return  The count of visible children. */
-    sal_Int64 SAL_CALL 
AccessibleGridControlTableCell::getAccessibleChildCount()
-    {
-        return 0;
-    }
+/** @return  The count of visible children. */
+sal_Int64 SAL_CALL AccessibleGridControlTableCell::getAccessibleChildCount() { 
return 0; }
 
-    /** @return  The css::accessibility::XAccessible interface of the 
specified child. */
-    css::uno::Reference< css::accessibility::XAccessible > SAL_CALL 
AccessibleGridControlTableCell::getAccessibleChild( sal_Int64 )
-    {
-        throw css::lang::IndexOutOfBoundsException();
-    }
+/** @return  The css::accessibility::XAccessible interface of the specified 
child. */
+css::uno::Reference<css::accessibility::XAccessible>
+    SAL_CALL AccessibleGridControlTableCell::getAccessibleChild(sal_Int64)
+{
+    throw css::lang::IndexOutOfBoundsException();
+}
 
-    /** Return a bitset of states of the current object.
+/** Return a bitset of states of the current object.
     */
-    sal_Int64 AccessibleGridControlTableCell::implCreateStateSet()
-    {
-        sal_Int64 nStateSet = 0;
-
-        if( isAlive() )
-        {
-            // SHOWING done with mxParent
-            if( implIsShowing() )
-                nStateSet |= AccessibleStateType::SHOWING;
+sal_Int64 AccessibleGridControlTableCell::implCreateStateSet()
+{
+    sal_Int64 nStateSet = 0;
 
-            m_aTable.FillAccessibleStateSetForCell( nStateSet, getRowPos(), 
static_cast< sal_uInt16 >( getColumnPos() ) );
-        }
-        else
-            nStateSet |= AccessibleStateType::DEFUNC;
+    if (isAlive())
+    {
+        // SHOWING done with mxParent
+        if (implIsShowing())
+            nStateSet |= AccessibleStateType::SHOWING;
 
-        return nStateSet;
+        m_aTable.FillAccessibleStateSetForCell(nStateSet, getRowPos(),
+                                               
static_cast<sal_uInt16>(getColumnPos()));
     }
+    else
+        nStateSet |= AccessibleStateType::DEFUNC;
 
-    // css::accessibility::XAccessibleContext
+    return nStateSet;
+}
 
-    sal_Int64 SAL_CALL 
AccessibleGridControlTableCell::getAccessibleIndexInParent()
-    {
-        SolarMutexGuard aSolarGuard;
+// css::accessibility::XAccessibleContext
 
-        ensureAlive();
+sal_Int64 SAL_CALL AccessibleGridControlTableCell::getAccessibleIndexInParent()
+{
+    SolarMutexGuard aSolarGuard;
 
-        return (static_cast<sal_Int64>(getRowPos()) * 
static_cast<sal_Int64>(m_aTable.GetColumnCount())) + getColumnPos();
-    }
+    ensureAlive();
 
-    sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition(  )
-    {
-        return -1;
-    }
-    sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( 
sal_Int32 nIndex )
-    {
-        SolarMutexGuard aSolarGuard;
+    return (static_cast<sal_Int64>(getRowPos()) * 
static_cast<sal_Int64>(m_aTable.GetColumnCount()))
+           + getColumnPos();
+}
 
-        if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
-            throw IndexOutOfBoundsException();
+sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition() { return 
-1; }
+sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition(sal_Int32 
nIndex)
+{
+    SolarMutexGuard aSolarGuard;
 
-        return false;
-    }
-    sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( 
sal_Int32 nIndex )
-    {
-        SolarMutexGuard aSolarGuard;
+    if (!implIsValidRange(nIndex, nIndex, implGetText().getLength()))
+        throw IndexOutOfBoundsException();
 
-        return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex 
);
-    }
-    css::uno::Sequence< css::beans::PropertyValue > SAL_CALL 
AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const 
css::uno::Sequence< OUString >& )
-    {
-        SolarMutexGuard aSolarGuard;
+    return false;
+}
+sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter(sal_Int32 
nIndex)
+{
+    SolarMutexGuard aSolarGuard;
 
-        OUString sText( implGetText() );
+    return OCommonAccessibleText::implGetCharacter(implGetText(), nIndex);
+}
+css::uno::Sequence<css::beans::PropertyValue> SAL_CALL
+AccessibleGridControlTableCell::getCharacterAttributes(sal_Int32 nIndex,
+                                                       const 
css::uno::Sequence<OUString>&)
+{
+    SolarMutexGuard aSolarGuard;
 
-        if ( !implIsValidIndex( nIndex, sText.getLength() ) )
-            throw IndexOutOfBoundsException();
+    OUString sText(implGetText());
 
-        return css::uno::Sequence< css::beans::PropertyValue >();
-    }
-    sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount(  )
-    {
-        SolarMutexGuard aSolarGuard;
+    if (!implIsValidIndex(nIndex, sText.getLength()))
+        throw IndexOutOfBoundsException();
 
-        return implGetText().getLength();
-    }
+    return css::uno::Sequence<css::beans::PropertyValue>();
+}
+sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount()
+{
+    SolarMutexGuard aSolarGuard;
 
-    OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText(  )
-    {
-        return OUString();
-    }
-    sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart(  )
-    {
-        return 0;
-    }
-    sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd(  )
-    {
-        return 0;
-    }
-    sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 
nStartIndex, sal_Int32 nEndIndex )
-    {
-        SolarMutexGuard aSolarGuard;
+    return implGetText().getLength();
+}
 
-        if ( !implIsValidRange( nStartIndex, nEndIndex, 
implGetText().getLength() ) )
-            throw IndexOutOfBoundsException();
+OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText() { return 
OUString(); }
+sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart() { 
return 0; }
+sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd() { return 
0; }
+sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection(sal_Int32 
nStartIndex,
+                                                               sal_Int32 
nEndIndex)
+{
+    SolarMutexGuard aSolarGuard;
 
-        return false;
-    }
-    OUString SAL_CALL AccessibleGridControlTableCell::getText(  )
-    {
-        SolarMutexGuard aSolarGuard;
+    if (!implIsValidRange(nStartIndex, nEndIndex, implGetText().getLength()))
+        throw IndexOutOfBoundsException();
 
-        return implGetText(  );
-    }
-    OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 
nStartIndex, sal_Int32 nEndIndex )
-    {
-        SolarMutexGuard aSolarGuard;
+    return false;
+}
+OUString SAL_CALL AccessibleGridControlTableCell::getText()
+{
+    SolarMutexGuard aSolarGuard;
 
-        return OCommonAccessibleText::implGetTextRange( implGetText(), 
nStartIndex, nEndIndex );
-    }
-    css::accessibility::TextSegment SAL_CALL 
AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 
aTextType )
-    {
-        SolarMutexGuard aSolarGuard;
+    return implGetText();
+}
+OUString SAL_CALL AccessibleGridControlTableCell::getTextRange(sal_Int32 
nStartIndex,
+                                                               sal_Int32 
nEndIndex)
+{
+    SolarMutexGuard aSolarGuard;
 
-        return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
-    }
-    css::accessibility::TextSegment SAL_CALL 
AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 
aTextType )
-    {
-        SolarMutexGuard aSolarGuard;
+    return OCommonAccessibleText::implGetTextRange(implGetText(), nStartIndex, 
nEndIndex);
+}
+css::accessibility::TextSegment SAL_CALL
+AccessibleGridControlTableCell::getTextAtIndex(sal_Int32 nIndex, sal_Int16 
aTextType)
+{
+    SolarMutexGuard aSolarGuard;
 
-        return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
-    }
-    css::accessibility::TextSegment SAL_CALL 
AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 
aTextType )
-    {
-        SolarMutexGuard aSolarGuard;
+    return OCommonAccessibleText::getTextAtIndex(nIndex, aTextType);
+}
+css::accessibility::TextSegment SAL_CALL
+AccessibleGridControlTableCell::getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 
aTextType)
+{
+    SolarMutexGuard aSolarGuard;
 
-        return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
-    }
-    sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 
nStartIndex, sal_Int32 nEndIndex )
-    {
-        SolarMutexGuard aSolarGuard;
+    return OCommonAccessibleText::getTextBeforeIndex(nIndex, aTextType);
+}
+css::accessibility::TextSegment SAL_CALL
+AccessibleGridControlTableCell::getTextBehindIndex(sal_Int32 nIndex, sal_Int16 
aTextType)
+{
+    SolarMutexGuard aSolarGuard;
 
-        OUString sText = implGetText();
-        checkIndex_Impl( nStartIndex, sText );
-        checkIndex_Impl( nEndIndex, sText );
+    return OCommonAccessibleText::getTextBehindIndex(nIndex, aTextType);
+}
+sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText(sal_Int32 
nStartIndex,
+                                                           sal_Int32 nEndIndex)
+{
+    SolarMutexGuard aSolarGuard;
 
-        //!!! don't know how to put a string into the clipboard
-        return false;
-    }
-    sal_Bool SAL_CALL AccessibleGridControlTableCell::scrollSubstringTo( 
sal_Int32, sal_Int32, AccessibleScrollType )
-    {
-        return false;
-    }
+    OUString sText = implGetText();
+    checkIndex_Impl(nStartIndex, sText);
+    checkIndex_Impl(nEndIndex, sText);
 
-    AbsoluteScreenPixelRectangle 
AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
-    {
-        AbsoluteScreenPixelRectangle aGridRect = 
m_aTable.GetWindowExtentsAbsolute();
-        tools::Rectangle aCellRect = m_aTable.calcCellRect(getRowPos(), 
getColumnPos());
-        tools::Long nX = aGridRect.Left() + aCellRect.Left();
-        tools::Long nY = aGridRect.Top() + aCellRect.Top();
-        AbsoluteScreenPixelRectangle aCell( AbsoluteScreenPixelPoint( nX, nY 
), aCellRect.GetSize());
-        return aCell;
-    }
+    //!!! don't know how to put a string into the clipboard
+    return false;
+}
+sal_Bool SAL_CALL AccessibleGridControlTableCell::scrollSubstringTo(sal_Int32, 
sal_Int32,
+                                                                    
AccessibleScrollType)
+{
+    return false;
+}
+
+AbsoluteScreenPixelRectangle 
AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
+{
+    AbsoluteScreenPixelRectangle aGridRect = 
m_aTable.GetWindowExtentsAbsolute();
+    tools::Rectangle aCellRect = m_aTable.calcCellRect(getRowPos(), 
getColumnPos());
+    tools::Long nX = aGridRect.Left() + aCellRect.Left();
+    tools::Long nY = aGridRect.Top() + aCellRect.Top();
+    AbsoluteScreenPixelRectangle aCell(AbsoluteScreenPixelPoint(nX, nY), 
aCellRect.GetSize());
+    return aCell;
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit afeaa37fe3bbba077a0fc2cb4c2ed36a86a52be7
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jun 25 10:32:12 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jun 26 13:09:57 2025 +0200

    toolkit a11y: clang-format OAccessibleControlContext
    
    This in particular gets rid of one extra level
    of indentation.
    
    Change-Id: Ide185fc1dcab05bb95384e9f9b536e461d39a2d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186954
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index af105abe78db..afb0233a8cdb 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -13407,7 +13407,6 @@ toolkit/inc/awt/vclxsystemdependentwindow.hxx
 toolkit/inc/awt/vclxtabpagecontainer.hxx
 toolkit/inc/awt/vclxtopwindow.hxx
 toolkit/inc/awt/vclxwindows.hxx
-toolkit/inc/controls/accessiblecontrolcontext.hxx
 toolkit/inc/controls/animatedimages.hxx
 toolkit/inc/controls/controlmodelcontainerbase.hxx
 toolkit/inc/controls/dialogcontrol.hxx
@@ -13467,7 +13466,6 @@ toolkit/source/awt/vclxtoolkit.cxx
 toolkit/source/awt/vclxtopwindow.cxx
 toolkit/source/awt/vclxwindow.cxx
 toolkit/source/awt/vclxwindows.cxx
-toolkit/source/controls/accessiblecontrolcontext.cxx
 toolkit/source/controls/animatedimages.cxx
 toolkit/source/controls/controlmodelcontainerbase.cxx
 toolkit/source/controls/dialogcontrol.cxx
diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx 
b/toolkit/inc/controls/accessiblecontrolcontext.hxx
index d58a91b0754d..09ab63577243 100644
--- a/toolkit/inc/controls/accessiblecontrolcontext.hxx
+++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx
@@ -24,84 +24,98 @@
 #include <cppuhelper/implbase.hxx>
 #include <rtl/ref.hxx>
 
-namespace vcl { class Window; }
-namespace com::sun::star::awt { class XControl; }
-namespace com::sun::star::awt { class XWindow; }
-namespace com::sun::star::beans { class XPropertySet; }
-namespace com::sun::star::beans { class XPropertySetInfo; }
+namespace vcl
+{
+class Window;
+}
+namespace com::sun::star::awt
+{
+class XControl;
+}
+namespace com::sun::star::awt
+{
+class XWindow;
+}
+namespace com::sun::star::beans
+{
+class XPropertySet;
+}
+namespace com::sun::star::beans
+{
+class XPropertySetInfo;
+}
 
 namespace toolkit
 {
+//= OAccessibleControlContext
 
-
-    //= OAccessibleControlContext
-
-    /** class implementing the AccessibleContext for a UNO control - to be 
used in design mode of the control.
+/** class implementing the AccessibleContext for a UNO control - to be used in 
design mode of the control.
         <p><b>life time control<b/><br/>
         This control should be held weak by the creator (a UNO control), it 
itself holds a hard reference to the
         control model, and a weak reference to the control. The reference to 
the model is freed when the model
         is being disposed.</p>
     */
-    class OAccessibleControlContext final
-            : public cppu::ImplInheritanceHelper<comphelper::OAccessible, 
css::lang::XEventListener>
-    {
-    public:
-        /** creates an accessible context for a uno control
+class OAccessibleControlContext final
+    : public cppu::ImplInheritanceHelper<comphelper::OAccessible, 
css::lang::XEventListener>
+{
+public:
+    /** creates an accessible context for a uno control
         @param rxControl
             the uno control. This must be an XControl from which an 
XControlModel can be retrieved.
         */
-        static rtl::Reference<OAccessibleControlContext> create(
-            const css::uno::Reference<css::awt::XControl>& rxControl
-        );
-
-    private:
-
-        // XAccessibleContext
-        virtual sal_Int64 SAL_CALL getAccessibleChildCount(  ) override;
-        virtual css::uno::Reference< css::accessibility::XAccessible > 
SAL_CALL getAccessibleChild( sal_Int64 i ) override;
-        virtual css::uno::Reference< css::accessibility::XAccessible > 
SAL_CALL getAccessibleParent(  ) override;
-        virtual sal_Int16 SAL_CALL getAccessibleRole(  ) override;
-        virtual OUString SAL_CALL getAccessibleDescription(  ) override;
-        virtual OUString SAL_CALL getAccessibleName(  ) override;
-        virtual css::uno::Reference< 
css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( 
 ) override;
-        virtual sal_Int64 SAL_CALL getAccessibleStateSet(  ) override;
-
-        // XAccessibleComponent
-        virtual css::uno::Reference< css::accessibility::XAccessible > 
SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
-        virtual void SAL_CALL grabFocus(  ) override;
-        virtual sal_Int32 SAL_CALL getForeground(  ) override;
-        virtual sal_Int32 SAL_CALL getBackground(  ) override;
-
-        // XEventListener
-        using comphelper::OAccessible::disposing;
-        virtual void SAL_CALL disposing( const css::lang::EventObject& Source 
) override;
-
-        // retrieves the value of a string property from the model, if the 
property is present
-        OUString getModelStringProperty( const OUString& _pPropertyName );
-
-        // starts listening at the control model (currently for disposal only)
-        void startModelListening( );
-        // stops listening at the control model
-        void stopModelListening( );
-
-        vcl::Window* implGetWindow( css::uno::Reference< css::awt::XWindow >* 
_pxUNOWindow = nullptr ) const;
-
-        OAccessibleControlContext(const 
css::uno::Reference<css::awt::XControl>& rxControl);
-        virtual ~OAccessibleControlContext() override;
-
-        // OAccessible overridables
-        virtual css::awt::Rectangle implGetBounds(  ) override;
-
-        css::uno::Reference< css::beans::XPropertySet >
-                    m_xControlModel;        // the model of the control 
which's context we implement
-        css::uno::Reference< css::beans::XPropertySetInfo >
-                    m_xModelPropsInfo;      // the cached property set info of 
the model
-        // the XControl whose XAccessibleContext this 
OAccessibleControlContext is
-        css::uno::WeakReference<css::awt::XControl> m_aControl;
-    };
-
-
-}   // namespace toolkit
-
+    static rtl::Reference<OAccessibleControlContext>
+    create(const css::uno::Reference<css::awt::XControl>& rxControl);
+
+private:
+    // XAccessibleContext
+    virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
+    virtual css::uno::Reference<css::accessibility::XAccessible>
+        SAL_CALL getAccessibleChild(sal_Int64 i) override;
+    virtual css::uno::Reference<css::accessibility::XAccessible>
+        SAL_CALL getAccessibleParent() override;
+    virtual sal_Int16 SAL_CALL getAccessibleRole() override;
+    virtual OUString SAL_CALL getAccessibleDescription() override;
+    virtual OUString SAL_CALL getAccessibleName() override;
+    virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet>
+        SAL_CALL getAccessibleRelationSet() override;
+    virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
+
+    // XAccessibleComponent
+    virtual css::uno::Reference<css::accessibility::XAccessible>
+        SAL_CALL getAccessibleAtPoint(const css::awt::Point& aPoint) override;
+    virtual void SAL_CALL grabFocus() override;
+    virtual sal_Int32 SAL_CALL getForeground() override;
+    virtual sal_Int32 SAL_CALL getBackground() override;
+
+    // XEventListener
+    using comphelper::OAccessible::disposing;
+    virtual void SAL_CALL disposing(const css::lang::EventObject& Source) 
override;
+
+    // retrieves the value of a string property from the model, if the 
property is present
+    OUString getModelStringProperty(const OUString& _pPropertyName);
+
+    // starts listening at the control model (currently for disposal only)
+    void startModelListening();
+    // stops listening at the control model
+    void stopModelListening();
+
+    vcl::Window* implGetWindow(css::uno::Reference<css::awt::XWindow>* 
_pxUNOWindow
+                               = nullptr) const;
+
+    OAccessibleControlContext(const css::uno::Reference<css::awt::XControl>& 
rxControl);
+    virtual ~OAccessibleControlContext() override;
+
+    // OAccessible overridables
+    virtual css::awt::Rectangle implGetBounds() override;
+
+    css::uno::Reference<css::beans::XPropertySet>
+        m_xControlModel; // the model of the control which's context we 
implement
+    css::uno::Reference<css::beans::XPropertySetInfo>
+        m_xModelPropsInfo; // the cached property set info of the model
+    // the XControl whose XAccessibleContext this OAccessibleControlContext is
+    css::uno::WeakReference<css::awt::XControl> m_aControl;
+};
+
+} // namespace toolkit
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx 
b/toolkit/source/controls/accessiblecontrolcontext.cxx
index 0b54cf1dbf33..4a6d6e21617c 100644
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -30,299 +30,273 @@
 #include <comphelper/diagnose_ex.hxx>
 #include <vcl/window.hxx>
 
-
 namespace toolkit
 {
+using ::comphelper::OContextEntryGuard;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
 
+//= OAccessibleControlContext
 
-    using ::comphelper::OContextEntryGuard;
-    using namespace ::com::sun::star;
-    using namespace ::com::sun::star::uno;
-    using namespace ::com::sun::star::lang;
-    using namespace ::com::sun::star::beans;
-    using namespace ::com::sun::star::accessibility;
-
-
-    //= OAccessibleControlContext
-
-
-    OAccessibleControlContext::OAccessibleControlContext(const 
css::uno::Reference<css::awt::XControl>& rxControl)
-    {
-        if (rxControl.is())
-            m_xControlModel.set(rxControl->getModel(), css::uno::UNO_QUERY);
-        OSL_ENSURE( m_xControlModel.is(), "OAccessibleControlContext::Init: 
invalid creator (no control, or control without model!" );
-        if ( !m_xControlModel.is() )
-            throw DisposedException();  // caught by the caller (the create 
method)
-
-        // start listening at the model
-        startModelListening();
-
-        m_aControl = rxControl;
-    }
-
-
-    OAccessibleControlContext::~OAccessibleControlContext()
-    {
-        ensureDisposed();
-    }
+OAccessibleControlContext::OAccessibleControlContext(
+    const css::uno::Reference<css::awt::XControl>& rxControl)
+{
+    if (rxControl.is())
+        m_xControlModel.set(rxControl->getModel(), css::uno::UNO_QUERY);
+    OSL_ENSURE(
+        m_xControlModel.is(),
+        "OAccessibleControlContext::Init: invalid creator (no control, or 
control without model!");
+    if (!m_xControlModel.is())
+        throw DisposedException(); // caught by the caller (the create method)
 
+    // start listening at the model
+    startModelListening();
 
-    rtl::Reference<OAccessibleControlContext> 
OAccessibleControlContext::create(const Reference<awt::XControl>& rXControl)
-    {
-        rtl::Reference<OAccessibleControlContext> pNew;
-        try
-        {
-            pNew = new OAccessibleControlContext(rXControl);
-        }
-        catch( const Exception& )
-        {
-            TOOLS_WARN_EXCEPTION( "toolkit", 
"OAccessibleControlContext::create: caught an exception in ctor!" );
-        }
-        return pNew;
-    }
+    m_aControl = rxControl;
+}
 
+OAccessibleControlContext::~OAccessibleControlContext() { ensureDisposed(); }
 
-    void OAccessibleControlContext::startModelListening( )
+rtl::Reference<OAccessibleControlContext>
+OAccessibleControlContext::create(const Reference<awt::XControl>& rXControl)
+{
+    rtl::Reference<OAccessibleControlContext> pNew;
+    try
     {
-        Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY );
-        OSL_ENSURE( xModelComp.is(), 
"OAccessibleControlContext::startModelListening: invalid model!" );
-        if ( xModelComp.is() )
-            xModelComp->addEventListener( this );
+        pNew = new OAccessibleControlContext(rXControl);
     }
-
-
-    void OAccessibleControlContext::stopModelListening( )
+    catch (const Exception&)
     {
-        Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY );
-        OSL_ENSURE( xModelComp.is(), 
"OAccessibleControlContext::stopModelListening: invalid model!" );
-        if ( xModelComp.is() )
-            xModelComp->removeEventListener( this );
+        TOOLS_WARN_EXCEPTION("toolkit",
+                             "OAccessibleControlContext::create: caught an 
exception in ctor!");
     }
+    return pNew;
+}
 
+void OAccessibleControlContext::startModelListening()
+{
+    Reference<XComponent> xModelComp(m_xControlModel, UNO_QUERY);
+    OSL_ENSURE(xModelComp.is(), 
"OAccessibleControlContext::startModelListening: invalid model!");
+    if (xModelComp.is())
+        xModelComp->addEventListener(this);
+}
 
-    sal_Int64 SAL_CALL OAccessibleControlContext::getAccessibleChildCount(  )
-    {
-        // we do not have children
-        return 0;
-    }
-
+void OAccessibleControlContext::stopModelListening()
+{
+    Reference<XComponent> xModelComp(m_xControlModel, UNO_QUERY);
+    OSL_ENSURE(xModelComp.is(), 
"OAccessibleControlContext::stopModelListening: invalid model!");
+    if (xModelComp.is())
+        xModelComp->removeEventListener(this);
+}
 
-    Reference< XAccessible > SAL_CALL 
OAccessibleControlContext::getAccessibleChild( sal_Int64 )
-    {
-        // we do not have children
-        throw IndexOutOfBoundsException();
-    }
+sal_Int64 SAL_CALL OAccessibleControlContext::getAccessibleChildCount()
+{
+    // we do not have children
+    return 0;
+}
 
+Reference<XAccessible> SAL_CALL 
OAccessibleControlContext::getAccessibleChild(sal_Int64)
+{
+    // we do not have children
+    throw IndexOutOfBoundsException();
+}
 
-    Reference< XAccessible > SAL_CALL 
OAccessibleControlContext::getAccessibleParent(  )
-    {
-        return Reference< XAccessible >();
-    }
+Reference<XAccessible> SAL_CALL 
OAccessibleControlContext::getAccessibleParent()
+{
+    return Reference<XAccessible>();
+}
 
+sal_Int16 SAL_CALL OAccessibleControlContext::getAccessibleRole() { return 
AccessibleRole::SHAPE; }
 
-    sal_Int16 SAL_CALL OAccessibleControlContext::getAccessibleRole(  )
-    {
-        return AccessibleRole::SHAPE;
-    }
+OUString SAL_CALL OAccessibleControlContext::getAccessibleDescription()
+{
+    OContextEntryGuard aGuard(this);
+    return getModelStringProperty(u"HelpText"_ustr);
+}
 
+OUString SAL_CALL OAccessibleControlContext::getAccessibleName()
+{
+    OContextEntryGuard aGuard(this);
+    return getModelStringProperty(u"Name"_ustr);
+}
 
-    OUString SAL_CALL OAccessibleControlContext::getAccessibleDescription(  )
-    {
-        OContextEntryGuard aGuard( this );
-        return getModelStringProperty( u"HelpText"_ustr );
-    }
+Reference<XAccessibleRelationSet> SAL_CALL 
OAccessibleControlContext::getAccessibleRelationSet()
+{
+    return nullptr;
+}
 
+sal_Int64 SAL_CALL OAccessibleControlContext::getAccessibleStateSet()
+{
+    ::osl::MutexGuard aGuard(GetMutex());
+    // no OContextEntryGuard here, as we do not want to throw an exception in 
case we're not alive anymore
 
-    OUString SAL_CALL OAccessibleControlContext::getAccessibleName(  )
+    sal_Int64 nStateSet = 0;
+    if (isAlive())
     {
-        OContextEntryGuard aGuard( this );
-        return getModelStringProperty( u"Name"_ustr );
+        // no own states, only the ones which are foreign controlled
     }
-
-
-    Reference< XAccessibleRelationSet > SAL_CALL 
OAccessibleControlContext::getAccessibleRelationSet(  )
-    {
-        return nullptr;
+    else
+    { // only the DEFUNC state if we're already disposed
+        nStateSet |= AccessibleStateType::DEFUNC;
     }
+    return nStateSet;
+}
 
+void SAL_CALL OAccessibleControlContext::disposing(const EventObject& _rSource)
+{
+    OSL_ENSURE(Reference<XPropertySet>(_rSource.Source, UNO_QUERY).get() == 
m_xControlModel.get(),
+               "OAccessibleControlContext::disposing: where did this come 
from?");
 
-    sal_Int64 SAL_CALL OAccessibleControlContext::getAccessibleStateSet(  )
-    {
-        ::osl::MutexGuard aGuard( GetMutex() );
-            // no OContextEntryGuard here, as we do not want to throw an 
exception in case we're not alive anymore
-
-        sal_Int64 nStateSet = 0;
-        if ( isAlive() )
-        {
-            // no own states, only the ones which are foreign controlled
-        }
-        else
-        {   // only the DEFUNC state if we're already disposed
-            nStateSet |= AccessibleStateType::DEFUNC;
-        }
-        return nStateSet;
-    }
+    stopModelListening();
+    m_xControlModel.clear();
+    m_xModelPropsInfo.clear();
 
+    comphelper::OAccessible::disposing();
+}
 
-    void SAL_CALL OAccessibleControlContext::disposing( const EventObject& 
_rSource )
+OUString OAccessibleControlContext::getModelStringProperty(const OUString& 
_pPropertyName)
+{
+    OUString sReturn;
+    try
     {
-        OSL_ENSURE( Reference< XPropertySet >( _rSource.Source, UNO_QUERY 
).get() == m_xControlModel.get(),
-            "OAccessibleControlContext::disposing: where did this come from?" 
);
-
-        stopModelListening( );
-        m_xControlModel.clear();
-        m_xModelPropsInfo.clear();
+        if (!m_xModelPropsInfo.is() && m_xControlModel.is())
+            m_xModelPropsInfo = m_xControlModel->getPropertySetInfo();
 
-        comphelper::OAccessible::disposing();
+        if (m_xModelPropsInfo.is() && 
m_xModelPropsInfo->hasPropertyByName(_pPropertyName))
+            m_xControlModel->getPropertyValue(_pPropertyName) >>= sReturn;
     }
-
-
-    OUString OAccessibleControlContext::getModelStringProperty( const 
OUString& _pPropertyName )
+    catch (const Exception&)
     {
-        OUString sReturn;
-        try
-        {
-            if ( !m_xModelPropsInfo.is() && m_xControlModel.is() )
-                m_xModelPropsInfo = m_xControlModel->getPropertySetInfo();
-
-            if ( m_xModelPropsInfo.is() && 
m_xModelPropsInfo->hasPropertyByName( _pPropertyName ) )
-                m_xControlModel->getPropertyValue( _pPropertyName ) >>= 
sReturn;
-        }
-        catch( const Exception& )
-        {
-            TOOLS_WARN_EXCEPTION( "toolkit", 
"OAccessibleControlContext::getModelStringProperty" );
-        }
-        return sReturn;
+        TOOLS_WARN_EXCEPTION("toolkit", 
"OAccessibleControlContext::getModelStringProperty");
     }
+    return sReturn;
+}
 
+vcl::Window* OAccessibleControlContext::implGetWindow(Reference<awt::XWindow>* 
_pxUNOWindow) const
+{
+    Reference<awt::XControl> xControl(m_aControl);
+    Reference<awt::XWindow> xWindow;
+    if (xControl.is())
+        xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);
 
-    vcl::Window* OAccessibleControlContext::implGetWindow( Reference< 
awt::XWindow >* _pxUNOWindow ) const
-    {
-        Reference<awt::XControl> xControl(m_aControl);
-        Reference< awt::XWindow > xWindow;
-        if ( xControl.is() )
-            xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);
-
-        vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow 
) : nullptr;
-
-        if ( _pxUNOWindow )
-            *_pxUNOWindow = std::move(xWindow);
+    vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow(xWindow) : 
nullptr;
 
-        return pWindow;
-    }
+    if (_pxUNOWindow)
+        *_pxUNOWindow = std::move(xWindow);
 
+    return pWindow;
+}
 
-    awt::Rectangle OAccessibleControlContext::implGetBounds(  )
+awt::Rectangle OAccessibleControlContext::implGetBounds()
+{
+    SolarMutexGuard aSolarGuard;
+    // want to do some VCL stuff here ...
+    OContextEntryGuard aGuard(this);
+
+    OSL_FAIL("OAccessibleControlContext::implGetBounds: performance issue: 
forced to calc the size "
+             "myself!");
+    // In design mode (and this is what this class is for), the surrounding 
shape (if any) should handle this call
+    // The problem is that in design mode, our size may not be correct (in the 
drawing layer, controls are
+    // positioned/sized for painting only), and that calculation of our 
position is expensive
+
+    // what we know (or can obtain from somewhere):
+    // * the PosSize of our peer, relative to its parent window
+    // * the parent window which the PosSize is relative to
+    // * our foreign controlled accessible parent
+    // from this info, we can determine the position of our peer relative to 
the foreign parent
+
+    // our control
+    Reference<awt::XWindow> xWindow;
+    VclPtr<vcl::Window> pVCLWindow = implGetWindow(&xWindow);
+
+    awt::Rectangle aBounds(0, 0, 0, 0);
+    if (xWindow.is())
     {
-        SolarMutexGuard aSolarGuard;
-            // want to do some VCL stuff here ...
-        OContextEntryGuard aGuard( this );
-
-        OSL_FAIL( "OAccessibleControlContext::implGetBounds: performance 
issue: forced to calc the size myself!" );
-        // In design mode (and this is what this class is for), the 
surrounding shape (if any) should handle this call
-        // The problem is that in design mode, our size may not be correct (in 
the drawing layer, controls are
-        // positioned/sized for painting only), and that calculation of our 
position is expensive
-
-        // what we know (or can obtain from somewhere):
-        // * the PosSize of our peer, relative to its parent window
-        // * the parent window which the PosSize is relative to
-        // * our foreign controlled accessible parent
-        // from this info, we can determine the position of our peer relative 
to the foreign parent
-
-        // our control
-        Reference< awt::XWindow > xWindow;
-        VclPtr< vcl::Window > pVCLWindow = implGetWindow( &xWindow );
-
-        awt::Rectangle aBounds( 0, 0, 0, 0 );
-        if ( xWindow.is() )
-        {
-            // ugly, but... though the XWindow has a getPosSize, it is 
impossible to determine the
-            // parent which this position/size is relative to. This means we 
must tunnel UNO and ask the
-            // implementation
-            vcl::Window* pVCLParent = pVCLWindow ? pVCLWindow->GetParent() : 
nullptr;
-
-            // the relative location of the window
-            ::Point aWindowRelativePos( 0, 0);
-            if ( pVCLWindow )
-                aWindowRelativePos = pVCLWindow->GetPosPixel();
-
-            // the screen position of the "window parent" of the control
-            ::Point aVCLParentScreenPos( 0, 0 );
-            if ( pVCLParent )
-                aVCLParentScreenPos = pVCLParent->GetPosPixel();
-
-            // now the size of the control
-            aBounds = xWindow->getPosSize();
-
-            // correct the pos
-            aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X();
-            aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y();
-        }
-
-        return aBounds;
+        // ugly, but... though the XWindow has a getPosSize, it is impossible 
to determine the
+        // parent which this position/size is relative to. This means we must 
tunnel UNO and ask the
+        // implementation
+        vcl::Window* pVCLParent = pVCLWindow ? pVCLWindow->GetParent() : 
nullptr;
+
+        // the relative location of the window
+        ::Point aWindowRelativePos(0, 0);
+        if (pVCLWindow)
+            aWindowRelativePos = pVCLWindow->GetPosPixel();
+
+        // the screen position of the "window parent" of the control
+        ::Point aVCLParentScreenPos(0, 0);
+        if (pVCLParent)
+            aVCLParentScreenPos = pVCLParent->GetPosPixel();
+
+        // now the size of the control
+        aBounds = xWindow->getPosSize();
+
+        // correct the pos
+        aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X();
+        aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y();
     }
 
+    return aBounds;
+}
 
-    Reference< XAccessible > SAL_CALL 
OAccessibleControlContext::getAccessibleAtPoint( const awt::Point& /* _rPoint 
*/ )
-    {
-        // no children at all
-        return nullptr;
-    }
-
+Reference<XAccessible>
+    SAL_CALL OAccessibleControlContext::getAccessibleAtPoint(const awt::Point& 
/* _rPoint */)
+{
+    // no children at all
+    return nullptr;
+}
 
-    void SAL_CALL OAccessibleControlContext::grabFocus(  )
-    {
-        OSL_FAIL( "OAccessibleControlContext::grabFocus: !isFocusTraversable, 
but grabFocus!" );
-    }
+void SAL_CALL OAccessibleControlContext::grabFocus()
+{
+    OSL_FAIL("OAccessibleControlContext::grabFocus: !isFocusTraversable, but 
grabFocus!");
+}
 
+sal_Int32 SAL_CALL OAccessibleControlContext::getForeground()
+{
+    SolarMutexGuard aSolarGuard;
+    // want to do some VCL stuff here ...
+    OContextEntryGuard aGuard(this);
 
-    sal_Int32 SAL_CALL OAccessibleControlContext::getForeground(  )
+    VclPtr<vcl::Window> pWindow = implGetWindow();
+    Color nColor;
+    if (pWindow)
     {
-        SolarMutexGuard aSolarGuard;
-            // want to do some VCL stuff here ...
-        OContextEntryGuard aGuard( this );
-
-        VclPtr< vcl::Window > pWindow = implGetWindow();
-        Color nColor;
-        if ( pWindow )
+        if (pWindow->IsControlForeground())
+            nColor = pWindow->GetControlForeground();
+        else
         {
-            if ( pWindow->IsControlForeground() )
-                nColor = pWindow->GetControlForeground();
+            vcl::Font aFont;
+            if (pWindow->IsControlFont())
+                aFont = pWindow->GetControlFont();
             else
-            {
-                vcl::Font aFont;
-                if ( pWindow->IsControlFont() )
-                    aFont = pWindow->GetControlFont();
-                else
-                    aFont = pWindow->GetFont();
-                nColor = aFont.GetColor();
-            }
+                aFont = pWindow->GetFont();
+            nColor = aFont.GetColor();
         }
-        return sal_Int32(nColor);
     }
+    return sal_Int32(nColor);
+}
 
+sal_Int32 SAL_CALL OAccessibleControlContext::getBackground()
+{
+    SolarMutexGuard aSolarGuard;
+    // want to do some VCL stuff here ...
+    OContextEntryGuard aGuard(this);
 
-    sal_Int32 SAL_CALL OAccessibleControlContext::getBackground(  )
+    VclPtr<vcl::Window> pWindow = implGetWindow();
+    Color nColor;
+    if (pWindow)
     {
-        SolarMutexGuard aSolarGuard;
-            // want to do some VCL stuff here ...
-        OContextEntryGuard aGuard( this );
-
-        VclPtr< vcl::Window > pWindow = implGetWindow();
-        Color nColor;
-        if ( pWindow )
-        {
-            if ( pWindow->IsControlBackground() )
-                nColor = pWindow->GetControlBackground();
-            else
-                nColor = pWindow->GetBackground().GetColor();
-        }
-
-        return sal_Int32(nColor);
+        if (pWindow->IsControlBackground())
+            nColor = pWindow->GetControlBackground();
+        else
+            nColor = pWindow->GetBackground().GetColor();
     }
 
+    return sal_Int32(nColor);
+}
 
-}   //namespace toolkit
-
+} //namespace toolkit
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to