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
192{
194 SwViewShellImp *m_pImp; // The Idler registers and deregisters here
195 SwContentNode *m_pContentNode; // The current cursor position is saved here
196 sal_Int32 m_nTextPos;
197 bool m_bPageValid; // Were we able to evaluate everything on the whole page?
198#ifdef DBG_UTIL
200
201 void ShowIdle( Color eName );
202#endif
203
205 bool DoIdleJob_( const SwContentFrame*, IdleJobType );
206 bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
207
208public:
209 SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pImp );
210 ~SwLayIdle();
211};
212
213inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew )
214{
215 if ( nNew < m_nCheckPageNum )
216 m_nCheckPageNum = nNew;
217}
218
219#endif // INCLUDED_SW_SOURCE_CORE_INC_LAYACT_HXX
220
221/* 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:58
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:1442
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:213
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:1906
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:1491
bool IsComplete() const
Definition: layact.hxx:171
bool TurboAction_(const SwContentFrame *)
Definition: layact.cxx:805
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:1639
void SetPaint(bool bNew)
Definition: layact.hxx:153
bool IsShortCut(SwPageFrame *&)
Definition: layact.cxx:991
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:861
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:1878
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:1206
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:194
SwContentNode * m_pContentNode
Definition: layact.hxx:195
~SwLayIdle()
Definition: layact.cxx:2414
sal_Int32 m_nTextPos
Definition: layact.hxx:196
bool DoIdleJob_(const SwContentFrame *, IdleJobType)
Definition: layact.cxx:1951
SwRootFrame * m_pRoot
Definition: layact.hxx:193
bool m_bPageValid
Definition: layact.hxx:197
@ AUTOCOMPLETE_WORDS
Definition: layact.hxx:204
@ WORD_COUNT
Definition: layact.hxx:204
@ SMART_TAGS
Definition: layact.hxx:204
@ ONLINE_SPELLING
Definition: layact.hxx:204
bool m_bIndicator
Definition: layact.hxx:199
bool DoIdleJob(IdleJobType, bool bVisAreaOnly)
Definition: layact.cxx:2100
void ShowIdle(Color eName)
SwLayIdle(SwRootFrame *pRt, SwViewShellImp *pImp)
Definition: layact.cxx:2223
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:58
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:47
VclInputFlags
long Long