LibreOffice Module sc (master) 1
AccessibleSpreadsheet.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <rtl/ref.hxx>
25#include <unotools/weakref.hxx>
26
28#include "viewdata.hxx"
29
30#include <vector>
31
32#include <rangelst.hxx>
33#include <map>
34
35class ScMyAddress : public ScAddress
36{
37public:
38 ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP) : ScAddress(nColP, nRowP, nTabP) {}
39 ScMyAddress(const ScAddress& rAddress) : ScAddress(rAddress) {}
40
41 bool operator< ( const ScMyAddress& rAddress ) const
42 {
43 if( Row() != rAddress.Row() )
44 return (Row() < rAddress.Row());
45 else
46 return (Col() < rAddress.Col());
47 }
48};
49
50class ScTabViewShell;
53
59{
60public:
62 ScAccessibleDocument* pAccDoc,
63 ScTabViewShell* pViewShell,
64 SCTAB nTab,
65 ScSplitPos eSplitPos);
66
68
69 virtual void SAL_CALL disposing() override;
70
71 void CompleteSelectionChanged(bool bNewState);
72
73 void LostFocus();
74 void GotFocus();
75
76 void BoundingBoxChanged();
77 void VisAreaChanged();
78 void FireFirstCellFocus();
79
80 bool IsScAddrFormulaSel (const ScAddress &addr) const;
81 bool IsFormulaMode();
82 ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex);
83 static bool CalcScRangeDifferenceMax(const ScRange & rSrc, const ScRange & rDest,int nMax,std::vector<ScMyAddress> &vecRet,int &nSize);
84 static bool CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,std::vector<ScMyAddress> &vecRet);
85
86private:
89 const ScRange& rRange );
90
91 virtual ~ScAccessibleSpreadsheet() override;
92
94 ScAccessibleDocument* pAccDoc,
95 ScTabViewShell* pViewShell,
96 SCTAB nTab,
97 ScSplitPos eSplitPos);
98
100
102 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
103
105
107 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL
108 getAccessibleRowHeaders( ) override;
109
111 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL
112 getAccessibleColumnHeaders( ) override;
113
115 virtual css::uno::Sequence< sal_Int32 > SAL_CALL
116 getSelectedAccessibleRows( ) override;
117
119 virtual css::uno::Sequence< sal_Int32 > SAL_CALL
121
123 virtual sal_Bool SAL_CALL
124 isAccessibleRowSelected( sal_Int32 nRow ) override;
125
127 virtual sal_Bool SAL_CALL
128 isAccessibleColumnSelected( sal_Int32 nColumn ) override;
129
131 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
132 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
133
134 rtl::Reference<ScAccessibleCell> GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn);
135
137 virtual sal_Bool SAL_CALL
138 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) override;
139
141
142 virtual css::uno::Reference< css::accessibility::XAccessible >
143 SAL_CALL getAccessibleAtPoint(
144 const css::awt::Point& rPoint ) override;
145
146 virtual void SAL_CALL grabFocus( ) override;
147
148 virtual sal_Int32 SAL_CALL getForeground( ) override;
149
150 virtual sal_Int32 SAL_CALL getBackground( ) override;
151
153
155 virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet> SAL_CALL
156 getAccessibleRelationSet() override;
157
159 virtual sal_Int64 SAL_CALL
160 getAccessibleStateSet() override;
161
163
164 virtual void SAL_CALL
165 selectAccessibleChild( sal_Int64 nChildIndex ) override;
166
167 virtual void SAL_CALL
168 clearAccessibleSelection( ) override;
169
170 virtual void SAL_CALL
171 selectAllAccessibleChildren( ) override;
172
173 virtual sal_Int64 SAL_CALL
175
176 virtual css::uno::Reference<css::accessibility::XAccessible > SAL_CALL
177 getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
178
179 virtual void SAL_CALL
180 deselectAccessibleChild( sal_Int64 nChildIndex ) override;
181
183
186 virtual OUString SAL_CALL
187 getImplementationName() override;
188
191 virtual css::uno::Sequence< OUString> SAL_CALL
192 getSupportedServiceNames() override;
193
195
198 virtual css::uno::Sequence<sal_Int8> SAL_CALL
199 getImplementationId() override;
200
202
206 virtual void SAL_CALL
208 const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
209
210 //===== XAccessibleTableSelection ============================================
211
212 virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) override;
213 virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) override;
214 virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) override;
215 virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) override;
216
218 virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
219
221 virtual tools::Rectangle GetBoundingBox() const override;
222
223 bool IsDefunc(sal_Int64 nParentStates);
224 bool IsEditable();
225 bool IsFocused();
227
228 void SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bDeselect);
229
230 static ScDocument* GetDocument(ScTabViewShell* pViewShell);
231
232 void RemoveSelection(const ScMarkData &refScMarkData);
233 void CommitFocusCell(const ScAddress &aNewCell);
234
235 sal_Int32 GetRowAll() const { return m_nMaxY - m_nMinY + 1 ; }
236 sal_uInt16 GetColAll() const { return m_nMaxX - m_nMinX + 1; }
237 void NotifyRefMode();
238 void RemoveFormulaSelection(bool bRemoveAll = false);
239 bool CheckChildIndex(sal_Int64) const;
240 ScAddress GetChildIndexAddress(sal_Int64) const;
241 sal_Int64 GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn );
243
245 std::unique_ptr<ScRangeList> mpMarkedRanges;
254 typedef std::map<ScMyAddress,css::uno::Reference< css::accessibility::XAccessible > >
261 std::vector<ScMyAddress> m_vecFormulaLastMyAddr;
263 sal_uInt16 m_nMinX;
264 sal_uInt16 m_nMaxX;
265 sal_Int32 m_nMinY;
266 sal_Int32 m_nMaxY;
271 std::map<ScAddress, unotools::WeakReference< ScAccessibleCell > >
273};
274
275/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@descr This base class provides an implementation of the AccessibleCell service.
@descr This base class provides an implementation of the AccessibleTable service.
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
===== SfxListener =====================================================
std::map< ScMyAddress, css::uno::Reference< css::accessibility::XAccessible > > MAP_ADDR_XACC
virtual void SAL_CALL grabFocus() override
static ScDocument * GetDocument(ScTabViewShell *pViewShell)
virtual sal_Bool SAL_CALL unselectColumn(sal_Int32 column) override
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
Returns a boolean value indicating whether the specified row is selected.
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
===== XAccessibleContext ==============================================
std::vector< ScMyAddress > m_vecFormulaLastMyAddr
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
Returns the column headers as an AccessibleTable.
virtual ~ScAccessibleSpreadsheet() override
bool CheckChildIndex(sal_Int64) const
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
Return the set of current states.
virtual sal_Bool SAL_CALL unselectRow(sal_Int32 row) override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
===== XAccessibleTable ================================================
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
===== XTypeProvider ===================================================
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
Returns the selected rows in a table.
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nChildIndex) override
void CommitFocusCell(const ScAddress &aNewCell)
rtl::Reference< ScAccessibleCell > mpAccCell
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
static bool CalcScRangeDifferenceMax(const ScRange &rSrc, const ScRange &rDest, int nMax, std::vector< ScMyAddress > &vecRet, int &nSize)
ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges, sal_Int32 nSelectedChildIndex)
virtual void SAL_CALL selectAllAccessibleChildren() override
void ConstructScAccessibleSpreadsheet(ScAccessibleDocument *pAccDoc, ScTabViewShell *pViewShell, SCTAB nTab, ScSplitPos eSplitPos)
sal_Int64 GetAccessibleIndexFormula(sal_Int32 nRow, sal_Int32 nColumn)
bool IsScAddrFormulaSel(const ScAddress &addr) const
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
Returns the Accessible at a specified row and column in the table.
std::unique_ptr< ScRangeList > mpMarkedRanges
virtual sal_Bool SAL_CALL selectColumn(sal_Int32 column) override
virtual sal_Int32 SAL_CALL getBackground() override
ScAccessibleSpreadsheet(ScAccessibleDocument *pAccDoc, ScTabViewShell *pViewShell, SCTAB nTab, ScSplitPos eSplitPos)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
void RemoveFormulaSelection(bool bRemoveAll=false)
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
Returns a boolean value indicating whether the accessible at a specified row and column is selected.
virtual sal_Bool SAL_CALL selectRow(sal_Int32 row) override
static bool CalcScRangeListDifferenceMax(ScRangeList *pSrc, ScRangeList *pDest, int nMax, std::vector< ScMyAddress > &vecRet)
rtl::Reference< ScAccessibleCell > m_pAccFormulaCell
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
Returns the selected columns in a table.
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
Returns a boolean value indicating whether the specified column is selected.
ScAddress GetChildIndexAddress(sal_Int64) const
virtual void SAL_CALL disposing() override
virtual tools::Rectangle GetBoundingBox() const override
Return the object's current bounding box relative to the parent object.
virtual sal_Int32 SAL_CALL getForeground() override
rtl::Reference< ScAccessibleCell > GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
virtual OUString SAL_CALL getImplementationName() override
===== XServiceInfo ====================================================
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
===== XAccessibleEventBroadcaster =====================================
void CompleteSelectionChanged(bool bNewState)
void RemoveSelection(const ScMarkData &refScMarkData)
std::map< ScAddress, unotools::WeakReference< ScAccessibleCell > > m_mapCells
ScAccessibleDocument * mpAccDoc
void SelectCell(sal_Int32 nRow, sal_Int32 nCol, bool bDeselect)
virtual tools::Rectangle GetBoundingBoxOnScreen() const override
Return the object's current bounding box relative to the desktop.
bool GetFormulaCurrentFocusCell(ScAddress &addr)
virtual void SAL_CALL clearAccessibleSelection() override
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
===== XAccessibleSelection ===========================================
virtual void SAL_CALL disposing() override
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP)
bool operator<(const ScMyAddress &rAddress) const
ScMyAddress(const ScAddress &rAddress)
unsigned char sal_Bool
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
ScSplitPos
Definition: viewdata.hxx:44