LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterAccessibility.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 2 664 0.3 %
Date: 2015-06-13 12:38:46 Functions: 2 119 1.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "PresenterAccessibility.hxx"
      21             : #include "PresenterTextView.hxx"
      22             : #include "PresenterConfigurationAccess.hxx"
      23             : #include "PresenterNotesView.hxx"
      24             : #include "PresenterPaneBase.hxx"
      25             : #include "PresenterPaneContainer.hxx"
      26             : #include "PresenterPaneFactory.hxx"
      27             : #include "PresenterViewFactory.hxx"
      28             : 
      29             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      30             : #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
      31             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      32             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      33             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      34             : #include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
      35             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      36             : #include <com/sun/star/accessibility/XAccessibleText.hpp>
      37             : #include <com/sun/star/drawing/framework/ResourceId.hpp>
      38             : #include <com/sun/star/drawing/framework/XPane.hpp>
      39             : #include <com/sun/star/drawing/framework/XView.hpp>
      40             : #include <cppuhelper/compbase1.hxx>
      41             : #include <cppuhelper/compbase5.hxx>
      42             : #include <cppuhelper/implbase1.hxx>
      43             : #include <boost/bind.hpp>
      44             : 
      45             : using namespace ::com::sun::star;
      46             : using namespace ::com::sun::star::accessibility;
      47             : using namespace ::com::sun::star::uno;
      48             : using namespace ::com::sun::star::drawing::framework;
      49             : 
      50             : //===== PresenterAccessibleObject =============================================
      51             : 
      52             : namespace sdext { namespace presenter {
      53             : 
      54             : namespace {
      55             :     typedef ::cppu::WeakComponentImplHelper5 <
      56             :         css::accessibility::XAccessible,
      57             :         css::accessibility::XAccessibleContext,
      58             :         css::accessibility::XAccessibleComponent,
      59             :         css::accessibility::XAccessibleEventBroadcaster,
      60             :         css::awt::XWindowListener
      61             :     > PresenterAccessibleObjectInterfaceBase;
      62             : }
      63             : 
      64             : class PresenterAccessible::AccessibleObject
      65             :     : public ::cppu::BaseMutex,
      66             :       public PresenterAccessibleObjectInterfaceBase
      67             : {
      68             : public:
      69             :     AccessibleObject (
      70             :         const css::lang::Locale& rLocale,
      71             :         const sal_Int16 nRole,
      72             :         const OUString& rsName);
      73             :     void LateInitialization();
      74             : 
      75             :     virtual ~AccessibleObject();
      76             : 
      77             :     virtual void SetWindow (
      78             :         const css::uno::Reference<css::awt::XWindow>& rxContentWindow,
      79             :         const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
      80             :     void SetAccessibleParent (const css::uno::Reference<css::accessibility::XAccessible>& rxAccessibleParent);
      81             : 
      82             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
      83             : 
      84             :     void AddChild (const ::rtl::Reference<AccessibleObject>& rpChild);
      85             :     void RemoveChild (const ::rtl::Reference<AccessibleObject>& rpChild);
      86             : 
      87             :     void SetIsFocused (const bool bIsFocused);
      88             :     void SetAccessibleName (const OUString& rsName);
      89             : 
      90             :     void FireAccessibleEvent (
      91             :         const sal_Int16 nEventId,
      92             :         const css::uno::Any& rOldValue,
      93             :         const css::uno::Any& rNewValue);
      94             : 
      95             :     void UpdateStateSet();
      96             : 
      97             :     //----- XAccessible -------------------------------------------------------
      98             : 
      99             :     virtual css::uno::Reference<css::accessibility::XAccessibleContext> SAL_CALL
     100             :         getAccessibleContext()
     101             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             : 
     103             :     //-----  XAccessibleContext  ----------------------------------------------
     104             : 
     105             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
     106             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     107             : 
     108             :     virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
     109             :         getAccessibleChild (sal_Int32 nIndex)
     110             :         throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             : 
     112             :     virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent()
     113             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     114             : 
     115             :     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
     116             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             :     virtual sal_Int16 SAL_CALL getAccessibleRole()
     119             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     120             : 
     121             :     virtual OUString SAL_CALL getAccessibleDescription()
     122             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     123             : 
     124             :     virtual OUString SAL_CALL getAccessibleName()
     125             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     126             : 
     127             :     virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet> SAL_CALL
     128             :         getAccessibleRelationSet()
     129             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             : 
     131             :     virtual css::uno::Reference<css::accessibility::XAccessibleStateSet> SAL_CALL
     132             :         getAccessibleStateSet()
     133             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             : 
     135             :     virtual css::lang::Locale SAL_CALL getLocale()
     136             :         throw (css::uno::RuntimeException,
     137             :             css::accessibility::IllegalAccessibleComponentStateException, std::exception) SAL_OVERRIDE;
     138             : 
     139             :     //-----  XAccessibleComponent  --------------------------------------------
     140             : 
     141             :     virtual sal_Bool SAL_CALL containsPoint (
     142             :         const css::awt::Point& aPoint)
     143             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             : 
     145             :     virtual css::uno::Reference<css::accessibility::XAccessible> SAL_CALL
     146             :         getAccessibleAtPoint (
     147             :             const css::awt::Point& aPoint)
     148             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             : 
     150             :     virtual css::awt::Rectangle SAL_CALL getBounds()
     151             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             : 
     153             :     virtual css::awt::Point SAL_CALL getLocation()
     154             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     155             : 
     156             :     virtual css::awt::Point SAL_CALL getLocationOnScreen()
     157             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             : 
     159             :     virtual css::awt::Size SAL_CALL getSize()
     160             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     161             : 
     162             :     virtual void SAL_CALL grabFocus()
     163             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             : 
     165             :     virtual sal_Int32 SAL_CALL getForeground()
     166             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     167             : 
     168             :     virtual sal_Int32 SAL_CALL getBackground()
     169             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     170             : 
     171             :     //-----  XAccessibleEventBroadcaster --------------------------------------
     172             : 
     173             :     virtual void SAL_CALL addAccessibleEventListener (
     174             :             const css::uno::Reference<css::accessibility::XAccessibleEventListener>& rxListener)
     175             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             : 
     177             :     virtual void SAL_CALL removeAccessibleEventListener (
     178             :             const css::uno::Reference<css::accessibility::XAccessibleEventListener>& rxListener)
     179             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             : 
     181             :     //----- XWindowListener ---------------------------------------------------
     182             : 
     183             :     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
     184             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     185             : 
     186             :     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
     187             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     188             : 
     189             :     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
     190             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     191             : 
     192             :     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
     193             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     194             : 
     195             :     //----- XEventListener ----------------------------------------------------
     196             : 
     197             :     virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
     198             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     199             : 
     200             : protected:
     201             :     OUString msName;
     202             :     css::uno::Reference<css::awt::XWindow2> mxContentWindow;
     203             :     css::uno::Reference<css::awt::XWindow2> mxBorderWindow;
     204             :     const css::lang::Locale maLocale;
     205             :     const sal_Int16 mnRole;
     206             :     sal_uInt32 mnStateSet;
     207             :     bool mbIsFocused;
     208             :     css::uno::Reference<css::accessibility::XAccessible> mxParentAccessible;
     209             :     ::std::vector<rtl::Reference<AccessibleObject> > maChildren;
     210             :     ::std::vector<Reference<XAccessibleEventListener> > maListeners;
     211             : 
     212             :     virtual awt::Point GetRelativeLocation();
     213             :     virtual awt::Size GetSize();
     214             :     virtual awt::Point GetAbsoluteParentLocation();
     215             : 
     216             :     virtual bool GetWindowState (const sal_Int16 nType) const;
     217             : 
     218             :     void UpdateState (const sal_Int16 aState, const bool bValue);
     219             : 
     220             :     bool IsDisposed() const;
     221             : 
     222             :     void ThrowIfDisposed() const
     223             :         throw (css::lang::DisposedException);
     224             : };
     225             : 
     226             : //===== AccessibleStateSet ====================================================
     227             : 
     228             : namespace {
     229             : typedef ::cppu::WeakComponentImplHelper1 <
     230             :     css::accessibility::XAccessibleStateSet
     231             :     > AccessibleStateSetInterfaceBase;
     232             : }
     233             : 
     234             : class AccessibleStateSet
     235             :     : public ::cppu::BaseMutex,
     236             :       public AccessibleStateSetInterfaceBase
     237             : {
     238             : public:
     239             :     AccessibleStateSet (const sal_Int32 nStateSet);
     240             :     virtual ~AccessibleStateSet();
     241             : 
     242             :     static sal_uInt32 GetStateMask (const sal_Int16 nType);
     243             : 
     244             :     //----- XAccessibleStateSet -----------------------------------------------
     245             : 
     246             :     virtual sal_Bool SAL_CALL isEmpty()
     247             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     248             : 
     249             :     virtual sal_Bool SAL_CALL contains (sal_Int16 nState)
     250             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     251             : 
     252             :     virtual sal_Bool SAL_CALL containsAll (const css::uno::Sequence<sal_Int16>& rStateSet)
     253             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     254             : 
     255             :     virtual css::uno::Sequence<sal_Int16> SAL_CALL getStates()
     256             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     257             : 
     258             : private:
     259             :     const sal_Int32 mnStateSet;
     260             : };
     261             : 
     262             : //===== AccessibleRelationSet =================================================
     263             : 
     264             : namespace {
     265             : typedef ::cppu::WeakComponentImplHelper1 <
     266             :     css::accessibility::XAccessibleRelationSet
     267             :     > AccessibleRelationSetInterfaceBase;
     268             : }
     269             : 
     270             : class AccessibleRelationSet
     271             :     : public ::cppu::BaseMutex,
     272             :       public AccessibleRelationSetInterfaceBase
     273             : {
     274             : public:
     275             :     AccessibleRelationSet();
     276             :     virtual ~AccessibleRelationSet();
     277             : 
     278             :     void AddRelation (
     279             :         const sal_Int16 nRelationType,
     280             :         const Reference<XInterface>& rxObject);
     281             : 
     282             :     //----- XAccessibleRelationSet --------------------------------------------
     283             : 
     284             :     virtual sal_Int32 SAL_CALL getRelationCount()
     285             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     286             : 
     287             :     virtual AccessibleRelation SAL_CALL getRelation (sal_Int32 nIndex)
     288             :         throw (css::uno::RuntimeException, css::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     289             : 
     290             :     virtual sal_Bool SAL_CALL containsRelation (sal_Int16 nRelationType)
     291             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     292             : 
     293             :     virtual AccessibleRelation SAL_CALL getRelationByType (sal_Int16 nRelationType)
     294             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     295             : 
     296             : private:
     297             :     ::std::vector<AccessibleRelation> maRelations;
     298             : };
     299             : 
     300             : //===== PresenterAccessibleParagraph ==========================================
     301             : 
     302             : namespace {
     303             : typedef ::cppu::ImplInheritanceHelper1 <
     304             :     PresenterAccessible::AccessibleObject,
     305             :     css::accessibility::XAccessibleText
     306             :     > PresenterAccessibleParagraphInterfaceBase;
     307             : }
     308             : 
     309             : class PresenterAccessible::AccessibleParagraph
     310             :     : public PresenterAccessibleParagraphInterfaceBase
     311             : {
     312             : public:
     313             :     AccessibleParagraph (
     314             :         const css::lang::Locale& rLocale,
     315             :         const sal_Int16 nRole,
     316             :         const OUString& rsName,
     317             :         const SharedPresenterTextParagraph& rpParagraph,
     318             :         const sal_Int32 nParagraphIndex);
     319             : 
     320             :     virtual ~AccessibleParagraph();
     321             : 
     322             :     //----- XAccessibleContext ------------------------------------------------
     323             : 
     324             :     virtual css::uno::Reference<css::accessibility::XAccessibleRelationSet> SAL_CALL
     325             :         getAccessibleRelationSet()
     326             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     327             : 
     328             :     //----- XAccessibleText ---------------------------------------------------
     329             : 
     330             :     virtual sal_Int32 SAL_CALL getCaretPosition()
     331             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     332             : 
     333             :     virtual sal_Bool SAL_CALL setCaretPosition (sal_Int32 nIndex)
     334             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     335             : 
     336             :     virtual sal_Unicode SAL_CALL getCharacter (sal_Int32 nIndex)
     337             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     338             : 
     339             :     virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL
     340             :         getCharacterAttributes (
     341             :             ::sal_Int32 nIndex,
     342             :             const css::uno::Sequence<OUString>& rRequestedAttributes)
     343             :         throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     344             : 
     345             :     virtual css::awt::Rectangle SAL_CALL getCharacterBounds (sal_Int32 nIndex)
     346             :         throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     347             : 
     348             :     virtual sal_Int32 SAL_CALL getCharacterCount()
     349             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     350             : 
     351             :     virtual sal_Int32 SAL_CALL getIndexAtPoint (const css::awt::Point& rPoint)
     352             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     353             : 
     354             :     virtual OUString SAL_CALL getSelectedText()
     355             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     356             : 
     357             :     virtual sal_Int32 SAL_CALL getSelectionStart()
     358             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     359             : 
     360             :     virtual sal_Int32 SAL_CALL getSelectionEnd()
     361             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     362             : 
     363             :     virtual sal_Bool SAL_CALL setSelection (sal_Int32 nStartIndex, sal_Int32 nEndIndex)
     364             :         throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     365             : 
     366             :     virtual OUString SAL_CALL getText()
     367             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     368             : 
     369             :     virtual OUString SAL_CALL getTextRange (
     370             :         sal_Int32 nStartIndex,
     371             :         sal_Int32 nEndIndex)
     372             :         throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     373             : 
     374             :     virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex (
     375             :         sal_Int32 nIndex,
     376             :         sal_Int16 nTextType)
     377             :         throw (css::lang::IndexOutOfBoundsException,
     378             :             css::lang::IllegalArgumentException,
     379             :             css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     380             : 
     381             :     virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex (
     382             :         sal_Int32 nIndex,
     383             :         sal_Int16 nTextType)
     384             :         throw (css::lang::IndexOutOfBoundsException,
     385             :             css::lang::IllegalArgumentException,
     386             :             css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     387             : 
     388             :     virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex (
     389             :         sal_Int32 nIndex,
     390             :         sal_Int16 nTextType)
     391             :         throw (css::lang::IndexOutOfBoundsException,
     392             :             css::lang::IllegalArgumentException,
     393             :             css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     394             : 
     395             :     virtual sal_Bool SAL_CALL copyText (sal_Int32 nStartIndex, sal_Int32 nEndIndex)
     396             :         throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     397             : 
     398             : protected:
     399             :     virtual awt::Point GetRelativeLocation() SAL_OVERRIDE;
     400             :     virtual awt::Size GetSize() SAL_OVERRIDE;
     401             :     virtual awt::Point GetAbsoluteParentLocation() SAL_OVERRIDE;
     402             :     virtual bool GetWindowState (const sal_Int16 nType) const SAL_OVERRIDE;
     403             : 
     404             : private:
     405             :     SharedPresenterTextParagraph mpParagraph;
     406             :     const sal_Int32 mnParagraphIndex;
     407             : };
     408             : 
     409             : //===== AccessibleConsole =====================================================
     410             : 
     411             : class AccessibleConsole
     412             : {
     413             : public:
     414           0 :     static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
     415             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     416             :         const lang::Locale& rLocale)
     417             :     {
     418           0 :         OUString sName ("Presenter Console");
     419             :         PresenterConfigurationAccess aConfiguration (
     420             :             rxContext,
     421             :             OUString("/org.openoffice.Office.PresenterScreen/"),
     422           0 :             PresenterConfigurationAccess::READ_ONLY);
     423             :         aConfiguration.GetConfigurationNode("Presenter/Accessibility/Console/String")
     424           0 :             >>= sName;
     425             : 
     426             :         rtl::Reference<PresenterAccessible::AccessibleObject> pObject (
     427             :             new PresenterAccessible::AccessibleObject(
     428           0 :                 rLocale, AccessibleRole::PANEL, sName));
     429           0 :         pObject->LateInitialization();
     430           0 :         pObject->UpdateStateSet();
     431             : 
     432           0 :         return pObject;
     433             :     }
     434             : };
     435             : 
     436             : //===== AccessiblePreview =====================================================
     437             : 
     438             : class AccessiblePreview
     439             : {
     440             : public:
     441           0 :     static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
     442             :         const Reference<css::uno::XComponentContext>& rxContext,
     443             :         const lang::Locale& rLocale,
     444             :         const Reference<awt::XWindow>& rxContentWindow,
     445             :         const Reference<awt::XWindow>& rxBorderWindow)
     446             :     {
     447           0 :         OUString sName ("Presenter Notes Window");
     448             :         {
     449             :             PresenterConfigurationAccess aConfiguration (
     450             :                 rxContext,
     451             :                 OUString("/org.openoffice.Office.PresenterScreen/"),
     452           0 :                 PresenterConfigurationAccess::READ_ONLY);
     453             :             aConfiguration.GetConfigurationNode("Presenter/Accessibility/Preview/String")
     454           0 :                 >>= sName;
     455             :         }
     456             : 
     457             :         rtl::Reference<PresenterAccessible::AccessibleObject> pObject (
     458             :             new PresenterAccessible::AccessibleObject(
     459             :                 rLocale,
     460             :                 AccessibleRole::LABEL,
     461           0 :                 sName));
     462           0 :         pObject->LateInitialization();
     463           0 :         pObject->UpdateStateSet();
     464           0 :         pObject->SetWindow(rxContentWindow, rxBorderWindow);
     465             : 
     466           0 :         return pObject;
     467             :     }
     468             : };
     469             : 
     470             : //===== AccessibleNotes =======================================================
     471             : 
     472           0 : class AccessibleNotes : public PresenterAccessible::AccessibleObject
     473             : {
     474             : public:
     475             :     AccessibleNotes (
     476             :         const css::lang::Locale& rLocale,
     477             :         const sal_Int16 nRole,
     478             :         const OUString& rsName);
     479             : 
     480             :     static rtl::Reference<PresenterAccessible::AccessibleObject> Create (
     481             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     482             :         const lang::Locale& rLocale,
     483             :         const Reference<awt::XWindow>& rxContentWindow,
     484             :         const Reference<awt::XWindow>& rxBorderWindow,
     485             :         const ::boost::shared_ptr<PresenterTextView>& rpTextView);
     486             : 
     487             :     void SetTextView (const ::boost::shared_ptr<PresenterTextView>& rpTextView);
     488             : 
     489             :     virtual void SetWindow (
     490             :         const css::uno::Reference<css::awt::XWindow>& rxContentWindow,
     491             :         const css::uno::Reference<css::awt::XWindow>& rxBorderWindow) SAL_OVERRIDE;
     492             : 
     493             : private:
     494             :     ::boost::shared_ptr<PresenterTextView> mpTextView;
     495             : 
     496             :     void NotifyCaretChange (
     497             :         const sal_Int32 nOldParagraphIndex,
     498             :         const sal_Int32 nOldCharacterIndex,
     499             :         const sal_Int32 nNewParagraphIndex,
     500             :         const sal_Int32 nNewCharacterIndex);
     501             :     void HandleTextChange();
     502             : };
     503             : 
     504             : //===== AccessibleFocusManager ================================================
     505             : 
     506             : /** A singleton class that makes sure that only one accessibility object in
     507             :     the PresenterConsole hierarchy has the focus.
     508             : */
     509           0 : class AccessibleFocusManager
     510             : {
     511             : public:
     512             :     static ::boost::shared_ptr<AccessibleFocusManager> Instance();
     513             : 
     514             :     void AddFocusableObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
     515             :     void RemoveFocusableObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
     516             : 
     517             :     void FocusObject (const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject);
     518             : 
     519             : private:
     520             :     static ::boost::shared_ptr<AccessibleFocusManager> mpInstance;
     521             :     ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> > maFocusableObjects;
     522             : 
     523             :     AccessibleFocusManager();
     524             : };
     525             : 
     526             : //===== PresenterAccessible ===================================================
     527             : 
     528           0 : PresenterAccessible::PresenterAccessible (
     529             :     const css::uno::Reference<css::uno::XComponentContext>& rxContext,
     530             :     const ::rtl::Reference<PresenterController>& rpPresenterController,
     531             :     const Reference<drawing::framework::XPane>& rxMainPane)
     532             :     : PresenterAccessibleInterfaceBase(m_aMutex),
     533             :       mxComponentContext(rxContext),
     534             :       mpPresenterController(rpPresenterController),
     535           0 :       mxMainPaneId(rxMainPane.is() ? rxMainPane->getResourceId() : Reference<XResourceId>()),
     536             :       mxMainPane(rxMainPane, UNO_QUERY),
     537             :       mxMainWindow(),
     538             :       mxPreviewContentWindow(),
     539             :       mxPreviewBorderWindow(),
     540             :       mxNotesContentWindow(),
     541             :       mxNotesBorderWindow(),
     542             :       mpAccessibleConsole(),
     543             :       mpAccessiblePreview(),
     544             :       mpAccessibleNotes(),
     545           0 :       mxAccessibleParent()
     546             : {
     547           0 :     if (mxMainPane.is())
     548           0 :         mxMainPane->setAccessible(this);
     549           0 : }
     550             : 
     551           0 : PresenterAccessible::~PresenterAccessible()
     552             : {
     553           0 : }
     554             : 
     555           0 : PresenterPaneContainer::SharedPaneDescriptor PresenterAccessible::GetPreviewPane() const
     556             : {
     557           0 :     PresenterPaneContainer::SharedPaneDescriptor pPreviewPane;
     558             : 
     559           0 :     if ( ! mpPresenterController.is())
     560           0 :         return pPreviewPane;
     561             : 
     562           0 :     rtl::Reference<PresenterPaneContainer> pContainer (mpPresenterController->GetPaneContainer());
     563           0 :     if ( ! pContainer.is())
     564           0 :         return pPreviewPane;
     565             : 
     566           0 :     pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL);
     567           0 :     Reference<drawing::framework::XPane> xPreviewPane;
     568           0 :     if (pPreviewPane)
     569           0 :         xPreviewPane = pPreviewPane->mxPane.get();
     570           0 :     if ( ! xPreviewPane.is())
     571             :     {
     572           0 :         pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msSlideSorterPaneURL);
     573             :     }
     574           0 :     return pPreviewPane;
     575             : }
     576             : 
     577           0 : void PresenterAccessible::UpdateAccessibilityHierarchy()
     578             : {
     579           0 :     if ( ! mpPresenterController.is())
     580           0 :         return;
     581             : 
     582             :     Reference<drawing::framework::XConfigurationController> xConfigurationController(
     583           0 :         mpPresenterController->GetConfigurationController());
     584           0 :     if ( ! xConfigurationController.is())
     585           0 :         return;
     586             : 
     587             :     rtl::Reference<PresenterPaneContainer> pPaneContainer (
     588           0 :         mpPresenterController->GetPaneContainer());
     589           0 :     if ( ! pPaneContainer.is())
     590           0 :         return;
     591             : 
     592           0 :     if ( ! mpAccessibleConsole.is())
     593           0 :         return;
     594             : 
     595             :     // Get the preview pane (standard or notes view) or the slide overview
     596             :     // pane.
     597           0 :     PresenterPaneContainer::SharedPaneDescriptor pPreviewPane(GetPreviewPane());
     598           0 :     Reference<drawing::framework::XPane> xPreviewPane;
     599           0 :     if (pPreviewPane)
     600           0 :         xPreviewPane = pPreviewPane->mxPane.get();
     601             : 
     602             :     // Get the notes pane.
     603             :     PresenterPaneContainer::SharedPaneDescriptor pNotesPane(
     604           0 :         pPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL));
     605           0 :     Reference<drawing::framework::XPane> xNotesPane;
     606           0 :     if (pNotesPane)
     607           0 :         xNotesPane = pNotesPane->mxPane.get();
     608             : 
     609             :     // Get the notes view.
     610           0 :     Reference<drawing::framework::XView> xNotesView;
     611           0 :     if (pNotesPane)
     612           0 :         xNotesView = pNotesPane->mxView;
     613             :     rtl::Reference<PresenterNotesView> pNotesView (
     614           0 :         dynamic_cast<PresenterNotesView*>(xNotesView.get()));
     615             : 
     616             :     UpdateAccessibilityHierarchy(
     617           0 :         pPreviewPane ? pPreviewPane->mxContentWindow : Reference<awt::XWindow>(),
     618           0 :         pPreviewPane ? pPreviewPane->mxBorderWindow : Reference<awt::XWindow>(),
     619           0 :         (pPreviewPane&&pPreviewPane->mxPane.is()) ? pPreviewPane->mxPane->GetTitle() : OUString(),
     620           0 :         pNotesPane ? pNotesPane->mxContentWindow : Reference<awt::XWindow>(),
     621           0 :         pNotesPane ? pNotesPane->mxBorderWindow : Reference<awt::XWindow>(),
     622           0 :         pNotesView.is()
     623             :             ? pNotesView->GetTextView()
     624           0 :             : ::boost::shared_ptr<PresenterTextView>());
     625             : }
     626             : 
     627           0 : void PresenterAccessible::UpdateAccessibilityHierarchy (
     628             :     const Reference<awt::XWindow>& rxPreviewContentWindow,
     629             :     const Reference<awt::XWindow>& rxPreviewBorderWindow,
     630             :     const OUString& rsTitle,
     631             :     const Reference<awt::XWindow>& rxNotesContentWindow,
     632             :     const Reference<awt::XWindow>& rxNotesBorderWindow,
     633             :     const ::boost::shared_ptr<PresenterTextView>& rpNotesTextView)
     634             : {
     635           0 :     if ( ! mpAccessibleConsole.is())
     636           0 :         return;
     637             : 
     638           0 :     if (mxPreviewContentWindow != rxPreviewContentWindow)
     639             :     {
     640           0 :         if (mpAccessiblePreview.is())
     641             :         {
     642           0 :             mpAccessibleConsole->RemoveChild(mpAccessiblePreview);
     643           0 :             mpAccessiblePreview = NULL;
     644             :         }
     645             : 
     646           0 :         mxPreviewContentWindow = rxPreviewContentWindow;
     647           0 :         mxPreviewBorderWindow = rxPreviewBorderWindow;
     648             : 
     649           0 :         if (mxPreviewContentWindow.is())
     650             :         {
     651           0 :             mpAccessiblePreview = AccessiblePreview::Create(
     652             :                 mxComponentContext,
     653             :                 lang::Locale(),
     654             :                 mxPreviewContentWindow,
     655           0 :                 mxPreviewBorderWindow);
     656           0 :             mpAccessibleConsole->AddChild(mpAccessiblePreview);
     657           0 :             mpAccessiblePreview->SetAccessibleName(rsTitle);
     658             :         }
     659             :     }
     660             : 
     661           0 :     if (mxNotesContentWindow != rxNotesContentWindow)
     662             :     {
     663           0 :         if (mpAccessibleNotes.is())
     664             :         {
     665           0 :             mpAccessibleConsole->RemoveChild(mpAccessibleNotes);
     666           0 :             mpAccessibleNotes = NULL;
     667             :         }
     668             : 
     669           0 :         mxNotesContentWindow = rxNotesContentWindow;
     670           0 :         mxNotesBorderWindow = rxNotesBorderWindow;
     671             : 
     672           0 :         if (mxNotesContentWindow.is())
     673             :         {
     674           0 :             mpAccessibleNotes = AccessibleNotes::Create(
     675             :                 mxComponentContext,
     676             :                 lang::Locale(),
     677             :                 mxNotesContentWindow,
     678             :                 mxNotesBorderWindow,
     679           0 :                 rpNotesTextView);
     680           0 :             mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
     681             :         }
     682             :     }
     683             : }
     684             : 
     685           0 : void PresenterAccessible::NotifyCurrentSlideChange (
     686             :     const sal_Int32 nCurrentSlideIndex,
     687             :     const sal_Int32 nSlideCount)
     688             : {
     689             :     (void)nCurrentSlideIndex;
     690             :     (void)nSlideCount;
     691             : 
     692           0 :     if (mpAccessiblePreview.is())
     693             :     {
     694           0 :         PresenterPaneContainer::SharedPaneDescriptor pPreviewPane (GetPreviewPane());
     695             :         mpAccessiblePreview->SetAccessibleName(
     696           0 :             (pPreviewPane&&pPreviewPane->mxPane.is()
     697           0 :                 ? pPreviewPane->mxPane->GetTitle()
     698           0 :                 : OUString()));
     699             :     }
     700             : 
     701             :     // Play some focus ping-pong to trigger AT tools.
     702             :     //AccessibleFocusManager::Instance()->FocusObject(mpAccessibleConsole);
     703           0 :     AccessibleFocusManager::Instance()->FocusObject(mpAccessiblePreview);
     704           0 : }
     705             : 
     706           0 : void SAL_CALL PresenterAccessible::disposing()
     707             : {
     708             :     UpdateAccessibilityHierarchy(
     709             :         NULL,
     710             :         NULL,
     711             :         OUString(),
     712             :         NULL,
     713             :         NULL,
     714           0 :         ::boost::shared_ptr<PresenterTextView>());
     715             : 
     716           0 :     if (mxMainWindow.is())
     717             :     {
     718           0 :         mxMainWindow->removeFocusListener(this);
     719             : 
     720           0 :         if (mxMainPane.is())
     721           0 :             mxMainPane->setAccessible(NULL);
     722             :     }
     723             : 
     724           0 :     mpAccessiblePreview = NULL;
     725           0 :     mpAccessibleNotes = NULL;
     726           0 :     mpAccessibleConsole = NULL;
     727           0 : }
     728             : 
     729             : //----- XAccessible -----------------------------------------------------------
     730             : 
     731           0 : Reference<XAccessibleContext> SAL_CALL PresenterAccessible::getAccessibleContext()
     732             :     throw (css::uno::RuntimeException, std::exception)
     733             : {
     734           0 :     if ( ! mpAccessibleConsole.is())
     735             :     {
     736           0 :         Reference<XPane> xMainPane (mxMainPane, UNO_QUERY);
     737           0 :         if (xMainPane.is())
     738             :         {
     739           0 :             mxMainWindow = Reference<awt::XWindow>(xMainPane->getWindow(), UNO_QUERY);
     740           0 :             mxMainWindow->addFocusListener(this);
     741             :         }
     742           0 :         mpAccessibleConsole = AccessibleConsole::Create(
     743           0 :             mxComponentContext, css::lang::Locale());
     744           0 :         mpAccessibleConsole->SetWindow(mxMainWindow, NULL);
     745           0 :         mpAccessibleConsole->SetAccessibleParent(mxAccessibleParent);
     746           0 :         UpdateAccessibilityHierarchy();
     747           0 :         if (mpPresenterController.is())
     748           0 :             mpPresenterController->SetAccessibilityActiveState(true);
     749             :     }
     750           0 :     return mpAccessibleConsole->getAccessibleContext();
     751             : }
     752             : 
     753             : //----- XFocusListener ----------------------------------------------------
     754             : 
     755           0 : void SAL_CALL PresenterAccessible::focusGained (const css::awt::FocusEvent& rEvent)
     756             :         throw (css::uno::RuntimeException, std::exception)
     757             : {
     758             :     (void)rEvent;
     759             :     SAL_INFO("sdext.presenter", OSL_THIS_FUNC << ": PresenterAccessible::focusGained at " << this
     760             :         << " and window " << mxMainWindow.get());
     761           0 :     AccessibleFocusManager::Instance()->FocusObject(mpAccessibleConsole);
     762           0 : }
     763             : 
     764           0 : void SAL_CALL PresenterAccessible::focusLost (const css::awt::FocusEvent& rEvent)
     765             :     throw (css::uno::RuntimeException, std::exception)
     766             : {
     767             :     (void)rEvent;
     768             :     SAL_INFO("sdext.presenter", OSL_THIS_FUNC << ": PresenterAccessible::focusLost at " << this);
     769           0 :     AccessibleFocusManager::Instance()->FocusObject(NULL);
     770           0 : }
     771             : 
     772             : //----- XEventListener ----------------------------------------------------
     773             : 
     774           0 : void SAL_CALL PresenterAccessible::disposing (const css::lang::EventObject& rEvent)
     775             :     throw (css::uno::RuntimeException, std::exception)
     776             : {
     777           0 :     if (rEvent.Source == mxMainWindow)
     778           0 :         mxMainWindow = NULL;
     779           0 : }
     780             : 
     781             : //----- XInitialize -----------------------------------------------------------
     782             : 
     783           0 : void SAL_CALL PresenterAccessible::initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
     784             :     throw (css::uno::RuntimeException, std::exception)
     785             : {
     786           0 :     if (rArguments.getLength() >= 1)
     787             :     {
     788           0 :         mxAccessibleParent = Reference<XAccessible>(rArguments[0], UNO_QUERY);
     789           0 :         if (mpAccessibleConsole.is())
     790           0 :             mpAccessibleConsole->SetAccessibleParent(mxAccessibleParent);
     791             :     }
     792           0 : }
     793             : 
     794             : //===== PresenterAccessible::AccessibleObject =========================================
     795             : 
     796           0 : PresenterAccessible::AccessibleObject::AccessibleObject (
     797             :     const lang::Locale& rLocale,
     798             :     const sal_Int16 nRole,
     799             :     const OUString& rsName)
     800             :     : PresenterAccessibleObjectInterfaceBase(m_aMutex),
     801             :       msName(rsName),
     802             :       mxContentWindow(),
     803             :       mxBorderWindow(),
     804             :       maLocale(rLocale),
     805             :       mnRole(nRole),
     806             :       mnStateSet(0),
     807             :       mbIsFocused(false),
     808             :       mxParentAccessible(),
     809             :       maChildren(),
     810           0 :       maListeners()
     811             : {
     812           0 : }
     813             : 
     814           0 : void PresenterAccessible::AccessibleObject::LateInitialization()
     815             : {
     816           0 :     AccessibleFocusManager::Instance()->AddFocusableObject(this);
     817           0 : }
     818             : 
     819           0 : PresenterAccessible::AccessibleObject::~AccessibleObject()
     820             : {
     821           0 : }
     822             : 
     823           0 : void PresenterAccessible::AccessibleObject::SetWindow (
     824             :     const Reference<awt::XWindow>& rxContentWindow,
     825             :     const Reference<awt::XWindow>& rxBorderWindow)
     826             : {
     827           0 :     Reference<awt::XWindow2> xContentWindow (rxContentWindow, UNO_QUERY);
     828             : 
     829           0 :     if (mxContentWindow.get() != xContentWindow.get())
     830             :     {
     831           0 :         if (mxContentWindow.is())
     832             :         {
     833           0 :             mxContentWindow->removeWindowListener(this);
     834             :         }
     835             : 
     836           0 :         mxContentWindow = xContentWindow;
     837           0 :         mxBorderWindow = Reference<awt::XWindow2>(rxBorderWindow, UNO_QUERY);
     838             : 
     839           0 :         if (mxContentWindow.is())
     840             :         {
     841           0 :             mxContentWindow->addWindowListener(this);
     842             :         }
     843             : 
     844           0 :         UpdateStateSet();
     845           0 :     }
     846           0 : }
     847             : 
     848           0 : void PresenterAccessible::AccessibleObject::SetAccessibleParent (
     849             :     const Reference<XAccessible>& rxAccessibleParent)
     850             : {
     851           0 :     mxParentAccessible = rxAccessibleParent;
     852           0 : }
     853             : 
     854           0 : void SAL_CALL PresenterAccessible::AccessibleObject::disposing()
     855             : {
     856           0 :     AccessibleFocusManager::Instance()->RemoveFocusableObject(this);
     857           0 :     SetWindow(NULL, NULL);
     858           0 : }
     859             : 
     860             : //----- XAccessible -------------------------------------------------------
     861             : 
     862             : Reference<XAccessibleContext> SAL_CALL
     863           0 :     PresenterAccessible::AccessibleObject::getAccessibleContext()
     864             :     throw (RuntimeException, std::exception)
     865             : {
     866           0 :     ThrowIfDisposed();
     867             : 
     868           0 :     return this;
     869             : }
     870             : 
     871             : //-----  XAccessibleContext  ----------------------------------------------
     872             : 
     873           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getAccessibleChildCount()
     874             :     throw (css::uno::RuntimeException, std::exception)
     875             : {
     876           0 :     ThrowIfDisposed();
     877             : 
     878           0 :     const sal_Int32 nChildCount (maChildren.size());
     879             : 
     880           0 :     return nChildCount;
     881             : }
     882             : 
     883             : Reference<XAccessible> SAL_CALL
     884           0 :     PresenterAccessible::AccessibleObject::getAccessibleChild (sal_Int32 nIndex)
     885             :     throw (lang::IndexOutOfBoundsException, RuntimeException, std::exception)
     886             : {
     887           0 :     ThrowIfDisposed();
     888             : 
     889           0 :     if (nIndex<0 || nIndex>=sal_Int32(maChildren.size()))
     890           0 :         throw lang::IndexOutOfBoundsException("invalid child index", static_cast<uno::XWeak*>(this));
     891             : 
     892           0 :     return Reference<XAccessible>(maChildren[nIndex].get());
     893             : }
     894             : 
     895             : Reference<XAccessible> SAL_CALL
     896           0 :     PresenterAccessible::AccessibleObject::getAccessibleParent()
     897             :     throw (RuntimeException, std::exception)
     898             : {
     899           0 :     ThrowIfDisposed();
     900             : 
     901           0 :     return mxParentAccessible;
     902             : }
     903             : 
     904             : sal_Int32 SAL_CALL
     905           0 :     PresenterAccessible::AccessibleObject::getAccessibleIndexInParent()
     906             :     throw (RuntimeException, std::exception)
     907             : {
     908           0 :     ThrowIfDisposed();
     909             : 
     910           0 :     const Reference<XAccessible> xThis (this);
     911           0 :     if (mxParentAccessible.is())
     912             :     {
     913           0 :         const Reference<XAccessibleContext> xContext (mxParentAccessible->getAccessibleContext());
     914           0 :         for (sal_Int32 nIndex=0,nCount=xContext->getAccessibleChildCount();
     915             :              nIndex<nCount;
     916             :              ++nIndex)
     917             :         {
     918           0 :             if (xContext->getAccessibleChild(nIndex) == xThis)
     919           0 :                 return nIndex;
     920           0 :         }
     921             :     }
     922             : 
     923           0 :     return 0;
     924             : }
     925             : 
     926             : sal_Int16 SAL_CALL
     927           0 :     PresenterAccessible::AccessibleObject::getAccessibleRole()
     928             :     throw (RuntimeException, std::exception)
     929             : {
     930           0 :     ThrowIfDisposed();
     931             : 
     932           0 :     return mnRole;
     933             : }
     934             : 
     935             : OUString SAL_CALL
     936           0 :     PresenterAccessible::AccessibleObject::getAccessibleDescription()
     937             :     throw (RuntimeException, std::exception)
     938             : {
     939           0 :     ThrowIfDisposed();
     940             : 
     941           0 :     return msName;
     942             : }
     943             : 
     944             : OUString SAL_CALL
     945           0 :     PresenterAccessible::AccessibleObject::getAccessibleName()
     946             :     throw (css::uno::RuntimeException, std::exception)
     947             : {
     948           0 :     ThrowIfDisposed();
     949             : 
     950           0 :     return msName;
     951             : }
     952             : 
     953             : Reference<XAccessibleRelationSet> SAL_CALL
     954           0 :     PresenterAccessible::AccessibleObject::getAccessibleRelationSet()
     955             :     throw (RuntimeException, std::exception)
     956             : {
     957           0 :     ThrowIfDisposed();
     958             : 
     959           0 :     return NULL;
     960             : }
     961             : 
     962             : Reference<XAccessibleStateSet> SAL_CALL
     963           0 :     PresenterAccessible::AccessibleObject::getAccessibleStateSet()
     964             :     throw (RuntimeException, std::exception)
     965             : {
     966           0 :     ThrowIfDisposed();
     967             : 
     968           0 :     return Reference<XAccessibleStateSet>(new AccessibleStateSet(mnStateSet));
     969             : }
     970             : 
     971             : lang::Locale SAL_CALL
     972           0 :     PresenterAccessible::AccessibleObject::getLocale()
     973             :     throw (RuntimeException,
     974             :         IllegalAccessibleComponentStateException, std::exception)
     975             : {
     976           0 :     ThrowIfDisposed();
     977             : 
     978           0 :     if (mxParentAccessible.is())
     979             :     {
     980           0 :         Reference<XAccessibleContext> xParentContext (mxParentAccessible->getAccessibleContext());
     981           0 :         if (xParentContext.is())
     982           0 :             return xParentContext->getLocale();
     983             :     }
     984           0 :     return maLocale;
     985             : }
     986             : 
     987             : //-----  XAccessibleComponent  ------------------------------------------------
     988             : 
     989           0 : sal_Bool SAL_CALL PresenterAccessible::AccessibleObject::containsPoint (
     990             :     const awt::Point& rPoint)
     991             :     throw (RuntimeException, std::exception)
     992             : {
     993           0 :     ThrowIfDisposed();
     994             : 
     995           0 :     if (mxContentWindow.is())
     996             :     {
     997           0 :         const awt::Rectangle aBox (getBounds());
     998           0 :         return rPoint.X>=aBox.X
     999           0 :             && rPoint.Y>=aBox.Y
    1000           0 :             && rPoint.X<aBox.X+aBox.Width
    1001           0 :             && rPoint.Y<aBox.Y+aBox.Height;
    1002             :     }
    1003             :     else
    1004           0 :         return false;
    1005             : }
    1006             : 
    1007             : Reference<XAccessible> SAL_CALL
    1008           0 :     PresenterAccessible::AccessibleObject::getAccessibleAtPoint (const awt::Point& rPoint)
    1009             :     throw (RuntimeException, std::exception)
    1010             : {
    1011             :     (void)rPoint;
    1012           0 :     ThrowIfDisposed();
    1013             : 
    1014           0 :     return Reference<XAccessible>();
    1015             : }
    1016             : 
    1017           0 : awt::Rectangle SAL_CALL PresenterAccessible::AccessibleObject::getBounds()
    1018             :     throw (RuntimeException, std::exception)
    1019             : {
    1020           0 :     ThrowIfDisposed();
    1021             : 
    1022           0 :     awt::Rectangle aBox;
    1023             : 
    1024           0 :     const awt::Point aLocation (GetRelativeLocation());
    1025           0 :     const awt::Size aSize (GetSize());
    1026             : 
    1027           0 :     return awt::Rectangle (aLocation.X, aLocation.Y, aSize.Width, aSize.Height);
    1028             : }
    1029             : 
    1030           0 : awt::Point SAL_CALL PresenterAccessible::AccessibleObject::getLocation()
    1031             :     throw (RuntimeException, std::exception)
    1032             : {
    1033           0 :     ThrowIfDisposed();
    1034             : 
    1035           0 :     const awt::Point aLocation (GetRelativeLocation());
    1036             : 
    1037           0 :     return aLocation;
    1038             : }
    1039             : 
    1040           0 : awt::Point SAL_CALL PresenterAccessible::AccessibleObject::getLocationOnScreen()
    1041             :     throw (RuntimeException, std::exception)
    1042             : {
    1043           0 :     ThrowIfDisposed();
    1044             : 
    1045           0 :     awt::Point aRelativeLocation (GetRelativeLocation());
    1046           0 :     awt::Point aParentLocationOnScreen (GetAbsoluteParentLocation());
    1047             : 
    1048             :     return awt::Point(
    1049           0 :         aRelativeLocation.X + aParentLocationOnScreen.X,
    1050           0 :         aRelativeLocation.Y + aParentLocationOnScreen.Y);
    1051             : }
    1052             : 
    1053           0 : awt::Size SAL_CALL PresenterAccessible::AccessibleObject::getSize()
    1054             :     throw (RuntimeException, std::exception)
    1055             : {
    1056           0 :     ThrowIfDisposed();
    1057             : 
    1058           0 :     const awt::Size aSize (GetSize());
    1059             : 
    1060           0 :     return aSize;
    1061             : }
    1062             : 
    1063           0 : void SAL_CALL PresenterAccessible::AccessibleObject::grabFocus()
    1064             :     throw (RuntimeException, std::exception)
    1065             : {
    1066           0 :     ThrowIfDisposed();
    1067           0 :     if (mxBorderWindow.is())
    1068           0 :         mxBorderWindow->setFocus();
    1069           0 :     else if (mxContentWindow.is())
    1070           0 :         mxContentWindow->setFocus();
    1071           0 : }
    1072             : 
    1073           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getForeground()
    1074             :     throw (RuntimeException, std::exception)
    1075             : {
    1076           0 :     ThrowIfDisposed();
    1077             : 
    1078           0 :     return 0x00ffffff;
    1079             : }
    1080             : 
    1081           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getBackground()
    1082             :     throw (RuntimeException, std::exception)
    1083             : {
    1084           0 :     ThrowIfDisposed();
    1085             : 
    1086           0 :     return 0x00000000;
    1087             : }
    1088             : 
    1089             : //----- XAccessibleEventBroadcaster -------------------------------------------
    1090             : 
    1091           0 : void SAL_CALL PresenterAccessible::AccessibleObject::addAccessibleEventListener (
    1092             :     const Reference<XAccessibleEventListener>& rxListener)
    1093             :     throw (RuntimeException, std::exception)
    1094             : {
    1095           0 :     if (rxListener.is())
    1096             :     {
    1097           0 :         const osl::MutexGuard aGuard(m_aMutex);
    1098             : 
    1099           0 :         if (IsDisposed())
    1100             :         {
    1101           0 :             uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
    1102           0 :             rxListener->disposing (lang::EventObject(xThis));
    1103             :         }
    1104             :         else
    1105             :         {
    1106           0 :             maListeners.push_back(rxListener);
    1107           0 :         }
    1108             :     }
    1109           0 : }
    1110             : 
    1111           0 : void SAL_CALL PresenterAccessible::AccessibleObject::removeAccessibleEventListener (
    1112             :     const Reference<XAccessibleEventListener>& rxListener)
    1113             :     throw (RuntimeException, std::exception)
    1114             : {
    1115           0 :     ThrowIfDisposed();
    1116           0 :     if (rxListener.is())
    1117             :     {
    1118           0 :         const osl::MutexGuard aGuard(m_aMutex);
    1119             : 
    1120           0 :         maListeners.erase(std::remove(maListeners.begin(), maListeners.end(), rxListener));
    1121             :     }
    1122           0 : }
    1123             : 
    1124             : //----- XWindowListener ---------------------------------------------------
    1125             : 
    1126           0 : void SAL_CALL PresenterAccessible::AccessibleObject::windowResized (
    1127             :     const css::awt::WindowEvent& rEvent)
    1128             :     throw (css::uno::RuntimeException, std::exception)
    1129             : {
    1130             :     (void)rEvent;
    1131             : 
    1132           0 :     FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any());
    1133           0 : }
    1134             : 
    1135           0 : void SAL_CALL PresenterAccessible::AccessibleObject::windowMoved (
    1136             :     const css::awt::WindowEvent& rEvent)
    1137             :     throw (css::uno::RuntimeException, std::exception)
    1138             : {
    1139             :     (void)rEvent;
    1140             : 
    1141           0 :     FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any());
    1142           0 : }
    1143             : 
    1144           0 : void SAL_CALL PresenterAccessible::AccessibleObject::windowShown (
    1145             :     const css::lang::EventObject& rEvent)
    1146             :     throw (css::uno::RuntimeException, std::exception)
    1147             : {
    1148             :     (void)rEvent;
    1149           0 :     UpdateStateSet();
    1150           0 : }
    1151             : 
    1152           0 : void SAL_CALL PresenterAccessible::AccessibleObject::windowHidden (
    1153             :     const css::lang::EventObject& rEvent)
    1154             :     throw (css::uno::RuntimeException, std::exception)
    1155             : {
    1156             :     (void)rEvent;
    1157           0 :     UpdateStateSet();
    1158           0 : }
    1159             : 
    1160             : //----- XEventListener --------------------------------------------------------
    1161             : 
    1162           0 : void SAL_CALL PresenterAccessible::AccessibleObject::disposing (const css::lang::EventObject& rEvent)
    1163             :     throw (css::uno::RuntimeException, std::exception)
    1164             : {
    1165           0 :     if (rEvent.Source == mxContentWindow)
    1166             :     {
    1167           0 :         mxContentWindow = NULL;
    1168           0 :         mxBorderWindow = NULL;
    1169             :     }
    1170             :     else
    1171             :     {
    1172           0 :         SetWindow(NULL, NULL);
    1173             :     }
    1174           0 : }
    1175             : 
    1176             : //----- private ---------------------------------------------------------------
    1177             : 
    1178           0 : bool PresenterAccessible::AccessibleObject::GetWindowState (const sal_Int16 nType) const
    1179             : {
    1180           0 :     switch (nType)
    1181             :     {
    1182             :         case AccessibleStateType::ENABLED:
    1183           0 :             return mxContentWindow.is() && mxContentWindow->isEnabled();
    1184             : 
    1185             :         case AccessibleStateType::FOCUSABLE:
    1186           0 :             return true;
    1187             : 
    1188             :         case AccessibleStateType::FOCUSED:
    1189           0 :             return mbIsFocused;
    1190             : 
    1191             :         case AccessibleStateType::SHOWING:
    1192           0 :             return mxContentWindow.is() && mxContentWindow->isVisible();
    1193             : 
    1194             :         default:
    1195           0 :             return false;
    1196             :     }
    1197             : }
    1198             : 
    1199           0 : void PresenterAccessible::AccessibleObject::UpdateStateSet()
    1200             : {
    1201           0 :     UpdateState(AccessibleStateType::FOCUSABLE, true);
    1202           0 :     UpdateState(AccessibleStateType::VISIBLE, true);
    1203           0 :     UpdateState(AccessibleStateType::ENABLED, true);
    1204           0 :     UpdateState(AccessibleStateType::MULTI_LINE, true);
    1205           0 :     UpdateState(AccessibleStateType::SENSITIVE, true);
    1206             : 
    1207           0 :     UpdateState(AccessibleStateType::ENABLED, GetWindowState(AccessibleStateType::ENABLED));
    1208           0 :     UpdateState(AccessibleStateType::FOCUSED, GetWindowState(AccessibleStateType::FOCUSED));
    1209           0 :     UpdateState(AccessibleStateType::SHOWING, GetWindowState(AccessibleStateType::SHOWING));
    1210             :     //    UpdateState(AccessibleStateType::ACTIVE, GetWindowState(AccessibleStateType::ACTIVE));
    1211           0 : }
    1212             : 
    1213           0 : void PresenterAccessible::AccessibleObject::UpdateState(
    1214             :     const sal_Int16 nState,
    1215             :     const bool bValue)
    1216             : {
    1217           0 :     const sal_uInt32 nStateMask (AccessibleStateSet::GetStateMask(nState));
    1218           0 :     if (((mnStateSet & nStateMask)!=0) != bValue)
    1219             :     {
    1220           0 :         if (bValue)
    1221             :         {
    1222           0 :             mnStateSet |= nStateMask;
    1223           0 :             FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), Any(nState));
    1224             :         }
    1225             :         else
    1226             :         {
    1227           0 :             mnStateSet &= ~nStateMask;
    1228           0 :             FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(nState), Any());
    1229             :         }
    1230             :     }
    1231           0 : }
    1232             : 
    1233           0 : void PresenterAccessible::AccessibleObject::AddChild (
    1234             :     const ::rtl::Reference<AccessibleObject>& rpChild)
    1235             : {
    1236           0 :     maChildren.push_back(rpChild);
    1237           0 :     rpChild->SetAccessibleParent(this);
    1238           0 :     FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
    1239           0 : }
    1240             : 
    1241           0 : void PresenterAccessible::AccessibleObject::RemoveChild (
    1242             :     const ::rtl::Reference<AccessibleObject>& rpChild)
    1243             : {
    1244           0 :     rpChild->SetAccessibleParent(Reference<XAccessible>());
    1245           0 :     maChildren.erase(::std::find(maChildren.begin(), maChildren.end(), rpChild));
    1246           0 :     FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
    1247           0 : }
    1248             : 
    1249           0 : void PresenterAccessible::AccessibleObject::SetIsFocused (const bool bIsFocused)
    1250             : {
    1251           0 :     if (mbIsFocused != bIsFocused)
    1252             :     {
    1253           0 :         mbIsFocused = bIsFocused;
    1254           0 :         UpdateStateSet();
    1255             :     }
    1256           0 : }
    1257             : 
    1258           0 : void PresenterAccessible::AccessibleObject::SetAccessibleName (const OUString& rsName)
    1259             : {
    1260           0 :     if (msName != rsName)
    1261             :     {
    1262           0 :         const OUString sOldName(msName);
    1263           0 :         msName = rsName;
    1264           0 :         FireAccessibleEvent(AccessibleEventId::NAME_CHANGED, Any(sOldName), Any(msName));
    1265             :     }
    1266           0 : }
    1267             : 
    1268           0 : void PresenterAccessible::AccessibleObject::FireAccessibleEvent (
    1269             :     const sal_Int16 nEventId,
    1270             :     const uno::Any& rOldValue,
    1271             :     const uno::Any& rNewValue )
    1272             : {
    1273           0 :     AccessibleEventObject aEventObject;
    1274             : 
    1275           0 :     aEventObject.Source = Reference<XWeak>(this);
    1276           0 :     aEventObject.EventId = nEventId;
    1277           0 :     aEventObject.NewValue = rNewValue;
    1278           0 :     aEventObject.OldValue = rOldValue;
    1279             : 
    1280           0 :     ::std::vector<Reference<XAccessibleEventListener> > aListenerCopy(maListeners);
    1281           0 :     for (::std::vector<Reference<XAccessibleEventListener> >::const_iterator
    1282           0 :              iListener(aListenerCopy.begin()),
    1283           0 :              iEnd(aListenerCopy.end());
    1284             :          iListener!=iEnd;
    1285             :          ++iListener)
    1286             :     {
    1287             :         try
    1288             :         {
    1289           0 :             (*iListener)->notifyEvent(aEventObject);
    1290             :         }
    1291           0 :         catch (const lang::DisposedException&)
    1292             :         {
    1293             :             // Listener has been disposed and should have been removed
    1294             :             // already.
    1295           0 :             removeAccessibleEventListener(*iListener);
    1296             :         }
    1297           0 :         catch (const Exception&)
    1298             :         {
    1299             :             // Ignore all other exceptions and assume that they are
    1300             :             // caused by a temporary problem.
    1301             :         }
    1302           0 :     }
    1303           0 : }
    1304             : 
    1305           0 : awt::Point PresenterAccessible::AccessibleObject::GetRelativeLocation()
    1306             : {
    1307           0 :     awt::Point aLocation;
    1308           0 :     if (mxContentWindow.is())
    1309             :     {
    1310           0 :         const awt::Rectangle aContentBox (mxContentWindow->getPosSize());
    1311           0 :         aLocation.X = aContentBox.X;
    1312           0 :         aLocation.Y = aContentBox.Y;
    1313           0 :         if (mxBorderWindow.is())
    1314             :         {
    1315           0 :             const awt::Rectangle aBorderBox (mxBorderWindow->getPosSize());
    1316           0 :             aLocation.X += aBorderBox.X;
    1317           0 :             aLocation.Y += aBorderBox.Y;
    1318             :         }
    1319             :     }
    1320           0 :     return aLocation;
    1321             : }
    1322             : 
    1323           0 : awt::Size PresenterAccessible::AccessibleObject::GetSize()
    1324             : {
    1325           0 :     if (mxContentWindow.is())
    1326             :     {
    1327           0 :         const awt::Rectangle aBox (mxContentWindow->getPosSize());
    1328           0 :         return awt::Size(aBox.Width, aBox.Height);
    1329             :     }
    1330             :     else
    1331           0 :         return awt::Size();
    1332             : }
    1333             : 
    1334           0 : awt::Point PresenterAccessible::AccessibleObject::GetAbsoluteParentLocation()
    1335             : {
    1336           0 :     Reference<XAccessibleComponent> xParentComponent;
    1337           0 :     if (mxParentAccessible.is())
    1338           0 :         xParentComponent = Reference<XAccessibleComponent>(
    1339           0 :             mxParentAccessible->getAccessibleContext(), UNO_QUERY);
    1340           0 :     if (xParentComponent.is())
    1341           0 :         return xParentComponent->getLocationOnScreen();
    1342             :     else
    1343           0 :         return awt::Point();
    1344             : }
    1345             : 
    1346           0 : bool PresenterAccessible::AccessibleObject::IsDisposed() const
    1347             : {
    1348           0 :     return (rBHelper.bDisposed || rBHelper.bInDispose);
    1349             : }
    1350             : 
    1351           0 : void PresenterAccessible::AccessibleObject::ThrowIfDisposed() const
    1352             :     throw (lang::DisposedException)
    1353             : {
    1354           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
    1355           0 :         throw lang::DisposedException("object has already been disposed", uno::Reference<uno::XInterface>(const_cast<uno::XWeak*>(static_cast<uno::XWeak const *>(this))));
    1356           0 : }
    1357             : 
    1358             : //===== AccessibleStateSet ====================================================
    1359             : 
    1360           0 : AccessibleStateSet::AccessibleStateSet (const sal_Int32 nStateSet)
    1361             :     : AccessibleStateSetInterfaceBase(m_aMutex),
    1362           0 :       mnStateSet (nStateSet)
    1363             : {
    1364           0 : }
    1365             : 
    1366           0 : AccessibleStateSet::~AccessibleStateSet()
    1367             : {
    1368           0 : }
    1369             : 
    1370           0 : sal_uInt32 AccessibleStateSet::GetStateMask (const sal_Int16 nState)
    1371             : {
    1372           0 :     if (nState<0 || nState>=sal_Int16(sizeof(sal_uInt32)*8))
    1373             :     {
    1374           0 :         throw RuntimeException("AccessibleStateSet::GetStateMask: invalid state");
    1375             :     }
    1376             : 
    1377           0 :     return 1<<nState;
    1378             : }
    1379             : 
    1380             : //----- XAccessibleStateSet ---------------------------------------------------
    1381             : 
    1382           0 : sal_Bool SAL_CALL AccessibleStateSet::isEmpty()
    1383             :     throw (css::uno::RuntimeException, std::exception)
    1384             : {
    1385           0 :     return mnStateSet==0;
    1386             : }
    1387             : 
    1388           0 : sal_Bool SAL_CALL AccessibleStateSet::contains (sal_Int16 nState)
    1389             :     throw (css::uno::RuntimeException, std::exception)
    1390             : {
    1391           0 :     return (mnStateSet & GetStateMask(nState)) != 0;
    1392             : }
    1393             : 
    1394           0 : sal_Bool SAL_CALL AccessibleStateSet::containsAll (const css::uno::Sequence<sal_Int16>& rStateSet)
    1395             :     throw (css::uno::RuntimeException, std::exception)
    1396             : {
    1397           0 :     for (sal_Int32 nIndex=0,nCount=rStateSet.getLength(); nIndex<nCount; ++nIndex)
    1398             :     {
    1399           0 :         if ((mnStateSet & GetStateMask(rStateSet[nIndex])) == 0)
    1400           0 :             return sal_False;
    1401             :     }
    1402           0 :     return sal_True;
    1403             : }
    1404             : 
    1405           0 : css::uno::Sequence<sal_Int16> SAL_CALL AccessibleStateSet::getStates()
    1406             :     throw (css::uno::RuntimeException, std::exception)
    1407             : {
    1408           0 :     ::std::vector<sal_Int16> aStates;
    1409           0 :     aStates.reserve(sizeof(mnStateSet)*8);
    1410           0 :     for (sal_uInt16 nIndex=0; nIndex<sizeof(mnStateSet)*8; ++nIndex)
    1411           0 :         if ((mnStateSet & GetStateMask(nIndex)) != 0)
    1412           0 :             aStates.push_back(nIndex);
    1413           0 :     return Sequence<sal_Int16>(&aStates.front(), aStates.size());
    1414             : }
    1415             : 
    1416             : //===== AccessibleRelationSet =================================================
    1417             : 
    1418           0 : AccessibleRelationSet::AccessibleRelationSet()
    1419             :     : AccessibleRelationSetInterfaceBase(m_aMutex),
    1420           0 :       maRelations()
    1421             : {
    1422           0 : }
    1423             : 
    1424           0 : AccessibleRelationSet::~AccessibleRelationSet()
    1425             : {
    1426           0 : }
    1427             : 
    1428           0 : void AccessibleRelationSet::AddRelation (
    1429             :     const sal_Int16 nRelationType,
    1430             :     const Reference<XInterface>& rxObject)
    1431             : {
    1432           0 :     maRelations.resize(maRelations.size()+1);
    1433           0 :     maRelations.back().RelationType = nRelationType;
    1434           0 :     maRelations.back().TargetSet.realloc(1);
    1435           0 :     maRelations.back().TargetSet[0] = rxObject;
    1436           0 : }
    1437             : 
    1438             : //----- XAccessibleRelationSet ------------------------------------------------
    1439             : 
    1440           0 : sal_Int32 SAL_CALL AccessibleRelationSet::getRelationCount()
    1441             :     throw (css::uno::RuntimeException, std::exception)
    1442             : {
    1443           0 :     return maRelations.size();
    1444             : }
    1445             : 
    1446           0 : AccessibleRelation SAL_CALL AccessibleRelationSet::getRelation (sal_Int32 nIndex)
    1447             :     throw (css::uno::RuntimeException, css::lang::IndexOutOfBoundsException, std::exception)
    1448             : {
    1449           0 :     if (nIndex<0 && sal_uInt32(nIndex)>=maRelations.size())
    1450           0 :         return AccessibleRelation();
    1451             :     else
    1452           0 :         return maRelations[nIndex];
    1453             : }
    1454             : 
    1455           0 : sal_Bool SAL_CALL AccessibleRelationSet::containsRelation (sal_Int16 nRelationType)
    1456             :     throw (css::uno::RuntimeException, std::exception)
    1457             : {
    1458           0 :     for (::std::vector<AccessibleRelation>::const_iterator iRelation(maRelations.begin());
    1459           0 :          iRelation!=maRelations.end();
    1460             :          ++iRelation)
    1461             :     {
    1462           0 :         if (iRelation->RelationType == nRelationType)
    1463           0 :             return sal_True;
    1464             :     }
    1465           0 :     return sal_False;
    1466             : }
    1467             : 
    1468           0 : AccessibleRelation SAL_CALL AccessibleRelationSet::getRelationByType (sal_Int16 nRelationType)
    1469             :     throw (css::uno::RuntimeException, std::exception)
    1470             : {
    1471           0 :     for (::std::vector<AccessibleRelation>::const_iterator iRelation(maRelations.begin());
    1472           0 :          iRelation!=maRelations.end();
    1473             :          ++iRelation)
    1474             :     {
    1475           0 :         if (iRelation->RelationType == nRelationType)
    1476           0 :             return *iRelation;
    1477             :     }
    1478           0 :     return AccessibleRelation();
    1479             : }
    1480             : 
    1481             : //===== PresenterAccessible::AccessibleParagraph ==============================
    1482             : 
    1483           0 : PresenterAccessible::AccessibleParagraph::AccessibleParagraph (
    1484             :     const lang::Locale& rLocale,
    1485             :     const sal_Int16 nRole,
    1486             :     const OUString& rsName,
    1487             :     const SharedPresenterTextParagraph& rpParagraph,
    1488             :     const sal_Int32 nParagraphIndex)
    1489             :     : PresenterAccessibleParagraphInterfaceBase(rLocale, nRole, rsName),
    1490             :       mpParagraph(rpParagraph),
    1491           0 :       mnParagraphIndex(nParagraphIndex)
    1492             : {
    1493           0 : }
    1494             : 
    1495           0 : PresenterAccessible::AccessibleParagraph::~AccessibleParagraph()
    1496             : {
    1497           0 : }
    1498             : 
    1499             : //----- XAccessibleContext ----------------------------------------------------
    1500             : 
    1501             : Reference<XAccessibleRelationSet> SAL_CALL
    1502           0 :     PresenterAccessible::AccessibleParagraph::getAccessibleRelationSet()
    1503             :     throw (RuntimeException, std::exception)
    1504             : {
    1505           0 :     ThrowIfDisposed();
    1506             : 
    1507           0 :     rtl::Reference<AccessibleRelationSet> pSet (new AccessibleRelationSet);
    1508             : 
    1509           0 :     if (mxParentAccessible.is())
    1510             :     {
    1511           0 :         Reference<XAccessibleContext> xParentContext (mxParentAccessible->getAccessibleContext());
    1512           0 :         if (xParentContext.is())
    1513             :         {
    1514           0 :             if (mnParagraphIndex>0)
    1515             :                 pSet->AddRelation(
    1516             :                     AccessibleRelationType::CONTENT_FLOWS_FROM,
    1517           0 :                     xParentContext->getAccessibleChild(mnParagraphIndex-1));
    1518             : 
    1519           0 :             if (mnParagraphIndex<xParentContext->getAccessibleChildCount()-1)
    1520             :                 pSet->AddRelation(
    1521             :                     AccessibleRelationType::CONTENT_FLOWS_TO,
    1522           0 :                     xParentContext->getAccessibleChild(mnParagraphIndex+1));
    1523           0 :         }
    1524             :     }
    1525             : 
    1526           0 :     return Reference<XAccessibleRelationSet>(pSet.get());
    1527             : }
    1528             : 
    1529             : //----- XAccessibleText -------------------------------------------------------
    1530             : 
    1531           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getCaretPosition()
    1532             :     throw (css::uno::RuntimeException, std::exception)
    1533             : {
    1534           0 :     ThrowIfDisposed();
    1535             : 
    1536           0 :     sal_Int32 nPosition (-1);
    1537           0 :     if (mpParagraph)
    1538           0 :         nPosition = mpParagraph->GetCaretPosition();
    1539             : 
    1540           0 :     return nPosition;
    1541             : }
    1542             : 
    1543           0 : sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::setCaretPosition (sal_Int32 nIndex)
    1544             :     throw (::com::sun::star::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1545             : {
    1546           0 :     ThrowIfDisposed();
    1547             : 
    1548           0 :     if (mpParagraph)
    1549             :     {
    1550           0 :         mpParagraph->SetCaretPosition(nIndex);
    1551           0 :         return sal_True;
    1552             :     }
    1553             :     else
    1554           0 :         return sal_False;
    1555             : }
    1556             : 
    1557           0 : sal_Unicode SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacter (sal_Int32 nIndex)
    1558             :     throw (::com::sun::star::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1559             : {
    1560           0 :     ThrowIfDisposed();
    1561             : 
    1562           0 :     if (!mpParagraph)
    1563           0 :         throw lang::IndexOutOfBoundsException("no text support in current mode", static_cast<uno::XWeak*>(this));
    1564           0 :     return mpParagraph->GetCharacter(nIndex);
    1565             : }
    1566             : 
    1567             : Sequence<css::beans::PropertyValue> SAL_CALL
    1568           0 :     PresenterAccessible::AccessibleParagraph::getCharacterAttributes (
    1569             :         ::sal_Int32 nIndex,
    1570             :         const css::uno::Sequence<OUString>& rRequestedAttributes)
    1571             :     throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1572             : {
    1573           0 :     ThrowIfDisposed();
    1574             : 
    1575             : #if OSL_DEBUG_LEVEL > 1
    1576             :     OSL_TRACE("PresenterAccessible::AccessibleParagraph::getCharacterAttributes at %p,%d returns empty set\r",
    1577             :         this,nIndex);
    1578             :     for (sal_Int32 nAttributeIndex(0),nAttributeCount(rRequestedAttributes.getLength());
    1579             :          nAttributeIndex<nAttributeCount;
    1580             :          ++nAttributeIndex)
    1581             :     {
    1582             :         OSL_TRACE("    requested attribute %d is %s\r",
    1583             :             nAttributeIndex,
    1584             :             OUStringToOString(rRequestedAttributes[nAttributeIndex], RTL_TEXTENCODING_UTF8).getStr());
    1585             :     }
    1586             : #endif
    1587             : 
    1588             :     // Character properties are not supported.
    1589             :     (void)nIndex;
    1590             :     (void)rRequestedAttributes;
    1591           0 :     return Sequence<css::beans::PropertyValue>();
    1592             : }
    1593             : 
    1594           0 : awt::Rectangle SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacterBounds (
    1595             :     sal_Int32 nIndex)
    1596             :     throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1597             : {
    1598           0 :     ThrowIfDisposed();
    1599             : 
    1600           0 :     awt::Rectangle aCharacterBox;
    1601           0 :     if (nIndex < 0)
    1602             :     {
    1603           0 :         throw lang::IndexOutOfBoundsException("invalid text index", static_cast<uno::XWeak*>(this));
    1604             :     }
    1605           0 :     else if (mpParagraph)
    1606             :     {
    1607           0 :         aCharacterBox = mpParagraph->GetCharacterBounds(nIndex, false);
    1608             :         // Convert coordinates relative to the window origin into absolute
    1609             :         // screen coordinates.
    1610           0 :         const awt::Point aWindowLocationOnScreen (getLocationOnScreen());
    1611           0 :         aCharacterBox.X += aWindowLocationOnScreen.X;
    1612           0 :         aCharacterBox.Y += aWindowLocationOnScreen.Y;
    1613             :     }
    1614             :     else
    1615             :     {
    1616           0 :         throw lang::IndexOutOfBoundsException("no text support in current mode", static_cast<uno::XWeak*>(this));
    1617             :     }
    1618             : 
    1619           0 :     return aCharacterBox;
    1620             : }
    1621             : 
    1622           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getCharacterCount()
    1623             :     throw (css::uno::RuntimeException, std::exception)
    1624             : {
    1625           0 :     ThrowIfDisposed();
    1626             : 
    1627           0 :     sal_Int32 nCount (0);
    1628           0 :     if (mpParagraph)
    1629           0 :         nCount = mpParagraph->GetCharacterCount();
    1630             : 
    1631           0 :     return nCount;
    1632             : }
    1633             : 
    1634           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getIndexAtPoint (
    1635             :     const css::awt::Point& )
    1636             :     throw (css::uno::RuntimeException, std::exception)
    1637             : {
    1638           0 :     ThrowIfDisposed();
    1639           0 :     sal_Int32 nIndex (-1);
    1640           0 :     return nIndex;
    1641             : }
    1642             : 
    1643           0 : OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectedText()
    1644             :     throw (css::uno::RuntimeException, std::exception)
    1645             : {
    1646           0 :     ThrowIfDisposed();
    1647             : 
    1648           0 :     return getTextRange(getSelectionStart(), getSelectionEnd());
    1649             : }
    1650             : 
    1651           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectionStart()
    1652             :     throw (css::uno::RuntimeException, std::exception)
    1653             : {
    1654           0 :     ThrowIfDisposed();
    1655             : 
    1656           0 :     return getCaretPosition();
    1657             : }
    1658             : 
    1659           0 : sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectionEnd()
    1660             :     throw (css::uno::RuntimeException, std::exception)
    1661             : {
    1662           0 :     ThrowIfDisposed();
    1663             : 
    1664           0 :     return getCaretPosition();
    1665             : }
    1666             : 
    1667           0 : sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::setSelection (
    1668             :     sal_Int32 nStartIndex,
    1669             :     sal_Int32 nEndIndex)
    1670             :     throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1671             : {
    1672             :     (void)nEndIndex;
    1673           0 :     ThrowIfDisposed();
    1674             : 
    1675           0 :     return setCaretPosition(nStartIndex);
    1676             : }
    1677             : 
    1678           0 : OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getText()
    1679             :     throw (css::uno::RuntimeException, std::exception)
    1680             : {
    1681           0 :     ThrowIfDisposed();
    1682             : 
    1683           0 :     OUString sText;
    1684           0 :     if (mpParagraph)
    1685           0 :         sText = mpParagraph->GetText();
    1686             : 
    1687           0 :     return sText;
    1688             : }
    1689             : 
    1690           0 : OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getTextRange (
    1691             :     sal_Int32 nLocalStartIndex,
    1692             :     sal_Int32 nLocalEndIndex)
    1693             :     throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1694             : {
    1695           0 :     ThrowIfDisposed();
    1696             : 
    1697           0 :     OUString sText;
    1698           0 :     if (mpParagraph)
    1699             :     {
    1700             :         const TextSegment aSegment (
    1701           0 :             mpParagraph->CreateTextSegment(nLocalStartIndex, nLocalEndIndex));
    1702           0 :         sText = aSegment.SegmentText;
    1703             :     }
    1704             : 
    1705           0 :     return sText;
    1706             : }
    1707             : 
    1708           0 : TextSegment SAL_CALL PresenterAccessible::AccessibleParagraph::getTextAtIndex (
    1709             :     sal_Int32 nLocalCharacterIndex,
    1710             :     sal_Int16 nTextType)
    1711             :     throw (css::lang::IndexOutOfBoundsException,
    1712             :         css::lang::IllegalArgumentException,
    1713             :         css::uno::RuntimeException, std::exception)
    1714             : {
    1715           0 :     ThrowIfDisposed();
    1716             : 
    1717           0 :     TextSegment aSegment;
    1718           0 :     if (mpParagraph)
    1719           0 :         aSegment = mpParagraph->GetTextSegment(0, nLocalCharacterIndex, nTextType);
    1720             : 
    1721           0 :     return aSegment;
    1722             : }
    1723             : 
    1724           0 : TextSegment SAL_CALL PresenterAccessible::AccessibleParagraph::getTextBeforeIndex (
    1725             :     sal_Int32 nLocalCharacterIndex,
    1726             :     sal_Int16 nTextType)
    1727             :     throw (css::lang::IndexOutOfBoundsException,
    1728             :         css::lang::IllegalArgumentException,
    1729             :         css::uno::RuntimeException, std::exception)
    1730             : {
    1731           0 :     ThrowIfDisposed();
    1732             : 
    1733           0 :     TextSegment aSegment;
    1734           0 :     if (mpParagraph)
    1735           0 :         aSegment = mpParagraph->GetTextSegment(-1, nLocalCharacterIndex, nTextType);
    1736             : 
    1737           0 :     return aSegment;
    1738             : }
    1739             : 
    1740           0 : TextSegment SAL_CALL PresenterAccessible::AccessibleParagraph::getTextBehindIndex (
    1741             :     sal_Int32 nLocalCharacterIndex,
    1742             :     sal_Int16 nTextType)
    1743             :     throw (css::lang::IndexOutOfBoundsException,
    1744             :         css::lang::IllegalArgumentException,
    1745             :         css::uno::RuntimeException, std::exception)
    1746             : {
    1747           0 :     ThrowIfDisposed();
    1748             : 
    1749           0 :     TextSegment aSegment;
    1750           0 :     if (mpParagraph)
    1751           0 :         aSegment = mpParagraph->GetTextSegment(+1, nLocalCharacterIndex, nTextType);
    1752             : 
    1753           0 :     return aSegment;
    1754             : }
    1755             : 
    1756           0 : sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::copyText (
    1757             :     sal_Int32 nStartIndex,
    1758             :     sal_Int32 nEndIndex)
    1759             :     throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
    1760             : {
    1761           0 :     ThrowIfDisposed();
    1762             : 
    1763             :     // Return false because copying to clipboard is not supported.
    1764             :     // It IS supported in the notes view.  There is no need to duplicate
    1765             :     // this here.
    1766             :     (void)nStartIndex;
    1767             :     (void)nEndIndex;
    1768           0 :     return sal_False;
    1769             : }
    1770             : 
    1771             : //----- protected -------------------------------------------------------------
    1772             : 
    1773           0 : awt::Point PresenterAccessible::AccessibleParagraph::GetRelativeLocation()
    1774             : {
    1775           0 :     awt::Point aLocation (AccessibleObject::GetRelativeLocation());
    1776           0 :     if (mpParagraph)
    1777             :     {
    1778           0 :         const awt::Point aParagraphLocation (mpParagraph->GetRelativeLocation());
    1779           0 :         aLocation.X += aParagraphLocation.X;
    1780           0 :         aLocation.Y += aParagraphLocation.Y;
    1781             :     }
    1782             : 
    1783           0 :     return aLocation;
    1784             : }
    1785             : 
    1786           0 : awt::Size PresenterAccessible::AccessibleParagraph::GetSize()
    1787             : {
    1788           0 :     if (mpParagraph)
    1789           0 :         return mpParagraph->GetSize();
    1790             :     else
    1791           0 :         return AccessibleObject::GetSize();
    1792             : }
    1793             : 
    1794           0 : awt::Point PresenterAccessible::AccessibleParagraph::GetAbsoluteParentLocation()
    1795             : {
    1796           0 :     if (mxParentAccessible.is())
    1797             :     {
    1798             :         Reference<XAccessibleContext> xParentContext(
    1799           0 :             mxParentAccessible->getAccessibleContext(), UNO_QUERY);
    1800           0 :         if (xParentContext.is())
    1801             :         {
    1802             :             Reference<XAccessibleComponent> xGrandParentComponent(
    1803           0 :                 xParentContext->getAccessibleParent(), UNO_QUERY);
    1804           0 :             if (xGrandParentComponent.is())
    1805           0 :                 return xGrandParentComponent->getLocationOnScreen();
    1806           0 :         }
    1807             :     }
    1808             : 
    1809           0 :     return awt::Point();
    1810             : }
    1811             : 
    1812           0 : bool PresenterAccessible::AccessibleParagraph::GetWindowState (const sal_Int16 nType) const
    1813             : {
    1814           0 :     switch (nType)
    1815             :     {
    1816             :         case AccessibleStateType::EDITABLE:
    1817           0 :             return mpParagraph.get()!=NULL;
    1818             : 
    1819             :         case AccessibleStateType::ACTIVE:
    1820           0 :             return true;
    1821             : 
    1822             :         default:
    1823           0 :             return AccessibleObject::GetWindowState(nType);
    1824             :     }
    1825             : }
    1826             : 
    1827             : //===== AccessibleNotes =======================================================
    1828             : 
    1829           0 : AccessibleNotes::AccessibleNotes (
    1830             :     const css::lang::Locale& rLocale,
    1831             :     const sal_Int16 nRole,
    1832             :     const OUString& rsName)
    1833             :     : AccessibleObject(rLocale,nRole,rsName),
    1834           0 :       mpTextView()
    1835             : {
    1836           0 : }
    1837             : 
    1838           0 : rtl::Reference<PresenterAccessible::AccessibleObject> AccessibleNotes::Create (
    1839             :     const css::uno::Reference<css::uno::XComponentContext>& rxContext,
    1840             :     const lang::Locale& rLocale,
    1841             :     const Reference<awt::XWindow>& rxContentWindow,
    1842             :     const Reference<awt::XWindow>& rxBorderWindow,
    1843             :     const ::boost::shared_ptr<PresenterTextView>& rpTextView)
    1844             : {
    1845           0 :     OUString sName ("Presenter Notes Text");
    1846             :     {
    1847             :         PresenterConfigurationAccess aConfiguration (
    1848             :             rxContext,
    1849             :             OUString("/org.openoffice.Office.PresenterScreen/"),
    1850           0 :             PresenterConfigurationAccess::READ_ONLY);
    1851             :         aConfiguration.GetConfigurationNode("Presenter/Accessibility/Notes/String")
    1852           0 :             >>= sName;
    1853             :     }
    1854             : 
    1855             :     rtl::Reference<AccessibleNotes> pObject (
    1856             :         new AccessibleNotes(
    1857             :             rLocale,
    1858             :             AccessibleRole::PANEL,
    1859           0 :             sName));
    1860           0 :     pObject->LateInitialization();
    1861           0 :     pObject->SetTextView(rpTextView);
    1862           0 :     pObject->UpdateStateSet();
    1863           0 :     pObject->SetWindow(rxContentWindow, rxBorderWindow);
    1864             : 
    1865           0 :     return rtl::Reference<PresenterAccessible::AccessibleObject>(pObject.get());
    1866             : }
    1867             : 
    1868           0 : void AccessibleNotes::SetTextView (
    1869             :     const ::boost::shared_ptr<PresenterTextView>& rpTextView)
    1870             : {
    1871           0 :     ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> > aChildren;
    1872             : 
    1873             :     // Release any listeners to the current text view.
    1874           0 :     if (mpTextView)
    1875             :     {
    1876             :         mpTextView->GetCaret()->SetCaretMotionBroadcaster(
    1877           0 :             ::boost::function<void(sal_Int32,sal_Int32,sal_Int32,sal_Int32)>());
    1878             :         mpTextView->SetTextChangeBroadcaster(
    1879           0 :             ::boost::function<void()>());
    1880             :     }
    1881             : 
    1882           0 :     mpTextView = rpTextView;
    1883             : 
    1884           0 :     if (mpTextView)
    1885             :     {
    1886             :         // Create a new set of children, one for each paragraph.
    1887           0 :         const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount());
    1888           0 :         for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
    1889             :         {
    1890             :             rtl::Reference<PresenterAccessible::AccessibleParagraph> pParagraph (
    1891             :                 new PresenterAccessible::AccessibleParagraph(
    1892             :                     css::lang::Locale(),
    1893             :                     AccessibleRole::PARAGRAPH,
    1894           0 :                     "Paragraph"+OUString::number(nIndex),
    1895             :                     rpTextView->GetParagraph(nIndex),
    1896           0 :                     nIndex));
    1897           0 :             pParagraph->LateInitialization();
    1898           0 :             pParagraph->SetWindow(
    1899             :                 Reference<awt::XWindow>(mxContentWindow, UNO_QUERY),
    1900           0 :                 Reference<awt::XWindow>(mxBorderWindow, UNO_QUERY));
    1901           0 :             pParagraph->SetAccessibleParent(this);
    1902             :             aChildren.push_back(
    1903           0 :                 rtl::Reference<PresenterAccessible::AccessibleObject>(pParagraph.get()));
    1904           0 :         }
    1905           0 :         maChildren.swap(aChildren);
    1906           0 :         FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
    1907             : 
    1908             :         // Dispose the old children. (This will remove them from the focus
    1909             :         // manager).
    1910           0 :         for (std::vector<rtl::Reference<AccessibleObject> >::const_iterator
    1911           0 :                  iChild(aChildren.begin()), iEnd(aChildren.end());
    1912             :              iChild!=iEnd;
    1913             :              ++iChild)
    1914             :         {
    1915           0 :             Reference<lang::XComponent> xComponent (static_cast<XWeak*>(iChild->get()), UNO_QUERY);
    1916           0 :             if (xComponent.is())
    1917           0 :                 xComponent->dispose();
    1918           0 :         }
    1919             : 
    1920             :         // This class acts as a controller of who broadcasts caret motion
    1921             :         // events and handles text changes.  Register the corresponding
    1922             :         // listeners here.
    1923             :         mpTextView->GetCaret()->SetCaretMotionBroadcaster(
    1924           0 :             ::boost::bind(&AccessibleNotes::NotifyCaretChange, this, _1, _2, _3, _4));
    1925             :         mpTextView->SetTextChangeBroadcaster(
    1926           0 :             ::boost::bind(&AccessibleNotes::HandleTextChange, this));
    1927           0 :     }
    1928           0 : }
    1929             : 
    1930           0 : void AccessibleNotes::SetWindow (
    1931             :     const css::uno::Reference<css::awt::XWindow>& rxContentWindow,
    1932             :     const css::uno::Reference<css::awt::XWindow>& rxBorderWindow)
    1933             : {
    1934           0 :     AccessibleObject::SetWindow(rxContentWindow, rxBorderWindow);
    1935             : 
    1936             :     // Set the windows at the children as well, so that every paragraph can
    1937             :     // setup its geometry.
    1938           0 :     for (::std::vector<rtl::Reference<AccessibleObject> >::const_iterator
    1939           0 :              iChild(maChildren.begin()),
    1940           0 :              iEnd(maChildren.end());
    1941             :          iChild!=iEnd;
    1942             :          ++iChild)
    1943             :     {
    1944           0 :         (*iChild)->SetWindow(rxContentWindow, rxBorderWindow);
    1945             :     }
    1946           0 : }
    1947             : 
    1948           0 : void AccessibleNotes::NotifyCaretChange (
    1949             :     const sal_Int32 nOldParagraphIndex,
    1950             :     const sal_Int32 nOldCharacterIndex,
    1951             :     const sal_Int32 nNewParagraphIndex,
    1952             :     const sal_Int32 nNewCharacterIndex)
    1953             : {
    1954             :     AccessibleFocusManager::Instance()->FocusObject(
    1955             :         nNewParagraphIndex >= 0
    1956           0 :             ? maChildren[nNewParagraphIndex]
    1957           0 :             : this);
    1958             : 
    1959           0 :     if (nOldParagraphIndex != nNewParagraphIndex)
    1960             :     {
    1961             :         // Moved caret from one paragraph to another (or showed or
    1962             :         // hid the caret).  Move focuse from one accessible
    1963             :         // paragraph to another.
    1964           0 :         if (nOldParagraphIndex >= 0)
    1965             :         {
    1966           0 :             maChildren[nOldParagraphIndex]->FireAccessibleEvent(
    1967             :                 AccessibleEventId::CARET_CHANGED,
    1968             :                 Any(nOldCharacterIndex),
    1969           0 :                 Any(sal_Int32(-1)));
    1970             :         }
    1971           0 :         if (nNewParagraphIndex >= 0)
    1972             :         {
    1973           0 :             maChildren[nNewParagraphIndex]->FireAccessibleEvent(
    1974             :                 AccessibleEventId::CARET_CHANGED,
    1975             :                 Any(sal_Int32(-1)),
    1976           0 :                 Any(nNewCharacterIndex));
    1977             :         }
    1978             :     }
    1979           0 :     else if (nNewParagraphIndex >= 0)
    1980             :     {
    1981             :         // Caret moved inside one paragraph.
    1982           0 :         maChildren[nNewParagraphIndex]->FireAccessibleEvent(
    1983             :             AccessibleEventId::CARET_CHANGED,
    1984             :             Any(nOldCharacterIndex),
    1985           0 :             Any(nNewCharacterIndex));
    1986             :     }
    1987           0 : }
    1988             : 
    1989           0 : void AccessibleNotes::HandleTextChange()
    1990             : {
    1991           0 :     SetTextView(mpTextView);
    1992           0 : }
    1993             : 
    1994             : //===== AccessibleFocusManager ================================================
    1995             : 
    1996           6 : ::boost::shared_ptr<AccessibleFocusManager> AccessibleFocusManager::mpInstance;
    1997             : 
    1998           0 : ::boost::shared_ptr<AccessibleFocusManager> AccessibleFocusManager::Instance()
    1999             : {
    2000           0 :     if ( ! mpInstance)
    2001             :     {
    2002           0 :         mpInstance.reset(new AccessibleFocusManager());
    2003             :     }
    2004           0 :     return mpInstance;
    2005             : }
    2006             : 
    2007           0 : AccessibleFocusManager::AccessibleFocusManager()
    2008           0 :     : maFocusableObjects()
    2009             : {
    2010           0 : }
    2011             : 
    2012           0 : void AccessibleFocusManager::AddFocusableObject (
    2013             :     const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject)
    2014             : {
    2015             :     OSL_ASSERT(rpObject.is());
    2016             :     OSL_ASSERT(::std::find(maFocusableObjects.begin(),maFocusableObjects.end(), rpObject)==maFocusableObjects.end());
    2017             : 
    2018           0 :     maFocusableObjects.push_back(rpObject);
    2019           0 : }
    2020             : 
    2021           0 : void AccessibleFocusManager::RemoveFocusableObject (
    2022             :     const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject)
    2023             : {
    2024             :     ::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> >::iterator iObject (
    2025           0 :         ::std::find(maFocusableObjects.begin(),maFocusableObjects.end(), rpObject));
    2026             : 
    2027           0 :     if (iObject != maFocusableObjects.end())
    2028           0 :         maFocusableObjects.erase(iObject);
    2029             :     else
    2030             :     {
    2031             :         OSL_ASSERT(iObject!=maFocusableObjects.end());
    2032             :     }
    2033           0 : }
    2034             : 
    2035           0 : void AccessibleFocusManager::FocusObject (
    2036             :     const ::rtl::Reference<PresenterAccessible::AccessibleObject>& rpObject)
    2037             : {
    2038             :     // Remove the focus of any of the other focusable objects.
    2039           0 :     for (::std::vector<rtl::Reference<PresenterAccessible::AccessibleObject> >::const_iterator
    2040           0 :              iObject (maFocusableObjects.begin()),
    2041           0 :              iEnd (maFocusableObjects.end());
    2042             :          iObject != iEnd;
    2043             :          ++iObject)
    2044             :     {
    2045           0 :         if (*iObject!=rpObject)
    2046           0 :             (*iObject)->SetIsFocused(false);
    2047             :     }
    2048             : 
    2049           0 :     if (rpObject.is())
    2050           0 :         rpObject->SetIsFocused(true);
    2051           0 : }
    2052             : 
    2053          18 : } } // end of namespace ::sd::presenter
    2054             : 
    2055             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11