LCOV - code coverage report
Current view: top level - sw/source/core/inc - layact.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 35 36 97.2 %
Date: 2014-04-11 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             : #include "swtypes.hxx"
      22             : #include "swrect.hxx"
      23             : 
      24             : class SwRootFrm;
      25             : class SwLayoutFrm;
      26             : class SwPageFrm;
      27             : class SwFlyFrm;
      28             : class SwCntntFrm;
      29             : class SwTabFrm;
      30             : class SwViewImp;
      31             : class SwCntntNode;
      32             : class SwWait;
      33             : 
      34             : // The usage of LayAction is always the same:
      35             : 
      36             : // 1. Generation of the LayAction object.
      37             : // 2. Specifying the wanted bahaviour via the Set-methods
      38             : // 3. Calling Action()
      39             : // 4. Soon after that the destruction of the object
      40             : 
      41             : // Das Objekt meldet sich im CTor beim SwViewImp an und erst im DTor
      42             : // wieder ab! Es handelt sich mithin um ein typisches Stackobjekt.
      43             : 
      44             : class SwLayAction
      45             : {
      46             :     SwRootFrm  *pRoot;
      47             :     SwViewImp  *pImp;   // here the action logs in and off
      48             : 
      49             :     // for the sake of optimization, so that the tables stick a bit better to the Crsr
      50             :     // when hitting return/backspace in front of one
      51             :     // Wenn der erste TabFrm, der sich Paintet (pro Seite) traegt sich im
      52             :     // Pointer ein. Die CntntFrms unterhalb der Seite brauchen sich
      53             :     // dann nicht mehr bei der Shell zum Painten anmelden.
      54             :     const SwTabFrm *pOptTab;
      55             : 
      56             :     SwWait *pWait;
      57             : 
      58             :     //Wenn ein Absatz - oder was auch immer - bei der Formatierung mehr
      59             :     //als eine Seite rueckwaerts floss traegt er seine neue Seitennummer
      60             :     //hier ein. Die Steuerung der InternalAction kann dann geeignet reagieren.
      61             :     sal_uInt16 nPreInvaPage;
      62             : 
      63             :     sal_uLong nStartTicks;  //Startzeitpunkt der Aktion, vergeht zu viel Zeit kann
      64             :                         //der WaitCrsr per CheckWaitCrsr() eingeschaltet werden.
      65             : 
      66             :     sal_uInt16 nInputType;  //Bei welchem Input soll die Verarbeitung abgebrochen
      67             :                         //werden?
      68             :     sal_uInt16 nEndPage;    //StatBar control
      69             :     sal_uInt16 nCheckPageNum; //CheckPageDesc() was delayed if != USHRT_MAX
      70             :                           // check from this page on
      71             : 
      72             :     sal_Bool bPaint;        // painting or only formatting?
      73             :     sal_Bool bComplete;     //Alles bis zum sichtbaren Bereich Formatieren oder
      74             :                         // or only the visible area?
      75             :     sal_Bool bCalcLayout;   //Vollstaendige Reformatierung?
      76             :     sal_Bool bAgain;        //Zur automatisch wiederholten Action wenn Seiten
      77             :                         //geloscht werden.
      78             :     sal_Bool bNextCycle;    //Wiederaufsetzen bei der ersten Ungueltigen Seite.
      79             :     sal_Bool bInput;        //Zum Abbrechen der Verarbeitung wenn ein Input anliegt.
      80             :     sal_Bool bIdle;         //True wenn die Layaction vom Idler ausgeloest wurde.
      81             :     sal_Bool bReschedule;   //Soll das Reschedule - abhaengig vom Progress -
      82             :                         //gerufen werden?
      83             :     sal_Bool bCheckPages;   //CheckPageDescs() ausfuehren oder verzoegern.
      84             :     sal_Bool bUpdateExpFlds;//Wird gesetzt wenn nach dem Formatierien noch eine
      85             :                         //Runde fuer den ExpFld laufen muss.
      86             :     sal_Bool bBrowseActionStop; //Action fruehzeitig beenden (per bInput) und den
      87             :                             //Rest dem Idler ueberlassen.
      88             :     sal_Bool bWaitAllowed;      //Wartecursor erlaubt?
      89             :     bool bPaintExtraData;   //Anzeige von Zeilennumerierung o. ae. eingeschaltet?
      90             :     sal_Bool bActionInProgress; // wird in Action() anfangs gesetzt und zum Schluss geloescht
      91             : 
      92             :     // OD 14.04.2003 #106346# - new flag for content formatting on interrupt.
      93             :     sal_Bool    mbFormatCntntOnInterrupt;
      94             : 
      95             : #ifdef _LAYACT_CXX
      96             : 
      97             :     void PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
      98             :                      const SwRect &rOldRect, long nOldBottom );
      99             :     sal_Bool PaintWithoutFlys( const SwRect &, const SwCntntFrm *,
     100             :                            const SwPageFrm * );
     101             :     inline sal_Bool _PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
     102             :                              const SwRect & );
     103             : 
     104             :     sal_Bool FormatLayout( SwLayoutFrm *, sal_Bool bAddRect = sal_True );
     105             :     sal_Bool FormatLayoutTab( SwTabFrm *, sal_Bool bAddRect = sal_True );
     106             :     sal_Bool FormatCntnt( const SwPageFrm* pPage );
     107             :     void _FormatCntnt( const SwCntntFrm* pCntnt,
     108             :                        const SwPageFrm* pPage );
     109             :     sal_Bool IsShortCut( SwPageFrm *& );
     110             : 
     111             :     sal_Bool TurboAction();
     112             :     sal_Bool _TurboAction( const SwCntntFrm * );
     113             :     void InternalAction();
     114             : 
     115             :     SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage );
     116             : 
     117             :     sal_Bool RemoveEmptyBrowserPages();
     118             : 
     119             :     inline void CheckIdleEnd();
     120        7291 :     inline sal_uLong GetStartTicks() { return nStartTicks; }
     121             : 
     122             : #endif
     123             : 
     124             : public:
     125             :     SwLayAction( SwRootFrm *pRt, SwViewImp *pImp );
     126             :     ~SwLayAction();
     127             : 
     128             : #ifdef _LAYACT_CXX
     129        1069 :     void SetIdle            ( sal_Bool bNew )   { bIdle = bNew; }
     130       25464 :     void SetCheckPages      ( sal_Bool bNew )   { bCheckPages = bNew; }
     131           8 :     void SetBrowseActionStop(sal_Bool bNew  )   { bBrowseActionStop = bNew; }
     132        4353 :     void SetNextCycle       ( sal_Bool bNew )   { bNextCycle = bNew; }
     133             : 
     134       46969 :     sal_Bool IsWaitAllowed()        const       { return bWaitAllowed; }
     135       35573 :     sal_Bool IsNextCycle()          const       { return bNextCycle; }
     136      209863 :     sal_Bool IsInput()              const       { return bInput; }
     137       47058 :     sal_Bool IsWait()               const       { return 0 != pWait;  }
     138      289855 :     sal_Bool IsPaint()              const       { return bPaint; }
     139       32661 :     sal_Bool IsIdle()               const       { return bIdle;  }
     140       95945 :     sal_Bool IsReschedule()         const       { return bReschedule;  }
     141       25074 :     bool IsPaintExtraData()     const       { return bPaintExtraData;}
     142      163629 :     sal_Bool IsInterrupt()        const { return IsInput(); }
     143             : 
     144       72055 :     sal_uInt16 GetInputType()    const { return nInputType; }
     145             : #endif
     146             : 
     147             :     // adjusting Action to the wanted behaviour
     148        7254 :     void SetPaint       ( sal_Bool bNew )   { bPaint = bNew; }
     149       24551 :     void SetComplete    ( sal_Bool bNew )   { bComplete = bNew; }
     150             :     void SetStatBar     ( sal_Bool bNew );
     151       25559 :     void SetInputType   ( sal_uInt16 nNew ) { nInputType = nNew; }
     152        1613 :     void SetCalcLayout  ( sal_Bool bNew )   { bCalcLayout = bNew; }
     153        1697 :     void SetReschedule  ( sal_Bool bNew )   { bReschedule = bNew; }
     154        1069 :     void SetWaitAllowed ( sal_Bool bNew )   { bWaitAllowed = bNew; }
     155             : 
     156         128 :     void SetAgain()         { bAgain = sal_True; }
     157        3832 :     void SetUpdateExpFlds() {bUpdateExpFlds = sal_True; }
     158             : 
     159             :     inline void SetCheckPageNum( sal_uInt16 nNew );
     160           1 :     inline void SetCheckPageNumDirect( sal_uInt16 nNew ) { nCheckPageNum = nNew; }
     161             : 
     162             :     void Action();  // here it begins
     163             :     void Reset();   // back to CTor-defaults
     164             : 
     165      356511 :     sal_Bool IsAgain()      const { return bAgain; }
     166       57663 :     sal_Bool IsComplete()   const { return bComplete; }
     167        1613 :     sal_Bool IsExpFlds()    const { return bUpdateExpFlds; }
     168       88554 :     sal_Bool IsCalcLayout() const { return bCalcLayout;  }
     169         250 :     sal_Bool IsCheckPages() const { return bCheckPages;  }
     170         961 :     sal_Bool IsBrowseActionStop() const { return bBrowseActionStop; }
     171           0 :     sal_Bool IsActionInProgress() const { return bActionInProgress; }
     172             : 
     173           3 :     sal_uInt16 GetCheckPageNum() const { return nCheckPageNum; }
     174             : 
     175             :     // others should be able to activate the WaitCrsr, too
     176             :     void CheckWaitCrsr();
     177             : 
     178             :     // #i28701# - method is now public;
     179             :     // delete 2nd parameter, because its not used;
     180             :     sal_Bool FormatLayoutFly( SwFlyFrm * );
     181             :     // #i28701# - method is now public
     182             :     sal_Bool _FormatFlyCntnt( const SwFlyFrm * );
     183             : 
     184             : };
     185             : 
     186             : class SwLayIdle
     187             : {
     188             : 
     189             :     SwRootFrm *pRoot;
     190             :     SwViewImp  *pImp;           // Hier Meldet sich der Idler an und ab.
     191             :     SwCntntNode *pCntntNode;    // Hier wird die aktuelle Cursorposition
     192             :     sal_Int32  nTxtPos;        // zwischengespeichert.
     193             :     sal_Bool        bPageValid;     // Konnte die Seite alles validiert werden?
     194             :     sal_Bool        bAllValid;      // Konnte alles validiert werden?
     195             : 
     196             : #ifdef DBG_UTIL
     197             :     bool m_bIndicator;
     198             : #endif
     199             : 
     200             : #ifdef _LAYACT_CXX
     201             : 
     202             : #ifdef DBG_UTIL
     203             :     void ShowIdle( ColorData eName );
     204             : #endif
     205             : 
     206             :     enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, SMART_TAGS };
     207             :     sal_Bool _DoIdleJob( const SwCntntFrm*, IdleJobType );
     208             :     sal_Bool DoIdleJob( IdleJobType, sal_Bool bVisAreaOnly );
     209             : 
     210             : #endif
     211             : 
     212             : public:
     213             :     SwLayIdle( SwRootFrm *pRt, SwViewImp *pImp );
     214             :     ~SwLayIdle();
     215             : };
     216             : 
     217         149 : inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew )
     218             : {
     219         149 :     if ( nNew < nCheckPageNum )
     220          18 :         nCheckPageNum = nNew;
     221         149 : }
     222             : 
     223             : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
     224             : 
     225             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10