LibreOffice Module sw (master) 1
pagefrm.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_PAGEFRM_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
21
22#include <viewsh.hxx>
23#include <swdllapi.h>
24#include "ftnboss.hxx"
25#include "hffrm.hxx"
26
28
29class SwFlyFrame;
31class SwPageDesc;
32class SwContentFrame;
33struct SwPosition;
35class SwAttrSetChg;
36namespace vcl { class Font; }
37class SwSortedObjs;
39
41{
42 NONE = 0x00,
43 InvalidatePrt = 0x01,
44 SetCompletePaint = 0x02,
45 InvalidateNextPos = 0x04,
46 PrepareHeader = 0x08,
47 PrepareFooter = 0x10,
48 CheckGrid = 0x20,
49 InvalidateGrid = 0x40,
50};
51
52namespace o3tl {
53 template<> struct typed_flags<SwPageFrameInvFlags> : is_typed_flags<SwPageFrameInvFlags, 0x007f> {};
54}
55
59{
60 friend class SwFrame;
61
62 std::unique_ptr<SwSortedObjs> m_pSortedObjs;
63
64 SwPageDesc *m_pDesc; //PageDesc that describes the Page
65
67 sal_uInt16 m_nPhyPageNum;
68
74 bool m_bFootnotePage :1; // This Page is for document end footnotes
75 bool m_bEmptyPage :1; // This Page is an explicitly empty page
76 bool m_bEndNotePage :1; // 'Footnote page' for end notes
77 bool m_bInvalidSpelling :1; // We need online spelling
78 bool m_bInvalidSmartTags :1; // We need checking for smarttags
79 bool m_bInvalidAutoCmplWrds :1; // Update auto complete word list
81 bool m_bHasGrid :1; // Grid for Asian layout
82
84
85 void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwPageFrameInvFlags &,
86 SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
87
89 void SetColMaxFootnoteHeight();
90
109 static void GetHorizontalShadowRect( const SwRect& _rPageRect,
110 const SwViewShell* _pViewShell,
111 OutputDevice const * pRenderContext,
112 SwRect& _orBottomShadowRect,
113 bool bPaintLeftShadow,
114 bool bPaintRightShadow,
115 bool bRightSidebar );
116
117 virtual void DestroyImpl() override;
118 virtual ~SwPageFrame() override;
119 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
120 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
121
123 size_t GetContentHeight(const tools::Long nTop, const tools::Long nBottom) const;
124
125public:
127
130 void PrepareHeader();
131 void PrepareFooter();
132
133 const SwSortedObjs *GetSortedObjs() const { return m_pSortedObjs.get(); }
134 SwSortedObjs *GetSortedObjs() { return m_pSortedObjs.get(); }
135
136 void AppendDrawObjToPage( SwAnchoredObject& _rNewObj );
137 void RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj );
138
139 void AppendFlyToPage( SwFlyFrame *pNew );
140 void RemoveFlyFromPage( SwFlyFrame *pToRemove );
141 void MoveFly( SwFlyFrame *pToMove, SwPageFrame *pDest ); // Optimized Remove/Append
142
144 SwPageDesc *GetPageDesc() { return m_pDesc; }
145 const SwPageDesc *GetPageDesc() const { return m_pDesc; }
147
148 SwContentFrame *FindLastBodyContent();
149 inline SwContentFrame *FindFirstBodyContent();
150 inline const SwContentFrame *FindFirstBodyContent() const;
151 inline const SwContentFrame *FindLastBodyContent() const;
152
153 SwRect GetBoundRect(OutputDevice const * pOutputDevice) const;
154
155 // Specialized GetContentPos() for Field in Frames
156 void GetContentPosition( const Point &rPt, SwPosition &rPos ) const;
157
158 bool IsEmptyPage() const { return m_bEmptyPage; } // Explicitly empty page
159
160 void UpdateFootnoteNum();
161
164 void PreparePage( bool bFootnote );
165
166 // Sends a Prepare() to all ContentFrames caused by a changed register template
167 void PrepareRegisterChg();
168
169 // Appends a fly frame - the given one or a new one - at the page frame.
170 // Needed for <Modify> and <MakeFrames>
171 // - return value not needed any more
172 // - second parameter is of type <SwFlyFrameFormat*>
173 // - third parameter only needed for assertion, but calling method assures
174 // this assertion. Thus, delete it.
175 void PlaceFly( SwFlyFrame* pFly, SwFlyFrameFormat* pFormat );
176
177 virtual bool GetModelPositionForViewPoint( SwPosition *, Point&,
178 SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
180 virtual bool GetInfo( SfxPoolItem& ) const override;
181
182 virtual void Cut() override;
183 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
184 virtual void CheckDirection( bool bVert ) override;
185 void CheckGrid( bool bInvalidate );
186 void PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) const;
187 bool HasGrid() const { return m_bHasGrid; }
188
189 void PaintDecorators( ) const;
190 virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const override;
191 virtual void PaintBreak() const override;
192
194 void RefreshExtraData( const SwRect & ) const;
195
197 void RefreshSubsidiary( const SwRect& ) const;
198
200 bool IsFootnotePage() const { return m_bFootnotePage; }
201 bool IsEndNotePage() const { return m_bEndNotePage; }
202 void SetFootnotePage( bool b ) { m_bFootnotePage = b; }
203 void SetEndNotePage( bool b ) { m_bEndNotePage = b; }
204
205 sal_uInt16 GetPhyPageNum() const { return m_nPhyPageNum;}
206 void SetPhyPageNum( sal_uInt16 nNum ) { m_nPhyPageNum = nNum;}
207
210 inline void InvalidateFlyLayout() const;
211 inline void InvalidateFlyContent() const;
212 inline void InvalidateFlyInCnt() const;
213 inline void InvalidateLayout() const;
214 inline void InvalidateContent() const;
215 inline void InvalidateSpelling() const;
216 inline void InvalidateSmartTags() const;
217 inline void InvalidateAutoCompleteWords() const;
218 inline void InvalidateWordCount() const;
219 inline void ValidateFlyLayout() const;
220 inline void ValidateFlyContent() const;
221 inline void ValidateFlyInCnt() const;
222 inline void ValidateLayout() const;
223 inline void ValidateContent() const;
224 inline void ValidateSpelling() const;
225 inline void ValidateSmartTags() const;
226 inline void ValidateAutoCompleteWords() const;
227 inline void ValidateWordCount() const;
228 inline bool IsInvalid() const;
229 inline bool IsInvalidFly() const;
230 bool IsRightShadowNeeded() const;
231 bool IsLeftShadowNeeded() const;
232 bool IsInvalidFlyLayout() const { return m_bInvalidFlyLayout; }
233 bool IsInvalidFlyContent() const { return m_bInvalidFlyContent; }
234 bool IsInvalidFlyInCnt() const { return m_bInvalidFlyInCnt; }
235 bool IsInvalidLayout() const { return m_bInvalidLayout; }
236 bool IsInvalidContent() const { return (m_bInvalidContent || m_bInvalidFlyInCnt); }
237 bool IsInvalidSpelling() const { return m_bInvalidSpelling; }
238 bool IsInvalidSmartTags() const { return m_bInvalidSmartTags; }
239 bool IsInvalidAutoCompleteWords() const { return m_bInvalidAutoCmplWrds; }
240 bool IsInvalidWordCount() const { return m_bInvalidWordCount; }
241
249 Color GetDrawBackgroundColor() const;
250
264 void PaintMarginArea( const SwRect& _rOutputRect,
265 SwViewShell const * _pViewShell ) const;
266
289 static void PaintBorderAndShadow( const SwRect& _rPageRect,
290 const SwViewShell* _pViewShell,
291 bool bPaintLeftShadow,
292 bool bPaintRightShadow,
293 bool bRightSidebar );
294
310 static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
311 const SwViewShell* _pViewShell,
312 OutputDevice const * pRenderContext,
313 SwRect& _orBorderAndShadowBoundRect,
314 const bool bLeftShadow,
315 const bool bRightShadow,
316 const bool bRightSidebar
317 );
318
319 static void PaintNotesSidebar(const SwRect& _rPageRect, SwViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight);
320 static void PaintNotesSidebarArrows(const Point &rMiddleFirst, const Point &rMiddleSecond, SwViewShell const * _pViewShell, const Color& rColorUp, const Color& rColorDown);
326
327 virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const override;
328
329 SwRect PrtWithoutHeaderAndFooter() const;
330
331 // in case this is an empty page, this function returns the 'reference' page
332 const SwPageFrame& GetFormatPage() const;
333
336 bool IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rControl ) const;
337
338 // return font used to paint the "empty page" string
339 static const vcl::Font& GetEmptyPageFont();
340
341 static SwTwips GetSidebarBorderWidth( const SwViewShell* );
342
345 bool CheckPageHeightValidForHideWhitespace(SwTwips nDiff);
346
347 const SwHeaderFrame* GetHeaderFrame() const;
348 const SwFooterFrame* GetFooterFrame() const;
349
350 void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
351};
352
354{
355 SwLayoutFrame *pBody = FindBodyCont();
356 return pBody ? pBody->ContainsContent() : nullptr;
357}
359{
360 const SwLayoutFrame *pBody = FindBodyCont();
361 return pBody ? pBody->ContainsContent() : nullptr;
362}
364{
365 return const_cast<SwPageFrame*>(this)->FindLastBodyContent();
366}
368{
369 const_cast<SwPageFrame*>(this)->m_bInvalidFlyLayout = true;
370}
372{
373 const_cast<SwPageFrame*>(this)->m_bInvalidFlyContent = true;
374}
376{
377 const_cast<SwPageFrame*>(this)->m_bInvalidFlyInCnt = true;
378}
380{
381 const_cast<SwPageFrame*>(this)->m_bInvalidLayout = true;
382}
384{
385 const_cast<SwPageFrame*>(this)->m_bInvalidContent = true;
386}
388{
389 const_cast<SwPageFrame*>(this)->m_bInvalidSpelling = true;
390}
391
393{
394 const_cast<SwPageFrame*>(this)->m_bInvalidSmartTags = true;
395}
397{
398 const_cast<SwPageFrame*>(this)->m_bInvalidAutoCmplWrds = true;
399}
401{
402 const_cast<SwPageFrame*>(this)->m_bInvalidWordCount = true;
403}
405{
406 const_cast<SwPageFrame*>(this)->m_bInvalidFlyLayout = false;
407}
409{
410 const_cast<SwPageFrame*>(this)->m_bInvalidFlyContent = false;
411}
413{
414 const_cast<SwPageFrame*>(this)->m_bInvalidFlyInCnt = false;
415}
417{
418 const_cast<SwPageFrame*>(this)->m_bInvalidLayout = false;
419}
421{
422 const_cast<SwPageFrame*>(this)->m_bInvalidContent = false;
423}
425{
426 const_cast<SwPageFrame*>(this)->m_bInvalidSpelling = false;
427}
428
430{
431 const_cast<SwPageFrame*>(this)->m_bInvalidSmartTags = false;
432}
434{
435 const_cast<SwPageFrame*>(this)->m_bInvalidAutoCmplWrds = false;
436}
438{
439 const_cast<SwPageFrame*>(this)->m_bInvalidWordCount = false;
440}
441
442inline bool SwPageFrame::IsInvalid() const
443{
445}
446inline bool SwPageFrame::IsInvalidFly() const
447{
449}
450
451
452class SwTextGridItem;
453
454SwTextGridItem const* GetGridItem(SwPageFrame const*const);
455
456sal_uInt16 GetGridWidth(SwTextGridItem const&, SwDoc const&);
457
458namespace sw { bool IsPageFrameEmpty(SwPageFrame const& rPage); }
459
460
461#endif // INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
462
463/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
wrapper class for the positioning of Writer fly frames and drawing objects
virtual bool GetInfo(SfxPoolItem &) const
Definition: calbck.hxx:173
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
Definition: doc.hxx:197
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
Footer in the document layout, inside a page.
Definition: hffrm.hxx:53
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:48
friend class SwPageFrame
Definition: ftnboss.hxx:54
Style of a layout element.
Definition: frmfmt.hxx:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
virtual void dumpAsXml(xmlTextWriterPtr writer=nullptr) const
Definition: xmldump.cxx:171
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:482
virtual void CheckDirection(bool bVert)
Definition: wsfrm.cxx:398
Header in the document layout, inside a page.
Definition: hffrm.hxx:44
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
virtual void PaintSubsidiaryLines(const SwPageFrame *, const SwRect &) const
Definition: paintfrm.cxx:7167
void RefreshExtraData(const SwRect &) const
Definition: paintfrm.cxx:7321
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: calcmove.cxx:944
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the ContentFrame owning the PrtArea containing the point.
Definition: trvlfrm.cxx:151
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
Definition: trvlfrm.cxx:367
virtual void DestroyImpl() override
Definition: ssfrm.cxx:487
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: wsfrm.cxx:1349
virtual void PaintBreak() const
Definition: paintfrm.cxx:3803
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:72
virtual void Cut() override
Definition: wsfrm.cxx:1446
A page of the document layout.
Definition: pagefrm.hxx:59
bool m_bInvalidContent
Definition: pagefrm.hxx:69
bool m_bFootnotePage
Definition: pagefrm.hxx:74
bool IsInvalidWordCount() const
Definition: pagefrm.hxx:240
void InvalidateContent() const
Definition: pagefrm.hxx:383
void ValidateFlyInCnt() const
Definition: pagefrm.hxx:412
const SwPageDesc * GetPageDesc() const
Definition: pagefrm.hxx:145
void SetPhyPageNum(sal_uInt16 nNum)
Definition: pagefrm.hxx:206
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
Definition: findfrm.cxx:57
void ValidateContent() const
Definition: pagefrm.hxx:420
SwSortedObjs * GetSortedObjs()
Definition: pagefrm.hxx:134
bool IsEndNotePage() const
Definition: pagefrm.hxx:201
void InvalidateWordCount() const
Definition: pagefrm.hxx:400
bool IsInvalid() const
Definition: pagefrm.hxx:442
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
Definition: pagefrm.hxx:367
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:396
bool m_bEndNotePage
Definition: pagefrm.hxx:76
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:205
void ValidateSmartTags() const
Definition: pagefrm.hxx:429
bool IsInvalidFlyContent() const
Definition: pagefrm.hxx:233
void InvalidateFlyInCnt() const
Definition: pagefrm.hxx:375
bool m_bHasGrid
Definition: pagefrm.hxx:81
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:133
bool m_bEmptyPage
Definition: pagefrm.hxx:75
void InvalidateSmartTags() const
Definition: pagefrm.hxx:392
bool IsInvalidFlyLayout() const
Definition: pagefrm.hxx:232
bool m_bInvalidAutoCmplWrds
Definition: pagefrm.hxx:79
bool IsEmptyPage() const
Definition: pagefrm.hxx:158
SwContentFrame * FindFirstBodyContent()
Definition: pagefrm.hxx:353
sal_uInt16 m_nPhyPageNum
Physical page number: index into list of SwRootFrame lowers.
Definition: pagefrm.hxx:67
bool m_bInvalidFlyContent
Definition: pagefrm.hxx:71
bool HasGrid() const
Definition: pagefrm.hxx:187
SwPageDesc * m_pDesc
Definition: pagefrm.hxx:64
static const sal_Int8 snShadowPxWidth
Definition: pagefrm.hxx:83
void SetEndNotePage(bool b)
Definition: pagefrm.hxx:203
bool IsInvalidSmartTags() const
Definition: pagefrm.hxx:238
void ValidateFlyLayout() const
Definition: pagefrm.hxx:404
void InvalidateSpelling() const
Definition: pagefrm.hxx:387
void InvalidateLayout() const
Definition: pagefrm.hxx:379
bool IsFootnotePage() const
Foot note interface.
Definition: pagefrm.hxx:200
bool IsInvalidContent() const
Definition: pagefrm.hxx:236
bool m_bInvalidSmartTags
Definition: pagefrm.hxx:78
void InvalidateFlyContent() const
Definition: pagefrm.hxx:371
bool IsInvalidSpelling() const
Definition: pagefrm.hxx:237
bool IsInvalidAutoCompleteWords() const
Definition: pagefrm.hxx:239
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:144
void SetFootnotePage(bool b)
Definition: pagefrm.hxx:202
void ValidateWordCount() const
Definition: pagefrm.hxx:437
bool m_bInvalidWordCount
Definition: pagefrm.hxx:80
std::unique_ptr< SwSortedObjs > m_pSortedObjs
Definition: pagefrm.hxx:62
bool m_bInvalidFlyInCnt
Definition: pagefrm.hxx:73
bool IsInvalidFlyInCnt() const
Definition: pagefrm.hxx:234
bool m_bInvalidSpelling
Definition: pagefrm.hxx:77
bool m_bInvalidFlyLayout
Definition: pagefrm.hxx:72
bool m_bInvalidLayout
Definition: pagefrm.hxx:70
void ValidateSpelling() const
Definition: pagefrm.hxx:424
bool IsInvalidFly() const
Definition: pagefrm.hxx:446
void ValidateAutoCompleteWords() const
Definition: pagefrm.hxx:433
void ValidateLayout() const
Definition: pagefrm.hxx:416
bool IsInvalidLayout() const
Definition: pagefrm.hxx:235
void ValidateFlyContent() const
Definition: pagefrm.hxx:408
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
This class is used as parameter for creation of a block cursor selection.
class for collecting anchored objects
Definition: sortedobjs.hxx:49
struct _xmlTextWriter * xmlTextWriterPtr
static SwPageDesc * FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId)
Definition: htmlcss1.cxx:1319
static bool bFootnote
Definition: insfnote.cxx:33
bool SetPageDesc(const css::uno::Any &rValue, SwDoc &rDoc, SfxItemSet &rSet)
NONE
Dialog to specify the properties of date form field.
bool IsPageFrameEmpty(SwPageFrame const &rPage)
check if there's content on the page that requires it to exist
Definition: pagechg.cxx:1015
long Long
SwPageFrameInvFlags
Definition: pagefrm.hxx:41
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2659
sal_uInt16 GetGridWidth(SwTextGridItem const &, SwDoc const &)
Definition: pagechg.cxx:2673
Marks a position in the document model.
Definition: pam.hxx:38
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
tools::Long SwTwips
Definition: swtypes.hxx:51
FrameControlType
Definition: swtypes.hxx:246
unsigned char sal_uInt8
signed char sal_Int8