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/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/implbase2.hxx> 27 #include <vcl/status.hxx> 28 #include <vcl/vclptr.hxx> 29 30 namespace utl { 31 class AccessibleStateSetHelper; 32 } 33 34 35 36 37 typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; 38 39 typedef ::cppu::ImplHelper2< 40 css::accessibility::XAccessible, 41 css::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE; 42 43 class VCLXAccessibleStatusBarItem final : public AccessibleTextHelper_BASE, 44 public VCLXAccessibleStatusBarItem_BASE 45 { 46 friend class VCLXAccessibleStatusBar; 47 48 private: 49 VclPtr<StatusBar> m_pStatusBar; 50 sal_uInt16 m_nItemId; 51 OUString m_sItemName; 52 OUString m_sItemText; 53 bool m_bShowing; 54 55 bool IsShowing(); 56 void SetShowing( bool bShowing ); 57 void SetItemName( const OUString& sItemName ); 58 OUString GetItemName(); 59 void SetItemText( const OUString& sItemText ); 60 OUString GetItemText(); GetItemId() const61 sal_uInt16 GetItemId() const { return m_nItemId; } 62 63 void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); 64 65 // OCommonAccessibleComponent 66 virtual css::awt::Rectangle implGetBounds( ) override; 67 68 // OCommonAccessibleText 69 virtual OUString implGetText() override; 70 virtual css::lang::Locale implGetLocale() override; 71 virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; 72 73 // XComponent 74 virtual void SAL_CALL disposing() override; 75 76 public: 77 VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId ); 78 79 // XInterface 80 DECLARE_XINTERFACE() 81 82 // XTypeProvider 83 DECLARE_XTYPEPROVIDER() 84 85 // XServiceInfo 86 virtual OUString SAL_CALL getImplementationName() override; 87 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; 88 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; 89 90 // XAccessible 91 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; 92 93 // XAccessibleContext 94 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; 95 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32) override; 96 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; 97 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; 98 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; 99 virtual OUString SAL_CALL getAccessibleDescription( ) override; 100 virtual OUString SAL_CALL getAccessibleName( ) override; 101 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; 102 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; 103 virtual css::lang::Locale SAL_CALL getLocale( ) override; 104 105 // XAccessibleComponent 106 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; 107 virtual void SAL_CALL grabFocus( ) override; 108 virtual sal_Int32 SAL_CALL getForeground( ) override; 109 virtual sal_Int32 SAL_CALL getBackground( ) override; 110 111 // XAccessibleExtendedComponent 112 virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; 113 virtual OUString SAL_CALL getTitledBorderText( ) override; 114 virtual OUString SAL_CALL getToolTipText( ) override; 115 116 // XAccessibleText 117 virtual sal_Int32 SAL_CALL getCaretPosition() override; 118 virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; 119 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; 120 virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; 121 virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; 122 virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; 123 virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; 124 virtual OUString SAL_CALL getText() override; 125 virtual sal_Int32 SAL_CALL getCharacterCount() override; 126 virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; 127 virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override; 128 virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; 129 130 }; 131 132 133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 134