1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVTOOLS_ACCESSIBLERULER_HXX
20 #define INCLUDED_SVTOOLS_ACCESSIBLERULER_HXX
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>
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>
43 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{
52 namespace vcl
{ class Window
; }
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
;
63 class SvtRulerAccessible
: public ::comphelper::OBaseMutex
, public SvtRulerAccessible_Base
66 //===== internal ========================================================
68 const ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>& rxParent
, Ruler
& rRepresentation
, const ::rtl::OUString
& rName
);
70 virtual ~SvtRulerAccessible();
74 isVisible() throw( ::com::sun::star::uno::RuntimeException
);
76 //===== XAccessible =====================================================
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
;
81 //===== XAccessibleComponent ============================================
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
;
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
;
89 virtual ::com::sun::star::awt::Rectangle SAL_CALL
90 getBounds() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual ::com::sun::star::awt::Point SAL_CALL
93 getLocation() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual ::com::sun::star::awt::Point SAL_CALL
96 getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual ::com::sun::star::awt::Size SAL_CALL
99 getSize() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
102 grabFocus() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
109 //===== XAccessibleContext ==============================================
111 virtual sal_Int32 SAL_CALL
112 getAccessibleChildCount() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
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
;
121 virtual sal_Int32 SAL_CALL
122 getAccessibleIndexInParent() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual sal_Int16 SAL_CALL
125 getAccessibleRole() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual ::rtl::OUString SAL_CALL
128 getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual ::rtl::OUString SAL_CALL
131 getAccessibleName() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
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
;
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
;
139 virtual ::com::sun::star::lang::Locale SAL_CALL
141 throw( ::com::sun::star::uno::RuntimeException
,
142 ::com::sun::star::accessibility::IllegalAccessibleComponentStateException
, std::exception
) SAL_OVERRIDE
;
143 //===== XAccessibleEventBroadcaster =====================================
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
;
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
;
151 //===== XServiceInfo ====================================================
153 virtual ::rtl::OUString SAL_CALL
154 getImplementationName() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 virtual sal_Bool SAL_CALL
157 supportsService( const ::rtl::OUString
& sServiceName
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
159 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
160 getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
162 //===== XTypeProvider ===================================================
164 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
165 getImplementationId() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
169 /// @Return the object's current bounding box relative to the desktop.
170 Rectangle
GetBoundingBoxOnScreen() throw( ::com::sun::star::uno::RuntimeException
);
172 /// @Return the object's current bounding box relative to the parent object.
173 Rectangle
GetBoundingBox() throw( ::com::sun::star::uno::RuntimeException
);
176 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
178 /// @returns true if it's disposed or in disposing
179 inline bool IsAlive() const;
181 /// @returns true if it's not disposed and no in disposing
182 inline bool IsNotAlive() const;
184 /// throws the exception DisposedException if it's not alive
185 void ThrowExceptionIfNotAlive() throw( ::com::sun::star::lang::DisposedException
);
188 /** Description of this object. This is not a constant because it can
189 be set from the outside.
191 ::rtl::OUString msDescription
;
193 /** Name of this object.
195 ::rtl::OUString msName
;
197 /// Reference to the parent object.
198 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
201 /// pointer to internal representation
202 VclPtr
<Ruler
> mpRepr
;
204 /// client id in the AccessibleEventNotifier queue
205 sal_uInt32 mnClientId
;
210 inline bool SvtRulerAccessible::IsAlive() const
212 return !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
;
215 inline bool SvtRulerAccessible::IsNotAlive() const
217 return rBHelper
.bDisposed
|| rBHelper
.bInDispose
;
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */