LCOV - code coverage report
Current view: top level - accessibility/inc/accessibility/extended - textwindowaccessibility.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 17 0.0 %
Date: 2012-08-25 Functions: 0 18 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 12 0.0 %

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

Generated by: LCOV version 1.10