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 _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_
29 #define _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_
30 
31 #include <com/sun/star/accessibility/XAccessible.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
34 #include <comphelper/accessiblecomponenthelper.hxx>
35 #include <cppuhelper/implbase3.hxx>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 
38 #include <vector>
39 
40 class Window;
41 class DialogWindow;
42 class DlgEdObj;
43 class VCLExternalSolarLock;
44 
45 namespace utl {
46 class AccessibleStateSetHelper;
47 }
48 
49 
50 //	----------------------------------------------------
51 //	class AccessibleDialogControlShape
52 //	----------------------------------------------------
53 
54 typedef ::comphelper::OAccessibleExtendedComponentHelper	AccessibleExtendedComponentHelper_BASE;
55 
56 typedef ::cppu::ImplHelper3<
57 	::com::sun::star::accessibility::XAccessible,
58 	::com::sun::star::lang::XServiceInfo,
59 	::com::sun::star::beans::XPropertyChangeListener > AccessibleDialogControlShape_BASE;
60 
61 class AccessibleDialogControlShape :	public AccessibleExtendedComponentHelper_BASE,
62 										public AccessibleDialogControlShape_BASE
63 {
64 	friend class AccessibleDialogWindow;
65 
66 private:
67 	VCLExternalSolarLock*	m_pExternalLock;
68 	DialogWindow*			m_pDialogWindow;
69 	DlgEdObj*				m_pDlgEdObj;
70 	sal_Bool				m_bFocused;
71 	sal_Bool				m_bSelected;
72 
73 	::com::sun::star::awt::Rectangle											m_aBounds;
74 	::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >	m_xControlModel;
75 
76 protected:
77 	sal_Bool				IsFocused();
78 	sal_Bool				IsSelected();
79 
80 	void					SetFocused( sal_Bool bFocused );
81 	void					SetSelected( sal_Bool bSelected );
82 
83 	::com::sun::star::awt::Rectangle GetBounds();
84 	void					SetBounds( const ::com::sun::star::awt::Rectangle& aBounds );
85 
86 	Window*					GetWindow() const;
87 
88 	::rtl::OUString			GetModelStringProperty( const sal_Char* pPropertyName );
89 
90 	virtual void			FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
91 
92 	// OCommonAccessibleComponent
93 	virtual ::com::sun::star::awt::Rectangle SAL_CALL	implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
94 
95 	// XComponent
96 	virtual void SAL_CALL	disposing();
97 
98 public:
99 	AccessibleDialogControlShape( DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj );
100 	virtual ~AccessibleDialogControlShape();
101 
102 	// XInterface
103 	DECLARE_XINTERFACE()
104 
105 	// XTypeProvider
106 	DECLARE_XTYPEPROVIDER()
107 
108 	// XEventListener
109 	virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rSource ) throw (::com::sun::star::uno::RuntimeException);
110 
111 	// XPropertyChangeListener
112 	virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
113 
114 	// XServiceInfo
115 	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
116 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
117 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
118 
119 	// XAccessible
120 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
121 
122 	// XAccessibleContext
123 	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
124 	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);
125 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
126 	virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
127 	virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
128 	virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
129 	virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
130 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
131 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
132 	virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
133 
134 	// XAccessibleComponent
135 	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);
136 	virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
137 	virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
138 	virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
139 
140 	// XAccessibleExtendedComponent
141 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont(	) throw (::com::sun::star::uno::RuntimeException);
142 	virtual ::rtl::OUString SAL_CALL getTitledBorderText(  ) throw (::com::sun::star::uno::RuntimeException);
143 	virtual ::rtl::OUString SAL_CALL getToolTipText(  ) throw (::com::sun::star::uno::RuntimeException);
144 };
145 
146 
147 #endif // _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_
148