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 .
20 #ifndef INCLUDED_EDITENG_ACCESSIBLEIMAGEBULLET_HXX
21 #define INCLUDED_EDITENG_ACCESSIBLEIMAGEBULLET_HXX
23 #include <tools/gen.hxx>
24 #include <cppuhelper/weakref.hxx>
25 #include <cppuhelper/implbase.hxx>
27 #include <cppuhelper/interfacecontainer.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/accessibility/XAccessible.hpp>
31 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
32 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
33 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
34 #include <editeng/AccessibleParaManager.hxx>
35 #include <editeng/unoedsrc.hxx>
37 namespace accessibility
39 typedef ::cppu::WeakImplHelper
< css::accessibility::XAccessible
,
40 css::accessibility::XAccessibleContext
,
41 css::accessibility::XAccessibleComponent
,
42 css::accessibility::XAccessibleEventBroadcaster
,
43 css::lang::XServiceInfo
> AccessibleImageBulletInterfaceBase
;
45 /** This class implements the image bullets for the EditEngine/Outliner UAA
47 class AccessibleImageBullet
: public AccessibleImageBulletInterfaceBase
51 /// Create accessible object for given parent
52 AccessibleImageBullet ( const css::uno::Reference
< css::accessibility::XAccessible
>& rParent
);
54 virtual ~AccessibleImageBullet () override
;
57 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) throw (css::uno::RuntimeException
, std::exception
) override
;
60 virtual sal_Int32 SAL_CALL
getAccessibleChildCount() throw (css::uno::RuntimeException
, std::exception
) override
;
61 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int32 i
) throw (css::lang::IndexOutOfBoundsException
, css::uno::RuntimeException
, std::exception
) override
;
62 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent() throw (css::uno::RuntimeException
, std::exception
) override
;
63 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent() throw (css::uno::RuntimeException
, std::exception
) override
;
64 virtual sal_Int16 SAL_CALL
getAccessibleRole() throw (css::uno::RuntimeException
, std::exception
) override
;
65 /// Maximal length of text returned by getAccessibleDescription()
66 enum { MaxDescriptionLen
= 40 };
67 virtual OUString SAL_CALL
getAccessibleDescription() throw (css::uno::RuntimeException
, std::exception
) override
;
68 virtual OUString SAL_CALL
getAccessibleName() throw (css::uno::RuntimeException
, std::exception
) override
;
69 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet() throw (css::uno::RuntimeException
, std::exception
) override
;
70 virtual css::uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
getAccessibleStateSet() throw (css::uno::RuntimeException
, std::exception
) override
;
71 virtual css::lang::Locale SAL_CALL
getLocale() throw (css::accessibility::IllegalAccessibleComponentStateException
, css::uno::RuntimeException
, std::exception
) override
;
73 // XAccessibleEventBroadcaster
74 virtual void SAL_CALL
addAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& xListener
) throw (css::uno::RuntimeException
, std::exception
) override
;
75 virtual void SAL_CALL
removeAccessibleEventListener( const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& xListener
) throw (css::uno::RuntimeException
, std::exception
) override
;
77 // XAccessibleComponent
78 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) throw (css::uno::RuntimeException
, std::exception
) override
;
79 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) throw (css::uno::RuntimeException
, std::exception
) override
;
80 virtual css::awt::Rectangle SAL_CALL
getBounds( ) throw (css::uno::RuntimeException
, std::exception
) override
;
81 virtual css::awt::Point SAL_CALL
getLocation( ) throw (css::uno::RuntimeException
, std::exception
) override
;
82 virtual css::awt::Point SAL_CALL
getLocationOnScreen( ) throw (css::uno::RuntimeException
, std::exception
) override
;
83 virtual css::awt::Size SAL_CALL
getSize( ) throw (css::uno::RuntimeException
, std::exception
) override
;
84 virtual void SAL_CALL
grabFocus( ) throw (css::uno::RuntimeException
, std::exception
) override
;
85 virtual sal_Int32 SAL_CALL
getForeground( ) throw (css::uno::RuntimeException
, std::exception
) override
;
86 virtual sal_Int32 SAL_CALL
getBackground( ) throw (css::uno::RuntimeException
, std::exception
) override
;
89 virtual OUString SAL_CALL
getImplementationName() throw (css::uno::RuntimeException
, std::exception
) override
;
90 virtual sal_Bool SAL_CALL
supportsService (const OUString
& sServiceName
) throw (css::uno::RuntimeException
, std::exception
) override
;
91 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw (css::uno::RuntimeException
, std::exception
) override
;
93 /** Set the current index in the accessibility parent
95 @attention This method does not lock the SolarMutex,
96 leaving that to the calling code. This is because only
97 there potential deadlock situations can be resolved. Thus,
98 make sure SolarMutex is locked when calling this.
100 void SetIndexInParent( sal_Int32 nIndex
);
102 /** Set the edit engine offset
104 @attention This method does not lock the SolarMutex,
105 leaving that to the calling code. This is because only
106 there potential deadlock situations can be resolved. Thus,
107 make sure SolarMutex is locked when calling this.
109 void SetEEOffset( const Point
& rOffset
);
111 /** Set the EditEngine offset
113 @attention This method does not lock the SolarMutex,
114 leaving that to the calling code. This is because only
115 there potential deadlock situations can be resolved. Thus,
116 make sure SolarMutex is locked when calling this.
118 void SetEditSource( SvxEditSource
* pEditSource
);
120 /** Dispose this object
122 Notifies and deregisters the listeners, drops all references.
126 /** Set the current paragraph number
128 @attention This method does not lock the SolarMutex,
129 leaving that to the calling code. This is because only
130 there potential deadlock situations can be resolved. Thus,
131 make sure SolarMutex is locked when calling this.
133 void SetParagraphIndex( sal_Int32 nIndex
);
135 /** Query the current paragraph number (0 - nParas-1)
137 @attention This method does not lock the SolarMutex,
138 leaving that to the calling code. This is because only
139 there potential deadlock situations can be resolved. Thus,
140 make sure SolarMutex is locked when calling this.
142 sal_Int32
GetParagraphIndex() const { return mnParagraphIndex
; }
144 /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
145 void FireEvent(const sal_Int16 nEventId
, const css::uno::Any
& rNewValue
, const css::uno::Any
& rOldValue
= css::uno::Any() ) const;
148 AccessibleImageBullet( const AccessibleImageBullet
& ) = delete;
149 AccessibleImageBullet
& operator= ( const AccessibleImageBullet
& ) = delete;
151 // maintain state set and send STATE_CHANGE events
152 void SetState( const sal_Int16 nStateId
);
153 void UnSetState( const sal_Int16 nStateId
);
155 SvxEditSource
& GetEditSource() const;
157 int getNotifierClientId() const { return mnNotifierClientId
; }
159 /** Query the SvxTextForwarder for EditEngine access.
161 @attention This method does not lock the SolarMutex,
162 leaving that to the calling code. This is because only
163 there potential deadlock situations can be resolved. Thus,
164 make sure SolarMutex is locked when calling this.
166 SvxTextForwarder
& GetTextForwarder() const;
168 /** Query the SvxViewForwarder for EditEngine access.
170 @attention This method does not lock the SolarMutex,
171 leaving that to the calling code. This is because only
172 there potential deadlock situations can be resolved. Thus,
173 make sure SolarMutex is locked when calling this.
175 SvxViewForwarder
& GetViewForwarder() const;
177 // the paragraph index in the edit engine (guarded by solar mutex)
178 sal_Int32 mnParagraphIndex
;
180 // our current index in the parent (guarded by solar mutex)
181 sal_Int32 mnIndexInParent
;
183 // the current edit source (guarded by solar mutex)
184 SvxEditSource
* mpEditSource
;
186 // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
189 // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
190 css::uno::Reference
< css::accessibility::XAccessibleStateSet
> mxStateSet
;
192 /// The shape we're the accessible for (unguarded)
193 css::uno::Reference
< css::accessibility::XAccessible
> mxParent
;
195 /// Our listeners (guarded by maMutex)
196 int mnNotifierClientId
;
199 } // end of namespace accessibility
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */