LCOV - code coverage report
Current view: top level - sd/source/ui/accessibility - AccessibleOutlineView.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 74 0.0 %
Date: 2012-08-25 Functions: 0 19 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 96 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/drawing/XDrawPage.hpp>
      30                 :            : #include <com/sun/star/drawing/XDrawView.hpp>
      31                 :            : #include <com/sun/star/drawing/XShapes.hpp>
      32                 :            : #include <com/sun/star/container/XChild.hpp>
      33                 :            : #include <com/sun/star/frame/XController.hpp>
      34                 :            : #include <com/sun/star/frame/XFrame.hpp>
      35                 :            : #include <com/sun/star/document/XEventBroadcaster.hpp>
      36                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      37                 :            : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      38                 :            : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      39                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      40                 :            : #include <rtl/ustring.h>
      41                 :            : #include<sfx2/viewfrm.hxx>
      42                 :            : 
      43                 :            : #include <svx/AccessibleShape.hxx>
      44                 :            : 
      45                 :            : #include <svx/svdobj.hxx>
      46                 :            : #include <svx/svdmodel.hxx>
      47                 :            : #include <svx/unoapi.hxx>
      48                 :            : #include <toolkit/helper/vclunohelper.hxx>
      49                 :            : #include <vcl/svapp.hxx>
      50                 :            : #include "Window.hxx"
      51                 :            : #include "ViewShell.hxx"
      52                 :            : #include "OutlineViewShell.hxx"
      53                 :            : #include "View.hxx"
      54                 :            : #include "AccessibleOutlineView.hxx"
      55                 :            : #include "AccessibleOutlineEditSource.hxx"
      56                 :            : 
      57                 :            : #include <memory>
      58                 :            : 
      59                 :            : #include "accessibility.hrc"
      60                 :            : #include "sdresid.hxx"
      61                 :            : #include <osl/mutex.hxx>
      62                 :            : 
      63                 :            : using namespace ::com::sun::star;
      64                 :            : using namespace ::com::sun::star::accessibility;
      65                 :            : 
      66                 :            : namespace accessibility {
      67                 :            : 
      68                 :            : 
      69                 :            : //=====  internal  ============================================================
      70                 :            : 
      71                 :          0 : AccessibleOutlineView::AccessibleOutlineView (
      72                 :            :     ::sd::Window* pSdWindow,
      73                 :            :     ::sd::OutlineViewShell* pViewShell,
      74                 :            :     const uno::Reference<frame::XController>& rxController,
      75                 :            :     const uno::Reference<XAccessible>& rxParent)
      76                 :            :     : AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent),
      77 [ #  # ][ #  # ]:          0 :       maTextHelper( ::std::auto_ptr< SvxEditSource >( NULL ) )
                 [ #  # ]
      78                 :            : {
      79         [ #  # ]:          0 :     SolarMutexGuard aGuard;
      80                 :            : 
      81                 :            :     // Beware! Here we leave the paths of the UNO API and descend into the
      82                 :            :     // depths of the core.  Necessary for making the edit engine accessible.
      83 [ #  # ][ #  # ]:          0 :     if( pViewShell && pSdWindow )
      84                 :            :     {
      85                 :          0 :         ::sd::View* pView = pViewShell->GetView();
      86                 :            : 
      87 [ #  # ][ #  # ]:          0 :         if (pView && pView->ISA(::sd::OutlineView))
         [ #  # ][ #  # ]
                 [ #  # ]
      88                 :            :         {
      89                 :            :             OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>(
      90         [ #  # ]:          0 :                 pView)->GetViewByWindow( pSdWindow );
      91                 :            :             SdrOutliner* pOutliner =
      92                 :          0 :                 static_cast< ::sd::OutlineView*>(pView)->GetOutliner();
      93                 :            : 
      94 [ #  # ][ #  # ]:          0 :             if( pOutlineView && pOutliner )
      95                 :            :             {
      96                 :            :                 maTextHelper.SetEditSource( ::std::auto_ptr< SvxEditSource >( new AccessibleOutlineEditSource(
      97 [ #  # ][ #  # ]:          0 :                                                                                   *pOutliner, *pView, *pOutlineView, *pSdWindow ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
      98                 :            :             }
      99                 :            :         }
     100         [ #  # ]:          0 :     }
     101                 :          0 : }
     102                 :            : 
     103                 :            : 
     104         [ #  # ]:          0 : AccessibleOutlineView::~AccessibleOutlineView (void)
     105                 :            : {
     106                 :            :     OSL_TRACE ("~AccessibleOutlineView");
     107         [ #  # ]:          0 : }
     108                 :            : 
     109                 :            : 
     110                 :          0 : void AccessibleOutlineView::Init (void)
     111                 :            : {
     112                 :            :     // Set event source _before_ starting to listen
     113         [ #  # ]:          0 :     maTextHelper.SetEventSource(this);
     114                 :            : 
     115                 :          0 :     AccessibleDocumentViewBase::Init ();
     116                 :          0 : }
     117                 :            : 
     118                 :            : 
     119                 :          0 : void AccessibleOutlineView::ViewForwarderChanged (ChangeType aChangeType,
     120                 :            :     const IAccessibleViewForwarder* pViewForwarder)
     121                 :            : {
     122                 :          0 :     AccessibleDocumentViewBase::ViewForwarderChanged (aChangeType, pViewForwarder);
     123                 :            : 
     124                 :          0 :     UpdateChildren();
     125                 :          0 : }
     126                 :            : 
     127                 :            : 
     128                 :            : //=====  XAccessibleContext  ==================================================
     129                 :            : 
     130                 :            : sal_Int32 SAL_CALL
     131                 :          0 :     AccessibleOutlineView::getAccessibleChildCount (void)
     132                 :            :     throw (uno::RuntimeException)
     133                 :            : {
     134                 :          0 :     ThrowIfDisposed ();
     135                 :            : 
     136                 :            :     // forward
     137                 :          0 :     return maTextHelper.GetChildCount();
     138                 :            : }
     139                 :            : 
     140                 :            : 
     141                 :            : uno::Reference<XAccessible> SAL_CALL
     142                 :          0 :     AccessibleOutlineView::getAccessibleChild (sal_Int32 nIndex)
     143                 :            :     throw (::com::sun::star::uno::RuntimeException)
     144                 :            : {
     145                 :          0 :     ThrowIfDisposed ();
     146                 :            :     // Forward request to children manager.
     147                 :          0 :     return maTextHelper.GetChild(nIndex);
     148                 :            : }
     149                 :            : 
     150                 :            : //=====  XAccessibleEventBroadcaster  ========================================
     151                 :            : 
     152                 :          0 : void SAL_CALL AccessibleOutlineView::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
     153                 :            : {
     154                 :            :     // delegate listener handling to children manager.
     155         [ #  # ]:          0 :     if ( ! IsDisposed())
     156                 :          0 :         maTextHelper.AddEventListener(xListener);
     157                 :          0 : }
     158                 :            : 
     159                 :          0 : void SAL_CALL AccessibleOutlineView::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
     160                 :            : {
     161                 :            :     // forward
     162         [ #  # ]:          0 :     if ( ! IsDisposed())
     163                 :          0 :         maTextHelper.RemoveEventListener(xListener);
     164                 :          0 : }
     165                 :            : 
     166                 :            : //=====  XServiceInfo  ========================================================
     167                 :            : 
     168                 :            : ::rtl::OUString SAL_CALL
     169                 :          0 :     AccessibleOutlineView::getImplementationName (void)
     170                 :            :     throw (::com::sun::star::uno::RuntimeException)
     171                 :            : {
     172                 :          0 :     return ::rtl::OUString("AccessibleOutlineView");
     173                 :            : }
     174                 :            : 
     175                 :            : 
     176                 :            : //=====  XEventListener  ======================================================
     177                 :            : 
     178                 :            : void SAL_CALL
     179                 :          0 :     AccessibleOutlineView::disposing (const lang::EventObject& rEventObject)
     180                 :            :     throw (::com::sun::star::uno::RuntimeException)
     181                 :            : {
     182                 :          0 :     AccessibleDocumentViewBase::disposing (rEventObject);
     183                 :          0 : }
     184                 :            : 
     185                 :            : //=====  protected internal  ==================================================
     186                 :            : 
     187                 :          0 : void AccessibleOutlineView::FireEvent(const AccessibleEventObject& aEvent )
     188                 :            : {
     189                 :            :     // delegate listener handling to children manager.
     190                 :          0 :     maTextHelper.FireEvent(aEvent);
     191                 :          0 : }
     192                 :            : 
     193                 :          0 : void AccessibleOutlineView::Activated (void)
     194                 :            : {
     195         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     196                 :            : 
     197                 :            :     // delegate listener handling to children manager.
     198 [ #  # ][ #  # ]:          0 :     maTextHelper.SetFocus(sal_True);
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : void AccessibleOutlineView::Deactivated (void)
     202                 :            : {
     203         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     204                 :            : 
     205                 :            :     // delegate listener handling to children manager.
     206 [ #  # ][ #  # ]:          0 :     maTextHelper.SetFocus(sal_False);
     207                 :          0 : }
     208                 :            : 
     209                 :          0 : void SAL_CALL AccessibleOutlineView::disposing (void)
     210                 :            : {
     211                 :            :     // dispose children
     212                 :          0 :     maTextHelper.Dispose();
     213                 :            : 
     214                 :          0 :     AccessibleDocumentViewBase::disposing ();
     215                 :          0 : }
     216                 :            : 
     217                 :            : //=====  XPropertyChangeListener  =============================================
     218                 :            : 
     219                 :            : void SAL_CALL
     220                 :          0 :     AccessibleOutlineView::propertyChange (const beans::PropertyChangeEvent& rEventObject)
     221                 :            :     throw (::com::sun::star::uno::RuntimeException)
     222                 :            : {
     223                 :          0 :     ThrowIfDisposed ();
     224                 :            : 
     225                 :          0 :     AccessibleDocumentViewBase::propertyChange (rEventObject);
     226                 :            : 
     227                 :            :     OSL_TRACE ("AccessibleOutlineView::propertyChange");
     228         [ #  # ]:          0 :     if ( rEventObject.PropertyName == "CurrentPage" )
     229                 :            :     {
     230                 :            :         OSL_TRACE ("    current page changed");
     231                 :            : 
     232                 :            :         // The current page changed. Update the children accordingly.
     233                 :          0 :         UpdateChildren();
     234                 :            :     }
     235         [ #  # ]:          0 :     else if ( rEventObject.PropertyName == "VisibleArea" )
     236                 :            :     {
     237                 :            :         OSL_TRACE ("    visible area changed");
     238                 :            : 
     239                 :            :         // The visible area changed. Update the children accordingly.
     240                 :          0 :         UpdateChildren();
     241                 :            :     }
     242                 :            :     else
     243                 :            :     {
     244                 :            :         OSL_TRACE ("  unhandled");
     245                 :            :     }
     246                 :            :     OSL_TRACE ("  done");
     247                 :          0 : }
     248                 :            : 
     249                 :            : 
     250                 :            : /// Create a name for this view.
     251                 :            : ::rtl::OUString
     252                 :          0 :     AccessibleOutlineView::CreateAccessibleName (void)
     253                 :            :     throw (::com::sun::star::uno::RuntimeException)
     254                 :            : {
     255         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     256                 :            : 
     257 [ #  # ][ #  # ]:          0 :     return String( SdResId(SID_SD_A11Y_I_OUTLINEVIEW_N) );
         [ #  # ][ #  # ]
                 [ #  # ]
     258                 :            : }
     259                 :            : 
     260                 :            : 
     261                 :            : /** Create a description for this view.  Use the model's description or URL
     262                 :            :     if a description is not available.
     263                 :            : */
     264                 :            : ::rtl::OUString
     265                 :          0 :     AccessibleOutlineView::CreateAccessibleDescription (void)
     266                 :            :     throw (::com::sun::star::uno::RuntimeException)
     267                 :            : {
     268         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     269                 :            : 
     270 [ #  # ][ #  # ]:          0 :     return String( SdResId(SID_SD_A11Y_I_OUTLINEVIEW_D) );
         [ #  # ][ #  # ]
                 [ #  # ]
     271                 :            : }
     272                 :            : 
     273                 :          0 : void AccessibleOutlineView::UpdateChildren()
     274                 :            : {
     275         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     276                 :            : 
     277                 :            :     // Update visible children
     278 [ #  # ][ #  # ]:          0 :     maTextHelper.UpdateChildren();
     279                 :          0 : }
     280                 :            : 
     281                 :            : } // end of namespace accessibility
     282                 :            : 
     283                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10