tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / AccessibleCell.hxx
blobf5c3f8d2821fc2c9824e04f52d6b5e40402261aa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <memory>
23 #include "AccessibleCellBase.hxx"
24 #include "viewdata.hxx"
25 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
26 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
27 #include <rtl/ref.hxx>
28 #include <editeng/AccessibleStaticTextBase.hxx>
29 #include <comphelper/uno3.hxx>
31 namespace com::sun::star::accessibility { class XAccessibleRelationSet; }
32 namespace utl { class AccessibleRelationSetHelper; }
34 class ScTabViewShell;
35 class ScAccessibleDocument;
37 typedef cppu::ImplHelper1< css::accessibility::XAccessibleExtendedAttributes>
38 ScAccessibleCellAttributeImpl;
40 using css::accessibility::AccessibleRelationType;
42 /** @descr
43 This base class provides an implementation of the
44 <code>AccessibleCell</code> service.
46 class ScAccessibleCell
47 : public ScAccessibleCellBase,
48 public accessibility::AccessibleStaticTextBase,
49 public ScAccessibleCellAttributeImpl
51 public:
52 static rtl::Reference<ScAccessibleCell> create(
53 const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
54 ScTabViewShell* pViewShell,
55 const ScAddress& rCellAddress,
56 sal_Int64 nIndex,
57 ScSplitPos eSplitPos,
58 ScAccessibleDocument* pAccDoc);
60 private:
61 ScAccessibleCell(
62 const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
63 ScTabViewShell* pViewShell,
64 const ScAddress& rCellAddress,
65 sal_Int64 nIndex,
66 ScSplitPos eSplitPos,
67 ScAccessibleDocument* pAccDoc);
69 virtual void Init() override;
71 using ScAccessibleCellBase::disposing;
72 virtual void SAL_CALL disposing() override;
74 protected:
75 virtual ~ScAccessibleCell() override;
77 using ScAccessibleCellBase::IsDefunc;
79 public:
80 ///===== XInterface =====================================================
82 DECLARE_XINTERFACE()
84 ///===== XTypeProvider ===================================================
86 DECLARE_XTYPEPROVIDER()
88 ///===== XAccessibleComponent ============================================
90 virtual css::uno::Reference< css::accessibility::XAccessible >
91 SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
93 virtual void SAL_CALL grabFocus( ) override;
95 protected:
96 /// Return the object's current bounding box relative to the desktop.
97 virtual AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen() const override;
99 /// Return the object's current bounding box relative to the parent object.
100 virtual tools::Rectangle GetBoundingBox() const override;
102 public:
103 ///===== XAccessibleContext ==============================================
105 /// Return the number of currently visible children.
106 /// override to calculate this on demand
107 virtual sal_Int64 SAL_CALL
108 getAccessibleChildCount() override;
110 /// Return the specified child or NULL if index is invalid.
111 /// override to calculate this on demand
112 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
113 getAccessibleChild(sal_Int64 nIndex) override;
115 /// Return the set of current states.
116 virtual sal_Int64 SAL_CALL
117 getAccessibleStateSet() override;
119 virtual css::uno::Reference<
120 css::accessibility::XAccessibleRelationSet> SAL_CALL
121 getAccessibleRelationSet() override;
123 ///===== XServiceInfo ====================================================
125 /** Returns an identifier for the implementation of this object.
127 virtual OUString SAL_CALL
128 getImplementationName() override;
130 /** Returns a list of all supported services.
132 virtual css::uno::Sequence< OUString> SAL_CALL
133 getSupportedServiceNames() override;
135 virtual css::uno::Any SAL_CALL getExtendedAttributes() override;
137 // Override this method to handle cell's ParaIndent attribute specially.
138 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
139 private:
140 ScTabViewShell* mpViewShell;
141 ScAccessibleDocument* mpAccDoc;
143 ScSplitPos meSplitPos;
145 bool IsDefunc(sal_Int64 nParentStates);
146 virtual bool IsEditable(sal_Int64 nParentStates) override;
147 bool IsOpaque() const;
148 bool IsFocused() const;
149 bool IsSelected();
151 static ScDocument* GetDocument(ScTabViewShell* mpViewShell);
153 ::std::unique_ptr< SvxEditSource > CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos);
155 void FillDependents(utl::AccessibleRelationSetHelper* pRelationSet);
156 void FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet);
157 void AddRelation(const ScAddress& rCell,
158 const AccessibleRelationType eRelationType,
159 ::utl::AccessibleRelationSetHelper* pRelationSet);
160 void AddRelation(const ScRange& rRange,
161 const AccessibleRelationType eRelationType,
162 ::utl::AccessibleRelationSetHelper* pRelationSet);
163 bool IsFormulaMode();
164 bool IsDropdown() const;
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */