LCOV - code coverage report
Current view: top level - sw/source/core/inc - viewimp.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 30 47 63.8 %
Date: 2014-04-11 Functions: 20 25 80.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_SOURCE_CORE_INC_VIEWIMP_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
      21             : 
      22             : #include <rtl/ustring.hxx>
      23             : #include <tools/color.hxx>
      24             : #include <svx/svdtypes.hxx>
      25             : #include <vcl/timer.hxx>
      26             : #include <swrect.hxx>
      27             : #include <swtypes.hxx>
      28             : #include <vector>
      29             : 
      30             : class SwViewShell;
      31             : class SwFlyFrm;
      32             : class SwViewOption;
      33             : class SwRegionRects;
      34             : class SwFrm;
      35             : class SwLayAction;
      36             : class SwLayIdle;
      37             : class SwDrawView;
      38             : class SdrPageView;
      39             : class SwPageFrm;
      40             : class SwRegionRects;
      41             : class SwAccessibleMap;
      42             : class SdrObject;
      43             : class Fraction;
      44             : class SwPrintData;
      45             : class SwPagePreviewLayout;
      46             : struct PreviewPage;
      47             : class SwTxtFrm;
      48             : // --> OD #i76669#
      49             : namespace sdr { namespace contact {
      50             :         class ViewObjectContactRedirector;
      51             : } }
      52             : // <--
      53             : 
      54             : class SwViewImp
      55             : {
      56             :     friend class SwViewShell;
      57             : 
      58             :     friend class SwLayAction;   //Lay- und IdleAction tragen sich ein und aus.
      59             :     friend class SwLayIdle;
      60             : 
      61             :     // for paint of page preview
      62             :     friend class SwPagePreviewLayout;
      63             : 
      64             :     SwViewShell *pSh;             //Falls jemand einen Imp durchreicht und doch
      65             :                                 //mal eine SwViewShell braucht hier die
      66             :                                 //Rueckwaertsverkettung.
      67             : 
      68             :     SwDrawView  *pDrawView;     //Unsere DrawView
      69             :     SdrPageView *pSdrPageView;  //Genau eine Seite fuer unsere DrawView
      70             : 
      71             :     SwPageFrm     *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite.
      72             :     SwRegionRects *pRegion;      //Sammler fuer Paintrects aus der LayAction.
      73             : 
      74             :     SwLayAction   *pLayAct;      //Ist gesetzt wenn ein Action-Objekt existiert
      75             :                                  //Wird vom SwLayAction-CTor ein- und vom DTor
      76             :                                  //ausgetragen.
      77             :     SwLayIdle     *pIdleAct;     //Analog zur SwLayAction fuer SwLayIdle.
      78             : 
      79             :     SwAccessibleMap *pAccMap;       // Accessible Wrappers
      80             : 
      81             :     mutable const SdrObject * pSdrObjCached;
      82             :     mutable OUString sSdrObjCachedComment;
      83             : 
      84             :     bool bFirstPageInvalid : 1; //Pointer auf erste Seite ungueltig?
      85             :     bool bResetHdlHiddenPaint : 1;//  -- "" --
      86             :     bool bSmoothUpdate : 1; //Meber fuer SmoothScroll
      87             :     bool bStopSmooth : 1;
      88             : 
      89             :     sal_uInt16 nRestoreActions  ; //Die Anzahl der zu restaurierenden Actions (UNO)
      90             :     SwRect aSmoothRect;
      91             : 
      92             :     SwPagePreviewLayout* mpPgPreviewLayout;
      93             : 
      94             :     void SetFirstVisPage();     //Neue Ermittlung der ersten sichtbaren Seite
      95             : 
      96             :     void StartAction();         //Henkel Anzeigen und verstecken.
      97             :     void EndAction();           //gerufen von SwViewShell::ImplXXXAction
      98             :     void LockPaint();           //dito, gerufen von SwViewShell::ImplLockPaint
      99             :     void UnlockPaint();
     100             : 
     101             : private:
     102             : 
     103             :     SwAccessibleMap *CreateAccessibleMap();
     104             : 
     105             :     /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
     106             : 
     107             :         #i27138#
     108             :         implementation for wrapper method
     109             :         <SwViewShell::InvalidateAccessibleParaFlowRelation(..)>
     110             : 
     111             :         @param _pFromTxtFrm
     112             :         input parameter - paragraph frame, for which the relation CONTENT_FLOWS_FROM
     113             :         has to be invalidated.
     114             :         If NULL, no CONTENT_FLOWS_FROM relation has to be invalidated
     115             : 
     116             :         @param _pToTxtFrm
     117             :         input parameter - paragraph frame, for which the relation CONTENT_FLOWS_TO
     118             :         has to be invalidated.
     119             :         If NULL, no CONTENT_FLOWS_TO relation has to be invalidated
     120             :     */
     121             :     void _InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
     122             :                                                 const SwTxtFrm* _pToTxtFrm );
     123             : 
     124             :     /** invalidate text selection for paragraphs
     125             : 
     126             :         #i27301#
     127             :         implementation for wrapper method
     128             :         <SwViewShell::InvalidateAccessibleParaTextSelection(..)>
     129             :     */
     130             :     void _InvalidateAccessibleParaTextSelection();
     131             : 
     132             :     /** invalidate attributes for paragraphs and paragraph's characters
     133             : 
     134             :         #i88069#
     135             :         implementation for wrapper method
     136             :         <SwViewShell::InvalidateAccessibleParaAttrs(..)>
     137             :     */
     138             :     void _InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm );
     139             : 
     140             : public:
     141             :     SwViewImp( SwViewShell * );
     142             :     ~SwViewImp();
     143             :     void Init( const SwViewOption * );          //nur fuer SwViewShell::Init()
     144             : 
     145       47701 :     const SwViewShell *GetShell() const { return pSh; }
     146      256429 :           SwViewShell *GetShell()       { return pSh; }
     147             : 
     148             :     Color GetRetoucheColor() const;
     149             : 
     150             :     //Verwaltung zur ersten sichtbaren Seite
     151             :     inline const SwPageFrm *GetFirstVisPage() const;
     152             :     inline       SwPageFrm *GetFirstVisPage();
     153       10914 :     void SetFirstVisPageInvalid() { bFirstPageInvalid = true; }
     154             : 
     155             :     bool AddPaintRect( const SwRect &rRect );
     156       64105 :     SwRegionRects *GetRegion()      { return pRegion; }
     157             :     void DelRegion();
     158             : 
     159             :     // neues Interface fuer StarView Drawing
     160      333505 :     bool  HasDrawView()             const { return 0 != pDrawView; }
     161      276868 :           SwDrawView* GetDrawView()       { return pDrawView; }
     162      213714 :     const SwDrawView* GetDrawView() const { return pDrawView; }
     163       20709 :           SdrPageView*GetPageView()       { return pSdrPageView; }
     164       13622 :     const SdrPageView*GetPageView() const { return pSdrPageView; }
     165             :     void MakeDrawView();
     166             : 
     167             :     // add 3rd parameter <const Color* pPageBackgrdColor> for setting this
     168             :     // color as the background color at the outliner of the draw view
     169             :     // for painting layers <hell> and <heaven>
     170             : 
     171             :     // add 4th parameter for the horizontal text
     172             :     // direction of the page in order to set the default horizontal text
     173             :     // direction at the outliner of the draw view for painting layers <hell>
     174             :     // and <heaven>.
     175             : 
     176             :     // #i76669# - added parameter <pRedirector>
     177             :     void   PaintLayer( const SdrLayerID _nLayerID,
     178             :                        SwPrintData const*const pPrintData,
     179             :                        const SwRect& _rRect,
     180             :                        const Color* _pPageBackgrdColor = 0,
     181             :                        const bool _bIsPageRightToLeft = false,
     182             :                        sdr::contact::ViewObjectContactRedirector* pRedirector = 0 ) const;
     183             : 
     184             :     //wird als Link an die DrawEngine uebergeben, entscheidet was wie
     185             :     //gepaintet wird oder nicht.
     186             : 
     187             :     // Interface Drawing
     188             :     bool IsDragPossible( const Point &rPoint );
     189             :     void NotifySizeChg( const Size &rNewSz );
     190             : 
     191             :     //SS Fuer die Lay- bzw. IdleAction und verwandtes
     192       10377 :     bool  IsAction() const                   { return pLayAct  != 0; }
     193       51807 :     bool  IsIdleAction() const               { return pIdleAct != 0; }
     194        3070 :           SwLayAction &GetLayAction()        { return *pLayAct; }
     195        1403 :     const SwLayAction &GetLayAction() const  { return *pLayAct; }
     196             :           SwLayIdle   &GetIdleAction()       { return *pIdleAct;}
     197             :     const SwLayIdle   &GetIdleAction() const { return *pIdleAct;}
     198             : 
     199             :     //Wenn eine Aktion laueft wird diese gebeten zu pruefen ob es
     200             :     //an der zeit ist den WaitCrsr einzuschalten.
     201             :     void CheckWaitCrsr();
     202             :     bool IsCalcLayoutProgress() const;  //Fragt die LayAction wenn vorhanden.
     203             :     //true wenn eine LayAction laeuft, dort wird dann auch das Flag fuer
     204             :     //ExpressionFields gesetzt.
     205             :     bool IsUpdateExpFlds();
     206             : 
     207         346 :     void    SetRestoreActions(sal_uInt16 nSet){nRestoreActions = nSet;}
     208         173 :     sal_uInt16  GetRestoreActions() const{return nRestoreActions;}
     209             : 
     210             :     void InitPagePreviewLayout();
     211             : 
     212           0 :     inline SwPagePreviewLayout* PagePreviewLayout()
     213             :     {
     214           0 :         return mpPgPreviewLayout;
     215             :     }
     216             : 
     217             :     // Is this view accessible?
     218       63211 :     bool IsAccessible() const { return pAccMap != 0; }
     219             : 
     220             :     inline SwAccessibleMap& GetAccessibleMap();
     221             : 
     222             :     // Update (this) accessible view
     223             :     void UpdateAccessible();
     224             : 
     225             :     // Remove a frame from the accessible view
     226             :     void DisposeAccessible( const SwFrm *pFrm, const SdrObject *pObj,
     227             :                             bool bRecursive );
     228             :     inline void DisposeAccessibleFrm( const SwFrm *pFrm,
     229             :                                bool bRecursive = false );
     230             :     inline void DisposeAccessibleObj( const SdrObject *pObj );
     231             : 
     232             :     // Move a frame's position in the accessible view
     233             :     void MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
     234             :                          const SwRect& rOldFrm );
     235             :     inline void MoveAccessibleFrm( const SwFrm *pFrm, const SwRect& rOldFrm );
     236             : 
     237             :     // Add a frame in the accessible view
     238             :     inline void AddAccessibleFrm( const SwFrm *pFrm );
     239             : 
     240             :     inline void AddAccessibleObj( const SdrObject *pObj );
     241             : 
     242             :     // Invalidate accessible frame's frame's content
     243             :     void InvalidateAccessibleFrmContent( const SwFrm *pFrm );
     244             : 
     245             :     // Invalidate accessible frame's cursor position
     246             :     void InvalidateAccessibleCursorPosition( const SwFrm *pFrm );
     247             : 
     248             :     // Invalidate editable state for all accessible frames
     249             :     void InvalidateAccessibleEditableState( bool bAllShells = true,
     250             :                                                const SwFrm *pFrm=0 );
     251             : 
     252             :     // Invalidate frame's relation set (for chained frames)
     253             :     void InvalidateAccessibleRelationSet( const SwFlyFrm *pMaster,
     254             :                                           const SwFlyFrm *pFollow );
     255             : 
     256             :     // update data for accessible preview
     257             :     // change method signature due to new page preview functionality
     258             :     void UpdateAccessiblePreview( const std::vector<PreviewPage*>& _rPreviewPages,
     259             :                                   const Fraction&  _rScale,
     260             :                                   const SwPageFrm* _pSelectedPageFrm,
     261             :                                   const Size&      _rPreviewWinSize );
     262             : 
     263             :     void InvalidateAccessiblePreviewSelection( sal_uInt16 nSelPage );
     264             : 
     265             :     // Fire all accessible events that have been collected so far
     266             :     void FireAccessibleEvents();
     267             : };
     268             : 
     269       41861 : inline SwPageFrm *SwViewImp::GetFirstVisPage()
     270             : {
     271       41861 :     if ( bFirstPageInvalid )
     272        7257 :         SetFirstVisPage();
     273       41861 :     return pFirstVisPage;
     274             : }
     275             : 
     276           1 : inline const SwPageFrm *SwViewImp::GetFirstVisPage() const
     277             : {
     278           1 :     if ( bFirstPageInvalid )
     279           0 :         ((SwViewImp*)this)->SetFirstVisPage();
     280           1 :     return pFirstVisPage;
     281             : }
     282             : 
     283         340 : inline SwAccessibleMap& SwViewImp::GetAccessibleMap()
     284             : {
     285         340 :     if( !pAccMap )
     286          12 :         CreateAccessibleMap();
     287             : 
     288         340 :     return *pAccMap;
     289             : }
     290             : 
     291           0 : inline void SwViewImp::DisposeAccessibleFrm( const SwFrm *pFrm,
     292             :                                bool bRecursive )
     293             : {
     294           0 :     DisposeAccessible( pFrm, 0, bRecursive );
     295           0 : }
     296             : 
     297           0 : inline void SwViewImp::DisposeAccessibleObj( const SdrObject *pObj )
     298             : {
     299           0 :     DisposeAccessible( 0, pObj, false );
     300           0 : }
     301             : 
     302          59 : inline void SwViewImp::MoveAccessibleFrm( const SwFrm *pFrm,
     303             :                                           const SwRect& rOldFrm )
     304             : {
     305          59 :     MoveAccessible( pFrm, 0, rOldFrm );
     306          59 : }
     307             : 
     308           0 : inline void SwViewImp::AddAccessibleFrm( const SwFrm *pFrm )
     309             : {
     310           0 :     SwRect aEmptyRect;
     311           0 :     MoveAccessible( pFrm, 0, aEmptyRect );
     312           0 : }
     313             : 
     314           0 : inline void SwViewImp::AddAccessibleObj( const SdrObject *pObj )
     315             : {
     316           0 :     SwRect aEmptyRect;
     317           0 :     MoveAccessible( 0, pObj, aEmptyRect );
     318           0 : }
     319             : #endif // INCLUDED_SW_SOURCE_CORE_INC_VIEWIMP_HXX
     320             : 
     321             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10