LCOV - code coverage report
Current view: top level - sw/source/core/inc - layact.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 35 36 97.2 %
Date: 2015-06-13 12:38:46 Functions: 32 33 97.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_LAYACT_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
      21             : 
      22             : #include <sal/config.h>
      23             : 
      24             : #include <ctime>
      25             : 
      26             : #include "swtypes.hxx"
      27             : #include "swrect.hxx"
      28             : 
      29             : class SwRootFrm;
      30             : class SwLayoutFrm;
      31             : class SwPageFrm;
      32             : class SwFlyFrm;
      33             : class SwContentFrm;
      34             : class SwTabFrm;
      35             : class SwViewShellImp;
      36             : class SwContentNode;
      37             : class SwWait;
      38             : 
      39             : /**
      40             :  * The usage of LayAction is always the same:
      41             :  *
      42             :  * 1. Generation of the LayAction object.
      43             :  * 2. Specifying the wanted behaviour via the Set-methods
      44             :  * 3. Calling Action()
      45             :  * 4. Soon after that the destruction of the object
      46             :  *
      47             :  * The object registers at the SwViewShellImp in the ctor and deregisters not until
      48             :  * the dtor!
      49             :  * It's a typical stack object.
      50             :  */
      51             : class SwLayAction
      52             : {
      53             :     SwRootFrm  *pRoot;
      54             :     SwViewShellImp  *pImp; // here the action logs in and off
      55             : 
      56             :     // For the sake of optimization, so that the tables stick a bit better to
      57             :     // the Crsr when hitting return/backspace in front of one.
      58             :     // The first TabFrm that paints itself (per page) adds itself to the pointer.
      59             :     // The ContentFrms beneath the page do not need to deregister at the Shell for
      60             :     // painting.
      61             :     const SwTabFrm *pOptTab;
      62             : 
      63             :     SwWait *pWait;
      64             : 
      65             :     // If a paragraph (or anything else) moved more than one page when
      66             :     // formatting, it adds its new page number here.
      67             :     // The InternalAction can then take the appropriate steps.
      68             :     sal_uInt16 nPreInvaPage;
      69             : 
      70             :     std::clock_t nStartTicks;      // The Action's starting time; if too much time passes the
      71             :                                 // WaitCrsr can be enabled via CheckWaitCrsr()
      72             : 
      73             :     VclInputFlags nInputType;      // Which input should terminate processing
      74             :     sal_uInt16 nEndPage;        // StatBar control
      75             :     sal_uInt16 nCheckPageNum;   // CheckPageDesc() was delayed if != USHRT_MAX
      76             :                                 // check from this page onwards
      77             : 
      78             :     bool bPaint;         // painting or only formatting?
      79             :     bool bComplete;      // Format everything or just the visible Area?
      80             :     bool bCalcLayout;    // Complete reformatting?
      81             :     bool bAgain;         // For the automatically repeated Action if Pages are deleted
      82             :     bool bNextCycle;     // Reset on the first invalid Page
      83             :     bool bInput;         // For terminating processing on input
      84             :     bool bIdle;          // True if the LayAction was triggered by the Idler
      85             :     bool bReschedule;    // Call Reschedule depending on Progress?
      86             :     bool bCheckPages;    // Run CheckPageDescs() or delay it
      87             :     bool bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField
      88             :     bool bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler
      89             :     bool bWaitAllowed;      // Waitcursor allowed?
      90             :     bool bPaintExtraData;   // Painting line numbers (or similar) enabled?
      91             :     bool bActionInProgress; // Is set in Action() at the beginning and deleted at the end
      92             : 
      93             :     // OD 14.04.2003 #106346# - new flag for content formatting on interrupt.
      94             :     bool    mbFormatContentOnInterrupt;
      95             : 
      96             :     void PaintContent( const SwContentFrm *, const SwPageFrm *,
      97             :                      const SwRect &rOldRect, long nOldBottom );
      98             :     bool PaintWithoutFlys( const SwRect &, const SwContentFrm *,
      99             :                            const SwPageFrm * );
     100             :     inline bool _PaintContent( const SwContentFrm *, const SwPageFrm *,
     101             :                              const SwRect & );
     102             : 
     103             :     bool FormatLayout( SwLayoutFrm *, bool bAddRect = true );
     104             :     bool FormatLayoutTab( SwTabFrm *, bool bAddRect = true );
     105             :     bool FormatContent( const SwPageFrm* pPage );
     106             :     void _FormatContent( const SwContentFrm* pContent,
     107             :                        const SwPageFrm* pPage );
     108             :     bool IsShortCut( SwPageFrm *& );
     109             : 
     110             :     bool TurboAction();
     111             :     bool _TurboAction( const SwContentFrm * );
     112             :     void InternalAction();
     113             : 
     114             :     static SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage );
     115             : 
     116             :     bool RemoveEmptyBrowserPages();
     117             : 
     118             :     inline void CheckIdleEnd();
     119        8297 :     inline std::clock_t GetStartTicks() { return nStartTicks; }
     120             : 
     121             : public:
     122             :     SwLayAction( SwRootFrm *pRt, SwViewShellImp *pImp );
     123             :     ~SwLayAction();
     124             : 
     125    26775052 :     void SetIdle            ( bool bNew )   { bIdle = bNew; }
     126    26815991 :     void SetCheckPages      ( bool bNew )   { bCheckPages = bNew; }
     127           8 :     void SetBrowseActionStop( bool bNew )   { bBrowseActionStop = bNew; }
     128        7360 :     void SetNextCycle       ( bool bNew )   { bNextCycle = bNew; }
     129             : 
     130       79127 :     bool IsWaitAllowed()        const       { return bWaitAllowed; }
     131       62224 :     bool IsNextCycle()          const       { return bNextCycle; }
     132    53912578 :     bool IsInput()              const       { return bInput; }
     133       79127 :     bool IsWait()               const       { return 0 != pWait;  }
     134    27255753 :     bool IsPaint()              const       { return bPaint; }
     135    26820440 :     bool IsIdle()               const       { return bIdle;  }
     136      163344 :     bool IsReschedule()         const       { return bReschedule;  }
     137       36296 :     bool IsPaintExtraData()     const       { return bPaintExtraData;}
     138    53830312 :     bool IsInterrupt()          const       { return IsInput(); }
     139             : 
     140      123841 :     VclInputFlags GetInputType()    const { return nInputType; }
     141             : 
     142             :     // adjusting Action to the wanted behaviour
     143       17191 :     void SetPaint       ( bool bNew )   { bPaint = bNew; }
     144       39009 :     void SetComplete    ( bool bNew )   { bComplete = bNew; }
     145             :     void SetStatBar     ( bool bNew );
     146    26813633 :     void SetInputType   ( VclInputFlags nNew ) { nInputType = nNew; }
     147        2819 :     void SetCalcLayout  ( bool bNew )   { bCalcLayout = bNew; }
     148        3252 :     void SetReschedule  ( bool bNew )   { bReschedule = bNew; }
     149    26775053 :     void SetWaitAllowed ( bool bNew )   { bWaitAllowed = bNew; }
     150             : 
     151         170 :     void SetAgain()         { bAgain = true; }
     152        6412 :     void SetUpdateExpFields() {bUpdateExpFields = true; }
     153             : 
     154             :     inline void SetCheckPageNum( sal_uInt16 nNew );
     155           1 :     inline void SetCheckPageNumDirect( sal_uInt16 nNew ) { nCheckPageNum = nNew; }
     156             : 
     157             :     void Action();  // here it begins
     158             :     void Reset();   // back to CTor-defaults
     159             : 
     160    27369125 :     bool IsAgain()      const { return bAgain; }
     161    53640736 :     bool IsComplete()   const { return bComplete; }
     162        2819 :     bool IsExpFields()    const { return bUpdateExpFields; }
     163    26924821 :     bool IsCalcLayout() const { return bCalcLayout;  }
     164         440 :     bool IsCheckPages() const { return bCheckPages;  }
     165        2470 :     bool IsBrowseActionStop() const { return bBrowseActionStop; }
     166           0 :     bool IsActionInProgress() const { return bActionInProgress; }
     167             : 
     168           3 :     sal_uInt16 GetCheckPageNum() const { return nCheckPageNum; }
     169             : 
     170             :     // others should be able to activate the WaitCrsr, too
     171             :     void CheckWaitCrsr();
     172             : 
     173             :     // #i28701# - method is now public;
     174             :     // delete 2nd parameter, because its not used;
     175             :     bool FormatLayoutFly( SwFlyFrm * );
     176             :     // #i28701# - method is now public
     177             :     bool _FormatFlyContent( const SwFlyFrm * );
     178             : 
     179             : };
     180             : 
     181             : class SwLayIdle
     182             : {
     183             : 
     184             :     SwRootFrm *pRoot;
     185             :     SwViewShellImp  *pImp;           // The Idler registers and deregisters here
     186             :     SwContentNode *pContentNode;    // The current cursor position is saved here
     187             :     sal_Int32  nTextPos;
     188             :     bool        bPageValid;     // Were we able to evaluate everything on the whole page?
     189             :     bool        bAllValid;      // Were we able to evaluate everything?
     190             : 
     191             : #ifdef DBG_UTIL
     192             :     bool m_bIndicator;
     193             : #endif
     194             : 
     195             : #ifdef DBG_UTIL
     196             :     void ShowIdle( ColorData eName );
     197             : #endif
     198             : 
     199             :     enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, SMART_TAGS };
     200             :     bool _DoIdleJob( const SwContentFrm*, IdleJobType );
     201             :     bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
     202             : 
     203             : public:
     204             :     SwLayIdle( SwRootFrm *pRt, SwViewShellImp *pImp );
     205             :     ~SwLayIdle();
     206             : };
     207             : 
     208         165 : inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew )
     209             : {
     210         165 :     if ( nNew < nCheckPageNum )
     211         157 :         nCheckPageNum = nNew;
     212         165 : }
     213             : 
     214             : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11