1a462bbb7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3a462bbb7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4a462bbb7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5a462bbb7SAndrew Rist  * distributed with this work for additional information
6a462bbb7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7a462bbb7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8a462bbb7SAndrew Rist  * "License"); you may not use this file except in compliance
9a462bbb7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10a462bbb7SAndrew Rist  *
11a462bbb7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12a462bbb7SAndrew Rist  *
13a462bbb7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14a462bbb7SAndrew Rist  * software distributed under the License is distributed on an
15a462bbb7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16a462bbb7SAndrew Rist  * KIND, either express or implied.  See the License for the
17a462bbb7SAndrew Rist  * specific language governing permissions and limitations
18a462bbb7SAndrew Rist  * under the License.
19a462bbb7SAndrew Rist  *
20a462bbb7SAndrew Rist  *************************************************************/
21a462bbb7SAndrew Rist 
22a462bbb7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #if !defined INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX
25cdf0e10cSrcweir #define INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <toolkit/awt/vclxaccessiblecomponent.hxx>
28cdf0e10cSrcweir #include <svl/lstner.hxx>
29cdf0e10cSrcweir #include <svtools/textdata.hxx>
30cdf0e10cSrcweir #include <svtools/texteng.hxx>
31cdf0e10cSrcweir #include <svtools/textview.hxx>
32cdf0e10cSrcweir #include <svtools/txtattr.hxx>
33cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/EventObject.hpp>
35cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
36cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp>
37cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
38cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
39cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
40cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
41cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleTextType.hpp>
42cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
43cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp>
44cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
45cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
46cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
47cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
48cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
49cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
50cdf0e10cSrcweir #include <cppuhelper/compbase7.hxx>
51cdf0e10cSrcweir #include <comphelper/accessiblecontexthelper.hxx>
52cdf0e10cSrcweir #include <comphelper/accessibletexthelper.hxx>
53cdf0e10cSrcweir #include <rtl/ref.hxx>
54cdf0e10cSrcweir 
55*21075d77SSteve Yin #ifndef _SVTOOLS_HRC
56*21075d77SSteve Yin #include "svtools/svtools.hrc"
57*21075d77SSteve Yin #endif
58*21075d77SSteve Yin #ifndef _SVTOOLS_SVTDATA_HXX
59*21075d77SSteve Yin #include "svtools/svtdata.hxx"
60*21075d77SSteve Yin #endif
61*21075d77SSteve Yin #ifndef _SV_SVAPP_HXX
62*21075d77SSteve Yin #include <vcl/svapp.hxx>
63*21075d77SSteve Yin #endif
64*21075d77SSteve Yin #ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
65*21075d77SSteve Yin #include <unotools/accessiblerelationsethelper.hxx>
66*21075d77SSteve Yin #endif
67*21075d77SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
68*21075d77SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
69*21075d77SSteve Yin #endif
70cdf0e10cSrcweir #include <memory>
71cdf0e10cSrcweir #include <queue>
72cdf0e10cSrcweir #include <hash_map>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class TextEngine;
75cdf0e10cSrcweir class TextView;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir namespace css = ::com::sun::star;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir namespace accessibility
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 
82cdf0e10cSrcweir class Paragraph;
83cdf0e10cSrcweir class Document;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir class SfxListenerGuard
86cdf0e10cSrcweir {
87cdf0e10cSrcweir public:
SfxListenerGuard(::SfxListener & rListener)88cdf0e10cSrcweir     inline SfxListenerGuard(::SfxListener & rListener):
89cdf0e10cSrcweir         m_rListener(rListener), m_pNotifier(0) {}
90cdf0e10cSrcweir 
~SfxListenerGuard()91cdf0e10cSrcweir     inline ~SfxListenerGuard() { endListening(); }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // Not thread safe:
94cdf0e10cSrcweir     void startListening(::SfxBroadcaster & rNotifier);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     // Not thread safe:
97cdf0e10cSrcweir     void endListening();
98cdf0e10cSrcweir 
99cdf0e10cSrcweir private:
100cdf0e10cSrcweir     ::SfxListener & m_rListener;
101cdf0e10cSrcweir     ::SfxBroadcaster * m_pNotifier;
102cdf0e10cSrcweir };
103cdf0e10cSrcweir 
104cdf0e10cSrcweir class WindowListenerGuard
105cdf0e10cSrcweir {
106cdf0e10cSrcweir public:
WindowListenerGuard(::Link const & rListener)107cdf0e10cSrcweir     inline WindowListenerGuard(::Link const & rListener):
108cdf0e10cSrcweir         m_aListener(rListener), m_pNotifier(0) {}
109cdf0e10cSrcweir 
~WindowListenerGuard()110cdf0e10cSrcweir     inline ~WindowListenerGuard() { endListening(); }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     // Not thread safe:
113cdf0e10cSrcweir     void startListening(::Window & rNotifier);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     // Not thread safe:
116cdf0e10cSrcweir     void endListening();
117cdf0e10cSrcweir 
118cdf0e10cSrcweir private:
119cdf0e10cSrcweir     ::Link m_aListener;
120cdf0e10cSrcweir     ::Window * m_pNotifier;
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir class ParagraphInfo
124cdf0e10cSrcweir {
125cdf0e10cSrcweir public:
ParagraphInfo(::sal_Int32 nHeight)126cdf0e10cSrcweir     inline ParagraphInfo(::sal_Int32 nHeight): m_nHeight(nHeight) {}
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     inline
129cdf0e10cSrcweir     ::css::uno::WeakReference< ::css::accessibility::XAccessible > const &
getParagraph() const130cdf0e10cSrcweir     getParagraph() const { return m_xParagraph; }
131cdf0e10cSrcweir 
getHeight() const132cdf0e10cSrcweir     inline ::sal_Int32 getHeight() const { return m_nHeight; }
133cdf0e10cSrcweir 
setParagraph(::css::uno::Reference<::css::accessibility::XAccessible> const & rParagraph)134cdf0e10cSrcweir     inline void setParagraph(
135cdf0e10cSrcweir         ::css::uno::Reference< ::css::accessibility::XAccessible > const &
136cdf0e10cSrcweir         rParagraph) { m_xParagraph = rParagraph; }
137cdf0e10cSrcweir 
changeHeight(::sal_Int32 nHeight)138cdf0e10cSrcweir     inline void changeHeight(::sal_Int32 nHeight) { m_nHeight = nHeight; }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir private:
141cdf0e10cSrcweir     ::css::uno::WeakReference< ::css::accessibility::XAccessible >
142cdf0e10cSrcweir     m_xParagraph;
143cdf0e10cSrcweir     ::sal_Int32 m_nHeight;
144cdf0e10cSrcweir };
145cdf0e10cSrcweir 
146cdf0e10cSrcweir typedef ::std::vector< ParagraphInfo > Paragraphs;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir typedef ::cppu::WeakAggComponentImplHelper7<
149cdf0e10cSrcweir     ::css::accessibility::XAccessible,
150cdf0e10cSrcweir     ::css::accessibility::XAccessibleContext,
151cdf0e10cSrcweir     ::css::accessibility::XAccessibleComponent,
152cdf0e10cSrcweir     ::css::accessibility::XAccessibleEditableText,
153cdf0e10cSrcweir     ::css::accessibility::XAccessibleMultiLineText,
154cdf0e10cSrcweir     ::css::accessibility::XAccessibleTextAttributes,
155cdf0e10cSrcweir     ::css::accessibility::XAccessibleEventBroadcaster > ParagraphBase;
156cdf0e10cSrcweir 
157cdf0e10cSrcweir // The Paragraph's number is the absolute position within the text engine (from
158cdf0e10cSrcweir // 0 to N - 1), whereas the Paragraph's index is the position within the text
159cdf0e10cSrcweir // view/accessible parent (from 0 to M - 1).  Paragraphs outside the currently
160cdf0e10cSrcweir // visible range have an index of -1.
161cdf0e10cSrcweir class ParagraphImpl:
162cdf0e10cSrcweir     public ParagraphBase, private ::comphelper::OCommonAccessibleText
163cdf0e10cSrcweir {
164cdf0e10cSrcweir public:
165cdf0e10cSrcweir     ParagraphImpl(::rtl::Reference< Document > const & rDocument,
166cdf0e10cSrcweir                   Paragraphs::size_type nNumber, ::osl::Mutex & rMutex);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     // Not thread-safe.
getNumber() const169cdf0e10cSrcweir     inline Paragraphs::size_type getNumber() const { return m_nNumber; }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     // Not thread-safe.
172cdf0e10cSrcweir     void numberChanged(bool bIncremented);
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     // Not thread-safe.
175cdf0e10cSrcweir     void textChanged();
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     // Thread-safe.
178cdf0e10cSrcweir     void notifyEvent(::sal_Int16 nEventId, ::css::uno::Any const & rOldValue,
179cdf0e10cSrcweir                      ::css::uno::Any const & rNewValue);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir protected:
182cdf0e10cSrcweir     // OCommonAccessibleText
183cdf0e10cSrcweir     virtual void implGetParagraphBoundary( ::css::i18n::Boundary& rBoundary,
184cdf0e10cSrcweir                                            ::sal_Int32 nIndex );
185cdf0e10cSrcweir     virtual void implGetLineBoundary( ::css::i18n::Boundary& rBoundary,
186cdf0e10cSrcweir                                       ::sal_Int32 nIndex );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir private:
189cdf0e10cSrcweir     virtual ::css::uno::Reference< ::css::accessibility::XAccessibleContext >
190cdf0e10cSrcweir     SAL_CALL getAccessibleContext() throw (::css::uno::RuntimeException);
191cdf0e10cSrcweir 
192cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getAccessibleChildCount()
193cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
194cdf0e10cSrcweir 
195cdf0e10cSrcweir     virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
196cdf0e10cSrcweir     getAccessibleChild(::sal_Int32 i)
197cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
198cdf0e10cSrcweir                ::css::uno::RuntimeException);
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
201cdf0e10cSrcweir     getAccessibleParent() throw (::css::uno::RuntimeException);
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent()
204cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     virtual ::sal_Int16 SAL_CALL getAccessibleRole()
207cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
210cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName()
213cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     virtual
216cdf0e10cSrcweir     ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet >
217cdf0e10cSrcweir     SAL_CALL getAccessibleRelationSet() throw (::css::uno::RuntimeException);
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     virtual
220cdf0e10cSrcweir     ::css::uno::Reference< ::css::accessibility::XAccessibleStateSet > SAL_CALL
221cdf0e10cSrcweir     getAccessibleStateSet() throw (::css::uno::RuntimeException);
222cdf0e10cSrcweir 
223cdf0e10cSrcweir     virtual ::css::lang::Locale SAL_CALL getLocale()
224cdf0e10cSrcweir         throw (::css::accessibility::IllegalAccessibleComponentStateException,
225cdf0e10cSrcweir                ::css::uno::RuntimeException);
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL containsPoint(::css::awt::Point const & rPoint)
228cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
231cdf0e10cSrcweir     getAccessibleAtPoint(::css::awt::Point const & rPoint)
232cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     virtual ::css::awt::Rectangle SAL_CALL getBounds()
235cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     virtual ::css::awt::Point SAL_CALL getLocation()
238cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     virtual ::css::awt::Point SAL_CALL getLocationOnScreen()
241cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     virtual ::css::awt::Size SAL_CALL getSize()
244cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     virtual void SAL_CALL grabFocus() throw (::css::uno::RuntimeException);
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     virtual ::css::uno::Any SAL_CALL getAccessibleKeyBinding()
249cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     virtual ::css::util::Color SAL_CALL getForeground()
252cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
253cdf0e10cSrcweir 
254cdf0e10cSrcweir     virtual ::css::util::Color SAL_CALL getBackground()
255cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getCaretPosition()
258cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL setCaretPosition(::sal_Int32 nIndex)
261cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
262cdf0e10cSrcweir                ::css::uno::RuntimeException);
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     virtual ::sal_Unicode SAL_CALL getCharacter(::sal_Int32 nIndex)
265cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
266cdf0e10cSrcweir                ::css::uno::RuntimeException);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
269cdf0e10cSrcweir     getCharacterAttributes(::sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
270cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
271cdf0e10cSrcweir                ::css::uno::RuntimeException);
272cdf0e10cSrcweir 
273cdf0e10cSrcweir     virtual ::css::awt::Rectangle SAL_CALL
274cdf0e10cSrcweir     getCharacterBounds(::sal_Int32 nIndex)
275cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
276cdf0e10cSrcweir                ::css::uno::RuntimeException);
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getCharacterCount()
279cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL
282cdf0e10cSrcweir     getIndexAtPoint(::css::awt::Point const & rPoint)
283cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
284cdf0e10cSrcweir 
285cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getSelectedText()
286cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
287cdf0e10cSrcweir 
288cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getSelectionStart()
289cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getSelectionEnd()
292cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL setSelection(::sal_Int32 nStartIndex,
295cdf0e10cSrcweir                                              ::sal_Int32 nEndIndex)
296cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
297cdf0e10cSrcweir                ::css::uno::RuntimeException);
298cdf0e10cSrcweir 
299cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getText()
300cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
301cdf0e10cSrcweir 
302cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getTextRange(::sal_Int32 nStartIndex,
303cdf0e10cSrcweir                                                   ::sal_Int32 nEndIndex)
304cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
305cdf0e10cSrcweir                ::css::uno::RuntimeException);
306cdf0e10cSrcweir 
307cdf0e10cSrcweir     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);
308cdf0e10cSrcweir     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);
309cdf0e10cSrcweir     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);
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL copyText(::sal_Int32 nStartIndex,
312cdf0e10cSrcweir                                          ::sal_Int32 nEndIndex)
313cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
314cdf0e10cSrcweir                ::css::uno::RuntimeException);
315cdf0e10cSrcweir 
316cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL cutText(::sal_Int32 nStartIndex,
317cdf0e10cSrcweir                                         ::sal_Int32 nEndIndex)
318cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
319cdf0e10cSrcweir                ::css::uno::RuntimeException);
320cdf0e10cSrcweir 
321cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL pasteText(::sal_Int32 nIndex)
322cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
323cdf0e10cSrcweir                ::css::uno::RuntimeException);
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL deleteText(::sal_Int32 nStartIndex,
326cdf0e10cSrcweir                                            ::sal_Int32 nEndIndex)
327cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
328cdf0e10cSrcweir                ::css::uno::RuntimeException);
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL insertText(::rtl::OUString const & rText,
331cdf0e10cSrcweir                                            ::sal_Int32 nIndex)
332cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
333cdf0e10cSrcweir                ::css::uno::RuntimeException);
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL replaceText(
336cdf0e10cSrcweir         ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex,
337cdf0e10cSrcweir         ::rtl::OUString const & rReplacement)
338cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
339cdf0e10cSrcweir                ::css::uno::RuntimeException);
340cdf0e10cSrcweir 
341cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL setAttributes(
342cdf0e10cSrcweir         ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex,
343cdf0e10cSrcweir         ::css::uno::Sequence< ::css::beans::PropertyValue > const &
344cdf0e10cSrcweir         rAttributeSet)
345cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
346cdf0e10cSrcweir                ::css::uno::RuntimeException);
347cdf0e10cSrcweir 
348cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL setText(::rtl::OUString const & rText)
349cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
352cdf0e10cSrcweir     getDefaultAttributes(const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
353cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
354cdf0e10cSrcweir 
355cdf0e10cSrcweir     virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
356cdf0e10cSrcweir     getRunAttributes(::sal_Int32 Index, const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
357cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
358cdf0e10cSrcweir                ::css::uno::RuntimeException);
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex )
361cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
362cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
363cdf0e10cSrcweir 
364cdf0e10cSrcweir     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo )
365cdf0e10cSrcweir         throw (::com::sun::star::lang::IndexOutOfBoundsException,
366cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret(  )
369cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
370cdf0e10cSrcweir 
371cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret(  )
372cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
373cdf0e10cSrcweir 
374cdf0e10cSrcweir     using cppu::WeakAggComponentImplHelperBase::addEventListener;
375cdf0e10cSrcweir     virtual void SAL_CALL addEventListener(
376cdf0e10cSrcweir         ::css::uno::Reference<
377cdf0e10cSrcweir         ::css::accessibility::XAccessibleEventListener > const & rListener)
378cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
379cdf0e10cSrcweir 
380cdf0e10cSrcweir     using cppu::WeakAggComponentImplHelperBase::removeEventListener;
381cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener(
382cdf0e10cSrcweir         ::css::uno::Reference<
383cdf0e10cSrcweir         ::css::accessibility::XAccessibleEventListener > const & rListener)
384cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     virtual void SAL_CALL disposing();
387cdf0e10cSrcweir 
388cdf0e10cSrcweir     virtual ::rtl::OUString implGetText();
389cdf0e10cSrcweir 
390cdf0e10cSrcweir     virtual ::css::lang::Locale implGetLocale();
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     virtual void implGetSelection(::sal_Int32 & rStartIndex,
393cdf0e10cSrcweir                                   ::sal_Int32 & rEndIndex);
394cdf0e10cSrcweir 
395cdf0e10cSrcweir     // Throws ::css::lang::DisposedException:
396cdf0e10cSrcweir     void checkDisposed();
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     ::rtl::Reference< Document > m_xDocument;
399cdf0e10cSrcweir     Paragraphs::size_type m_nNumber;
400cdf0e10cSrcweir 
401cdf0e10cSrcweir //    ::cppu::OInterfaceContainerHelper m_aListeners;
402cdf0e10cSrcweir     /// client id in the AccessibleEventNotifier queue
403cdf0e10cSrcweir     sal_uInt32 m_nClientId;
404cdf0e10cSrcweir 
405cdf0e10cSrcweir     ::rtl::OUString m_aParagraphText;
406cdf0e10cSrcweir };
407cdf0e10cSrcweir 
408cdf0e10cSrcweir 
409cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString,
410cdf0e10cSrcweir                          ::css::beans::PropertyValue,
411cdf0e10cSrcweir                          ::rtl::OUStringHash,
412cdf0e10cSrcweir                          ::std::equal_to< ::rtl::OUString > > tPropValMap;
413cdf0e10cSrcweir 
414cdf0e10cSrcweir class Document: public ::VCLXAccessibleComponent, public ::SfxListener
415cdf0e10cSrcweir {
416cdf0e10cSrcweir public:
417cdf0e10cSrcweir     Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
418cdf0e10cSrcweir              ::TextView & rView, bool bCompoundControlChild);
419cdf0e10cSrcweir 
420cdf0e10cSrcweir     inline ::css::uno::Reference< ::css::accessibility::XAccessible >
getAccessible()421cdf0e10cSrcweir     getAccessible() { return m_xAccessible; }
422cdf0e10cSrcweir 
423cdf0e10cSrcweir     // Must be called only after init has been called.
424cdf0e10cSrcweir     ::css::lang::Locale retrieveLocale();
425cdf0e10cSrcweir 
426cdf0e10cSrcweir     // Must be called only after init has been called.
427cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
428cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
429cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const *" instead of a
430cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
431cdf0e10cSrcweir     ::sal_Int32 retrieveParagraphIndex(ParagraphImpl const * pParagraph);
432cdf0e10cSrcweir 
433cdf0e10cSrcweir     // Must be called only after init has been called.
434cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
435cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
436cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const *" instead of a
437cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
438cdf0e10cSrcweir     ::sal_Int64 retrieveParagraphState(ParagraphImpl const * pParagraph);
439cdf0e10cSrcweir 
440cdf0e10cSrcweir     // Must be called only after init has been called.
441cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
442cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
443cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
444cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
445cdf0e10cSrcweir     ::css::awt::Rectangle
446cdf0e10cSrcweir     retrieveParagraphBounds(ParagraphImpl const * pParagraph, bool bAbsolute);
447cdf0e10cSrcweir 
448cdf0e10cSrcweir     // Must be called only after init has been called.
449cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
450cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
451cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
452cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
453cdf0e10cSrcweir     ::rtl::OUString retrieveParagraphText(ParagraphImpl const * pParagraph);
454cdf0e10cSrcweir 
455cdf0e10cSrcweir     // Must be called only after init has been called.
456cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
457cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
458cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
459cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
460cdf0e10cSrcweir     void retrieveParagraphSelection(ParagraphImpl const * pParagraph,
461cdf0e10cSrcweir                                     ::sal_Int32 * pBegin, ::sal_Int32 * pEnd);
462cdf0e10cSrcweir 
463cdf0e10cSrcweir     // Must be called only after init has been called.
464cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
465cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
466cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const *" instead of a
467cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
468cdf0e10cSrcweir     ::sal_Int32 retrieveParagraphCaretPosition(ParagraphImpl const * pParagraph);
469cdf0e10cSrcweir 
470cdf0e10cSrcweir     // Must be called only after init has been called.
471cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
472cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
473cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
474cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
475cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
476cdf0e10cSrcweir     ::css::awt::Rectangle
477cdf0e10cSrcweir     retrieveCharacterBounds(ParagraphImpl const * pParagraph,
478cdf0e10cSrcweir                             ::sal_Int32 nIndex);
479cdf0e10cSrcweir 
480cdf0e10cSrcweir     // Must be called only after init has been called.
481cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
482cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
483cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
484cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
485cdf0e10cSrcweir     ::sal_Int32 retrieveCharacterIndex(ParagraphImpl const * pParagraph,
486cdf0e10cSrcweir                                        ::css::awt::Point const & rPoint);
487cdf0e10cSrcweir 
488cdf0e10cSrcweir     // Must be called only after init has been called.
489cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
490cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
491cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
492cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
493cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
494cdf0e10cSrcweir     ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveCharacterAttributes(
495cdf0e10cSrcweir         ParagraphImpl const * pParagraph, ::sal_Int32 nIndex,
496cdf0e10cSrcweir         const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes);
497cdf0e10cSrcweir 
498cdf0e10cSrcweir     // Must be called only after init has been called.
499cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
500cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
501cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
502cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
503cdf0e10cSrcweir     ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveDefaultAttributes(
504cdf0e10cSrcweir         ParagraphImpl const * pParagraph,
505cdf0e10cSrcweir         const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes);
506cdf0e10cSrcweir 
507cdf0e10cSrcweir     // Must be called only after init has been called.
508cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
509cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
510cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
511cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
512cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
513cdf0e10cSrcweir     ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveRunAttributes(
514cdf0e10cSrcweir         ParagraphImpl const * pParagraph, ::sal_Int32 Index,
515cdf0e10cSrcweir         const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes);
516cdf0e10cSrcweir 
517cdf0e10cSrcweir     // Must be called only after init has been called.
518cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
519cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
520cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
521cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
522cdf0e10cSrcweir     void changeParagraphText(ParagraphImpl * pParagraph,
523cdf0e10cSrcweir                              ::rtl::OUString const & rText);
524cdf0e10cSrcweir 
525cdf0e10cSrcweir     // Must be called only after init has been called.
526cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
527cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
528cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
529cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
530cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
531cdf0e10cSrcweir     void changeParagraphText(ParagraphImpl * pParagraph, ::sal_Int32 nBegin,
532cdf0e10cSrcweir                              ::sal_Int32 nEnd, bool bCut, bool bPaste,
533cdf0e10cSrcweir                              ::rtl::OUString const & rText);
534cdf0e10cSrcweir 
535cdf0e10cSrcweir     // Must be called only after init has been called.
536cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
537cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
538cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
539cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
540cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
541cdf0e10cSrcweir     void copyParagraphText(ParagraphImpl const * pParagraph,
542cdf0e10cSrcweir                            ::sal_Int32 nBegin, ::sal_Int32 nEnd);
543cdf0e10cSrcweir 
544cdf0e10cSrcweir     // Must be called only after init has been called.
545cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
546cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
547cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
548cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
549cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
550cdf0e10cSrcweir     void changeParagraphAttributes(
551cdf0e10cSrcweir         ParagraphImpl * pParagraph, ::sal_Int32 nBegin, ::sal_Int32 nEnd,
552cdf0e10cSrcweir         ::css::uno::Sequence< ::css::beans::PropertyValue > const &
553cdf0e10cSrcweir         rAttributeSet);
554cdf0e10cSrcweir 
555cdf0e10cSrcweir     // Must be called only after init has been called.
556cdf0e10cSrcweir     // To make it possible for this method to be (indirectly) called from
557cdf0e10cSrcweir     // within Paragraph's constructor (i.e., when the Paragraph's ref count is
558cdf0e10cSrcweir     // still zero), pass a "ParagraphImpl const &" instead of a
559cdf0e10cSrcweir     // "::rtl::Reference< ParagraphImpl > const &".
560cdf0e10cSrcweir     // Throws ::css::lang::IndexOutOfBoundsException.
561cdf0e10cSrcweir     void changeParagraphSelection(ParagraphImpl * pParagraph,
562cdf0e10cSrcweir                                   ::sal_Int32 nBegin, ::sal_Int32 nEnd);
563cdf0e10cSrcweir 
564cdf0e10cSrcweir     ::css::i18n::Boundary
565cdf0e10cSrcweir     retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph,
566cdf0e10cSrcweir                                    ::sal_Int32 nIndex, ::sal_Int32 *pLineNo = NULL);
567cdf0e10cSrcweir 
568cdf0e10cSrcweir     ::css::i18n::Boundary
569cdf0e10cSrcweir     retrieveParagraphBoundaryOfLine( ParagraphImpl const * pParagraph,
570cdf0e10cSrcweir                                      ::sal_Int32 nIndex );
571cdf0e10cSrcweir 
572cdf0e10cSrcweir     sal_Int32 retrieveParagraphLineWithCursor( ParagraphImpl const * pParagraph );
573cdf0e10cSrcweir 
574cdf0e10cSrcweir     ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet >
575cdf0e10cSrcweir     retrieveParagraphRelationSet( ParagraphImpl const * pParagraph );
576cdf0e10cSrcweir 
577cdf0e10cSrcweir protected:
578cdf0e10cSrcweir 	// window event listener from base class
579cdf0e10cSrcweir 	virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
580cdf0e10cSrcweir 
581cdf0e10cSrcweir private:
582cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getAccessibleChildCount()
583cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
584cdf0e10cSrcweir 
585cdf0e10cSrcweir     virtual ::css::uno::Reference< ::css::accessibility::XAccessible >
586cdf0e10cSrcweir     SAL_CALL getAccessibleChild(::sal_Int32 i)
587cdf0e10cSrcweir         throw (::css::lang::IndexOutOfBoundsException,
588cdf0e10cSrcweir                ::css::uno::RuntimeException);
589cdf0e10cSrcweir 
590cdf0e10cSrcweir     virtual ::sal_Int16 SAL_CALL getAccessibleRole()
591cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
592cdf0e10cSrcweir 
593cdf0e10cSrcweir     virtual ::css::uno::Reference< ::css::accessibility::XAccessible >
594cdf0e10cSrcweir     SAL_CALL getAccessibleAtPoint(::css::awt::Point const & rPoint)
595cdf0e10cSrcweir         throw (::css::uno::RuntimeException);
596*21075d77SSteve Yin     virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
597*21075d77SSteve Yin    virtual void	FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
598cdf0e10cSrcweir     // ??? Will be called with both the external (Solar) and internal mutex
599cdf0e10cSrcweir     // locked:
600cdf0e10cSrcweir     virtual void SAL_CALL disposing();
601cdf0e10cSrcweir 
602cdf0e10cSrcweir     // ??? Will be called with the external (Solar) mutex locked.
603cdf0e10cSrcweir     // init will already have been called.
604cdf0e10cSrcweir     virtual void Notify(::SfxBroadcaster & rBC, ::SfxHint const & rHint);
605cdf0e10cSrcweir 
606cdf0e10cSrcweir     // Assuming that this will only be called with the external (Solar) mutex
607cdf0e10cSrcweir     // locked.
608cdf0e10cSrcweir     // init will already have been called.
609cdf0e10cSrcweir     DECL_LINK(WindowEventHandler, VclSimpleEvent *);
610cdf0e10cSrcweir 
611cdf0e10cSrcweir     // Must be called with both the external (Solar) and internal mutex
612cdf0e10cSrcweir     // locked.
613cdf0e10cSrcweir     void init();
614cdf0e10cSrcweir 
615cdf0e10cSrcweir     // Must be called with both the external (Solar) and internal mutex
616cdf0e10cSrcweir     // locked, and after init has been called:
617cdf0e10cSrcweir     ::rtl::Reference< ParagraphImpl >
618cdf0e10cSrcweir     getParagraph(Paragraphs::iterator const & rIt);
619cdf0e10cSrcweir 
620cdf0e10cSrcweir     // Must be called with both the external (Solar) and internal mutex
621cdf0e10cSrcweir     // locked, and after init has been called.
622cdf0e10cSrcweir     // Throws ::css::uno::RuntimeException.
623cdf0e10cSrcweir     ::css::uno::Reference< ::css::accessibility::XAccessible >
624cdf0e10cSrcweir     getAccessibleChild(Paragraphs::iterator const & rIt);
625cdf0e10cSrcweir 
626cdf0e10cSrcweir     // Must be called with both the external (Solar) and internal mutex
627cdf0e10cSrcweir     // locked, and after init has been called:
628cdf0e10cSrcweir     void determineVisibleRange();
629cdf0e10cSrcweir 
630cdf0e10cSrcweir     // Must be called with both the external (Solar) and internal mutex
631cdf0e10cSrcweir     // locked, and after init has been called:
632cdf0e10cSrcweir     void notifyVisibleRangeChanges(
633cdf0e10cSrcweir         Paragraphs::iterator const & rOldVisibleBegin,
634cdf0e10cSrcweir         Paragraphs::iterator const & rOldVisibleEnd,
635cdf0e10cSrcweir         Paragraphs::iterator const & rInserted);
636cdf0e10cSrcweir 
637cdf0e10cSrcweir     // Must be called with both the external (Solar) and internal mutex
638cdf0e10cSrcweir     // locked, and after init has been called:
639cdf0e10cSrcweir     void changeParagraphText(::sal_uLong nNumber, ::sal_uInt16 nBegin, ::sal_uInt16 nEnd,
640cdf0e10cSrcweir                              bool bCut, bool bPaste,
641cdf0e10cSrcweir                              ::rtl::OUString const & rText);
642cdf0e10cSrcweir 
643cdf0e10cSrcweir     void
644cdf0e10cSrcweir     handleParagraphNotifications();
645cdf0e10cSrcweir 
646cdf0e10cSrcweir     void handleSelectionChangeNotification();
647cdf0e10cSrcweir 
648cdf0e10cSrcweir     void notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast );
649*21075d77SSteve Yin     ::sal_Int32 getSelectionType(::sal_Int32 nNewFirstPara, ::sal_Int32 nNewFirstPos, ::sal_Int32 nNewLastPara, ::sal_Int32 nNewLastPos);
650*21075d77SSteve Yin     void sendEvent(::sal_Int32 start, ::sal_Int32 end, ::sal_Int16 nEventId);
651cdf0e10cSrcweir 
652cdf0e10cSrcweir     void justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd );
653cdf0e10cSrcweir 
654cdf0e10cSrcweir     void disposeParagraphs();
655cdf0e10cSrcweir 
656cdf0e10cSrcweir     static ::css::uno::Any mapFontColor(::Color const & rColor);
657cdf0e10cSrcweir 
658cdf0e10cSrcweir     static ::Color mapFontColor(::css::uno::Any const & rColor);
659cdf0e10cSrcweir 
660cdf0e10cSrcweir     static ::css::uno::Any mapFontWeight(::FontWeight nWeight);
661cdf0e10cSrcweir 
662cdf0e10cSrcweir     static ::FontWeight mapFontWeight(::css::uno::Any const & rWeight);
663cdf0e10cSrcweir 
664cdf0e10cSrcweir     void retrieveDefaultAttributesImpl(
665cdf0e10cSrcweir         ParagraphImpl const * pParagraph,
666cdf0e10cSrcweir         const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes,
667cdf0e10cSrcweir         tPropValMap& rDefAttrSeq);
668cdf0e10cSrcweir 
669cdf0e10cSrcweir     void retrieveRunAttributesImpl(
670cdf0e10cSrcweir         ParagraphImpl const * pParagraph, ::sal_Int32 Index,
671cdf0e10cSrcweir         const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes,
672cdf0e10cSrcweir         tPropValMap& rRunAttrSeq);
673cdf0e10cSrcweir 
674cdf0e10cSrcweir     static ::css::uno::Sequence< ::css::beans::PropertyValue >
675cdf0e10cSrcweir     convertHashMapToSequence(tPropValMap& rAttrSeq);
676cdf0e10cSrcweir 
677cdf0e10cSrcweir     ::css::uno::Reference< ::css::accessibility::XAccessible > m_xAccessible;
678cdf0e10cSrcweir     ::TextEngine & m_rEngine;
679cdf0e10cSrcweir     ::TextView & m_rView;
680cdf0e10cSrcweir 
681cdf0e10cSrcweir     SfxListenerGuard m_aEngineListener;
682cdf0e10cSrcweir     WindowListenerGuard m_aViewListener;
683cdf0e10cSrcweir 
684cdf0e10cSrcweir     // All the following members have valid values only after calling init:
685cdf0e10cSrcweir 
686cdf0e10cSrcweir     ::std::auto_ptr< Paragraphs > m_xParagraphs;
687cdf0e10cSrcweir 
688cdf0e10cSrcweir     // m_nViewOffset is from the start of the document (0) to the start of the
689cdf0e10cSrcweir     // current view, and m_nViewHeight is the height of the view:
690cdf0e10cSrcweir     ::sal_Int32 m_nViewOffset;
691cdf0e10cSrcweir     ::sal_Int32 m_nViewHeight;
692cdf0e10cSrcweir 
693cdf0e10cSrcweir     // m_aVisibleBegin points to the first Paragraph that is (partially)
694cdf0e10cSrcweir     // contained in the view, and m_aVisibleEnd points past the last Paragraph
695cdf0e10cSrcweir     // that is (partially) contained.  If no Paragraphs are (partially) in the
696cdf0e10cSrcweir     // view, both m_aVisibleBegin and m_aVisibleEnd are set to
697cdf0e10cSrcweir     // m_xParagraphs->end().  These values are only changed by
698cdf0e10cSrcweir     // determineVisibleRange.
699cdf0e10cSrcweir     Paragraphs::iterator m_aVisibleBegin;
700cdf0e10cSrcweir     Paragraphs::iterator m_aVisibleEnd;
701cdf0e10cSrcweir 
702cdf0e10cSrcweir     // m_nVisibleBeginOffset is from m_nViewOffset back to the start of the
703cdf0e10cSrcweir     // Paragraph pointed to by m_aVisibleBegin (and always has a non-negative
704cdf0e10cSrcweir     // value).  If m_aVisibleBegin == m_xParagraphs->end(),
705cdf0e10cSrcweir     // m_nVisibleBeginOffset is set to 0.  These values are only changed by
706cdf0e10cSrcweir     // determineVisibleRange.
707cdf0e10cSrcweir     ::sal_Int32 m_nVisibleBeginOffset;
708cdf0e10cSrcweir 
709cdf0e10cSrcweir     // If no selection has yet been set, all the following four variables are
710cdf0e10cSrcweir     // set to -1.  m_nSelectionLastPara/Pos is also the cursor position.
711cdf0e10cSrcweir     ::sal_Int32 m_nSelectionFirstPara;
712cdf0e10cSrcweir     ::sal_Int32 m_nSelectionFirstPos;
713cdf0e10cSrcweir     ::sal_Int32 m_nSelectionLastPara;
714cdf0e10cSrcweir     ::sal_Int32 m_nSelectionLastPos;
715cdf0e10cSrcweir 
716cdf0e10cSrcweir     Paragraphs::iterator m_aFocused;
717cdf0e10cSrcweir 
718cdf0e10cSrcweir     ::std::queue< ::TextHint > m_aParagraphNotifications;
719cdf0e10cSrcweir     bool m_bSelectionChangedNotification;
720cdf0e10cSrcweir 	bool m_bCompoundControlChild;
721cdf0e10cSrcweir };
722cdf0e10cSrcweir 
723cdf0e10cSrcweir }
724cdf0e10cSrcweir 
725cdf0e10cSrcweir #endif // INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX
726