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