LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - layact.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 36 72.2 %
Date: 2012-12-27 Functions: 26 33 78.8 %
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 _LAYACT_HXX
      20             : #define _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             : // #i28701#
      34             : class SfxProgress;
      35             : 
      36             : //Die Verwendung der LayAction laeuft immer gleich ab:
      37             : //
      38             : // 1. Erzeugen des LayAction-Objektes.
      39             : // 2. Einstellen des gewuenschten Verhaltens mittels der Set-Methoden
      40             : // 3. Aufruf von Action()
      41             : // 4. Baldiges Zerstoeren des Objektes.
      42             : //
      43             : // Das Objekt meldet sich im CTor beim SwViewImp an und erst im DTor
      44             : // wieder ab! Es handelt sich mithin um ein typisches Stackobjekt.
      45             : 
      46             : 
      47             : class SwLayAction
      48             : {
      49             :     SwRootFrm  *pRoot;
      50             :     SwViewImp  *pImp;   //Hier Meldet sich die Action an und ab.
      51             : 
      52             :     //Zur Optimierung, damit die Tabellen etwas besser am Crsr kleben beim
      53             :     //Return/Backspace davor.
      54             :     //Wenn der erste TabFrm, der sich Paintet (pro Seite) traegt sich im
      55             :     //Pointer ein. Die CntntFrms unterhalb der Seite brauchen sich
      56             :     //dann nicht mehr bei der Shell zum Painten anmelden.
      57             :     const SwTabFrm *pOptTab;
      58             : 
      59             :     SwWait *pWait;
      60             : 
      61             :     SfxProgress * pProgress;
      62             : 
      63             :     //Wenn ein Absatz - oder was auch immer - bei der Formatierung mehr
      64             :     //als eine Seite rueckwaerts floss traegt er seine neue Seitennummer
      65             :     //hier ein. Die Steuerung der InternalAction kann dann geeignet reagieren.
      66             :     sal_uInt16 nPreInvaPage;
      67             : 
      68             :     sal_uLong nStartTicks;  //Startzeitpunkt der Aktion, vergeht zu viel Zeit kann
      69             :                         //der WaitCrsr per CheckWaitCrsr() eingeschaltet werden.
      70             : 
      71             :     sal_uInt16 nInputType;  //Bei welchem Input soll die Verarbeitung abgebrochen
      72             :                         //werden?
      73             :     sal_uInt16 nEndPage;    //StatBar Steuerung.
      74             :     sal_uInt16 nCheckPageNum; //CheckPageDesc() wurde verzoegert wenn != USHRT_MAX
      75             :                           //ab dieser Seite Checken.
      76             : 
      77             :     sal_Bool bPaint;        //Painten oder nur Formatieren?
      78             :     sal_Bool bComplete;     //Alles bis zum sichtbaren Bereich Formatieren oder
      79             :                         //oder nur den sichtbaren Bereich?
      80             :     sal_Bool bCalcLayout;   //Vollstaendige Reformatierung?
      81             :     sal_Bool bAgain;        //Zur automatisch wiederholten Action wenn Seiten
      82             :                         //geloscht werden.
      83             :     sal_Bool bNextCycle;    //Wiederaufsetzen bei der ersten Ungueltigen Seite.
      84             :     sal_Bool bInput;        //Zum Abbrechen der Verarbeitung wenn ein Input anliegt.
      85             :     sal_Bool bIdle;         //True wenn die Layaction vom Idler ausgeloest wurde.
      86             :     sal_Bool bReschedule;   //Soll das Reschedule - abhaengig vom Progress -
      87             :                         //gerufen werden?
      88             :     sal_Bool bCheckPages;   //CheckPageDescs() ausfuehren oder verzoegern.
      89             :     sal_Bool bUpdateExpFlds;//Wird gesetzt wenn nach dem Formatierien noch eine
      90             :                         //Runde fuer den ExpFld laufen muss.
      91             :     sal_Bool bBrowseActionStop; //Action fruehzeitig beenden (per bInput) und den
      92             :                             //Rest dem Idler ueberlassen.
      93             :     sal_Bool bWaitAllowed;      //Wartecursor erlaubt?
      94             :     bool bPaintExtraData;   //Anzeige von Zeilennumerierung o. ae. eingeschaltet?
      95             :     sal_Bool bActionInProgress; // wird in Action() anfangs gesetzt und zum Schluss geloescht
      96             : 
      97             :     // OD 14.04.2003 #106346# - new flag for content formatting on interrupt.
      98             :     sal_Bool    mbFormatCntntOnInterrupt;
      99             : 
     100             : #ifdef _LAYACT_CXX
     101             : 
     102             :     void PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
     103             :                      const SwRect &rOldRect, long nOldBottom );
     104             :     sal_Bool PaintWithoutFlys( const SwRect &, const SwCntntFrm *,
     105             :                            const SwPageFrm * );
     106             :     inline sal_Bool _PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
     107             :                              const SwRect & );
     108             : 
     109             :     sal_Bool FormatLayout( SwLayoutFrm *, sal_Bool bAddRect = sal_True );
     110             :     sal_Bool FormatLayoutTab( SwTabFrm *, sal_Bool bAddRect = sal_True );
     111             :     sal_Bool FormatCntnt( const SwPageFrm* pPage );
     112             :     void _FormatCntnt( const SwCntntFrm* pCntnt,
     113             :                        const SwPageFrm* pPage );
     114             :     sal_Bool IsShortCut( SwPageFrm *& );
     115             : 
     116             :     sal_Bool TurboAction();
     117             :     sal_Bool _TurboAction( const SwCntntFrm * );
     118             :     void InternalAction();
     119             : 
     120             :     SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage );
     121             : 
     122             :     sal_Bool RemoveEmptyBrowserPages();
     123             : 
     124             :     inline void CheckIdleEnd();
     125          29 :     inline sal_uLong GetStartTicks() { return nStartTicks; }
     126             : 
     127             : #endif
     128             : 
     129             : public:
     130             :     SwLayAction( SwRootFrm *pRt, SwViewImp *pImp );
     131             :     ~SwLayAction();
     132             : 
     133             : #ifdef _LAYACT_CXX
     134         379 :     void SetIdle            ( sal_Bool bNew )   { bIdle = bNew; }
     135        1585 :     void SetCheckPages      ( sal_Bool bNew )   { bCheckPages = bNew; }
     136           0 :     void SetBrowseActionStop(sal_Bool bNew  )   { bBrowseActionStop = bNew; }
     137         199 :     void SetNextCycle       ( sal_Bool bNew )   { bNextCycle = bNew; }
     138             : 
     139        1783 :     sal_Bool IsWaitAllowed()        const       { return bWaitAllowed; }
     140        1530 :     sal_Bool IsNextCycle()          const       { return bNextCycle; }
     141        6679 :     sal_Bool IsInput()              const       { return bInput; }
     142        1783 :     sal_Bool IsWait()               const       { return 0 != pWait;  }
     143        8836 :     sal_Bool IsPaint()              const       { return bPaint; }
     144        1443 :     sal_Bool IsIdle()               const       { return bIdle;  }
     145        2584 :     sal_Bool IsReschedule()         const       { return bReschedule;  }
     146         760 :     bool IsPaintExtraData()     const       { return bPaintExtraData;}
     147             :     sal_Bool IsStopPrt()          const;
     148        5889 :     sal_Bool IsInterrupt()        const { return IsInput() || IsStopPrt(); }
     149             : 
     150        1512 :     sal_uInt16 GetInputType()    const { return nInputType; }
     151             : #endif
     152             : 
     153             :     //Einstellen der Action auf das gewuenschte Verhalten.
     154         667 :     void SetPaint       ( sal_Bool bNew )   { bPaint = bNew; }
     155        1100 :     void SetComplete    ( sal_Bool bNew )   { bComplete = bNew; }
     156             :     void SetStatBar     ( sal_Bool bNew );
     157        1476 :     void SetInputType   ( sal_uInt16 nNew ) { nInputType = nNew; }
     158          53 :     void SetCalcLayout  ( sal_Bool bNew )   { bCalcLayout = bNew; }
     159          55 :     void SetReschedule  ( sal_Bool bNew )   { bReschedule = bNew; }
     160         379 :     void SetWaitAllowed ( sal_Bool bNew )   { bWaitAllowed = bNew; }
     161             : 
     162           0 :     void SetAgain()         { bAgain = sal_True; }
     163           0 :     void SetUpdateExpFlds() {bUpdateExpFlds = sal_True; }
     164             :     void SetProgress(SfxProgress * _pProgress = NULL)
     165             :     { pProgress = _pProgress; }
     166             : 
     167             :     inline void SetCheckPageNum( sal_uInt16 nNew );
     168           0 :     inline void SetCheckPageNumDirect( sal_uInt16 nNew ) { nCheckPageNum = nNew; }
     169             : 
     170             :     void Action();  //Jetzt gehts loos...
     171             :     void Reset();   //Zurueck auf CTor-Defaults.
     172             : 
     173       11554 :     sal_Bool IsAgain()      const { return bAgain; }
     174        3619 :     sal_Bool IsComplete()   const { return bComplete; }
     175          53 :     sal_Bool IsExpFlds()    const { return bUpdateExpFlds; }
     176        2553 :     sal_Bool IsCalcLayout() const { return bCalcLayout;  }
     177           2 :     sal_Bool IsCheckPages() const { return bCheckPages;  }
     178          24 :     sal_Bool IsBrowseActionStop() const { return bBrowseActionStop; }
     179           0 :     sal_Bool IsActionInProgress() const { return bActionInProgress; }
     180             : 
     181           0 :     sal_uInt16 GetCheckPageNum() const { return nCheckPageNum; }
     182             : 
     183             :     //Auch andere sollen den Wartecrsr einschalten koennen.
     184             :     void CheckWaitCrsr();
     185             : 
     186             :     // #i28701# - method is now public;
     187             :     // delete 2nd parameter, because its not used;
     188             :     sal_Bool FormatLayoutFly( SwFlyFrm * );
     189             :     // #i28701# - method is now public
     190             :     sal_Bool _FormatFlyCntnt( const SwFlyFrm * );
     191             : 
     192             : };
     193             : 
     194             : class SwLayIdle
     195             : {
     196             : 
     197             :     SwRootFrm *pRoot;
     198             :     SwViewImp  *pImp;           // Hier Meldet sich der Idler an und ab.
     199             :     SwCntntNode *pCntntNode;    // Hier wird die aktuelle Cursorposition
     200             :     xub_StrLen  nTxtPos;        // zwischengespeichert.
     201             :     sal_Bool        bPageValid;     // Konnte die Seite alles validiert werden?
     202             :     sal_Bool        bAllValid;      // Konnte alles validiert werden?
     203             : 
     204             : #ifdef DBG_UTIL
     205             :     bool m_bIndicator;
     206             : #endif
     207             : 
     208             : #ifdef _LAYACT_CXX
     209             : 
     210             : #ifdef DBG_UTIL
     211             :     void ShowIdle( ColorData eName );
     212             : #endif
     213             : 
     214             :     enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, SMART_TAGS };    // SMARTTAGS
     215             :     sal_Bool _DoIdleJob( const SwCntntFrm*, IdleJobType );
     216             :     sal_Bool DoIdleJob( IdleJobType, sal_Bool bVisAreaOnly );
     217             : 
     218             : #endif
     219             : 
     220             : public:
     221             :     SwLayIdle( SwRootFrm *pRt, SwViewImp *pImp );
     222             :     ~SwLayIdle();
     223             : };
     224             : 
     225           0 : inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew )
     226             : {
     227           0 :     if ( nNew < nCheckPageNum )
     228           0 :         nCheckPageNum = nNew;
     229           0 : }
     230             : 
     231             : #endif  //_LAYACT_HXX
     232             : 
     233             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10