xref: /trunk/main/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
25 #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
26 
27 #include <com/sun/star/accessibility/XAccessible.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <comphelper/accessibletexthelper.hxx>
30 #ifndef _CPPUHELPER_IMPLBASE2_HXX
31 #include <cppuhelper/implbase2.hxx>
32 #endif
33 
34 
35 class StatusBar;
36 class VCLExternalSolarLock;
37 
38 namespace utl {
39 class AccessibleStateSetHelper;
40 }
41 
42 
43 //  ----------------------------------------------------
44 //  class VCLXAccessibleStatusBarItem
45 //  ----------------------------------------------------
46 
47 typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE;
48 
49 typedef ::cppu::ImplHelper2<
50     ::com::sun::star::accessibility::XAccessible,
51     ::com::sun::star::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE;
52 
53 class VCLXAccessibleStatusBarItem : public AccessibleTextHelper_BASE,
54                                     public VCLXAccessibleStatusBarItem_BASE
55 {
56     friend class VCLXAccessibleStatusBar;
57 
58 private:
59     VCLExternalSolarLock*   m_pExternalLock;
60     StatusBar*              m_pStatusBar;
61     sal_uInt16              m_nItemId;
62     ::rtl::OUString         m_sItemName;
63     ::rtl::OUString         m_sItemText;
64     sal_Bool                m_bShowing;
65 
66 protected:
67     sal_Bool                IsShowing();
68     void                    SetShowing( sal_Bool bShowing );
69     void                    SetItemName( const ::rtl::OUString& sItemName );
70     ::rtl::OUString         GetItemName();
71     void                    SetItemText( const ::rtl::OUString& sItemText );
72     ::rtl::OUString         GetItemText();
GetItemId() const73     sal_uInt16              GetItemId() const { return m_nItemId; }
74 
75     virtual void            FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
76 
77     // OCommonAccessibleComponent
78     virtual ::com::sun::star::awt::Rectangle SAL_CALL   implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
79 
80     // OCommonAccessibleText
81     virtual ::rtl::OUString                 implGetText();
82     virtual ::com::sun::star::lang::Locale  implGetLocale();
83     virtual void                            implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
84 
85     // XComponent
86     virtual void SAL_CALL   disposing();
87 
88 public:
89     VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId );
90     virtual ~VCLXAccessibleStatusBarItem();
91 
92     // XInterface
93     DECLARE_XINTERFACE()
94 
95     // XTypeProvider
96     DECLARE_XTYPEPROVIDER()
97 
98     // XServiceInfo
99     virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
100     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
101     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
102 
103     // XAccessible
104     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
105 
106     // XAccessibleContext
107     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
108     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
109     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
110     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
111     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
112     virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
113     virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
114     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
115     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
116     virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
117 
118     // XAccessibleComponent
119     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
120     virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
121     virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
122     virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
123 
124     // XAccessibleExtendedComponent
125     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont(  ) throw (::com::sun::star::uno::RuntimeException);
126     virtual ::rtl::OUString SAL_CALL getTitledBorderText(  ) throw (::com::sun::star::uno::RuntimeException);
127     virtual ::rtl::OUString SAL_CALL getToolTipText(  ) throw (::com::sun::star::uno::RuntimeException);
128 
129     // XAccessibleText
130     virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
131     virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
132     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
133     virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
134     virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
135     virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
136     virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
137 };
138 
139 #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
140