LibreOffice Module sw (master)  1
ftnboss.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 
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_FTNBOSS_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_FTNBOSS_HXX
22 
23 #include "layfrm.hxx"
24 
27 class SwFootnoteFrame;
28 class SwTextFootnote;
29 
30 // Set max. footnote area.
31 // Restoration of the old value in DTor. Implementation in ftnfrm.cxx
33 {
38 public:
39  SwSaveFootnoteHeight( SwFootnoteBossFrame *pBs, const SwTwips nDeadLine );
41 };
42 
43 enum class SwNeighbourAdjust {
45 };
46 
47 typedef std::vector<SwFootnoteFrame*> SwFootnoteFrames;
48 
49 class SAL_DLLPUBLIC_RTTI SwFootnoteBossFrame: public SwLayoutFrame
50 {
51  // for private footnote operations
52  friend class SwFrame;
53  friend class SwSaveFootnoteHeight;
54  friend class SwPageFrame; // for setting of MaxFootnoteHeight
55 
56  // max. height of the footnote container on this page
58 
62 
65 
66 protected:
68  static void ResetFootnote( const SwFootnoteFrame *pAssumed );
69 
70 public:
72  : SwLayoutFrame( pFormat, pSib )
73  , m_nMaxFootnoteHeight(0)
74  {}
75 
77  inline const SwLayoutFrame *FindBodyCont() const;
78  void SetMaxFootnoteHeight( const SwTwips nNewMax ) { m_nMaxFootnoteHeight = nNewMax; }
79 
80  // footnote interface
82  bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep = true);
83  static SwFootnoteFrame *FindFootnote( const SwContentFrame *, const SwTextFootnote * );
85  inline const SwFootnoteContFrame *FindFootnoteCont() const;
86  const SwFootnoteFrame *FindFirstFootnote( SwContentFrame const * ) const;
87  SwFootnoteContFrame *FindNearestFootnoteCont( bool bDontLeave = false );
88 
89  static void ChangeFootnoteRef( const SwContentFrame *pOld, const SwTextFootnote *,
90  SwContentFrame *pNew );
91  void RearrangeFootnotes( const SwTwips nDeadLine, const bool bLock,
92  const SwTextFootnote *pAttr = nullptr );
93 
94  // Set DeadLine (in document coordinates) so that the text formatter can
95  // temporarily limit footnote height.
96  void SetFootnoteDeadLine( const SwTwips nDeadLine );
98 
99  // returns value for remaining space until the body reaches minimal height
100  SwTwips GetVarSpace() const;
101 
102  // methods needed for layouting
103  // The parameter <_bCollectOnlyPreviousFootnotes> controls if only footnotes
104  // that are positioned before the this footnote boss-frame have to be
105  // collected.
106  void CollectFootnotes( const SwContentFrame* _pRef,
107  SwFootnoteBossFrame* _pOld,
108  SwFootnoteFrames& _rFootnoteArr,
109  const bool _bCollectOnlyPreviousFootnotes = false );
110  void MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool bCalc = false );
111  void MoveFootnotes( const SwContentFrame *pSrc, SwContentFrame *pDest,
112  SwTextFootnote const *pAttr );
113 
114  // should AdjustNeighbourhood be called (or Grow/Shrink)?
117 };
118 
120 {
121  return const_cast<SwFootnoteBossFrame*>(this)->FindBodyCont();
122 }
123 
125 {
126  return const_cast<SwFootnoteBossFrame*>(this)->FindFootnoteCont();
127 }
128 
129 #endif
130 
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwSaveFootnoteHeight(SwFootnoteBossFrame *pBs, const SwTwips nDeadLine)
Definition: ftnfrm.cxx:2881
Base class of the Writer layout elements.
Definition: frame.hxx:314
SwFootnoteContFrame * FindNearestFootnoteCont(bool bDontLeave=false)
Search the next available footnote container.
Definition: ftnfrm.cxx:1059
static void CollectFootnotes_(const SwContentFrame *, SwFootnoteFrame *, SwFootnoteFrames &, const SwFootnoteBossFrame *)
Definition: ftnfrm.cxx:1830
static SwFootnoteFrame * FindFootnote(const SwContentFrame *, const SwTextFootnote *)
Definition: ftnfrm.cxx:1694
void SetMaxFootnoteHeight(const SwTwips nNewMax)
Definition: ftnboss.hxx:78
void InsertFootnote(SwFootnoteFrame *)
Definition: ftnfrm.cxx:1233
static void ChangeFootnoteRef(const SwContentFrame *pOld, const SwTextFootnote *, SwContentFrame *pNew)
Definition: ftnfrm.cxx:1762
SwFrameDeleteGuard aGuard
Definition: ftnboss.hxx:34
SwTwips GetMaxFootnoteHeight() const
Definition: ftnboss.hxx:97
void RearrangeFootnotes(const SwTwips nDeadLine, const bool bLock, const SwTextFootnote *pAttr=nullptr)
Definition: ftnfrm.cxx:2213
void SetFootnoteDeadLine(const SwTwips nDeadLine)
Definition: ftnfrm.cxx:2508
void MoveFootnotes_(SwFootnoteFrames &rFootnoteArr, bool bCalc=false)
Definition: ftnfrm.cxx:1967
SwFootnoteContFrame * FindFootnoteCont()
Definition: ftnfrm.cxx:1036
void AppendFootnote(SwContentFrame *, SwTextFootnote *)
Definition: ftnfrm.cxx:1513
SwNeighbourAdjust NeighbourhoodAdjustment_() const
Obtain if pFrame's size adjustment should be processed.
Definition: ftnfrm.cxx:2617
Style of a layout element.
Definition: frmfmt.hxx:59
SwFootnoteFrame * FindFirstFootnote()
Definition: ftnfrm.cxx:1082
SwFootnoteBossFrame * pBoss
Definition: ftnboss.hxx:35
SwNeighbourAdjust NeighbourhoodAdjustment() const
Definition: ftnboss.hxx:115
SwFootnoteContFrame * MakeFootnoteCont()
Insert a footnote container.
Definition: ftnfrm.cxx:1026
A page of the document layout.
Definition: pagefrm.hxx:57
tools::Long SwTwips
Definition: swtypes.hxx:51
SwFootnoteBossFrame(SwFrameFormat *pFormat, SwFrame *pSib)
Definition: ftnboss.hxx:71
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:46
bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep=true)
Definition: ftnfrm.cxx:1734
void CollectFootnotes(const SwContentFrame *_pRef, SwFootnoteBossFrame *_pOld, SwFootnoteFrames &_rFootnoteArr, const bool _bCollectOnlyPreviousFootnotes=false)
OD 03.04.2003 #108446# - add parameter <_bCollectOnlyPreviousFootnotes> in order to control...
Definition: ftnfrm.cxx:1776
SwNeighbourAdjust
Definition: ftnboss.hxx:43
static void ResetFootnote(const SwFootnoteFrame *pAssumed)
Definition: ftnfrm.cxx:1193
SwTwips GetVarSpace() const
Definition: ftnfrm.cxx:2536
SwTwips m_nMaxFootnoteHeight
Definition: ftnboss.hxx:57
bool IsPageFrame() const
Definition: frame.hxx:1178
void MoveFootnotes(const SwContentFrame *pSrc, SwContentFrame *pDest, SwTextFootnote const *pAttr)
Definition: ftnfrm.cxx:2175
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
std::vector< SwFootnoteFrame * > SwFootnoteFrames
Definition: ftnboss.hxx:47
const SwTwips nOldHeight
Definition: ftnboss.hxx:36