Avoid potential negative array index access to cached text.
[LibreOffice.git] / accessibility / inc / standard / accessiblemenuitemcomponent.hxx
blobb6adebbde81e33a68579cc1332e533cf223d9831
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 <standard/accessiblemenubasecomponent.hxx>
27 class OAccessibleMenuItemComponent : public OAccessibleMenuBaseComponent
29 friend class OAccessibleMenuBaseComponent;
31 protected:
32 VclPtr<Menu> m_pParent;
33 sal_uInt16 m_nItemPos;
34 OUString m_sAccessibleName;
35 OUString m_sItemText;
37 virtual bool IsEnabled() override;
38 virtual bool IsVisible() override;
39 void Select();
40 void DeSelect();
41 virtual void Click() override;
43 void SetItemPos( sal_uInt16 nItemPos );
44 void SetAccessibleName( const OUString& sAccessibleName );
45 OUString GetAccessibleName();
46 void SetItemText( const OUString& sItemText );
47 OUString GetItemText();
49 virtual bool IsMenuHideDisabledEntries() override;
51 virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override;
53 // OCommonAccessibleComponent
54 virtual css::awt::Rectangle implGetBounds( ) override;
56 // XComponent
57 virtual void SAL_CALL disposing() override;
59 public:
60 OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu );
61 virtual ~OAccessibleMenuItemComponent() override;
63 // XAccessibleContext
64 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
65 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
66 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
67 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
68 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
69 virtual OUString SAL_CALL getAccessibleDescription( ) override;
70 virtual OUString SAL_CALL getAccessibleName( ) override;
71 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
72 virtual css::lang::Locale SAL_CALL getLocale( ) override;
74 // XAccessibleComponent
75 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
76 virtual void SAL_CALL grabFocus( ) override;
77 virtual sal_Int32 SAL_CALL getForeground( ) override;
78 virtual sal_Int32 SAL_CALL getBackground( ) override;
80 // XAccessibleExtendedComponent
81 virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override;
82 virtual OUString SAL_CALL getTitledBorderText( ) override;
83 virtual OUString SAL_CALL getToolTipText( ) override;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */