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 : #include <vcl/vclptr.hxx>
42 :
43 : namespace com { namespace sun { namespace star { namespace awt {
44 : struct Point;
45 : struct Rectangle;
46 : struct Size;
47 : class XFocusListener;
48 : } } } }
49 :
50 : class Rectangle;
51 : class Ruler;
52 : namespace vcl { class Window; }
53 :
54 :
55 : typedef ::cppu::WeakAggComponentImplHelper5<
56 : ::com::sun::star::accessibility::XAccessible,
57 : ::com::sun::star::accessibility::XAccessibleComponent,
58 : ::com::sun::star::accessibility::XAccessibleContext,
59 : ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
60 : ::com::sun::star::lang::XServiceInfo >
61 : SvtRulerAccessible_Base;
62 :
63 : class SvtRulerAccessible : public ::comphelper::OBaseMutex, public SvtRulerAccessible_Base
64 : {
65 : public:
66 : //===== internal ========================================================
67 : SvtRulerAccessible(
68 : const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, Ruler& rRepresentation, const ::rtl::OUString& rName );
69 : protected:
70 : virtual ~SvtRulerAccessible();
71 : public:
72 :
73 : bool SAL_CALL
74 : isVisible() throw( ::com::sun::star::uno::RuntimeException );
75 :
76 : //===== XAccessible =====================================================
77 :
78 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
79 : getAccessibleContext() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
80 :
81 : //===== XAccessibleComponent ============================================
82 :
83 : virtual sal_Bool SAL_CALL
84 : containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
85 :
86 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
87 : getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
88 :
89 : virtual ::com::sun::star::awt::Rectangle SAL_CALL
90 : getBounds() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
91 :
92 : virtual ::com::sun::star::awt::Point SAL_CALL
93 : getLocation() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
94 :
95 : virtual ::com::sun::star::awt::Point SAL_CALL
96 : getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
97 :
98 : virtual ::com::sun::star::awt::Size SAL_CALL
99 : getSize() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
100 :
101 : virtual void SAL_CALL
102 : grabFocus() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
103 :
104 : virtual sal_Int32 SAL_CALL
105 : getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 : virtual sal_Int32 SAL_CALL
107 : getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 :
109 : //===== XAccessibleContext ==============================================
110 :
111 : virtual sal_Int32 SAL_CALL
112 : getAccessibleChildCount() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
113 :
114 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
115 : getAccessibleChild( sal_Int32 nIndex )
116 : throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException, std::exception ) SAL_OVERRIDE;
117 :
118 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
119 : getAccessibleParent() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
120 :
121 : virtual sal_Int32 SAL_CALL
122 : getAccessibleIndexInParent() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
123 :
124 : virtual sal_Int16 SAL_CALL
125 : getAccessibleRole() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
126 :
127 : virtual ::rtl::OUString SAL_CALL
128 : getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 :
130 : virtual ::rtl::OUString SAL_CALL
131 : getAccessibleName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 :
133 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
134 : getAccessibleRelationSet() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
135 :
136 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
137 : getAccessibleStateSet() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
138 :
139 : virtual ::com::sun::star::lang::Locale SAL_CALL
140 : getLocale()
141 : throw( ::com::sun::star::uno::RuntimeException,
142 : ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception ) SAL_OVERRIDE;
143 : //===== XAccessibleEventBroadcaster =====================================
144 :
145 : virtual void SAL_CALL
146 : addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
147 :
148 : virtual void SAL_CALL
149 : removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
150 :
151 : //===== XServiceInfo ====================================================
152 :
153 : virtual ::rtl::OUString SAL_CALL
154 : getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
155 :
156 : virtual sal_Bool SAL_CALL
157 : supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
158 :
159 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
160 : getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
161 :
162 : //===== XTypeProvider ===================================================
163 :
164 : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
165 : getImplementationId() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
166 :
167 : protected:
168 :
169 : /// @Return the object's current bounding box relative to the desktop.
170 : Rectangle GetBoundingBoxOnScreen() throw( ::com::sun::star::uno::RuntimeException );
171 :
172 : /// @Return the object's current bounding box relative to the parent object.
173 : Rectangle GetBoundingBox() throw( ::com::sun::star::uno::RuntimeException );
174 :
175 :
176 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
177 :
178 : /// @returns true if it's disposed or in disposing
179 : inline bool IsAlive() const;
180 :
181 : /// @returns true if it's not disposed and no in disposing
182 : inline bool IsNotAlive() const;
183 :
184 : /// throws the exception DisposedException if it's not alive
185 : void ThrowExceptionIfNotAlive() throw( ::com::sun::star::lang::DisposedException );
186 :
187 : private:
188 : /** Description of this object. This is not a constant because it can
189 : be set from the outside.
190 : */
191 : ::rtl::OUString msDescription;
192 :
193 : /** Name of this object.
194 : */
195 : ::rtl::OUString msName;
196 :
197 : /// Reference to the parent object.
198 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
199 : mxParent;
200 :
201 : /// pointer to internal representation
202 : VclPtr<Ruler> mpRepr;
203 :
204 : /// client id in the AccessibleEventNotifier queue
205 : sal_uInt32 mnClientId;
206 :
207 :
208 : };
209 :
210 10 : inline bool SvtRulerAccessible::IsAlive() const
211 : {
212 10 : return !rBHelper.bDisposed && !rBHelper.bInDispose;
213 : }
214 :
215 15 : inline bool SvtRulerAccessible::IsNotAlive() const
216 : {
217 15 : return rBHelper.bDisposed || rBHelper.bInDispose;
218 : }
219 :
220 : #endif
221 :
222 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|