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 "ftnboss.hxx"
24 #include "hffrm.hxx"
25 
26 #include <SidebarWindowsTypes.hxx>
27 
28 class SwFlyFrame;
29 class SwFlyFrameFormat;
30 class SwPageDesc;
31 class SwContentFrame;
32 struct SwPosition;
33 struct SwCursorMoveState;
34 class SwAttrSetChg;
35 namespace vcl { class Font; }
36 class SwSortedObjs;
37 class SwAnchoredObject;
38 
41 class SAL_DLLPUBLIC_RTTI SwPageFrame: public SwFootnoteBossFrame
42 {
43  friend class SwFrame;
44 
45  std::unique_ptr<SwSortedObjs> m_pSortedObjs;
46 
47  SwPageDesc *m_pDesc; //PageDesc that describes the Page
48 
50  sal_uInt16 m_nPhyPageNum;
51 
52  bool m_bInvalidContent :1;
53  bool m_bInvalidLayout :1;
54  bool m_bInvalidFlyContent :1;
55  bool m_bInvalidFlyLayout :1;
56  bool m_bInvalidFlyInCnt :1;
57  bool m_bFootnotePage :1; // This Page is for document end footnotes
58  bool m_bEmptyPage :1; // This Page is an explicitly empty page
59  bool m_bEndNotePage :1; // 'Footnote page' for end notes
60  bool m_bInvalidSpelling :1; // We need online spelling
61  bool m_bInvalidSmartTags :1; // We need checking for smarttags
62  bool m_bInvalidAutoCmplWrds :1; // Update auto complete word list
63  bool m_bInvalidWordCount :1;
64  bool m_bHasGrid :1; // Grid for Asian layout
65 
66  static const sal_Int8 mnShadowPxWidth;
67 
68  void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
69  SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
70 
72  void SetColMaxFootnoteHeight();
73 
92  static void GetHorizontalShadowRect( const SwRect& _rPageRect,
93  const SwViewShell* _pViewShell,
94  OutputDevice const * pRenderContext,
95  SwRect& _orBottomShadowRect,
96  bool bPaintLeftShadow,
97  bool bPaintRightShadow,
98  bool bRightSidebar );
99 
100  virtual void DestroyImpl() override;
101  virtual ~SwPageFrame() override;
102 
103 protected:
104  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
105  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
106  virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
107 
109  size_t GetContentHeight(const long nTop, const long nBottom) const;
110 
111 public:
113 
116  void PrepareHeader();
117  void PrepareFooter();
118 
119  const SwSortedObjs *GetSortedObjs() const { return m_pSortedObjs.get(); }
120  SwSortedObjs *GetSortedObjs() { return m_pSortedObjs.get(); }
121 
122  void AppendDrawObjToPage( SwAnchoredObject& _rNewObj );
123  void RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj );
124 
125  void AppendFlyToPage( SwFlyFrame *pNew );
126  void RemoveFlyFromPage( SwFlyFrame *pToRemove );
127  void MoveFly( SwFlyFrame *pToMove, SwPageFrame *pDest ); // Optimized Remove/Append
128 
129  void SetPageDesc( SwPageDesc *, SwFrameFormat * );
130  SwPageDesc *GetPageDesc() { return m_pDesc; }
131  const SwPageDesc *GetPageDesc() const { return m_pDesc; }
133 
134  SwContentFrame *FindLastBodyContent();
135  inline SwContentFrame *FindFirstBodyContent();
136  inline const SwContentFrame *FindFirstBodyContent() const;
137  inline const SwContentFrame *FindLastBodyContent() const;
138 
139  SwRect GetBoundRect(OutputDevice const * pOutputDevice) const;
140 
141  // Specialized GetContentPos() for Field in Frames
142  void GetContentPosition( const Point &rPt, SwPosition &rPos ) const;
143 
144  bool IsEmptyPage() const { return m_bEmptyPage; } // Explicitly empty page
145 
146  void UpdateFootnoteNum();
147 
150  void PreparePage( bool bFootnote );
151 
152  // Sends a Prepare() to all ContentFrames caused by a changed register template
153  void PrepareRegisterChg();
154 
155  // Appends a fly frame - the given one or a new one - at the page frame.
156  // Needed for <Modify> and <MakeFrames>
157  // - return value not needed any more
158  // - second parameter is of type <SwFlyFrameFormat*>
159  // - third parameter only needed for assertion, but calling method assures
160  // this assertion. Thus, delete it.
161  void PlaceFly( SwFlyFrame* pFly, SwFlyFrameFormat* pFormat );
162 
163  virtual bool GetModelPositionForViewPoint( SwPosition *, Point&,
164  SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
166  virtual bool GetInfo( SfxPoolItem& ) const override;
167 
168  virtual void Cut() override;
169  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
170  virtual void CheckDirection( bool bVert ) override;
171  void CheckGrid( bool bInvalidate );
172  void PaintGrid( OutputDevice const * pOut, SwRect const &rRect ) const;
173  bool HasGrid() const { return m_bHasGrid; }
174 
175  void PaintDecorators( ) const;
176  virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const override;
177  virtual void PaintBreak() const override;
178 
180  void RefreshExtraData( const SwRect & ) const;
181 
183  void RefreshSubsidiary( const SwRect& ) const;
184 
186  bool IsFootnotePage() const { return m_bFootnotePage; }
187  bool IsEndNotePage() const { return m_bEndNotePage; }
188  void SetFootnotePage( bool b ) { m_bFootnotePage = b; }
189  void SetEndNotePage( bool b ) { m_bEndNotePage = b; }
190 
191  sal_uInt16 GetPhyPageNum() const { return m_nPhyPageNum;}
192  void SetPhyPageNum( sal_uInt16 nNum ) { m_nPhyPageNum = nNum;}
193 
196  inline void InvalidateFlyLayout() const;
197  inline void InvalidateFlyContent() const;
198  inline void InvalidateFlyInCnt() const;
199  inline void InvalidateLayout() const;
200  inline void InvalidateContent() const;
201  inline void InvalidateSpelling() const;
202  inline void InvalidateSmartTags() const;
203  inline void InvalidateAutoCompleteWords() const;
204  inline void InvalidateWordCount() const;
205  inline void ValidateFlyLayout() const;
206  inline void ValidateFlyContent() const;
207  inline void ValidateFlyInCnt() const;
208  inline void ValidateLayout() const;
209  inline void ValidateContent() const;
210  inline void ValidateSpelling() const;
211  inline void ValidateSmartTags() const;
212  inline void ValidateAutoCompleteWords() const;
213  inline void ValidateWordCount() const;
214  inline bool IsInvalid() const;
215  inline bool IsInvalidFly() const;
216  bool IsRightShadowNeeded() const;
217  bool IsLeftShadowNeeded() const;
218  bool IsInvalidFlyLayout() const { return m_bInvalidFlyLayout; }
219  bool IsInvalidFlyContent() const { return m_bInvalidFlyContent; }
220  bool IsInvalidFlyInCnt() const { return m_bInvalidFlyInCnt; }
221  bool IsInvalidLayout() const { return m_bInvalidLayout; }
222  bool IsInvalidContent() const { return (m_bInvalidContent || m_bInvalidFlyInCnt); }
223  bool IsInvalidSpelling() const { return m_bInvalidSpelling; }
224  bool IsInvalidSmartTags() const { return m_bInvalidSmartTags; }
225  bool IsInvalidAutoCompleteWords() const { return m_bInvalidAutoCmplWrds; }
226  bool IsInvalidWordCount() const { return m_bInvalidWordCount; }
227 
235  Color GetDrawBackgrdColor() const;
236 
250  void PaintMarginArea( const SwRect& _rOutputRect,
251  SwViewShell const * _pViewShell ) const;
252 
275  static void PaintBorderAndShadow( const SwRect& _rPageRect,
276  const SwViewShell* _pViewShell,
277  bool bPaintLeftShadow,
278  bool bPaintRightShadow,
279  bool bRightSidebar );
280 
296  static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
297  const SwViewShell* _pViewShell,
298  OutputDevice const * pRenderContext,
299  SwRect& _orBorderAndShadowBoundRect,
300  const bool bLeftShadow,
301  const bool bRightShadow,
302  const bool bRightSidebar
303  );
304 
305  static void PaintNotesSidebar(const SwRect& _rPageRect, SwViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight);
306  static void PaintNotesSidebarArrows(const Point &rMiddleFirst, const Point &rMiddleSecond, SwViewShell const * _pViewShell, const Color& rColorUp, const Color& rColorDown);
312 
313  virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const override;
314 
315  SwRect PrtWithoutHeaderAndFooter() const;
316 
317  // in case this is an empty page, this function returns the 'reference' page
318  const SwPageFrame& GetFormatPage() const;
319 
322  bool IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rControl ) const;
323 
324  // return font used to paint the "empty page" string
325  static const vcl::Font& GetEmptyPageFont();
326 
327  static SwTwips GetSidebarBorderWidth( const SwViewShell* );
328 
331  bool CheckPageHeightValidForHideWhitespace(SwTwips nDiff);
332 
333  const SwHeaderFrame* GetHeaderFrame() const;
334  const SwFooterFrame* GetFooterFrame() const;
335 };
336 
338 {
339  SwLayoutFrame *pBody = FindBodyCont();
340  return pBody ? pBody->ContainsContent() : nullptr;
341 }
343 {
344  const SwLayoutFrame *pBody = FindBodyCont();
345  return pBody ? pBody->ContainsContent() : nullptr;
346 }
348 {
349  return const_cast<SwPageFrame*>(this)->FindLastBodyContent();
350 }
352 {
353  const_cast<SwPageFrame*>(this)->m_bInvalidFlyLayout = true;
354 }
356 {
357  const_cast<SwPageFrame*>(this)->m_bInvalidFlyContent = true;
358 }
360 {
361  const_cast<SwPageFrame*>(this)->m_bInvalidFlyInCnt = true;
362 }
363 inline void SwPageFrame::InvalidateLayout() const
364 {
365  const_cast<SwPageFrame*>(this)->m_bInvalidLayout = true;
366 }
368 {
369  const_cast<SwPageFrame*>(this)->m_bInvalidContent = true;
370 }
372 {
373  const_cast<SwPageFrame*>(this)->m_bInvalidSpelling = true;
374 }
375 
377 {
378  const_cast<SwPageFrame*>(this)->m_bInvalidSmartTags = true;
379 }
381 {
382  const_cast<SwPageFrame*>(this)->m_bInvalidAutoCmplWrds = true;
383 }
385 {
386  const_cast<SwPageFrame*>(this)->m_bInvalidWordCount = true;
387 }
389 {
390  const_cast<SwPageFrame*>(this)->m_bInvalidFlyLayout = false;
391 }
393 {
394  const_cast<SwPageFrame*>(this)->m_bInvalidFlyContent = false;
395 }
396 inline void SwPageFrame::ValidateFlyInCnt() const
397 {
398  const_cast<SwPageFrame*>(this)->m_bInvalidFlyInCnt = false;
399 }
400 inline void SwPageFrame::ValidateLayout() const
401 {
402  const_cast<SwPageFrame*>(this)->m_bInvalidLayout = false;
403 }
404 inline void SwPageFrame::ValidateContent() const
405 {
406  const_cast<SwPageFrame*>(this)->m_bInvalidContent = false;
407 }
408 inline void SwPageFrame::ValidateSpelling() const
409 {
410  const_cast<SwPageFrame*>(this)->m_bInvalidSpelling = false;
411 }
412 
414 {
415  const_cast<SwPageFrame*>(this)->m_bInvalidSmartTags = false;
416 }
418 {
419  const_cast<SwPageFrame*>(this)->m_bInvalidAutoCmplWrds = false;
420 }
422 {
423  const_cast<SwPageFrame*>(this)->m_bInvalidWordCount = false;
424 }
425 
426 inline bool SwPageFrame::IsInvalid() const
427 {
429 }
430 inline bool SwPageFrame::IsInvalidFly() const
431 {
433 }
434 
435 
436 class SwTextGridItem;
437 
438 SwTextGridItem const* GetGridItem(SwPageFrame const*const);
439 
440 sal_uInt16 GetGridWidth(SwTextGridItem const&, SwDoc const&);
441 
442 #endif // INCLUDED_SW_SOURCE_CORE_INC_PAGEFRM_HXX
443 
444 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:297
void SetFootnotePage(bool b)
Definition: pagefrm.hxx:188
Marks a position in the document model.
Definition: pam.hxx:35
Header in the document layout, inside a page.
Definition: hffrm.hxx:43
bool IsInvalidWordCount() const
Definition: pagefrm.hxx:226
signed char sal_Int8
void ValidateSpelling() const
Definition: pagefrm.hxx:408
bool m_bInvalidFlyLayout
Definition: pagefrm.hxx:55
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: wsfrm.cxx:474
Definition: doc.hxx:184
void ValidateFlyContent() const
Definition: pagefrm.hxx:392
void ValidateContent() const
Definition: pagefrm.hxx:404
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: wsfrm.cxx:1303
long SwTwips
Definition: swtypes.hxx:49
This class is used as parameter for creation of a block cursor selection.
virtual void SwClientNotify(const SwModify &, const SfxHint &rHint) override
Definition: calbck.cxx:108
bool IsFootnotePage() const
Foot note interface.
Definition: pagefrm.hxx:186
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
SwContentFrame * FindFirstBodyContent()
Definition: pagefrm.hxx:337
void InvalidateFlyInCnt() const
Definition: pagefrm.hxx:359
bool m_bInvalidLayout
Definition: pagefrm.hxx:53
static bool bFootnote
Definition: insfnote.cxx:33
void RefreshExtraData(const SwRect &) const
Definition: paintfrm.cxx:6968
bool m_bInvalidWordCount
Definition: pagefrm.hxx:63
void ValidateWordCount() const
Definition: pagefrm.hxx:421
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:191
void ValidateAutoCompleteWords() const
Definition: pagefrm.hxx:417
bool HasGrid() const
Definition: pagefrm.hxx:173
wrapper class for the positioning of Writer fly frames and drawing objects
bool IsInvalidFlyInCnt() const
Definition: pagefrm.hxx:220
bool IsEmptyPage() const
Definition: pagefrm.hxx:144
bool IsInvalidAutoCompleteWords() const
Definition: pagefrm.hxx:225
void InvalidateFlyContent() const
Definition: pagefrm.hxx:355
sal_uInt16 m_nPhyPageNum
Physical page number: index into list of SwRootFrame lowers.
Definition: pagefrm.hxx:50
bool m_bInvalidSpelling
Definition: pagefrm.hxx:60
bool IsInvalidSpelling() const
Definition: pagefrm.hxx:223
bool IsInvalidSmartTags() const
Definition: pagefrm.hxx:224
virtual void DestroyImpl() override
Definition: ssfrm.cxx:473
void InvalidateLayout() const
Definition: pagefrm.hxx:363
void InvalidateContent() const
Definition: pagefrm.hxx:367
bool IsInvalidContent() const
Definition: pagefrm.hxx:222
void ValidateFlyLayout() const
Definition: pagefrm.hxx:388
bool IsInvalidFly() const
Definition: pagefrm.hxx:430
bool IsInvalidFlyContent() const
Definition: pagefrm.hxx:219
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:380
Style of a layout element.
Definition: frmfmt.hxx:57
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:119
void InvalidateSpelling() const
Definition: pagefrm.hxx:371
void ValidateFlyInCnt() const
Definition: pagefrm.hxx:396
virtual void Cut() override
Definition: wsfrm.cxx:1400
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
Definition: pagechg.cxx:2545
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:130
void InvalidateSmartTags() const
Definition: pagefrm.hxx:376
bool IsEndNotePage() const
Definition: pagefrm.hxx:187
bool m_bInvalidFlyInCnt
Definition: pagefrm.hxx:56
void SetPhyPageNum(sal_uInt16 nNum)
Definition: pagefrm.hxx:192
friend class SwPageFrame
Definition: ftnboss.hxx:53
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
Definition: pagefrm.hxx:351
SwPageDesc * m_pDesc
Definition: pagefrm.hxx:47
A page of the document layout.
Definition: pagefrm.hxx:41
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:42
bool m_bInvalidContent
Definition: pagefrm.hxx:52
bool IsInvalidFlyLayout() const
Definition: pagefrm.hxx:218
void ValidateLayout() const
Definition: pagefrm.hxx:400
virtual void CheckDirection(bool bVert)
Definition: wsfrm.cxx:389
void ValidateSmartTags() const
Definition: pagefrm.hxx:413
FrameControlType
Definition: swtypes.hxx:236
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
Definition: findfrm.cxx:51
virtual void PaintSubsidiaryLines(const SwPageFrame *, const SwRect &) const
Definition: paintfrm.cxx:6814
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
unsigned char sal_uInt8
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Searches the ContentFrame owning the PrtArea containing the point.
Definition: trvlfrm.cxx:150
bool m_bInvalidAutoCmplWrds
Definition: pagefrm.hxx:62
virtual void PaintBreak() const
Definition: paintfrm.cxx:3667
bool m_bInvalidFlyContent
Definition: pagefrm.hxx:54
static const sal_Int8 mnShadowPxWidth
Definition: pagefrm.hxx:66
sal_uInt16 GetGridWidth(SwTextGridItem const &, SwDoc const &)
Definition: pagechg.cxx:2559
virtual bool GetInfo(SfxPoolItem &) const
Definition: calbck.hxx:164
bool SetPageDesc(const css::uno::Any &rValue, SwDoc &rDoc, SfxItemSet &rSet)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
bool IsInvalid() const
Definition: pagefrm.hxx:426
const SwPageDesc * GetPageDesc() const
Definition: pagefrm.hxx:131
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:66
void InvalidateWordCount() const
Definition: pagefrm.hxx:384
bool m_bInvalidSmartTags
Definition: pagefrm.hxx:61
void SetEndNotePage(bool b)
Definition: pagefrm.hxx:189
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: calcmove.cxx:951
class for collecting anchored objects
Definition: sortedobjs.hxx:48
Footer in the document layout, inside a page.
Definition: hffrm.hxx:50
bool IsInvalidLayout() const
Definition: pagefrm.hxx:221
static SwPageDesc * FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId)
Definition: htmlcss1.cxx:1327
std::unique_ptr< SwSortedObjs > m_pSortedObjs
Definition: pagefrm.hxx:45
SwSortedObjs * GetSortedObjs()
Definition: pagefrm.hxx:120
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const override
Definition: trvlfrm.cxx:366