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 :
20 : #ifndef INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX
21 : #define INCLUDED_EDITENG_ACCESSIBLEEDITABLETEXTPARA_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <tools/gen.hxx>
25 : #include <cppuhelper/weakref.hxx>
26 : #include <cppuhelper/compbase9.hxx>
27 : #include <cppuhelper/typeprovider.hxx>
28 : #include <cppuhelper/interfacecontainer.hxx>
29 :
30 : #include <com/sun/star/uno/Reference.hxx>
31 : #include <com/sun/star/lang/XServiceInfo.hpp>
32 : #include <com/sun/star/accessibility/XAccessible.hpp>
33 : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
34 : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
35 : #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
36 : #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
37 : #include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
38 : #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
39 :
40 : #include <comphelper/accessibletexthelper.hxx>
41 : #include <comphelper/broadcasthelper.hxx>
42 : #include <editeng/AccessibleParaManager.hxx>
43 : #include <editeng/AccessibleImageBullet.hxx>
44 : #include <editeng/unoedprx.hxx>
45 : #include <editeng/editengdllapi.h>
46 :
47 : namespace accessibility
48 : {
49 : typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible,
50 : ::com::sun::star::accessibility::XAccessibleContext,
51 : ::com::sun::star::accessibility::XAccessibleComponent,
52 : ::com::sun::star::accessibility::XAccessibleEditableText,
53 : ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
54 : ::com::sun::star::accessibility::XAccessibleTextAttributes,
55 : ::com::sun::star::accessibility::XAccessibleHypertext,
56 : ::com::sun::star::accessibility::XAccessibleMultiLineText,
57 : ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase;
58 :
59 : /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA
60 : */
61 : class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText
62 : {
63 :
64 : protected:
65 : // override OCommonAccessibleText methods
66 : virtual OUString implGetText() SAL_OVERRIDE;
67 : virtual ::com::sun::star::lang::Locale implGetLocale() SAL_OVERRIDE;
68 : virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) SAL_OVERRIDE;
69 : virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ) SAL_OVERRIDE;
70 : virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ) SAL_OVERRIDE;
71 :
72 : public:
73 : /// Create accessible object for given parent
74 : // #i27138#
75 : // - add parameter <_pParaManager> (default value NULL)
76 : // This has to be the instance of <AccessibleParaManager>, which
77 : // created and manages this accessible paragraph.
78 : AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent,
79 : const AccessibleParaManager* _pParaManager = NULL );
80 :
81 : virtual ~AccessibleEditableTextPara ();
82 :
83 : // XInterface
84 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 :
86 : // XAccessible
87 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 :
89 : // XAccessibleContext
90 : virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : /// Maximal length of text returned by getAccessibleDescription()
96 : enum { MaxDescriptionLen = 40 };
97 : virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 : virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 :
103 : // XAccessibleEventBroadcaster
104 : virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 :
107 : // XAccessibleComponent
108 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 : virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 :
118 : // XAccessibleText (this comes implicitly inherited by XAccessibleEditableText AND by XAccessibleMultiLineText)
119 : virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 : virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 : virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 : virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 : virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 : /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
133 : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 : /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
135 : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 : /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
137 : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 : virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 :
140 : // XAccessibleEditableText
141 : virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 : virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 : virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 : virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 : virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 : virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
147 : virtual sal_Bool SAL_CALL setText( const OUString& sText ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
148 :
149 : // XAccessibleTextAttributes
150 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (css::beans::UnknownPropertyException, css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
152 :
153 : // XAccessibleHypertext
154 : virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 : virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 :
158 : // XAccessibleMultiLineText
159 : virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 : virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 :
164 : // XServiceInfo
165 : virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 : virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 : virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 :
169 : // XServiceName
170 : static OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException);
171 :
172 : /** Set the current index in the accessibility parent
173 :
174 : @attention This method does not lock the SolarMutex,
175 : leaving that to the calling code. This is because only
176 : there potential deadlock situations can be resolved. Thus,
177 : make sure SolarMutex is locked when calling this.
178 : */
179 : void SetIndexInParent( sal_Int32 nIndex );
180 :
181 : /** Get the current index in the accessibility parent
182 :
183 : @attention This method does not lock the SolarMutex,
184 : leaving that to the calling code. This is because only
185 : there potential deadlock situations can be resolved. Thus,
186 : make sure SolarMutex is locked when calling this.
187 : */
188 0 : sal_Int32 GetIndexInParent() const { return mnIndexInParent; }
189 :
190 : /** Set the current paragraph number
191 :
192 : @attention This method does not lock the SolarMutex,
193 : leaving that to the calling code. This is because only
194 : there potential deadlock situations can be resolved. Thus,
195 : make sure SolarMutex is locked when calling this.
196 : */
197 : void SetParagraphIndex( sal_Int32 nIndex );
198 :
199 : /** Query the current paragraph number (0 - nParas-1)
200 :
201 : @attention This method does not lock the SolarMutex,
202 : leaving that to the calling code. This is because only
203 : there potential deadlock situations can be resolved. Thus,
204 : make sure SolarMutex is locked when calling this.
205 : */
206 518 : sal_Int32 GetParagraphIndex() const { return mnParagraphIndex; }
207 :
208 : /** Set the edit engine offset
209 :
210 : @attention This method does not lock the SolarMutex,
211 : leaving that to the calling code. This is because only
212 : there potential deadlock situations can be resolved. Thus,
213 : make sure SolarMutex is locked when calling this.
214 : */
215 : void SetEEOffset( const Point& rOffset );
216 :
217 : /** Set the EditEngine offset
218 :
219 : @attention This method does not lock the SolarMutex,
220 : leaving that to the calling code. This is because only
221 : there potential deadlock situations can be resolved. Thus,
222 : make sure SolarMutex is locked when calling this.
223 : */
224 : void SetEditSource( SvxEditSourceAdapter* pEditSource );
225 :
226 : /** Dispose this object
227 :
228 : Notifies and deregisters the listeners, drops all references.
229 : */
230 : void Dispose();
231 :
232 : /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
233 : void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
234 :
235 : /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
236 : void SetState( const sal_Int16 nStateId );
237 : /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
238 : void UnSetState( const sal_Int16 nStateId );
239 :
240 : static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder );
241 :
242 : SvxEditSourceAdapter& GetEditSource() const;
243 :
244 : /** Query the SvxTextForwarder for EditEngine access.
245 :
246 : @attention This method does not lock the SolarMutex,
247 : leaving that to the calling code. This is because only
248 : there potential deadlock situations can be resolved. Thus,
249 : make sure SolarMutex is locked when calling this.
250 : */
251 : SvxAccessibleTextAdapter& GetTextForwarder() const;
252 :
253 : /** Query the SvxViewForwarder for EditEngine access.
254 :
255 : @attention This method does not lock the SolarMutex,
256 : leaving that to the calling code. This is because only
257 : there potential deadlock situations can be resolved. Thus,
258 : make sure SolarMutex is locked when calling this.
259 : */
260 : SvxViewForwarder& GetViewForwarder() const;
261 :
262 : /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder
263 :
264 : @attention This method does not lock the SolarMutex,
265 : leaving that to the calling code. This is because only
266 : there potential deadlock situations can be resolved. Thus,
267 : make sure SolarMutex is locked when calling this.
268 : */
269 : bool HaveEditView() const;
270 :
271 : /** Query the SvxEditViewForwarder for EditEngine access.
272 :
273 : @attention This method does not lock the SolarMutex,
274 : leaving that to the calling code. This is because only
275 : there potential deadlock situations can be resolved. Thus,
276 : make sure SolarMutex is locked when calling this.
277 : */
278 : SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( bool bCreate = false ) const;
279 :
280 : /** Send a TEXT_CHANGED event for this paragraph
281 :
282 : This method internally caters for calculating text
283 : differences, and sends the appropriate Anys in the
284 : Accessibility::TEXT_CHANGED event
285 : */
286 : void TextChanged();
287 :
288 : private:
289 : AccessibleEditableTextPara( const AccessibleEditableTextPara& ) SAL_DELETED_FUNCTION;
290 : AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& ) SAL_DELETED_FUNCTION;
291 :
292 : /** Calculate character range of similar attributes
293 :
294 : @param nStartIndex
295 : Therein, the start of the character range with the same attributes is returned
296 :
297 : @param nEndIndex
298 : Therein, the end (exclusively) of the character range with the same attributes is returned
299 :
300 : @param nIndex
301 : The character index at where to look for similar character attributes
302 :
303 : @return false, if the method was not able to determine the range
304 : */
305 : bool GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nIndex );
306 :
307 : // syntactic sugar for FireEvent
308 : void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
309 : void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
310 :
311 147 : int getNotifierClientId() const { return mnNotifierClientId; }
312 :
313 : /// Do we have children? This is the case for image bullets
314 : bool HaveChildren();
315 :
316 106 : const Point& GetEEOffset() const { return maEEOffset; }
317 :
318 : // Get text from forwarder
319 : OUString GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
320 : sal_Int32 GetTextLen() const;
321 :
322 : /** Get the current selection of this paragraph
323 :
324 : @return sal_False, if nothing in this paragraph is selected
325 : */
326 : bool GetSelection(sal_Int32& nStartPos, sal_Int32& nEndPos );
327 :
328 : /** create selection from Accessible selection.
329 :
330 : */
331 : ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex );
332 : ESelection MakeSelection( sal_Int32 nEEIndex );
333 : ESelection MakeCursor( sal_Int32 nEEIndex );
334 :
335 : // check whether index value is within permitted range
336 :
337 : /// Check whether 0<=nIndex<=n-1
338 : void CheckIndex( sal_Int32 nIndex );
339 : /// Check whether 0<=nIndex<=n
340 : void CheckPosition( sal_Int32 nIndex );
341 : /// Check whether 0<=nStart<=n and 0<=nEnd<=n
342 : void CheckRange( sal_Int32 nStart, sal_Int32 nEnd );
343 :
344 : void _correctValues( const sal_Int32 nIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues );
345 : sal_Int32 SkipField(sal_Int32 nIndex, bool bForward);
346 : // get overlapped field, extend return string. Only extend forward for now
347 : bool ExtendByField( ::com::sun::star::accessibility::TextSegment& Segment );
348 : OUString GetFieldTypeNameAtIndex(sal_Int32 nIndex);
349 : // the paragraph index in the edit engine (guarded by solar mutex)
350 : sal_Int32 mnParagraphIndex;
351 :
352 : // our current index in the parent (guarded by solar mutex)
353 : sal_Int32 mnIndexInParent;
354 :
355 : // the current edit source (guarded by solar mutex)
356 : SvxEditSourceAdapter* mpEditSource;
357 :
358 : // the possible child (for image bullets, guarded by solar mutex)
359 : typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet;
360 : WeakBullet maImageBullet;
361 :
362 : // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex)
363 : OUString maLastTextString;
364 :
365 : // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
366 : Point maEEOffset;
367 :
368 : // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
369 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
370 :
371 : /// The shape we're the accessible for (unguarded)
372 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
373 :
374 : /// Our listeners (guarded by maMutex)
375 : int mnNotifierClientId;
376 : public:
377 : void SetParagraphBackColorAccessible(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > & ref)
378 : { m_xAccInfo = ref ;}
379 : private:
380 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAccInfo;
381 :
382 : // Text paragraphs should provide FLOWS_TO and FLOWS_FROM relations (#i27138#)
383 : // the paragraph manager, which created this instance - is NULL, if
384 : // instance isn't created by AccessibleParaManager.
385 : // Needed for method <getAccessibleRelationSet()> to retrieve predecessor
386 : // paragraph and the successor paragraph.
387 : const AccessibleParaManager* mpParaManager;
388 : };
389 :
390 : } // end of namespace accessibility
391 :
392 : #endif
393 :
394 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|