1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <comphelper/accessibletexthelper.hxx>
22 #include <cppuhelper/implbase2.hxx>
23 #include <extended/AccessibleGridControlBase.hxx>
24 #include <vcl/accessibletable.hxx>
25 #include <com/sun/star/accessibility/AccessibleScrollType.hpp>
27 namespace accessibility
29 class AccessibleGridControlCell
: public AccessibleGridControlBase
32 sal_Int32 m_nRowPos
; // the row number of the table cell
33 sal_Int32 m_nColPos
; // the column id of the table cell
37 sal_Int32
getRowPos( ) const { return m_nRowPos
; }
38 sal_Int32
getColumnPos( ) const { return m_nColPos
; }
40 // XAccessibleComponent
41 virtual void SAL_CALL
grabFocus() override
;
45 virtual OUString SAL_CALL
getAccessibleName() override
;
48 AccessibleGridControlCell(
49 const css::uno::Reference
< css::accessibility::XAccessible
>& _rxParent
,
50 ::vcl::table::IAccessibleTable
& _rTable
,
53 ::vcl::table::AccessibleTableControlObjType _eType
56 virtual ~AccessibleGridControlCell() override
= default;
59 AccessibleGridControlCell( const AccessibleGridControlCell
& ) = delete;
60 AccessibleGridControlCell
& operator=( const AccessibleGridControlCell
& ) = delete;
63 typedef ::cppu::ImplHelper2
< css::accessibility::XAccessibleText
64 , css::accessibility::XAccessible
65 > AccessibleTextHelper_BASE
;
66 // implementation of a table cell of GridControl
67 class AccessibleGridControlTableCell final
:public AccessibleGridControlCell
68 ,public AccessibleTextHelper_BASE
69 ,public ::comphelper::OCommonAccessibleText
72 // OCommonAccessibleText
73 virtual OUString
implGetText() override
;
74 virtual css::lang::Locale
implGetLocale() override
;
75 virtual void implGetSelection( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
) override final
;
76 virtual tools::Rectangle
implGetBoundingBox() override
;
77 virtual AbsoluteScreenPixelRectangle
implGetBoundingBoxOnScreen() override
;
80 AccessibleGridControlTableCell( const css::uno::Reference
< css::accessibility::XAccessible
>& _rxParent
,
81 ::vcl::table::IAccessibleTable
& _rTable
,
85 // XInterface -------------------------------------------------------------
87 /** Queries for a new interface. */
88 css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
90 /** Acquires the object (calls acquire() on base class). */
91 virtual void SAL_CALL
acquire() noexcept override
;
93 /** Releases the object (calls release() on base class). */
94 virtual void SAL_CALL
release() noexcept override
;
96 /** @return The index of this object among the parent's children. */
97 virtual sal_Int64 SAL_CALL
getAccessibleIndexInParent() override
;
100 The name of this class.
102 virtual OUString SAL_CALL
getImplementationName() override
;
105 The count of visible children.
107 virtual sal_Int64 SAL_CALL
getAccessibleChildCount() override
;
110 The XAccessible interface of the specified child.
112 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
113 getAccessibleChild( sal_Int64 nChildIndex
) override
;
115 /** Return a bitset of states of the current object.
117 sal_Int64
implCreateStateSet() override
;
119 // XAccessible ------------------------------------------------------------
121 /** @return The XAccessibleContext interface of this object. */
122 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
123 getAccessibleContext() override
;
126 virtual sal_Int32 SAL_CALL
getCaretPosition() override
;
127 virtual sal_Bool SAL_CALL
setCaretPosition( sal_Int32 nIndex
) override
;
128 virtual sal_Unicode SAL_CALL
getCharacter( sal_Int32 nIndex
) override
;
129 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
getCharacterAttributes( sal_Int32 nIndex
, const css::uno::Sequence
< OUString
>& aRequestedAttributes
) override
;
130 virtual css::awt::Rectangle SAL_CALL
getCharacterBounds( sal_Int32 nIndex
) override
;
131 virtual sal_Int32 SAL_CALL
getCharacterCount() override
;
132 virtual sal_Int32 SAL_CALL
getIndexAtPoint( const css::awt::Point
& aPoint
) override
;
133 virtual OUString SAL_CALL
getSelectedText() override
;
134 virtual sal_Int32 SAL_CALL
getSelectionStart() override
;
135 virtual sal_Int32 SAL_CALL
getSelectionEnd() override
;
136 virtual sal_Bool SAL_CALL
setSelection( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) override
;
137 virtual OUString SAL_CALL
getText() override
;
138 virtual OUString SAL_CALL
getTextRange( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) override
;
139 virtual css::accessibility::TextSegment SAL_CALL
getTextAtIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) override
;
140 virtual css::accessibility::TextSegment SAL_CALL
getTextBeforeIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) override
;
141 virtual css::accessibility::TextSegment SAL_CALL
getTextBehindIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) override
;
142 virtual sal_Bool SAL_CALL
copyText( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) override
;
143 virtual sal_Bool SAL_CALL
scrollSubstringTo( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
, css::accessibility::AccessibleScrollType aScrollType
) override
;
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */