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>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <cppuhelper/interfacecontainer.h>
30 #include <cppuhelper/compbase5.hxx>
31 #include <cppuhelper/basemutex.hxx>
32 #include <vcl/vclptr.hxx>
34 namespace tools
{ class Rectangle
; }
38 typedef ::cppu::WeakAggComponentImplHelper5
<
39 css::accessibility::XAccessible
,
40 css::accessibility::XAccessibleComponent
,
41 css::accessibility::XAccessibleContext
,
42 css::accessibility::XAccessibleEventBroadcaster
,
43 css::lang::XServiceInfo
>
44 SvtRulerAccessible_Base
;
46 class SvtRulerAccessible final
: public ::cppu::BaseMutex
, public SvtRulerAccessible_Base
49 //===== internal ========================================================
51 const css::uno::Reference
< css::accessibility::XAccessible
>& rxParent
, Ruler
& rRepresentation
, const OUString
& rName
);
53 /// @throws css::uno::RuntimeException
57 //===== XAccessible =====================================================
59 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
60 getAccessibleContext() override
;
62 //===== XAccessibleComponent ============================================
64 virtual sal_Bool SAL_CALL
65 containsPoint( const css::awt::Point
& rPoint
) override
;
67 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
68 getAccessibleAtPoint( const css::awt::Point
& rPoint
) override
;
70 virtual css::awt::Rectangle SAL_CALL
73 virtual css::awt::Point SAL_CALL
74 getLocation() override
;
76 virtual css::awt::Point SAL_CALL
77 getLocationOnScreen() override
;
79 virtual css::awt::Size SAL_CALL
85 virtual sal_Int32 SAL_CALL
86 getForeground( ) override
;
87 virtual sal_Int32 SAL_CALL
88 getBackground( ) override
;
90 //===== XAccessibleContext ==============================================
92 virtual sal_Int32 SAL_CALL
93 getAccessibleChildCount() override
;
95 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
96 getAccessibleChild( sal_Int32 nIndex
) override
;
98 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
99 getAccessibleParent() override
;
101 virtual sal_Int32 SAL_CALL
102 getAccessibleIndexInParent() override
;
104 virtual sal_Int16 SAL_CALL
105 getAccessibleRole() override
;
107 virtual OUString SAL_CALL
108 getAccessibleDescription() override
;
110 virtual OUString SAL_CALL
111 getAccessibleName() override
;
113 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
114 getAccessibleRelationSet() override
;
116 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
117 getAccessibleStateSet() override
;
119 virtual css::lang::Locale SAL_CALL
120 getLocale() override
;
121 //===== XAccessibleEventBroadcaster =====================================
123 virtual void SAL_CALL
124 addAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& xListener
) override
;
126 virtual void SAL_CALL
127 removeAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& xListener
) override
;
129 //===== XServiceInfo ====================================================
131 virtual OUString SAL_CALL
132 getImplementationName() override
;
134 virtual sal_Bool SAL_CALL
135 supportsService( const OUString
& sServiceName
) override
;
137 virtual css::uno::Sequence
< OUString
> SAL_CALL
138 getSupportedServiceNames() override
;
140 //===== XTypeProvider ===================================================
142 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
143 getImplementationId() override
;
147 virtual ~SvtRulerAccessible() override
;
149 virtual void SAL_CALL
disposing() override
;
151 /// @returns true if it's disposed or in disposing
152 inline bool IsAlive() const;
154 /// @throws DisposedException if it's not alive
155 void ThrowExceptionIfNotAlive();
157 /// @Return the object's current bounding box relative to the desktop.
159 /// @throws css::uno::RuntimeException
160 tools::Rectangle
GetBoundingBoxOnScreen();
162 /// @Return the object's current bounding box relative to the parent object.
164 /// @throws css::uno::RuntimeException
165 tools::Rectangle
GetBoundingBox();
167 /// Name of this object.
168 OUString
const msName
;
170 /// Reference to the parent object.
171 css::uno::Reference
< css::accessibility::XAccessible
>
174 /// pointer to internal representation
175 VclPtr
<Ruler
> mpRepr
;
177 /// client id in the AccessibleEventNotifier queue
178 sal_uInt32 mnClientId
;
181 inline bool SvtRulerAccessible::IsAlive() const
183 return !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
;
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */