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