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;
40
42{
43 NONE = 0x00,
44 InvalidatePrt = 0x01,
45 SetCompletePaint = 0x02,
46 InvalidateNextPos = 0x04,
47 PrepareHeader = 0x08,
48 PrepareFooter = 0x10,
49 CheckGrid = 0x20,
50 InvalidateGrid = 0x40,
51};
52
53namespace o3tl {
54 template<> struct typed_flags<SwPageFrameInvFlags> : is_typed_flags<SwPageFrameInvFlags, 0x007f> {};
55}
56
60{
61 friend class SwFrame;
62
63 std::unique_ptr<SwSortedObjs> m_pSortedObjs;
64
65 SwPageDesc *m_pDesc; //PageDesc that describes the Page
66
68 sal_uInt16 m_nPhyPageNum;
69
75 bool m_bFootnotePage :1; // This Page is for document end footnotes
76 bool m_bEmptyPage :1; // This Page is an explicitly empty page
77 bool m_bEndNotePage :1; // 'Footnote page' for end notes
78 bool m_bInvalidSpelling :1; // We need online spelling
79 bool m_bInvalidSmartTags :1; // We need checking for smarttags
80 bool m_bInvalidAutoCmplWrds :1; // Update auto complete word list
82 bool m_bHasGrid :1; // Grid for Asian layout
83
85
86 void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwPageFrameInvFlags &,
87 SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
88
90 void SetColMaxFootnoteHeight();
91
110 static void GetHorizontalShadowRect( const SwRect& _rPageRect,
111 const SwViewShell* _pViewShell,
112 OutputDevice const * pRenderContext,
113 SwRect& _orBottomShadowRect,
114 bool bPaintLeftShadow,
115 bool bPaintRightShadow,
116 bool bRightSidebar );
117
118 virtual void DestroyImpl() override;
119 virtual ~SwPageFrame() override;
120 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
121 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
122
124 size_t GetContentHeight(const tools::Long nTop, const tools::Long nBottom) const;
125
126 std::vector<basegfx::B2DPolygon> GetSubsidiaryLinesPolygons(const SwViewShell& rViewShell) const;
127
128public:
130
133 void PrepareHeader();
134 void PrepareFooter();
135
136 const SwSortedObjs *GetSortedObjs() const { return m_pSortedObjs.get(); }
137 SwSortedObjs *GetSortedObjs() { return m_pSortedObjs.get(); }
138
139 void AppendDrawObjToPage( SwAnchoredObject& _rNewObj );
140 void RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj );
141
142 void AppendFlyToPage( SwFlyFrame *pNew );
143 void RemoveFlyFromPage( SwFlyFrame *pToRemove );
144 void MoveFly( SwFlyFrame *pToMove, SwPageFrame *pDest ); // Optimized Remove/Append
145
147 SwPageDesc *GetPageDesc() { return m_pDesc; }
148 const SwPageDesc *GetPageDesc() const { return m_pDesc; }
150
151 SwContentFrame *FindLastBodyContent();
152 inline SwContentFrame *FindFirstBodyContent();
153 inline const SwContentFrame *FindFirstBodyContent() const;
154 inline const SwContentFrame *FindLastBodyContent() const;
155
156 SwRect GetBoundRect(OutputDevice const * pOutputDevice) const;
157
158 // Specialized GetContentPos() for Field in Frames
159 void GetContentPosition( const Point &rPt, SwPosition &rPos ) const;
160
161 bool IsEmptyPage() const { return m_bEmptyPage; } // Explicitly empty page
162
163 void UpdateFootnoteNum();
164
167 void PreparePage( bool bFootnote );
168
169 // Sends a Prepare() to all ContentFrames caused by a changed register template
170 void PrepareRegisterChg();
171
172 // Appends a fly frame - the given one or a new one - at the page frame.
173 // Needed for <Modify> and <MakeFrames>
174 // - return value not needed any more
175 // - second parameter is of type <SwFlyFrameFormat*>
176 // - third parameter only needed for assertion, but calling method assures
177 // this assertion. Thus, delete it.
178 void PlaceFly( SwFlyFrame* pFly, SwFlyFrameFormat* pFormat );
179
181 SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
183 virtual bool GetInfo( SfxPoolItem& ) const override;
184
185 virtual void Cut() override;
186 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
187 virtual void CheckDirection( bool bVert ) override;
188 void CheckGrid( bool bInvalidate );
189 void PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) const;
190 bool HasGrid() const { return m_bHasGrid; }
191
192 void PaintDecorators( ) const;
193 virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const override;
194 void AddSubsidiaryLinesBounds(const SwViewShell& rShell, RectangleVector& rRects) const;
195 virtual void PaintBreak() const override;
196
198 void RefreshExtraData( const SwRect & ) const;
199
201 void RefreshSubsidiary( const SwRect& ) const;
202
204 bool IsFootnotePage() const { return m_bFootnotePage; }
205 bool IsEndNotePage() const { return m_bEndNotePage; }
206 void SetFootnotePage( bool b ) { m_bFootnotePage = b; }
207 void SetEndNotePage( bool b ) { m_bEndNotePage = b; }
208
209 sal_uInt16 GetPhyPageNum() const { return m_nPhyPageNum;}
210 void SetPhyPageNum( sal_uInt16 nNum ) { m_nPhyPageNum = nNum;}
211
214 inline void InvalidateFlyLayout() const;
215 inline void InvalidateFlyContent() const;
216 inline void InvalidateFlyInCnt() const;
217 inline void InvalidateLayout() const;
218 inline void InvalidateContent() const;
219 inline void InvalidateSpelling() const;
220 inline void InvalidateSmartTags() const;
221 inline void InvalidateAutoCompleteWords() const;
222 inline void InvalidateWordCount() const;
223 inline void ValidateFlyLayout() const;
224 inline void ValidateFlyContent() const;
225 inline void ValidateFlyInCnt() const;
226 inline void ValidateLayout() const;
227 inline void ValidateContent() const;
228 inline void ValidateSpelling() const;
229 inline void ValidateSmartTags() const;
230 inline void ValidateAutoCompleteWords() const;
231 inline void ValidateWordCount() const;
232 inline bool IsInvalid() const;
233 inline bool IsInvalidFly() const;
234 bool IsRightShadowNeeded() const;
235 bool IsLeftShadowNeeded() const;
236 bool IsInvalidFlyLayout() const { return m_bInvalidFlyLayout; }
237 bool IsInvalidFlyContent() const { return m_bInvalidFlyContent; }
238 bool IsInvalidFlyInCnt() const { return m_bInvalidFlyInCnt; }
239 bool IsInvalidLayout() const { return m_bInvalidLayout; }
240 bool IsInvalidContent() const { return (m_bInvalidContent || m_bInvalidFlyInCnt); }
241 bool IsInvalidSpelling() const { return m_bInvalidSpelling; }
242 bool IsInvalidSmartTags() const { return m_bInvalidSmartTags; }
243 bool IsInvalidAutoCompleteWords() const { return m_bInvalidAutoCmplWrds; }
244 bool IsInvalidWordCount() const { return m_bInvalidWordCount; }
245
253 Color GetDrawBackgroundColor() const;
254
268 void PaintMarginArea( const SwRect& _rOutputRect,
269 SwViewShell const * _pViewShell ) const;
270
293 static void PaintBorderAndShadow( const SwRect& _rPageRect,
294 const SwViewShell* _pViewShell,
295 bool bPaintLeftShadow,
296 bool bPaintRightShadow,
297 bool bRightSidebar );
298
314 static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
315 const SwViewShell* _pViewShell,
316 OutputDevice const * pRenderContext,
317 SwRect& _orBorderAndShadowBoundRect,
318 const bool bLeftShadow,
319 const bool bRightShadow,
320 const bool bRightSidebar
321 );
322
323 static void PaintNotesSidebar(const SwRect& _rPageRect, SwViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight);
324 static void PaintNotesSidebarArrows(const Point &rMiddleFirst, const Point &rMiddleSecond, SwViewShell const * _pViewShell, const Color& rColorUp, const Color& rColorDown);
330
331 virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const override;
332
333 SwRect PrtWithoutHeaderAndFooter() const;
334
335 // in case this is an empty page, this function returns the 'reference' page
336 const SwPageFrame& GetFormatPage() const;
337
340 bool IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rControl ) const;
341
342 // return font used to paint the "empty page" string
343 static const vcl::Font& GetEmptyPageFont();
344
345 static SwTwips GetSidebarBorderWidth( const SwViewShell* );
346
349 bool CheckPageHeightValidForHideWhitespace(SwTwips nDiff);
350
351 const SwHeaderFrame* GetHeaderFrame() const;
352 const SwFooterFrame* GetFooterFrame() const;
353
354 bool UpdateVirtPageNumInfo(SwVirtPageNumInfo& rHint, const SwFrame* pFrame) const;
355
356 void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
357};
358
360{
361 SwLayoutFrame *pBody = FindBodyCont();
362 return pBody ? pBody->ContainsContent() : nullptr;
363}
365{
366 const SwLayoutFrame *pBody = FindBodyCont();
367 return pBody ? pBody->ContainsContent() : nullptr;
368}
370{
371 return const_cast<SwPageFrame*>(this)->FindLastBodyContent();
372}
374{
375 const_cast<SwPageFrame*>(this)->m_bInvalidFlyLayout = true;
376}
378{
379 const_cast<SwPageFrame*>(this)->m_bInvalidFlyContent = true;
380}
382{
383 const_cast<SwPageFrame*>(this)->m_bInvalidFlyInCnt = true;
384}
386{
387 const_cast<SwPageFrame*>(this)->m_bInvalidLayout = true;
388}
390{
391 const_cast<SwPageFrame*>(this)->m_bInvalidContent = true;
392}
394{
395 const_cast<SwPageFrame*>(this)->m_bInvalidSpelling = true;
396}
397
399{
400 const_cast<SwPageFrame*>(this)->m_bInvalidSmartTags = true;
401}
403{
404 const_cast<SwPageFrame*>(this)->m_bInvalidAutoCmplWrds = true;
405}
407{
408 const_cast<SwPageFrame*>(this)->m_bInvalidWordCount = true;
409}
411{
412 const_cast<SwPageFrame*>(this)->m_bInvalidFlyLayout = false;
413}
415{
416 const_cast<SwPageFrame*>(this)->m_bInvalidFlyContent = false;
417}
419{
420 const_cast<SwPageFrame*>(this)->m_bInvalidFlyInCnt = false;
421}
423{
424 const_cast<SwPageFrame*>(this)->m_bInvalidLayout = false;
425}
427{
428 const_cast<SwPageFrame*>(this)->m_bInvalidContent = false;
429}
431{
432 const_cast<SwPageFrame*>(this)->m_bInvalidSpelling = false;
433}
434
436{
437 const_cast<SwPageFrame*>(this)->m_bInvalidSmartTags = false;
438}
440{
441 const_cast<SwPageFrame*>(this)->m_bInvalidAutoCmplWrds = false;
442}
444{
445 const_cast<SwPageFrame*>(this)->m_bInvalidWordCount = false;
446}
447
448inline bool SwPageFrame::IsInvalid() const
449{
451}
452inline bool SwPageFrame::IsInvalidFly() const
453{
455}
456
457
458class SwTextGridItem;
459
460SwTextGridItem const* GetGridItem(SwPageFrame const*const);
461
462sal_uInt16 GetGridWidth(SwTextGridItem const&, SwDoc const&);
463
464namespace sw { bool IsPageFrameEmpty(SwPageFrame const& rPage); }
465
466
467#endif // INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
468
469/* 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:59
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 =0
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:50
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:7263
void RefreshExtraData(const SwRect &) const
Definition: paintfrm.cxx:7417
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:1350
virtual void PaintBreak() const
Definition: paintfrm.cxx:3822
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:1447
A page of the document layout.
Definition: pagefrm.hxx:60
bool m_bInvalidContent
Definition: pagefrm.hxx:70
bool m_bFootnotePage
Definition: pagefrm.hxx:75
bool IsInvalidWordCount() const
Definition: pagefrm.hxx:244
void InvalidateContent() const
Definition: pagefrm.hxx:389
void ValidateFlyInCnt() const
Definition: pagefrm.hxx:418
const SwPageDesc * GetPageDesc() const
Definition: pagefrm.hxx:148
void SetPhyPageNum(sal_uInt16 nNum)
Definition: pagefrm.hxx:210
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
Definition: findfrm.cxx:57
void ValidateContent() const
Definition: pagefrm.hxx:426
SwSortedObjs * GetSortedObjs()
Definition: pagefrm.hxx:137
bool IsEndNotePage() const
Definition: pagefrm.hxx:205
void InvalidateWordCount() const
Definition: pagefrm.hxx:406
bool IsInvalid() const
Definition: pagefrm.hxx:448
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
Definition: pagefrm.hxx:373
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:402
bool m_bEndNotePage
Definition: pagefrm.hxx:77
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:209
void ValidateSmartTags() const
Definition: pagefrm.hxx:435
bool IsInvalidFlyContent() const
Definition: pagefrm.hxx:237
void InvalidateFlyInCnt() const
Definition: pagefrm.hxx:381
bool m_bHasGrid
Definition: pagefrm.hxx:82
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:136
bool m_bEmptyPage
Definition: pagefrm.hxx:76
void InvalidateSmartTags() const
Definition: pagefrm.hxx:398
bool IsInvalidFlyLayout() const
Definition: pagefrm.hxx:236
bool m_bInvalidAutoCmplWrds
Definition: pagefrm.hxx:80
bool IsEmptyPage() const
Definition: pagefrm.hxx:161
SwContentFrame * FindFirstBodyContent()
Definition: pagefrm.hxx:359
sal_uInt16 m_nPhyPageNum
Physical page number: index into list of SwRootFrame lowers.
Definition: pagefrm.hxx:68
bool m_bInvalidFlyContent
Definition: pagefrm.hxx:72
bool HasGrid() const
Definition: pagefrm.hxx:190
SwPageDesc * m_pDesc
Definition: pagefrm.hxx:65
static const sal_Int8 snShadowPxWidth
Definition: pagefrm.hxx:84
void SetEndNotePage(bool b)
Definition: pagefrm.hxx:207
bool IsInvalidSmartTags() const
Definition: pagefrm.hxx:242
void ValidateFlyLayout() const
Definition: pagefrm.hxx:410
void InvalidateSpelling() const
Definition: pagefrm.hxx:393
void InvalidateLayout() const
Definition: pagefrm.hxx:385
bool IsFootnotePage() const
Foot note interface.
Definition: pagefrm.hxx:204
bool IsInvalidContent() const
Definition: pagefrm.hxx:240
bool m_bInvalidSmartTags
Definition: pagefrm.hxx:79
void InvalidateFlyContent() const
Definition: pagefrm.hxx:377
bool IsInvalidSpelling() const
Definition: pagefrm.hxx:241
bool IsInvalidAutoCompleteWords() const
Definition: pagefrm.hxx:243
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
void SetFootnotePage(bool b)
Definition: pagefrm.hxx:206
void ValidateWordCount() const
Definition: pagefrm.hxx:443
bool m_bInvalidWordCount
Definition: pagefrm.hxx:81
std::unique_ptr< SwSortedObjs > m_pSortedObjs
Definition: pagefrm.hxx:63
bool m_bInvalidFlyInCnt
Definition: pagefrm.hxx:74
bool IsInvalidFlyInCnt() const
Definition: pagefrm.hxx:238
bool m_bInvalidSpelling
Definition: pagefrm.hxx:78
bool m_bInvalidFlyLayout
Definition: pagefrm.hxx:73
bool m_bInvalidLayout
Definition: pagefrm.hxx:71
void ValidateSpelling() const
Definition: pagefrm.hxx:430
bool IsInvalidFly() const
Definition: pagefrm.hxx:452
void ValidateAutoCompleteWords() const
Definition: pagefrm.hxx:439
void ValidateLayout() const
Definition: pagefrm.hxx:422
bool IsInvalidLayout() const
Definition: pagefrm.hxx:239
void ValidateFlyContent() const
Definition: pagefrm.hxx:414
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:42
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2676
sal_uInt16 GetGridWidth(SwTextGridItem const &, SwDoc const &)
Definition: pagechg.cxx:2690
std::vector< tools::Rectangle > RectangleVector
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