crashtesting: assert on reimport of docx export of ooo102874-2.doc
[LibreOffice.git] / editeng / source / accessibility / AccessibleImageBullet.hxx
blob97fd98cae7961abe6c99303532b6ab47760c1a12
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <rtl/ref.hxx>
23 #include <tools/gen.hxx>
24 #include <cppuhelper/implbase.hxx>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/accessibility/XAccessible.hpp>
29 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
30 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
31 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
33 class SvxEditSource;
34 class SvxTextForwarder;
35 class SvxViewForwarder;
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 final : public AccessibleImageBulletInterfaceBase
50 public:
51 /// Create accessible object for given parent
52 AccessibleImageBullet ( css::uno::Reference< css::accessibility::XAccessible > xParent );
54 virtual ~AccessibleImageBullet () override;
56 // XAccessible
57 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
59 // XAccessibleContext
60 virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
61 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
62 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
63 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
64 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
65 virtual OUString SAL_CALL getAccessibleDescription() override;
66 virtual OUString SAL_CALL getAccessibleName() override;
67 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
68 virtual sal_Int64 SAL_CALL getAccessibleStateSet() override;
69 virtual css::lang::Locale SAL_CALL getLocale() override;
71 // XAccessibleEventBroadcaster
72 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
73 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
75 // XAccessibleComponent
76 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
77 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
78 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
79 virtual css::awt::Point SAL_CALL getLocation( ) override;
80 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
81 virtual css::awt::Size SAL_CALL getSize( ) override;
82 virtual void SAL_CALL grabFocus( ) override;
83 virtual sal_Int32 SAL_CALL getForeground( ) override;
84 virtual sal_Int32 SAL_CALL getBackground( ) override;
86 // XServiceInfo
87 virtual OUString SAL_CALL getImplementationName() override;
88 virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) override;
89 virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override;
91 /** Set the current index in the accessibility parent
93 @attention This method does not lock the SolarMutex,
94 leaving that to the calling code. This is because only
95 there potential deadlock situations can be resolved. Thus,
96 make sure SolarMutex is locked when calling this.
98 void SetIndexInParent( sal_Int32 nIndex );
100 /** Set the edit engine offset
102 @attention This method does not lock the SolarMutex,
103 leaving that to the calling code. This is because only
104 there potential deadlock situations can be resolved. Thus,
105 make sure SolarMutex is locked when calling this.
107 void SetEEOffset( const Point& rOffset );
109 /** Set the EditEngine offset
111 @attention This method does not lock the SolarMutex,
112 leaving that to the calling code. This is because only
113 there potential deadlock situations can be resolved. Thus,
114 make sure SolarMutex is locked when calling this.
116 void SetEditSource( SvxEditSource* pEditSource );
118 /** Dispose this object
120 Notifies and deregisters the listeners, drops all references.
122 void Dispose();
124 /** Set the current paragraph number
126 @attention This method does not lock the SolarMutex,
127 leaving that to the calling code. This is because only
128 there potential deadlock situations can be resolved. Thus,
129 make sure SolarMutex is locked when calling this.
131 void SetParagraphIndex( sal_Int32 nIndex );
133 /** Query the current paragraph number (0 - nParas-1)
135 @attention This method does not lock the SolarMutex,
136 leaving that to the calling code. This is because only
137 there potential deadlock situations can be resolved. Thus,
138 make sure SolarMutex is locked when calling this.
140 sal_Int32 GetParagraphIndex() const { return mnParagraphIndex; }
142 /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
143 void FireEvent(const sal_Int16 nEventId, const css::uno::Any& rNewValue, const css::uno::Any& rOldValue = css::uno::Any() ) const;
145 private:
146 AccessibleImageBullet( const AccessibleImageBullet& ) = delete;
147 AccessibleImageBullet& operator= ( const AccessibleImageBullet& ) = delete;
149 // maintain state set and send STATE_CHANGE events
150 void SetState( const sal_Int64 nStateId );
151 void UnSetState( const sal_Int64 nStateId );
153 SvxEditSource& GetEditSource() const;
155 int getNotifierClientId() const { return mnNotifierClientId; }
157 /** Query the SvxTextForwarder for EditEngine access.
159 @attention This method does not lock the SolarMutex,
160 leaving that to the calling code. This is because only
161 there potential deadlock situations can be resolved. Thus,
162 make sure SolarMutex is locked when calling this.
164 SvxTextForwarder& GetTextForwarder() const;
166 /** Query the SvxViewForwarder for EditEngine access.
168 @attention This method does not lock the SolarMutex,
169 leaving that to the calling code. This is because only
170 there potential deadlock situations can be resolved. Thus,
171 make sure SolarMutex is locked when calling this.
173 SvxViewForwarder& GetViewForwarder() const;
175 css::awt::Rectangle implGetBounds();
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)
187 Point maEEOffset;
189 // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
190 sal_Int64 mnStateSet = 0;
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
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */