LCOV - code coverage report
Current view: top level - sw/inc - accmap.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 2 0.0 %
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             : #ifndef INCLUDED_SW_INC_ACCMAP_HXX
      20             : #define INCLUDED_SW_INC_ACCMAP_HXX
      21             : 
      22             : #include <cppuhelper/weakref.hxx>
      23             : #include <com/sun/star/accessibility/XAccessible.hpp>
      24             : #include <rtl/ref.hxx>
      25             : #include <osl/mutex.hxx>
      26             : #include <svx/IAccessibleViewForwarder.hxx>
      27             : #include <svx/IAccessibleParent.hxx>
      28             : #include <tools/fract.hxx>
      29             : 
      30             : #include <svx/AccessibleControlShape.hxx>
      31             : #include <svx/AccessibleShape.hxx>
      32             : #include "fesh.hxx"
      33             : #include <vector>
      34             : #include <set>
      35             : class SwAccessibleParagraph;
      36             : 
      37             : class SwViewShell;
      38             : class Rectangle;
      39             : class SwFrm;
      40             : class SwTxtFrm;
      41             : class SwPageFrm;
      42             : class SwAccessibleContext;
      43             : class SwAccessibleContextMap_Impl;
      44             : class SwAccessibleEventList_Impl;
      45             : class SwAccessibleEventMap_Impl;
      46             : class SwShapeList_Impl;
      47             : class SdrObject;
      48             : namespace accessibility {
      49             :     class AccessibleShape;
      50             : }
      51             : class SwAccessibleShapeMap_Impl;
      52             : struct SwAccessibleEvent_Impl;
      53             : class SwAccessibleSelectedParas_Impl;
      54             : class SwRect;
      55             : class MapMode;
      56             : class SwAccPreviewData;
      57             : struct PreviewPage;
      58             : class Window;
      59             : 
      60             : // real states for events
      61             : #define ACC_STATE_EDITABLE 0x01
      62             : #define ACC_STATE_OPAQUE 0x02
      63             : 
      64             : // pseudo states for events
      65             : #define ACC_STATE_TEXT_ATTRIBUTE_CHANGED 0x0200
      66             : #define ACC_STATE_TEXT_SELECTION_CHANGED 0x0100
      67             : #define ACC_STATE_CARET 0x80
      68             : #define ACC_STATE_RELATION_FROM 0x40
      69             : #define ACC_STATE_RELATION_TO 0x20
      70             : 
      71             : #define ACC_STATE_RELATION_MASK 0x60
      72             : 
      73             : #define ACC_STATE_MASK 0x1F
      74             : 
      75             : typedef sal_uInt16 tAccessibleStates;
      76             : 
      77             : class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
      78             :                         public ::accessibility::IAccessibleParent
      79             : {
      80             :     mutable ::osl::Mutex maMutex;
      81             :     ::osl::Mutex maEventMutex;
      82             :     SwAccessibleContextMap_Impl *mpFrmMap;
      83             :     SwAccessibleShapeMap_Impl *mpShapeMap;
      84             :     SwShapeList_Impl *mpShapes;
      85             :     SwAccessibleEventList_Impl *mpEvents;
      86             :     SwAccessibleEventMap_Impl *mpEventMap;
      87             :     // #i27301 data structure to keep information about
      88             :     // accessible paragraph, which have a selection.
      89             :     SwAccessibleSelectedParas_Impl* mpSelectedParas;
      90             :     SwViewShell *mpVSh;
      91             :     /// for page preview: store preview data, VisArea, and mapping of
      92             :     /// preview-to-display coordinates
      93             :     SwAccPreviewData* mpPreview;
      94             : 
      95             :     ::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible > mxCursorContext;
      96             : 
      97             :     sal_Int32 mnPara;
      98             : 
      99             :     bool mbShapeSelected;
     100             : 
     101             :     void FireEvent( const SwAccessibleEvent_Impl& rEvent );
     102             : 
     103             :     void AppendEvent( const SwAccessibleEvent_Impl& rEvent );
     104             : 
     105             :     void InvalidateCursorPosition(
     106             :         const ::com::sun::star::uno::Reference<
     107             :             ::com::sun::star::accessibility::XAccessible>& rAcc );
     108             :     void DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode = sal_False);
     109             : 
     110             :     void InvalidateShapeSelection();
     111             : 
     112             :     //mpSelectedFrmMap contains the old selected objects.
     113             :     SwAccessibleContextMap_Impl *mpSeletedFrmMap;
     114             :     //IvalidateShapeInParaSelection() method is reponsible for the updating the selected states of the objects.
     115             :     void InvalidateShapeInParaSelection();
     116             : 
     117             :     void _InvalidateRelationSet( const SwFrm* pFrm, bool bFrom );
     118             : 
     119             :     ::com::sun::star::uno::Reference<
     120             :         ::com::sun::star::accessibility::XAccessible>
     121             :             _GetDocumentView( bool bPagePreview );
     122             : 
     123             :     /** method to build up a new data structure of the accessible pararaphs,
     124             :         which have a selection
     125             : 
     126             :         Important note: method has to used inside a mutual exclusive section
     127             : 
     128             :         @author OD
     129             :     */
     130             :     SwAccessibleSelectedParas_Impl* _BuildSelectedParas();
     131             : 
     132             : public:
     133             : 
     134             :     SwAccessibleMap( SwViewShell *pSh );
     135             :     virtual ~SwAccessibleMap();
     136             : 
     137             :     ::com::sun::star::uno::Reference<
     138             :         ::com::sun::star::accessibility::XAccessible> GetDocumentView();
     139             : 
     140             :     ::com::sun::star::uno::Reference<
     141             :         ::com::sun::star::accessibility::XAccessible> GetDocumentPreview(
     142             :                             const std::vector<PreviewPage*>& _rPreviewPages,
     143             :                             const Fraction&  _rScale,
     144             :                             const SwPageFrm* _pSelectedPageFrm,
     145             :                             const Size&      _rPreviewWinSize );
     146             : 
     147             :     ::rtl::Reference < SwAccessibleContext > GetContextImpl(
     148             :                                                  const SwFrm *pFrm,
     149             :                                                 sal_Bool bCreate = sal_True );
     150             :     ::com::sun::star::uno::Reference<
     151             :         ::com::sun::star::accessibility::XAccessible> GetContext(
     152             :                                                  const SwFrm *pFrm,
     153             :                                                 sal_Bool bCreate = sal_True );
     154             : 
     155             :     ::rtl::Reference < ::accessibility::AccessibleShape > GetContextImpl(
     156             :                                         const SdrObject *pObj,
     157             :                                         SwAccessibleContext *pParentImpl,
     158             :                                         sal_Bool bCreate = sal_True );
     159             :     ::com::sun::star::uno::Reference<
     160             :         ::com::sun::star::accessibility::XAccessible> GetContext(
     161             :                                         const SdrObject *pObj,
     162             :                                         SwAccessibleContext *pParentImpl,
     163             :                                         sal_Bool bCreate = sal_True );
     164             : 
     165           0 :     inline SwViewShell* GetShell() const
     166             :     {
     167           0 :         return mpVSh;
     168             :     }
     169             :     sal_Bool IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh);
     170             :     void AddShapeContext(const SdrObject *pObj,
     171             :                              ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccShape);
     172             : 
     173             :     void AddGroupContext(const SdrObject *pParentObj,
     174             :                     ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
     175             :     void RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
     176             : 
     177             :     const SwRect& GetVisArea() const;
     178             : 
     179             :     /** get size of a dedicated preview page
     180             : 
     181             :         @author OD
     182             : 
     183             :         @param _nPreviewPageNum
     184             :         input parameter - physical page number of page visible in the page preview
     185             : 
     186             :         @return an object of class <Size>
     187             :     */
     188             :     Size GetPreviewPageSize( sal_uInt16 _nPreviewPageNum ) const;
     189             : 
     190             :     void RemoveContext( const SwFrm *pFrm );
     191             :     void RemoveContext( const SdrObject *pObj );
     192             : 
     193             :     // Dispose frame and its children if bRecursive is set
     194             :     void Dispose( const SwFrm* pFrm,
     195             :                   const SdrObject* pObj,
     196             :                   Window* pWindow,
     197             :                   sal_Bool bRecursive = sal_False );
     198             : 
     199             :     void InvalidatePosOrSize( const SwFrm* pFrm,
     200             :                               const SdrObject* pObj,
     201             :                               Window* pWindow,
     202             :                               const SwRect& rOldFrm );
     203             : 
     204             :     void InvalidateContent( const SwFrm *pFrm );
     205             : 
     206             :     void InvalidateAttr( const SwTxtFrm& rTxtFrm );
     207             : 
     208             :     void InvalidateCursorPosition( const SwFrm *pFrm );
     209             :     void InvalidateFocus();
     210             :     void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
     211             :     void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
     212             :     void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
     213             :     void SetCursorContext(
     214             :         const ::rtl::Reference < SwAccessibleContext >& rCursorContext );
     215             : 
     216             :     // Invalidate state of whole tree. If an action is open, this call
     217             :     // is processed when the last action ends.
     218             :     void InvalidateStates( tAccessibleStates _nStates,
     219             :                            const SwFrm* _pFrm = 0 );
     220             : 
     221             :     void InvalidateRelationSet( const SwFrm* pMaster, const SwFrm* pFollow );
     222             : 
     223             :     /** invalidation CONTENT_FLOWS_FROM/_TO relation of a paragraph
     224             : 
     225             :         @author OD
     226             : 
     227             :         @param _rTxtFrm
     228             :         input parameter - reference to paragraph, whose CONTENT_FLOWS_FROM/_TO
     229             :         has to be invalidated.
     230             : 
     231             :         @param _bFrom
     232             :         input parameter - boolean indicating, if relation CONTENT_FLOWS_FROM
     233             :         (value <true>) or CONTENT_FLOWS_TO (value <false>) has to be invalidated.
     234             :     */
     235             :     void InvalidateParaFlowRelation( const SwTxtFrm& _rTxtFrm,
     236             :                                      const bool _bFrom );
     237             : 
     238             :     /** invalidation of text selection of a paragraph
     239             : 
     240             :         @author OD
     241             :     */
     242             :     void InvalidateParaTextSelection( const SwTxtFrm& _rTxtFrm );
     243             : 
     244             :     /** invalidation of text selection of all paragraphs
     245             : 
     246             :         @author OD
     247             :     */
     248             :     void InvalidateTextSelectionOfAllParas();
     249             : 
     250             :     sal_Int32 GetChildIndex( const SwFrm& rParentFrm,
     251             :                              Window& rChild ) const;
     252             : 
     253             :     // update preview data (and fire events if necessary)
     254             :     void UpdatePreview( const std::vector<PreviewPage*>& _rPreviewPages,
     255             :                         const Fraction&  _rScale,
     256             :                         const SwPageFrm* _pSelectedPageFrm,
     257             :                         const Size&      _rPreviewWinSize );
     258             : 
     259             :     void InvalidatePreviewSelection( sal_uInt16 nSelPage );
     260             :     bool IsPageSelected( const SwPageFrm *pPageFrm ) const;
     261             : 
     262             :     void FireEvents();
     263             : 
     264             :     // IAccessibleViewForwarder
     265             : 
     266             :     virtual bool IsValid() const SAL_OVERRIDE;
     267             :     virtual Rectangle GetVisibleArea() const SAL_OVERRIDE;
     268             :     virtual Point LogicToPixel (const Point& rPoint) const SAL_OVERRIDE;
     269             :     virtual Size LogicToPixel (const Size& rSize) const SAL_OVERRIDE;
     270             :     virtual Point PixelToLogic (const Point& rPoint) const SAL_OVERRIDE;
     271             :     virtual Size PixelToLogic (const Size& rSize) const SAL_OVERRIDE;
     272             : 
     273             :     // IAccessibleParent
     274             :     virtual bool ReplaceChild (
     275             :         ::accessibility::AccessibleShape* pCurrentChild,
     276             :         const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
     277             :         const long _nIndex,
     278             :         const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
     279             :     )   throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     280             :     virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel
     281             :         (::com::sun::star::beans::XPropertySet* pSet)
     282             :         throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     283             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >   GetAccessibleCaption (
     284             :         const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape)
     285             :     throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     286             : 
     287             :     // additional Core/Pixel conversions for internal use; also works
     288             :     // for preview
     289             :     Point PixelToCore (const Point& rPoint) const;
     290             :     Rectangle CoreToPixel (const Rectangle& rRect) const;
     291             : 
     292             : private:
     293             :     /** get mapping mode for LogicToPixel and PixelToLogic conversions
     294             : 
     295             :         Replacement method <PreviewAdjust(..)> by new method <GetMapMode>.
     296             :         Method returns mapping mode of current output device and adjusts it,
     297             :         if the shell is in page/print preview.
     298             :         Necessary, because <PreviewAdjust(..)> changes mapping mode at current
     299             :         output device for mapping logic document positions to page preview window
     300             :         positions and vice versa and doesn't take care to recover its changes.
     301             : 
     302             :         @author OD
     303             : 
     304             :         @param _rPoint
     305             :         input parameter - constant reference to point to determine the mapping
     306             :         mode adjustments for page/print preview.
     307             : 
     308             :         @param _orMapMode
     309             :         output parameter - reference to the mapping mode, which is determined
     310             :         by the method
     311             :     */
     312             :     void GetMapMode( const Point& _rPoint,
     313             :                      MapMode&     _orMapMode ) const;
     314             : public:
     315             :     virtual bool IsDocumentSelAll() SAL_OVERRIDE;
     316             : 
     317             :     ::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible >
     318           0 :         GetCursorContext() const { return mxCursorContext; }
     319             : 
     320             :     //Para Container for InvalidateCursorPosition
     321             :     typedef std::set< SwAccessibleParagraph* >  SET_PARA;
     322             :     SET_PARA m_setParaAdd;
     323             :     SET_PARA m_setParaRemove;
     324             : };
     325             : #endif
     326             : 
     327             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10