Avoid potential negative array index access to cached text.
[LibreOffice.git] / accessibility / inc / standard / vclxaccessiblestatusbaritem.hxx
blob0ab119fe19eb4d8cd266d824fd846029812d1a74
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 <com/sun/star/accessibility/AccessibleScrollType.hpp>
23 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <comphelper/accessibletexthelper.hxx>
26 #include <cppuhelper/implbase.hxx>
27 #include <vcl/status.hxx>
28 #include <vcl/vclptr.hxx>
33 typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE;
35 class VCLXAccessibleStatusBarItem final : public cppu::ImplInheritanceHelper<
36 AccessibleTextHelper_BASE,
37 css::accessibility::XAccessible,
38 css::lang::XServiceInfo>
40 friend class VCLXAccessibleStatusBar;
42 private:
43 VclPtr<StatusBar> m_pStatusBar;
44 sal_uInt16 m_nItemId;
45 OUString m_sItemName;
46 OUString m_sItemText;
47 bool m_bShowing;
49 bool IsShowing();
50 void SetShowing( bool bShowing );
51 void SetItemName( const OUString& sItemName );
52 OUString GetItemName();
53 void SetItemText( const OUString& sItemText );
54 OUString GetItemText();
56 void FillAccessibleStateSet( sal_Int64& rStateSet );
58 // OCommonAccessibleComponent
59 virtual css::awt::Rectangle implGetBounds( ) override;
61 // OCommonAccessibleText
62 virtual OUString implGetText() override;
63 virtual css::lang::Locale implGetLocale() override;
64 virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override;
66 // XComponent
67 virtual void SAL_CALL disposing() override;
69 public:
70 VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId );
72 // XServiceInfo
73 virtual OUString SAL_CALL getImplementationName() override;
74 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
75 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
77 // XAccessible
78 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
80 // XAccessibleContext
81 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
82 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64) override;
83 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
84 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
85 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
86 virtual OUString SAL_CALL getAccessibleDescription( ) override;
87 virtual OUString SAL_CALL getAccessibleName( ) override;
88 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
89 virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
90 virtual css::lang::Locale SAL_CALL getLocale( ) override;
92 // XAccessibleComponent
93 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
94 virtual void SAL_CALL grabFocus( ) override;
95 virtual sal_Int32 SAL_CALL getForeground( ) override;
96 virtual sal_Int32 SAL_CALL getBackground( ) override;
98 // XAccessibleExtendedComponent
99 virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override;
100 virtual OUString SAL_CALL getTitledBorderText( ) override;
101 virtual OUString SAL_CALL getToolTipText( ) override;
103 // XAccessibleText
104 virtual sal_Int32 SAL_CALL getCaretPosition() override;
105 virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
106 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
107 virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override;
108 virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
109 virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
110 virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
111 virtual OUString SAL_CALL getText() override;
112 virtual sal_Int32 SAL_CALL getCharacterCount() override;
113 virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
114 virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
115 virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */