LibreOffice Module sw (master) 1
layact.hxx
Go to the documentation of this file.
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 INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
21
22#include <sal/config.h>
23
24#include <vcl/inputtypes.hxx>
25#include <tools/color.hxx>
26
27#include <ctime>
28#include <memory>
29#include <vector>
30
31#include <swrect.hxx>
32
33class OutputDevice;
34class SwFrame;
36class SwRootFrame;
37class SwLayoutFrame;
38class SwPageFrame;
39class SwFlyFrame;
40class SwContentFrame;
41class SwTabFrame;
42class SwViewShellImp;
43class SwContentNode;
44class SwWait;
45
59{
61 SwViewShellImp *m_pImp; // here the action logs in and off
62
63 // For the sake of optimization, so that the tables stick a bit better to
64 // the Cursor when hitting return/backspace in front of one.
65 // The first TabFrame that paints itself (per page) adds itself to the pointer.
66 // The ContentFrames beneath the page do not need to deregister at the Shell for
67 // painting.
69
70 std::unique_ptr<SwWait> m_pWait;
71
72 std::vector<SwFrame*> m_aFrameStack;
73 std::vector<std::unique_ptr<SwFrameDeleteGuard>> m_aFrameDeleteGuards;
74
75 // If a paragraph (or anything else) moved more than one page when
76 // formatting, it adds its new page number here.
77 // The InternalAction can then take the appropriate steps.
78 sal_uInt16 m_nPreInvaPage;
79
80 std::clock_t m_nStartTicks; // The Action's starting time; if too much time passes the
81 // WaitCursor can be enabled via CheckWaitCursor()
82
83 VclInputFlags m_nInputType; // Which input should terminate processing
84 sal_uInt16 m_nEndPage; // StatBar control
85 sal_uInt16 m_nCheckPageNum; // CheckPageDesc() was delayed if != USHRT_MAX
86 // check from this page onwards
87
88 bool m_bPaint; // painting or only formatting?
89 bool m_bComplete; // Format everything or just the visible Area?
90 bool m_bCalcLayout; // Complete reformatting?
91 bool m_bAgain; // For the automatically repeated Action if Pages are deleted
92 bool m_bNextCycle; // Reset on the first invalid Page
93 bool m_bInterrupt; // For terminating processing on interrupt
94 bool m_bIdle; // True if the LayAction was triggered by the Idler
95 bool m_bReschedule; // Call Reschedule depending on Progress?
96 bool m_bCheckPages; // Run CheckPageDescs() or delay it
97 bool m_bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField
98 bool m_bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler
99 bool m_bWaitAllowed; // Waitcursor allowed?
100 bool m_bPaintExtraData; // Painting line numbers (or similar) enabled?
101 bool m_bActionInProgress; // Is set in Action() at the beginning and deleted at the end
102
103 // OD 14.04.2003 #106346# - new flag for content formatting on interrupt.
105
106 void PaintContent( const SwContentFrame *, const SwPageFrame *,
107 const SwRect &rOldRect, tools::Long nOldBottom );
108 bool PaintWithoutFlys( const SwRect &, const SwContentFrame *,
109 const SwPageFrame * );
110 inline bool PaintContent_( const SwContentFrame *, const SwPageFrame *,
111 const SwRect & );
112
113 bool FormatLayout( OutputDevice* pRenderContext, SwLayoutFrame *, bool bAddRect = true );
114 bool FormatLayoutTab( SwTabFrame *, bool bAddRect );
115 bool FormatContent(SwPageFrame * pPage);
116 void FormatContent_( const SwContentFrame* pContent,
117 const SwPageFrame* pPage );
118 bool IsShortCut( SwPageFrame *& );
119
120 bool TurboAction();
121 bool TurboAction_( const SwContentFrame * );
122 void InternalAction(OutputDevice* pRenderContext);
123
124 static SwPageFrame *CheckFirstVisPage( SwPageFrame *pPage );
125
127
128 void PushFormatLayout(SwFrame* pLow);
129 void PopFormatLayout();
130
131 inline void CheckIdleEnd();
132
133public:
135 ~SwLayAction();
136
137 void SetIdle ( bool bNew ) { m_bIdle = bNew; }
138 void SetCheckPages ( bool bNew ) { m_bCheckPages = bNew; }
139 void SetBrowseActionStop( bool bNew ) { m_bBrowseActionStop = bNew; }
140 void SetNextCycle ( bool bNew ) { m_bNextCycle = bNew; }
141
142 bool IsWaitAllowed() const { return m_bWaitAllowed; }
143 bool IsNextCycle() const { return m_bNextCycle; }
144 bool IsPaint() const { return m_bPaint; }
145 bool IsIdle() const { return m_bIdle; }
146 bool IsReschedule() const { return m_bReschedule; }
147 bool IsPaintExtraData() const { return m_bPaintExtraData;}
148 bool IsInterrupt() const { return m_bInterrupt; }
149
151
152 // adjusting Action to the wanted behaviour
153 void SetPaint ( bool bNew ) { m_bPaint = bNew; }
154 void SetComplete ( bool bNew ) { m_bComplete = bNew; }
155 void SetStatBar ( bool bNew );
156 void SetInputType ( VclInputFlags nNew ) { m_nInputType = nNew; }
157 void SetCalcLayout ( bool bNew ) { m_bCalcLayout = bNew; }
158 void SetReschedule ( bool bNew ) { m_bReschedule = bNew; }
159 void SetWaitAllowed ( bool bNew ) { m_bWaitAllowed = bNew; }
160
161 void SetAgain(bool bAgain);
163
164 inline void SetCheckPageNum( sal_uInt16 nNew );
165 void SetCheckPageNumDirect( sal_uInt16 nNew ) { m_nCheckPageNum = nNew; }
166
167 void Action(OutputDevice* pRenderContext); // here it begins
168 void Reset(); // back to CTor-defaults
169
170 bool IsAgain() const { return m_bAgain; }
171 bool IsComplete() const { return m_bComplete; }
172 bool IsExpFields() const { return m_bUpdateExpFields; }
173 bool IsCalcLayout() const { return m_bCalcLayout; }
174 bool IsCheckPages() const { return m_bCheckPages; }
177
178 sal_uInt16 GetCheckPageNum() const { return m_nCheckPageNum; }
179
180 // others should be able to activate the WaitCursor, too
181 void CheckWaitCursor();
182
183 // #i28701# - method is now public;
184 // delete 2nd parameter, because it's not used;
185 void FormatLayoutFly( SwFlyFrame * );
186 // #i28701# - method is now public
187 void FormatFlyContent( const SwFlyFrame * );
188
189};
190
191enum class IdleJobType
192{
197};
198
199enum class IdleJobArea
200{
201 ALL,
202 VISIBLE
203};
204
206{
208 SwViewShellImp *m_pImp; // The Idler registers and deregisters here
209 SwContentNode *m_pContentNode; // The current cursor position is saved here
210 sal_Int32 m_nTextPos;
211 bool m_bPageValid; // Were we able to evaluate everything on the whole page?
212#ifdef DBG_UTIL
214
215 void ShowIdle( Color eName );
216#endif
217
218 bool DoIdleJob_( const SwContentFrame*, IdleJobType );
219 bool DoIdleJob(IdleJobType eJobType, IdleJobArea eJobArea);
220
221 static bool isJobEnabled(IdleJobType eJob, const SwViewShell* pViewShell);
222public:
223 SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pImp );
224 ~SwLayIdle();
225};
226
227inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew )
228{
229 if ( nNew < m_nCheckPageNum )
230 m_nCheckPageNum = nNew;
231}
232
233#endif // INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
234
235/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
Base class of the Writer layout elements.
Definition: frame.hxx:315
The usage of LayAction is always the same:
Definition: layact.hxx:59
void FormatLayoutFly(SwFlyFrame *)
Definition: layact.cxx:1455
bool m_bActionInProgress
Definition: layact.hxx:101
bool m_bNextCycle
Definition: layact.hxx:92
bool m_bIdle
Definition: layact.hxx:94
bool m_bPaintExtraData
Definition: layact.hxx:100
SwLayAction(SwRootFrame *pRt, SwViewShellImp *pImp)
Definition: layact.cxx:249
std::clock_t m_nStartTicks
Definition: layact.hxx:80
void SetCheckPageNumDirect(sal_uInt16 nNew)
Definition: layact.hxx:165
void Reset()
Definition: layact.cxx:276
bool IsAgain() const
Definition: layact.hxx:170
bool m_bBrowseActionStop
Definition: layact.hxx:98
const SwTabFrame * m_pOptTab
Definition: layact.hxx:68
bool m_bPaint
Definition: layact.hxx:88
void Action(OutputDevice *pRenderContext)
Definition: layact.cxx:363
void SetReschedule(bool bNew)
Definition: layact.hxx:158
void CheckIdleEnd()
Definition: layact.cxx:86
void SetCheckPageNum(sal_uInt16 nNew)
Definition: layact.hxx:227
std::unique_ptr< SwWait > m_pWait
Definition: layact.hxx:70
sal_uInt16 m_nPreInvaPage
Definition: layact.hxx:78
SwViewShellImp * m_pImp
Definition: layact.hxx:61
void SetAgain(bool bAgain)
Definition: layact.cxx:316
bool m_bCalcLayout
Definition: layact.hxx:90
void FormatFlyContent(const SwFlyFrame *)
Definition: layact.cxx:1925
bool m_bWaitAllowed
Definition: layact.hxx:99
bool IsExpFields() const
Definition: layact.hxx:172
bool IsNextCycle() const
Definition: layact.hxx:143
void SetInputType(VclInputFlags nNew)
Definition: layact.hxx:156
VclInputFlags GetInputType() const
Definition: layact.hxx:150
void SetBrowseActionStop(bool bNew)
Definition: layact.hxx:139
bool m_bCheckPages
Definition: layact.hxx:96
bool m_bUpdateExpFields
Definition: layact.hxx:97
void SetCheckPages(bool bNew)
Definition: layact.hxx:138
void SetComplete(bool bNew)
Definition: layact.hxx:154
void SetUpdateExpFields()
Definition: layact.hxx:162
void SetCalcLayout(bool bNew)
Definition: layact.hxx:157
bool m_bReschedule
Definition: layact.hxx:95
void PaintContent(const SwContentFrame *, const SwPageFrame *, const SwRect &rOldRect, tools::Long nOldBottom)
Depending of the type, the Content is output according to its changes, or the area to be outputted is...
Definition: layact.cxx:199
bool FormatLayoutTab(SwTabFrame *, bool bAddRect)
Definition: layact.cxx:1504
bool IsComplete() const
Definition: layact.hxx:171
bool TurboAction_(const SwContentFrame *)
Definition: layact.cxx:818
bool m_bInterrupt
Definition: layact.hxx:93
bool IsWaitAllowed() const
Definition: layact.hxx:142
sal_uInt16 m_nCheckPageNum
Definition: layact.hxx:85
void SetWaitAllowed(bool bNew)
Definition: layact.hxx:159
void CheckWaitCursor()
Definition: layact.cxx:72
bool IsReschedule() const
Definition: layact.hxx:146
void PopFormatLayout()
Definition: layact.cxx:357
void PushFormatLayout(SwFrame *pLow)
Definition: layact.cxx:343
bool PaintWithoutFlys(const SwRect &, const SwContentFrame *, const SwPageFrame *)
Definition: layact.cxx:103
bool IsIdle() const
Definition: layact.hxx:145
void InternalAction(OutputDevice *pRenderContext)
Definition: layact.cxx:466
sal_uInt16 m_nEndPage
Definition: layact.hxx:84
bool IsPaint() const
Definition: layact.hxx:144
std::vector< SwFrame * > m_aFrameStack
Definition: layact.hxx:72
bool FormatContent(SwPageFrame *pPage)
Definition: layact.cxx:1652
void SetPaint(bool bNew)
Definition: layact.hxx:153
bool IsShortCut(SwPageFrame *&)
Definition: layact.cxx:1004
bool m_bComplete
Definition: layact.hxx:89
~SwLayAction()
Definition: layact.cxx:270
bool IsBrowseActionStop() const
Definition: layact.hxx:175
sal_uInt16 GetCheckPageNum() const
Definition: layact.hxx:178
bool RemoveEmptyBrowserPages()
Definition: layact.cxx:288
bool IsActionInProgress() const
Definition: layact.hxx:176
bool TurboAction()
Definition: layact.cxx:874
bool IsInterrupt() const
Definition: layact.hxx:148
std::vector< std::unique_ptr< SwFrameDeleteGuard > > m_aFrameDeleteGuards
Definition: layact.hxx:73
void SetIdle(bool bNew)
Definition: layact.hxx:137
void SetStatBar(bool bNew)
Definition: layact.cxx:92
void SetNextCycle(bool bNew)
Definition: layact.hxx:140
SwRootFrame * m_pRoot
Definition: layact.hxx:60
bool IsPaintExtraData() const
Definition: layact.hxx:147
bool PaintContent_(const SwContentFrame *, const SwPageFrame *, const SwRect &)
Definition: layact.cxx:181
void FormatContent_(const SwContentFrame *pContent, const SwPageFrame *pPage)
Definition: layact.cxx:1897
bool IsCheckPages() const
Definition: layact.hxx:174
bool m_bAgain
Definition: layact.hxx:91
bool IsCalcLayout() const
Definition: layact.hxx:173
bool FormatLayout(OutputDevice *pRenderContext, SwLayoutFrame *, bool bAddRect=true)
Definition: layact.cxx:1219
bool mbFormatContentOnInterrupt
Definition: layact.hxx:104
static SwPageFrame * CheckFirstVisPage(SwPageFrame *pPage)
Definition: layact.cxx:412
VclInputFlags m_nInputType
Definition: layact.hxx:83
SwViewShellImp * m_pImp
Definition: layact.hxx:208
SwContentNode * m_pContentNode
Definition: layact.hxx:209
~SwLayIdle()
Definition: layact.cxx:2456
sal_Int32 m_nTextPos
Definition: layact.hxx:210
bool DoIdleJob_(const SwContentFrame *, IdleJobType)
Definition: layact.cxx:1970
SwRootFrame * m_pRoot
Definition: layact.hxx:207
bool m_bPageValid
Definition: layact.hxx:211
bool m_bIndicator
Definition: layact.hxx:213
bool DoIdleJob(IdleJobType eJobType, IdleJobArea eJobArea)
Definition: layact.cxx:2153
static bool isJobEnabled(IdleJobType eJob, const SwViewShell *pViewShell)
Definition: layact.cxx:2119
void ShowIdle(Color eName)
SwLayIdle(SwRootFrame *pRt, SwViewShellImp *pImp)
Definition: layact.cxx:2264
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
A page of the document layout.
Definition: pagefrm.hxx:60
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:49
VclInputFlags
IdleJobArea
Definition: layact.hxx:200
IdleJobType
Definition: layact.hxx:192
long Long
VISIBLE