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