LCOV - code coverage report
Current view: top level - sw/source/core/inc - layact.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 36 75.0 %
Date: 2012-08-25 Functions: 27 33 81.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _LAYACT_HXX
      29                 :            : #define _LAYACT_HXX
      30                 :            : #include "swtypes.hxx"
      31                 :            : #include "swrect.hxx"
      32                 :            : 
      33                 :            : class SwRootFrm;
      34                 :            : class SwLayoutFrm;
      35                 :            : class SwPageFrm;
      36                 :            : class SwFlyFrm;
      37                 :            : class SwCntntFrm;
      38                 :            : class SwTabFrm;
      39                 :            : class SwViewImp;
      40                 :            : class SwCntntNode;
      41                 :            : class SwWait;
      42                 :            : // #i28701#
      43                 :            : class SfxProgress;
      44                 :            : 
      45                 :            : //Die Verwendung der LayAction laeuft immer gleich ab:
      46                 :            : //
      47                 :            : // 1. Erzeugen des LayAction-Objektes.
      48                 :            : // 2. Einstellen des gewuenschten Verhaltens mittels der Set-Methoden
      49                 :            : // 3. Aufruf von Action()
      50                 :            : // 4. Baldiges Zerstoeren des Objektes.
      51                 :            : //
      52                 :            : // Das Objekt meldet sich im CTor beim SwViewImp an und erst im DTor
      53                 :            : // wieder ab! Es handelt sich mithin um ein typisches Stackobjekt.
      54                 :            : 
      55                 :            : 
      56                 :            : class SwLayAction
      57                 :            : {
      58                 :            :     SwRootFrm  *pRoot;
      59                 :            :     SwViewImp  *pImp;   //Hier Meldet sich die Action an und ab.
      60                 :            : 
      61                 :            :     //Zur Optimierung, damit die Tabellen etwas besser am Crsr kleben beim
      62                 :            :     //Return/Backspace davor.
      63                 :            :     //Wenn der erste TabFrm, der sich Paintet (pro Seite) traegt sich im
      64                 :            :     //Pointer ein. Die CntntFrms unterhalb der Seite brauchen sich
      65                 :            :     //dann nicht mehr bei der Shell zum Painten anmelden.
      66                 :            :     const SwTabFrm *pOptTab;
      67                 :            : 
      68                 :            :     SwWait *pWait;
      69                 :            : 
      70                 :            :     SfxProgress * pProgress;
      71                 :            : 
      72                 :            :     //Wenn ein Absatz - oder was auch immer - bei der Formatierung mehr
      73                 :            :     //als eine Seite rueckwaerts floss traegt er seine neue Seitennummer
      74                 :            :     //hier ein. Die Steuerung der InternalAction kann dann geeignet reagieren.
      75                 :            :     sal_uInt16 nPreInvaPage;
      76                 :            : 
      77                 :            :     sal_uLong nStartTicks;  //Startzeitpunkt der Aktion, vergeht zu viel Zeit kann
      78                 :            :                         //der WaitCrsr per CheckWaitCrsr() eingeschaltet werden.
      79                 :            : 
      80                 :            :     sal_uInt16 nInputType;  //Bei welchem Input soll die Verarbeitung abgebrochen
      81                 :            :                         //werden?
      82                 :            :     sal_uInt16 nEndPage;    //StatBar Steuerung.
      83                 :            :     sal_uInt16 nCheckPageNum; //CheckPageDesc() wurde verzoegert wenn != USHRT_MAX
      84                 :            :                           //ab dieser Seite Checken.
      85                 :            : 
      86                 :            :     sal_Bool bPaint;        //Painten oder nur Formatieren?
      87                 :            :     sal_Bool bComplete;     //Alles bis zum sichtbaren Bereich Formatieren oder
      88                 :            :                         //oder nur den sichtbaren Bereich?
      89                 :            :     sal_Bool bCalcLayout;   //Vollstaendige Reformatierung?
      90                 :            :     sal_Bool bAgain;        //Zur automatisch wiederholten Action wenn Seiten
      91                 :            :                         //geloscht werden.
      92                 :            :     sal_Bool bNextCycle;    //Wiederaufsetzen bei der ersten Ungueltigen Seite.
      93                 :            :     sal_Bool bInput;        //Zum Abbrechen der Verarbeitung wenn ein Input anliegt.
      94                 :            :     sal_Bool bIdle;         //True wenn die Layaction vom Idler ausgeloest wurde.
      95                 :            :     sal_Bool bReschedule;   //Soll das Reschedule - abhaengig vom Progress -
      96                 :            :                         //gerufen werden?
      97                 :            :     sal_Bool bCheckPages;   //CheckPageDescs() ausfuehren oder verzoegern.
      98                 :            :     sal_Bool bUpdateExpFlds;//Wird gesetzt wenn nach dem Formatierien noch eine
      99                 :            :                         //Runde fuer den ExpFld laufen muss.
     100                 :            :     sal_Bool bBrowseActionStop; //Action fruehzeitig beenden (per bInput) und den
     101                 :            :                             //Rest dem Idler ueberlassen.
     102                 :            :     sal_Bool bWaitAllowed;      //Wartecursor erlaubt?
     103                 :            :     sal_Bool bPaintExtraData;   //Anzeige von Zeilennumerierung o. ae. eingeschaltet?
     104                 :            :     sal_Bool bActionInProgress; // wird in Action() anfangs gesetzt und zum Schluss geloescht
     105                 :            : 
     106                 :            :     // OD 14.04.2003 #106346# - new flag for content formatting on interrupt.
     107                 :            :     sal_Bool    mbFormatCntntOnInterrupt;
     108                 :            : 
     109                 :            : #ifdef _LAYACT_CXX
     110                 :            : 
     111                 :            :     void PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
     112                 :            :                      const SwRect &rOldRect, long nOldBottom );
     113                 :            :     sal_Bool PaintWithoutFlys( const SwRect &, const SwCntntFrm *,
     114                 :            :                            const SwPageFrm * );
     115                 :            :     inline sal_Bool _PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
     116                 :            :                              const SwRect & );
     117                 :            : 
     118                 :            :     sal_Bool FormatLayout( SwLayoutFrm *, sal_Bool bAddRect = sal_True );
     119                 :            :     sal_Bool FormatLayoutTab( SwTabFrm *, sal_Bool bAddRect = sal_True );
     120                 :            :     sal_Bool FormatCntnt( const SwPageFrm* pPage );
     121                 :            :     void _FormatCntnt( const SwCntntFrm* pCntnt,
     122                 :            :                        const SwPageFrm* pPage );
     123                 :            :     sal_Bool IsShortCut( SwPageFrm *& );
     124                 :            : 
     125                 :            :     sal_Bool TurboAction();
     126                 :            :     sal_Bool _TurboAction( const SwCntntFrm * );
     127                 :            :     void InternalAction();
     128                 :            : 
     129                 :            :     SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage );
     130                 :            : 
     131                 :            :     sal_Bool RemoveEmptyBrowserPages();
     132                 :            : 
     133                 :            :     inline void CheckIdleEnd();
     134                 :      13225 :     inline sal_uLong GetStartTicks() { return nStartTicks; }
     135                 :            : 
     136                 :            : #endif
     137                 :            : 
     138                 :            : public:
     139                 :            :     SwLayAction( SwRootFrm *pRt, SwViewImp *pImp );
     140                 :            :     ~SwLayAction();
     141                 :            : 
     142                 :            : #ifdef _LAYACT_CXX
     143                 :       4488 :     void SetIdle            ( sal_Bool bNew )   { bIdle = bNew; }
     144                 :      31469 :     void SetCheckPages      ( sal_Bool bNew )   { bCheckPages = bNew; }
     145                 :          0 :     void SetBrowseActionStop(sal_Bool bNew  )   { bBrowseActionStop = bNew; }
     146                 :       3899 :     void SetNextCycle       ( sal_Bool bNew )   { bNextCycle = bNew; }
     147                 :            : 
     148                 :      21157 :     sal_Bool IsWaitAllowed()        const       { return bWaitAllowed; }
     149                 :      29521 :     sal_Bool IsNextCycle()          const       { return bNextCycle; }
     150                 :     122364 :     sal_Bool IsInput()              const       { return bInput; }
     151                 :      21166 :     sal_Bool IsWait()               const       { return 0 != pWait;  }
     152                 :     121847 :     sal_Bool IsPaint()              const       { return bPaint; }
     153                 :      52244 :     sal_Bool IsIdle()               const       { return bIdle;  }
     154                 :      36249 :     sal_Bool IsReschedule()         const       { return bReschedule;  }
     155                 :      10033 :     sal_Bool IsPaintExtraData()     const       { return bPaintExtraData;}
     156                 :            :     sal_Bool IsStopPrt()          const;
     157 [ +  + ][ -  + ]:     106176 :     sal_Bool IsInterrupt()        const { return IsInput() || IsStopPrt(); }
     158                 :            : 
     159                 :      31222 :     sal_uInt16 GetInputType()    const { return nInputType; }
     160                 :            : #endif
     161                 :            : 
     162                 :            :     //Einstellen der Action auf das gewuenschte Verhalten.
     163                 :       3121 :     void SetPaint       ( sal_Bool bNew )   { bPaint = bNew; }
     164                 :      34558 :     void SetComplete    ( sal_Bool bNew )   { bComplete = bNew; }
     165                 :            :     void SetStatBar     ( sal_Bool bNew );
     166                 :      38946 :     void SetInputType   ( sal_uInt16 nNew ) { nInputType = nNew; }
     167                 :        148 :     void SetCalcLayout  ( sal_Bool bNew )   { bCalcLayout = bNew; }
     168                 :        167 :     void SetReschedule  ( sal_Bool bNew )   { bReschedule = bNew; }
     169                 :       4488 :     void SetWaitAllowed ( sal_Bool bNew )   { bWaitAllowed = bNew; }
     170                 :            : 
     171                 :         16 :     void SetAgain()         { bAgain = sal_True; }
     172                 :          0 :     void SetUpdateExpFlds() {bUpdateExpFlds = sal_True; }
     173                 :            :     void SetProgress(SfxProgress * _pProgress = NULL)
     174                 :            :     { pProgress = _pProgress; }
     175                 :            : 
     176                 :            :     inline void SetCheckPageNum( sal_uInt16 nNew );
     177                 :          0 :     inline void SetCheckPageNumDirect( sal_uInt16 nNew ) { nCheckPageNum = nNew; }
     178                 :            : 
     179                 :            :     void Action();  //Jetzt gehts loos...
     180                 :            :     void Reset();   //Zurueck auf CTor-Defaults.
     181                 :            : 
     182                 :     161766 :     sal_Bool IsAgain()      const { return bAgain; }
     183                 :      71587 :     sal_Bool IsComplete()   const { return bComplete; }
     184                 :        148 :     sal_Bool IsExpFlds()    const { return bUpdateExpFlds; }
     185                 :      48236 :     sal_Bool IsCalcLayout() const { return bCalcLayout;  }
     186                 :          6 :     sal_Bool IsCheckPages() const { return bCheckPages;  }
     187                 :        400 :     sal_Bool IsBrowseActionStop() const { return bBrowseActionStop; }
     188                 :          0 :     sal_Bool IsActionInProgress() const { return bActionInProgress; }
     189                 :            : 
     190                 :          0 :     sal_uInt16 GetCheckPageNum() const { return nCheckPageNum; }
     191                 :            : 
     192                 :            :     //Auch andere sollen den Wartecrsr einschalten koennen.
     193                 :            :     void CheckWaitCrsr();
     194                 :            : 
     195                 :            :     // #i28701# - method is now public;
     196                 :            :     // delete 2nd parameter, because its not used;
     197                 :            :     sal_Bool FormatLayoutFly( SwFlyFrm * );
     198                 :            :     // #i28701# - method is now public
     199                 :            :     sal_Bool _FormatFlyCntnt( const SwFlyFrm * );
     200                 :            : 
     201                 :            : };
     202                 :            : 
     203                 :            : class SwLayIdle
     204                 :            : {
     205                 :            : 
     206                 :            :     SwRootFrm *pRoot;
     207                 :            :     SwViewImp  *pImp;           // Hier Meldet sich der Idler an und ab.
     208                 :            :     SwCntntNode *pCntntNode;    // Hier wird die aktuelle Cursorposition
     209                 :            :     xub_StrLen  nTxtPos;        // zwischengespeichert.
     210                 :            :     sal_Bool        bPageValid;     // Konnte die Seite alles validiert werden?
     211                 :            :     sal_Bool        bAllValid;      // Konnte alles validiert werden?
     212                 :            : 
     213                 :            : #ifdef DBG_UTIL
     214                 :            :     bool m_bIndicator;
     215                 :            : #endif
     216                 :            : 
     217                 :            : #ifdef _LAYACT_CXX
     218                 :            : 
     219                 :            : #ifdef DBG_UTIL
     220                 :            :     void ShowIdle( ColorData eName );
     221                 :            : #endif
     222                 :            : 
     223                 :            :     enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, SMART_TAGS };    // SMARTTAGS
     224                 :            :     sal_Bool _DoIdleJob( const SwCntntFrm*, IdleJobType );
     225                 :            :     sal_Bool DoIdleJob( IdleJobType, sal_Bool bVisAreaOnly );
     226                 :            : 
     227                 :            : #endif
     228                 :            : 
     229                 :            : public:
     230                 :            :     SwLayIdle( SwRootFrm *pRt, SwViewImp *pImp );
     231                 :            :     ~SwLayIdle();
     232                 :            : };
     233                 :            : 
     234                 :          0 : inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew )
     235                 :            : {
     236         [ #  # ]:          0 :     if ( nNew < nCheckPageNum )
     237                 :          0 :         nCheckPageNum = nNew;
     238                 :          0 : }
     239                 :            : 
     240                 :            : #endif  //_LAYACT_HXX
     241                 :            : 
     242                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10