1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
29 #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
30 
31 #include <com/sun/star/accessibility/XAccessible.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <comphelper/accessibletexthelper.hxx>
34 #ifndef _CPPUHELPER_IMPLBASE2_HXX
35 #include <cppuhelper/implbase2.hxx>
36 #endif
37 
38 
39 class StatusBar;
40 class VCLExternalSolarLock;
41 
42 namespace utl {
43 class AccessibleStateSetHelper;
44 }
45 
46 
47 //	----------------------------------------------------
48 //	class VCLXAccessibleStatusBarItem
49 //	----------------------------------------------------
50 
51 typedef ::comphelper::OAccessibleTextHelper	AccessibleTextHelper_BASE;
52 
53 typedef ::cppu::ImplHelper2<
54 	::com::sun::star::accessibility::XAccessible,
55 	::com::sun::star::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE;
56 
57 class VCLXAccessibleStatusBarItem :	public AccessibleTextHelper_BASE,
58 									public VCLXAccessibleStatusBarItem_BASE
59 {
60 	friend class VCLXAccessibleStatusBar;
61 
62 private:
63 	VCLExternalSolarLock*	m_pExternalLock;
64 	StatusBar*				m_pStatusBar;
65 	sal_uInt16				m_nItemId;
66 	::rtl::OUString			m_sItemName;
67 	::rtl::OUString			m_sItemText;
68 	sal_Bool				m_bShowing;
69 
70 protected:
71 	sal_Bool				IsShowing();
72 	void					SetShowing( sal_Bool bShowing );
73 	void					SetItemName( const ::rtl::OUString& sItemName );
74 	::rtl::OUString			GetItemName();
75 	void					SetItemText( const ::rtl::OUString& sItemText );
76 	::rtl::OUString			GetItemText();
77 	sal_uInt16				GetItemId() const { return m_nItemId; }
78 
79     virtual void			FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
80 
81 	// OCommonAccessibleComponent
82 	virtual ::com::sun::star::awt::Rectangle SAL_CALL	implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
83 
84 	// OCommonAccessibleText
85 	virtual ::rtl::OUString					implGetText();
86 	virtual ::com::sun::star::lang::Locale	implGetLocale();
87 	virtual void							implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
88 
89 	// XComponent
90 	virtual void SAL_CALL	disposing();
91 
92 public:
93 	VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId );
94 	virtual ~VCLXAccessibleStatusBarItem();
95 
96 	// XInterface
97 	DECLARE_XINTERFACE()
98 
99 	// XTypeProvider
100 	DECLARE_XTYPEPROVIDER()
101 
102 	// XServiceInfo
103 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
104 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
105 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
106 
107 	// XAccessible
108 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
109 
110 	// XAccessibleContext
111 	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
112 	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);
113 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
114 	virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
115 	virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
116 	virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
117 	virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
118 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
119 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
120 	virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
121 
122 	// XAccessibleComponent
123 	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);
124 	virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
125 	virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
126 	virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
127 
128 	// XAccessibleExtendedComponent
129 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont(	) throw (::com::sun::star::uno::RuntimeException);
130 	virtual ::rtl::OUString SAL_CALL getTitledBorderText(  ) throw (::com::sun::star::uno::RuntimeException);
131 	virtual ::rtl::OUString SAL_CALL getToolTipText(  ) throw (::com::sun::star::uno::RuntimeException);
132 
133 	// XAccessibleText
134 	virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
135 	virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
136     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);
137 	virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
138 	virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
139 	virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
140 	virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
141 };
142 
143 #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
144 
145