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