Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / AccessibleFilterMenu.hxx
blobf5ede6e03f813f18112477b01a97d70c8208123e
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 #ifndef INCLUDED_SC_INC_ACCESSIBLEFILTERMENU_HXX
21 #define INCLUDED_SC_INC_ACCESSIBLEFILTERMENU_HXX
23 #include <AccessibleContextBase.hxx>
24 #include <cppuhelper/implbase1.hxx>
26 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 #include <vcl/vclptr.hxx>
29 #include <vector>
31 namespace com { namespace sun { namespace star {
32 namespace accessibility {
33 struct AccessibleEventObject;
35 }}}
37 class ScMenuFloatingWindow;
39 typedef ::cppu::ImplHelper1<
40 css::accessibility::XAccessibleSelection > ScAccessibleFilterMenu_BASE;
42 class ScAccessibleFilterMenu :
43 public ScAccessibleContextBase,
44 public ScAccessibleFilterMenu_BASE
46 public:
47 explicit ScAccessibleFilterMenu(
48 const css::uno::Reference< css::accessibility::XAccessible>& rxParent,
49 ScMenuFloatingWindow* pWin, const OUString& rName, size_t nMenuPos);
50 virtual ~ScAccessibleFilterMenu() override;
52 virtual bool isVisible() override;
54 /// XAccessibleComponent
56 virtual css::uno::Reference< css::accessibility::XAccessible >
57 SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
59 virtual void SAL_CALL grabFocus() override;
61 virtual sal_Int32 SAL_CALL getForeground() override;
63 virtual sal_Int32 SAL_CALL getBackground() override;
65 /// XAccessibleContext
67 virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
69 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
70 getAccessibleChild(sal_Int32 nIndex) override;
72 virtual css::uno::Reference<
73 css::accessibility::XAccessibleStateSet> SAL_CALL
74 getAccessibleStateSet() override;
76 virtual OUString SAL_CALL getImplementationName() override;
78 /// XAccessibleEventBroadcaster
79 virtual void SAL_CALL
80 addAccessibleEventListener(
81 const css::uno::Reference< css::accessibility::XAccessibleEventListener>& xListener) override;
83 /// Remove an existing event listener.
84 virtual void SAL_CALL
85 removeAccessibleEventListener(
86 const css::uno::Reference< css::accessibility::XAccessibleEventListener>& xListener) override;
88 /// XAccessibleSelection
90 virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override;
92 virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override;
94 virtual void SAL_CALL clearAccessibleSelection() override;
96 virtual void SAL_CALL selectAllAccessibleChildren() override;
98 virtual ::sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override;
100 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
101 getSelectedAccessibleChild(sal_Int32 nChildIndex) override;
103 virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override;
105 /// XInterface
107 virtual css::uno::Any SAL_CALL queryInterface(
108 css::uno::Type const & rType ) override;
110 virtual void SAL_CALL acquire() throw () override;
111 virtual void SAL_CALL release() throw () override;
113 /// XTypeProvider
115 virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
117 /// non-UNO methods
119 void appendMenuItem(const OUString& rName, size_t nMenuPos);
120 void setMenuPos(size_t nMenuPos);
122 protected:
124 sal_Int32 getMenuItemCount() const;
126 virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
128 virtual tools::Rectangle GetBoundingBox() const override;
130 private:
131 bool isSelected() const;
133 void updateStates();
135 private:
136 ::std::vector< css::uno::Reference< css::accessibility::XAccessible > > maMenuItems;
137 css::uno::Reference< css::accessibility::XAccessibleStateSet > mxStateSet;
139 size_t mnMenuPos;
140 VclPtr<ScMenuFloatingWindow> mpWindow;
143 #endif
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */