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