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