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 {
37 public:
38  SwSaveFootnoteHeight( SwFootnoteBossFrame *pBs, const SwTwips nDeadLine );
40 };
41 
42 enum class SwNeighbourAdjust {
44 };
45 
46 typedef std::vector<SwFootnoteFrame*> SwFootnoteFrames;
47 
48 class SAL_DLLPUBLIC_RTTI SwFootnoteBossFrame: public SwLayoutFrame
49 {
50  // for private footnote operations
51  friend class SwFrame;
52  friend class SwSaveFootnoteHeight;
53  friend class SwPageFrame; // for setting of MaxFootnoteHeight
54 
55  // max. height of the footnote container on this page
57 
61 
62 protected:
64  static void ResetFootnote( const SwFootnoteFrame *pAssumed );
65 
66 public:
68  : SwLayoutFrame( pFormat, pSib )
69  , m_nMaxFootnoteHeight(0)
70  {}
71 
73  inline const SwLayoutFrame *FindBodyCont() const;
74  void SetMaxFootnoteHeight( const SwTwips nNewMax ) { m_nMaxFootnoteHeight = nNewMax; }
75 
76  // footnote interface
78  bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep = true);
79  static SwFootnoteFrame *FindFootnote( const SwContentFrame *, const SwTextFootnote * );
81  inline const SwFootnoteContFrame *FindFootnoteCont() const;
82  const SwFootnoteFrame *FindFirstFootnote( SwContentFrame const * ) const;
83  SwFootnoteContFrame *FindNearestFootnoteCont( bool bDontLeave = false );
84 
85  static void ChangeFootnoteRef( const SwContentFrame *pOld, const SwTextFootnote *,
86  SwContentFrame *pNew );
87  void RearrangeFootnotes( const SwTwips nDeadLine, const bool bLock,
88  const SwTextFootnote *pAttr = nullptr );
89 
90  // Set DeadLine (in document coordinates) so that the text formatter can
91  // temporarily limit footnote height.
92  void SetFootnoteDeadLine( const SwTwips nDeadLine );
94 
95  // returns value for remaining space until the body reaches minimal height
96  SwTwips GetVarSpace() const;
97 
98  // methods needed for layouting
99  // The parameters <_bCollectOnlyPreviousFootnotes> and <_pRefFootnoteBossFrame> control
100  // if only footnotes that are positioned before the given reference
101  // footnote boss-frame have to be collected.
102  // Note: if parameter <_bCollectOnlyPreviousFootnotes> is true, then parameter
103  // <_pRefFootnoteBossFrame> has to be referenced by an object.
104  static void CollectFootnotes_( const SwContentFrame* _pRef,
105  SwFootnoteFrame* _pFootnote,
106  SwFootnoteFrames& _rFootnoteArr,
107  const bool _bCollectOnlyPreviousFootnotes = false,
108  const SwFootnoteBossFrame* _pRefFootnoteBossFrame = nullptr);
109  // The parameter <_bCollectOnlyPreviousFootnotes> controls if only footnotes
110  // that are positioned before the footnote boss-frame <this> have to be
111  // collected.
112  void CollectFootnotes( const SwContentFrame* _pRef,
113  SwFootnoteBossFrame* _pOld,
114  SwFootnoteFrames& _rFootnoteArr,
115  const bool _bCollectOnlyPreviousFootnotes = false );
116  void MoveFootnotes_( SwFootnoteFrames &rFootnoteArr, bool bCalc = false );
117  void MoveFootnotes( const SwContentFrame *pSrc, SwContentFrame *pDest,
118  SwTextFootnote const *pAttr );
119 
120  // should AdjustNeighbourhood be called (or Grow/Shrink)?
123 };
124 
126 {
127  return const_cast<SwFootnoteBossFrame*>(this)->FindBodyCont();
128 }
129 
131 {
132  return const_cast<SwFootnoteBossFrame*>(this)->FindFootnoteCont();
133 }
134 
135 #endif
136 
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwSaveFootnoteHeight(SwFootnoteBossFrame *pBs, const SwTwips nDeadLine)
Definition: ftnfrm.cxx:2854
Base class of the Writer layout elements.
Definition: frame.hxx:295
SwFootnoteContFrame * FindNearestFootnoteCont(bool bDontLeave=false)
Search the next available footnote container.
Definition: ftnfrm.cxx:988
static SwFootnoteFrame * FindFootnote(const SwContentFrame *, const SwTextFootnote *)
Definition: ftnfrm.cxx:1641
void SetMaxFootnoteHeight(const SwTwips nNewMax)
Definition: ftnboss.hxx:74
void InsertFootnote(SwFootnoteFrame *)
Definition: ftnfrm.cxx:1162
long SwTwips
Definition: swtypes.hxx:49
static void ChangeFootnoteRef(const SwContentFrame *pOld, const SwTextFootnote *, SwContentFrame *pNew)
Definition: ftnfrm.cxx:1709
SwTwips GetMaxFootnoteHeight() const
Definition: ftnboss.hxx:93
void RearrangeFootnotes(const SwTwips nDeadLine, const bool bLock, const SwTextFootnote *pAttr=nullptr)
Definition: ftnfrm.cxx:2178
void SetFootnoteDeadLine(const SwTwips nDeadLine)
Definition: ftnfrm.cxx:2473
void MoveFootnotes_(SwFootnoteFrames &rFootnoteArr, bool bCalc=false)
Definition: ftnfrm.cxx:1932
SwFootnoteContFrame * FindFootnoteCont()
Definition: ftnfrm.cxx:965
void AppendFootnote(SwContentFrame *, SwTextFootnote *)
Definition: ftnfrm.cxx:1415
SwNeighbourAdjust NeighbourhoodAdjustment_() const
Obtain if pFrame's size adjustment should be processed.
Definition: ftnfrm.cxx:2582
Style of a layout element.
Definition: frmfmt.hxx:57
SwFootnoteFrame * FindFirstFootnote()
Definition: ftnfrm.cxx:1011
SwFootnoteBossFrame * pBoss
Definition: ftnboss.hxx:34
SwNeighbourAdjust NeighbourhoodAdjustment() const
Definition: ftnboss.hxx:121
SwFootnoteContFrame * MakeFootnoteCont()
Insert a footnote container.
Definition: ftnfrm.cxx:955
A page of the document layout.
Definition: pagefrm.hxx:40
SwFootnoteBossFrame(SwFrameFormat *pFormat, SwFrame *pSib)
Definition: ftnboss.hxx:67
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:42
bool RemoveFootnote(const SwContentFrame *, const SwTextFootnote *, bool bPrep=true)
Definition: ftnfrm.cxx:1681
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:1723
SwNeighbourAdjust
Definition: ftnboss.hxx:42
static void ResetFootnote(const SwFootnoteFrame *pAssumed)
Definition: ftnfrm.cxx:1122
SwTwips GetVarSpace() const
Definition: ftnfrm.cxx:2501
SwTwips m_nMaxFootnoteHeight
Definition: ftnboss.hxx:56
bool IsPageFrame() const
Definition: frame.hxx:1154
void MoveFootnotes(const SwContentFrame *pSrc, SwContentFrame *pDest, SwTextFootnote const *pAttr)
Definition: ftnfrm.cxx:2140
static void CollectFootnotes_(const SwContentFrame *_pRef, SwFootnoteFrame *_pFootnote, SwFootnoteFrames &_rFootnoteArr, const bool _bCollectOnlyPreviousFootnotes=false, const SwFootnoteBossFrame *_pRefFootnoteBossFrame=nullptr)
OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFootnotes> and <_pRefFootnoteBossFrame>...
Definition: ftnfrm.cxx:1788
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:46
const SwTwips nOldHeight
Definition: ftnboss.hxx:35