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