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 .
19 #ifndef INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX
20 #define INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX
22 #include <com/sun/star/accessibility/XAccessible.hpp>
23 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
24 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
27 #include <com/sun/star/accessibility/XAccessibleText.hpp>
28 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
29 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <cppuhelper/implbase4.hxx>
32 #include <comphelper/accessibletexthelper.hxx>
33 #include <vcl/vclptr.hxx>
38 typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE
;
39 typedef ::cppu::ImplHelper4
< css::accessibility::XAccessible
,
40 css::accessibility::XAccessibleAction
,
41 css::accessibility::XAccessibleValue
,
42 css::lang::XServiceInfo
> VCLXAccessibleToolBoxItem_BASE
;
44 class VCLXAccessibleToolBoxItem final
: public AccessibleTextHelper_BASE
,
45 public VCLXAccessibleToolBoxItem_BASE
49 VclPtr
<ToolBox
> m_pToolBox
;
50 sal_Int32 m_nIndexInParent
;
55 bool m_bIndeterminate
;
57 css::uno::Reference
< css::accessibility::XAccessible
> m_xChild
;
61 sal_Int32
getIndexInParent() const { return m_nIndexInParent
; }
62 void setIndexInParent( sal_Int32 _nNewIndex
) { m_nIndexInParent
= _nNewIndex
; }
65 virtual ~VCLXAccessibleToolBoxItem() override
;
67 virtual void SAL_CALL
disposing() override
;
69 /// implements the calculation of the bounding rectangle
70 virtual css::awt::Rectangle
implGetBounds( ) override
;
72 // OCommonAccessibleText
73 virtual OUString
implGetText() override
;
74 virtual css::lang::Locale
implGetLocale() override
;
75 virtual void implGetSelection( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
) override
;
78 VCLXAccessibleToolBoxItem( ToolBox
* _pToolBox
, sal_Int32 _nPos
);
80 void SetFocus( bool _bFocus
);
81 bool HasFocus() const { return m_bHasFocus
; }
82 void SetChecked( bool _bCheck
);
83 void SetIndeterminate( bool _bIndeterminate
);
84 void ReleaseToolBox() { m_pToolBox
= nullptr; }
86 void SetChild( const css::uno::Reference
< css::accessibility::XAccessible
>& _xChild
);
87 const css::uno::Reference
< css::accessibility::XAccessible
>&
88 GetChild() const { return m_xChild
; }
89 void NotifyChildEvent( const css::uno::Reference
< css::accessibility::XAccessible
>& _xChild
, bool _bShow
);
91 void ToggleEnableState();
95 DECLARE_XTYPEPROVIDER( )
98 virtual OUString SAL_CALL
getImplementationName() override
;
99 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) override
;
100 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
103 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
;
105 // XAccessibleContext
106 virtual sal_Int32 SAL_CALL
getAccessibleChildCount( ) override
;
107 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int32 i
) override
;
108 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
109 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent( ) override
;
110 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
111 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
112 virtual OUString SAL_CALL
getAccessibleName( ) override
;
113 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
114 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet( ) override
;
117 virtual OUString SAL_CALL
getText() override
;
118 virtual sal_Unicode SAL_CALL
getCharacter( sal_Int32 nIndex
) override
;
119 virtual sal_Int32 SAL_CALL
getCharacterCount() override
;
120 virtual sal_Int32 SAL_CALL
getCaretPosition() override
;
121 virtual sal_Bool SAL_CALL
setCaretPosition( sal_Int32 nIndex
) override
;
122 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
getCharacterAttributes( sal_Int32 nIndex
, const css::uno::Sequence
< OUString
>& aRequestedAttributes
) override
;
123 virtual css::awt::Rectangle SAL_CALL
getCharacterBounds( sal_Int32 nIndex
) override
;
124 virtual sal_Int32 SAL_CALL
getIndexAtPoint( const css::awt::Point
& aPoint
) override
;
125 virtual sal_Bool SAL_CALL
setSelection( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) override
;
126 virtual sal_Bool SAL_CALL
copyText( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) override
;
127 virtual OUString SAL_CALL
getTextRange( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
) override
;
129 // XAccessibleComponent
130 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
131 virtual void SAL_CALL
grabFocus( ) override
;
132 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
133 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
135 // XAccessibleExtendedComponent
136 virtual css::uno::Reference
< css::awt::XFont
> SAL_CALL
getFont( ) override
;
137 virtual OUString SAL_CALL
getTitledBorderText( ) override
;
138 virtual OUString SAL_CALL
getToolTipText( ) override
;
141 virtual sal_Int32 SAL_CALL
getAccessibleActionCount( ) override
;
142 virtual sal_Bool SAL_CALL
doAccessibleAction ( sal_Int32 nIndex
) override
;
143 virtual OUString SAL_CALL
getAccessibleActionDescription ( sal_Int32 nIndex
) override
;
144 virtual css::uno::Reference
< css::accessibility::XAccessibleKeyBinding
> SAL_CALL
getAccessibleActionKeyBinding( sal_Int32 nIndex
) override
;
147 virtual css::uno::Any SAL_CALL
getCurrentValue( ) override
;
148 virtual sal_Bool SAL_CALL
setCurrentValue( const css::uno::Any
& aNumber
) override
;
149 virtual css::uno::Any SAL_CALL
getMaximumValue( ) override
;
150 virtual css::uno::Any SAL_CALL
getMinimumValue( ) override
;
153 #endif // INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */