LibreOffice Module accessibility (master) 1
accessiblemenubasecomponent.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 <com/sun/star/accessibility/XAccessible.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <com/sun/star/awt/Point.hpp>
27#include <tools/link.hxx>
28#include <vcl/vclptr.hxx>
29
30#include <vector>
31
32class Menu;
33class VclSimpleEvent;
34class VclMenuEvent;
35
36
37class OAccessibleMenuBaseComponent : public cppu::ImplInheritanceHelper<
38 comphelper::OAccessibleExtendedComponentHelper,
39 css::accessibility::XAccessible,
40 css::lang::XServiceInfo>
41{
44 friend class VCLXAccessibleMenu;
45
46protected:
47 typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren;
48
51
57
58 virtual bool IsEnabled();
59 virtual bool IsFocused();
60 virtual bool IsVisible();
61 virtual bool IsSelected();
62 virtual bool IsChecked();
63
64 void SetEnabled( bool bEnabled );
65 void SetFocused( bool bFocused );
66 void SetVisible( bool bVisible );
67 void SetSelected( bool bSelected );
68 void SetChecked( bool bChecked );
69
70 void UpdateEnabled( sal_Int32 i, bool bEnabled );
71 void UpdateFocused( sal_Int32 i, bool bFocused );
72 void UpdateVisible();
73 void UpdateSelected( sal_Int32 i, bool bSelected );
74 void UpdateChecked( sal_Int32 i, bool bChecked );
75 void UpdateAccessibleName( sal_Int32 i );
76 void UpdateItemRole(sal_Int32 i);
77 void UpdateItemText( sal_Int32 i );
78
79 sal_Int64 GetChildCount() const;
80
81 css::uno::Reference< css::accessibility::XAccessible > GetChild( sal_Int64 i );
82 css::uno::Reference< css::accessibility::XAccessible > GetChildAt( const css::awt::Point& rPoint );
83
84 void InsertChild( sal_Int32 i );
85 void RemoveChild( sal_Int32 i );
86
87 virtual bool IsHighlighted();
88 bool IsChildHighlighted();
89
90 virtual bool IsMenuHideDisabledEntries();
91
92 void SelectChild( sal_Int32 i );
93 void DeSelectAll();
94 bool IsChildSelected( sal_Int32 i );
95
96 virtual void Click();
97 virtual bool IsPopupMenuOpen();
98
99 DECL_LINK( MenuEventListener, VclMenuEvent&, void );
100
101 void ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent );
102
103 virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) = 0;
104
105 // XComponent
106 virtual void SAL_CALL disposing() override;
107
108public:
110 virtual ~OAccessibleMenuBaseComponent() override;
111
112 void SetStates();
113
114 // XServiceInfo
115 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
116
117 // XAccessible
118 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
119
120 // XAccessibleContext
121 virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
122};
123
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
virtual void SAL_CALL disposing() override
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
css::uno::Reference< css::accessibility::XAccessible > GetChild(sal_Int64 i)
std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren
void UpdateChecked(sal_Int32 i, bool bChecked)
void ProcessMenuEvent(const VclMenuEvent &rVclMenuEvent)
css::uno::Reference< css::accessibility::XAccessible > GetChildAt(const css::awt::Point &rPoint)
void UpdateEnabled(sal_Int32 i, bool bEnabled)
DECL_LINK(MenuEventListener, VclMenuEvent &, void)
void UpdateFocused(sal_Int32 i, bool bFocused)
void UpdateSelected(sal_Int32 i, bool bSelected)
virtual void FillAccessibleStateSet(sal_Int64 &rStateSet)=0
unsigned char sal_Bool