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_ACCESSIBILITY_INC_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX
21 #define INCLUDED_ACCESSIBILITY_INC_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX
23 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/awt/Point.hpp>
26 #include <comphelper/accessiblecomponenthelper.hxx>
27 #include <cppuhelper/implbase2.hxx>
28 #include <tools/link.hxx>
29 #include <vcl/vclptr.hxx>
38 class AccessibleStateSetHelper
;
42 // class OAccessibleMenuBaseComponent
44 typedef ::cppu::ImplHelper2
<
45 css::accessibility::XAccessible
,
46 css::lang::XServiceInfo
> OAccessibleMenuBaseComponent_BASE
;
48 class OAccessibleMenuBaseComponent
: public comphelper::OAccessibleExtendedComponentHelper
,
49 public OAccessibleMenuBaseComponent_BASE
51 friend class OAccessibleMenuItemComponent
;
52 friend class VCLXAccessibleMenuItem
;
53 friend class VCLXAccessibleMenu
;
56 typedef std::vector
< css::uno::Reference
< css::accessibility::XAccessible
> > AccessibleChildren
;
58 AccessibleChildren m_aAccessibleChildren
;
67 virtual bool IsEnabled();
68 virtual bool IsFocused();
69 virtual bool IsVisible();
70 virtual bool IsSelected();
71 virtual bool IsChecked();
73 void SetEnabled( bool bEnabled
);
74 void SetFocused( bool bFocused
);
75 void SetVisible( bool bVisible
);
76 void SetSelected( bool bSelected
);
77 void SetChecked( bool bChecked
);
79 void UpdateEnabled( sal_Int32 i
, bool bEnabled
);
80 void UpdateFocused( sal_Int32 i
, bool bFocused
);
82 void UpdateSelected( sal_Int32 i
, bool bSelected
);
83 void UpdateChecked( sal_Int32 i
, bool bChecked
);
84 void UpdateAccessibleName( sal_Int32 i
);
85 void UpdateItemText( sal_Int32 i
);
87 sal_Int32
GetChildCount();
89 css::uno::Reference
< css::accessibility::XAccessible
> GetChild( sal_Int32 i
);
90 css::uno::Reference
< css::accessibility::XAccessible
> GetChildAt( const css::awt::Point
& rPoint
);
92 void InsertChild( sal_Int32 i
);
93 void RemoveChild( sal_Int32 i
);
95 virtual bool IsHighlighted();
96 bool IsChildHighlighted();
98 virtual bool IsMenuHideDisabledEntries();
100 void SelectChild( sal_Int32 i
);
102 bool IsChildSelected( sal_Int32 i
);
104 virtual void Click();
105 virtual bool IsPopupMenuOpen();
107 DECL_LINK( MenuEventListener
, VclMenuEvent
&, void );
109 void ProcessMenuEvent( const VclMenuEvent
& rVclMenuEvent
);
111 virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper
& rStateSet
) = 0;
114 virtual void SAL_CALL
disposing() override
;
117 OAccessibleMenuBaseComponent( Menu
* pMenu
);
118 virtual ~OAccessibleMenuBaseComponent() override
;
126 DECLARE_XTYPEPROVIDER()
129 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) override
;
132 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
;
134 // XAccessibleContext
135 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) override
;
138 #endif // INCLUDED_ACCESSIBILITY_INC_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */