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

Generated by: LCOV version 1.10