Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
4 : * This Source Code Form is subject to the terms of the Mozilla Public
5 : * License, v. 2.0. If a copy of the MPL was not distributed with this
6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
10 : * Licensed to the Apache Software Foundation (ASF) under one or more
11 : * contributor license agreements. See the NOTICE file distributed
12 : * with this work for additional information regarding copyright
13 : * ownership. The ASF licenses this file to you under the Apache
14 : * License, Version 2.0 (the "License"); you may not use this file
15 : * except in compliance with the License. You may obtain a copy of
16 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
17 : */
18 : #ifndef _SVTRULERACCESSIBLE_HXX
19 : #define _SVTRULERACCESSIBLE_HXX
20 :
21 : #include <com/sun/star/accessibility/XAccessible.hpp>
22 : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
23 : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
24 : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
25 : #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
26 :
27 : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
28 : #include <com/sun/star/uno/Reference.hxx>
29 : #include <cppuhelper/weak.hxx>
30 : #include <com/sun/star/lang/XServiceInfo.hpp>
31 : #include <com/sun/star/lang/XTypeProvider.hpp>
32 : #include <com/sun/star/lang/XServiceName.hpp>
33 : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
34 : #include <com/sun/star/lang/DisposedException.hpp>
35 : #include <cppuhelper/interfacecontainer.h>
36 : #include <cppuhelper/compbase5.hxx>
37 : #include <comphelper/broadcasthelper.hxx>
38 : #include <cppuhelper/implbase5.hxx>
39 : #include <comphelper/servicehelper.hxx>
40 :
41 : namespace com { namespace sun { namespace star { namespace awt {
42 : struct Point;
43 : struct Rectangle;
44 : struct Size;
45 : class XFocusListener;
46 : } } } }
47 :
48 : class Rectangle;
49 : class Ruler;
50 : class Window;
51 :
52 :
53 : typedef ::cppu::WeakAggComponentImplHelper5<
54 : ::com::sun::star::accessibility::XAccessible,
55 : ::com::sun::star::accessibility::XAccessibleComponent,
56 : ::com::sun::star::accessibility::XAccessibleContext,
57 : ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
58 : ::com::sun::star::lang::XServiceInfo >
59 : SvtRulerAccessible_Base;
60 :
61 : class SvtRulerAccessible : public ::comphelper::OBaseMutex, public SvtRulerAccessible_Base
62 : {
63 : public:
64 : //===== internal ========================================================
65 : SvtRulerAccessible(
66 : const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, Ruler& rRepresentation, const ::rtl::OUString& rName );
67 : protected:
68 : virtual ~SvtRulerAccessible();
69 : public:
70 : //===== XAccessible =====================================================
71 :
72 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
73 : getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
74 :
75 : //===== XAccessibleComponent ============================================
76 :
77 : virtual sal_Bool SAL_CALL
78 : containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
79 :
80 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
81 : getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 :
83 : virtual ::com::sun::star::awt::Rectangle SAL_CALL
84 : getBounds() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
85 :
86 : virtual ::com::sun::star::awt::Point SAL_CALL
87 : getLocation() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
88 :
89 : virtual ::com::sun::star::awt::Point SAL_CALL
90 : getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
91 :
92 : virtual ::com::sun::star::awt::Size SAL_CALL
93 : getSize() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
94 :
95 : virtual sal_Bool SAL_CALL
96 : isShowing() throw( ::com::sun::star::uno::RuntimeException );
97 :
98 : virtual sal_Bool SAL_CALL
99 : isVisible() throw( ::com::sun::star::uno::RuntimeException );
100 :
101 : virtual sal_Bool SAL_CALL
102 : isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException );
103 :
104 : virtual void SAL_CALL
105 : addFocusListener(
106 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
107 : throw( ::com::sun::star::uno::RuntimeException );
108 :
109 : virtual void SAL_CALL
110 : removeFocusListener(
111 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
112 : throw( ::com::sun::star::uno::RuntimeException );
113 :
114 : virtual void SAL_CALL
115 : grabFocus() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
116 :
117 : virtual ::com::sun::star::uno::Any SAL_CALL
118 : getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException );
119 : virtual sal_Int32 SAL_CALL
120 : getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual sal_Int32 SAL_CALL
122 : getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 :
124 : //===== XAccessibleContext ==============================================
125 :
126 : virtual sal_Int32 SAL_CALL
127 : getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
128 :
129 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
130 : getAccessibleChild( sal_Int32 nIndex )
131 : throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception ) SAL_OVERRIDE;
132 :
133 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
134 : getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
135 :
136 : virtual sal_Int32 SAL_CALL
137 : getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
138 :
139 : virtual sal_Int16 SAL_CALL
140 : getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
141 :
142 : virtual ::rtl::OUString SAL_CALL
143 : getAccessibleDescription( void ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 :
145 : virtual ::rtl::OUString SAL_CALL
146 : getAccessibleName( void ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
147 :
148 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
149 : getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
150 :
151 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
152 : getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
153 :
154 : virtual ::com::sun::star::lang::Locale SAL_CALL
155 : getLocale( void )
156 : throw( ::com::sun::star::uno::RuntimeException,
157 : ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception ) SAL_OVERRIDE;
158 : //===== XAccessibleEventBroadcaster =====================================
159 :
160 : virtual void SAL_CALL
161 : addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
162 :
163 : virtual void SAL_CALL
164 : removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
165 :
166 : //===== XServiceInfo ====================================================
167 :
168 : virtual ::rtl::OUString SAL_CALL
169 : getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
170 :
171 : virtual sal_Bool SAL_CALL
172 : supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
173 :
174 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
175 : getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
176 :
177 : //===== XTypeProvider ===================================================
178 :
179 : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
180 : getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
181 :
182 : protected:
183 :
184 : /// @Return the object's current bounding box relative to the desktop.
185 : virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
186 :
187 : /// @Return the object's current bounding box relative to the parent object.
188 : virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
189 :
190 :
191 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
192 :
193 : /// @returns true if it's disposed or in disposing
194 : inline bool IsAlive( void ) const;
195 :
196 : /// @returns true if it's not disposed and no in disposing
197 : inline bool IsNotAlive( void ) const;
198 :
199 : /// throws the exception DisposedException if it's not alive
200 : void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
201 :
202 : private:
203 : /** Description of this object. This is not a constant because it can
204 : be set from the outside.
205 : */
206 : ::rtl::OUString msDescription;
207 :
208 : /** Name of this object.
209 : */
210 : ::rtl::OUString msName;
211 :
212 : /// Reference to the parent object.
213 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
214 : mxParent;
215 :
216 : /// pointer to internal representation
217 : Ruler* mpRepr;
218 :
219 : /// client id in the AccessibleEventNotifier queue
220 : sal_uInt32 mnClientId;
221 :
222 :
223 : };
224 :
225 0 : inline bool SvtRulerAccessible::IsAlive( void ) const
226 : {
227 0 : return !rBHelper.bDisposed && !rBHelper.bInDispose;
228 : }
229 :
230 0 : inline bool SvtRulerAccessible::IsNotAlive( void ) const
231 : {
232 0 : return rBHelper.bDisposed || rBHelper.bInDispose;
233 : }
234 :
235 : #endif
|