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 .
20 #ifndef INCLUDED_SVX_SOURCE_TABLE_ACCESSIBLECELL_HXX
21 #define INCLUDED_SVX_SOURCE_TABLE_ACCESSIBLECELL_HXX
23 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
25 #include <com/sun/star/accessibility/AccessibleRole.hpp>
26 #include <com/sun/star/drawing/XShape.hpp>
28 #include <rtl/ref.hxx>
30 #include <editeng/AccessibleContextBase.hxx>
31 #include <editeng/AccessibleComponentBase.hxx>
32 #include <svx/IAccessibleViewForwarderListener.hxx>
33 #include <svx/AccessibleTextHelper.hxx>
34 #include <svx/AccessibleShapeTreeInfo.hxx>
35 #include <AccessibleTableShape.hxx>
37 #include <cppuhelper/implbase.hxx>
42 namespace accessibility
45 class AccessibleShapeTreeInfo
;
47 typedef ::cppu::ImplInheritanceHelper
< AccessibleContextBase
, css::accessibility::XAccessibleExtendedComponent
> AccessibleCellBase
;
49 class AccessibleCell
: public AccessibleCellBase
50 , public AccessibleComponentBase
51 , public IAccessibleViewForwarderListener
54 AccessibleCell( const css::uno::Reference
< css::accessibility::XAccessible
>& rxParent
, const sdr::table::CellRef
& rCell
, sal_Int32 nIndex
, const AccessibleShapeTreeInfo
& rShapeTreeInfo
);
55 virtual ~AccessibleCell() override
;
56 AccessibleCell(const AccessibleCell
&) = delete;
57 AccessibleCell
& operator=(const AccessibleCell
&) = delete;
61 virtual bool SetState (sal_Int16 aState
) override
;
62 virtual bool ResetState (sal_Int16 aState
) override
;
65 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
66 virtual void SAL_CALL
acquire( ) throw () override
;
67 virtual void SAL_CALL
release( ) throw () override
;
70 virtual sal_Int32 SAL_CALL
getAccessibleChildCount() override
;
71 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild(sal_Int32 nIndex
) override
;
72 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet() override
;
73 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent() override
;
74 virtual OUString SAL_CALL
getAccessibleName() override
;
75 const sdr::table::CellRef
& getCellRef() const { return mxCell
;}
76 void UpdateChildren();
77 static OUString
getCellName( sal_Int32 nCol
, sal_Int32 nRow
);
79 // XAccessibleComponent
80 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) override
;
81 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint(const css::awt::Point
& aPoint
) override
;
82 virtual css::awt::Rectangle SAL_CALL
getBounds() override
;
83 virtual css::awt::Point SAL_CALL
getLocation() override
;
84 virtual css::awt::Point SAL_CALL
getLocationOnScreen() override
;
85 virtual css::awt::Size SAL_CALL
getSize() override
;
86 virtual void SAL_CALL
grabFocus() override
;
87 virtual sal_Int32 SAL_CALL
getForeground() override
;
88 virtual sal_Int32 SAL_CALL
getBackground() override
;
90 // XAccessibleExtendedComponent
91 virtual css::uno::Reference
< css::awt::XFont
> SAL_CALL
getFont() override
;
92 virtual OUString SAL_CALL
getTitledBorderText() override
;
93 virtual OUString SAL_CALL
getToolTipText() override
;
95 // XAccessibleEventBroadcaster
96 virtual void SAL_CALL
addAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
97 virtual void SAL_CALL
removeAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& rxListener
) override
;
100 virtual OUString SAL_CALL
getImplementationName() override
;
101 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
103 // IAccessibleViewForwarderListener
104 virtual void ViewForwarderChanged() override
;
108 /** set the index _nIndex at the accessible cell param _nIndex The new index in parent.
110 void setIndexInParent(sal_Int32 _nIndex
) { mnIndexInParent
= _nIndex
; }
112 //Get the parent table
113 AccessibleTableShape
* GetParentTable() { return pAccTable
; }
115 /// Bundle of information passed to all shapes in a document tree.
116 AccessibleShapeTreeInfo maShapeTreeInfo
;
118 /// the index in parent.
119 sal_Int32 mnIndexInParent
;
121 /// The accessible text engine. May be NULL if it can not be created.
122 std::unique_ptr
<AccessibleTextHelper
> mpText
;
124 sdr::table::CellRef mxCell
;
126 /// This method is called from the component helper base class while disposing.
127 virtual void SAL_CALL
disposing() override
;
129 AccessibleTableShape
*pAccTable
;
132 } // end of namespace accessibility
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */