1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_FTNFRM_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_FTNFRM_HXX
30 class SwFootnoteFrame
;
32 void sw_RemoveFootnotes( SwFootnoteBossFrame
* pBoss
, bool bPageOnly
, bool bEndNotes
);
36 void RemoveFootnotesForNode(
37 SwRootFrame
const& rLayout
, SwTextNode
const& rTextNode
,
38 std::vector
<std::pair
<sal_Int32
, sal_Int32
>> const*const pExtents
);
42 // There exists a special container frame on a page for footnotes. It's called
43 // SwFootnoteContFrame. Each footnote is separated by a SwFootnoteFrame which contains
44 // the text frames of a footnote. SwFootnoteFrame can be split and will then
45 // continue on another page.
46 class SwFootnoteContFrame final
: public SwLayoutFrame
48 static SwFootnoteFrame
* AddChained(bool bAppend
, SwFrame
*pNewUpper
, bool bDefaultFormat
);
51 SwFootnoteContFrame( SwFrameFormat
*, SwFrame
* );
53 const SwFootnoteFrame
* FindFootNote() const;
55 static inline SwFootnoteFrame
* AppendChained(SwFrame
* pThis
, bool bDefaultFormat
);
56 static inline SwFootnoteFrame
* PrependChained(SwFrame
* pThis
, bool bDefaultFormat
);
58 virtual SwTwips
ShrinkFrame( SwTwips
, bool bTst
= false, bool bInfo
= false ) override
;
59 virtual SwTwips
GrowFrame ( SwTwips
, bool bTst
= false, bool bInfo
= false ) override
;
60 virtual void Format( vcl::RenderContext
* pRenderContext
, const SwBorderAttrs
*pAttrs
= nullptr ) override
;
61 virtual void PaintSwFrameShadowAndBorder(
63 const SwPageFrame
* pPage
,
64 const SwBorderAttrs
&) const override
;
65 virtual void PaintSubsidiaryLines( const SwPageFrame
*, const SwRect
& ) const override
;
66 void PaintLine( const SwRect
&, const SwPageFrame
* ) const;
68 void dumpAsXml(xmlTextWriterPtr writer
= nullptr) const override
;
71 inline SwFootnoteFrame
* SwFootnoteContFrame::AppendChained(SwFrame
* pThis
, bool bDefaultFormat
)
73 return AddChained(true, pThis
, bDefaultFormat
);
76 inline SwFootnoteFrame
* SwFootnoteContFrame::PrependChained(SwFrame
* pThis
, bool bDefaultFormat
)
78 return AddChained(false, pThis
, bDefaultFormat
);
81 /// Represents one footnote or endnote in the layout. Typical upper is an SwFootnoteContFrame,
82 /// typical lower is an SwTextFrame.
83 class SwFootnoteFrame final
: public SwLayoutFrame
85 // Pointer to FootnoteFrame in which the footnote will be continued:
86 // - 0 no following existent
87 // - otherwise the following FootnoteFrame
88 SwFootnoteFrame
*mpFollow
;
89 SwFootnoteFrame
*mpMaster
; // FootnoteFrame from which I am the following
90 SwContentFrame
*mpReference
; // in this ContentFrame is the footnote reference
91 SwTextFootnote
*mpAttribute
; // footnote attribute (for recognition)
93 // if true paragraphs in this footnote are NOT permitted to flow backwards
94 bool mbBackMoveLocked
: 1;
95 // #i49383# - control unlock of position of lower anchored objects.
96 bool mbUnlockPosOfLowerObjs
: 1;
99 SwFootnoteFrame( SwFrameFormat
*, SwFrame
*, SwContentFrame
*, SwTextFootnote
* );
101 virtual bool IsDeleteForbidden() const override
;
102 virtual void Cut() override
;
103 virtual void Paste( SwFrame
* pParent
, SwFrame
* pSibling
= nullptr ) override
;
105 virtual void PaintSubsidiaryLines( const SwPageFrame
*, const SwRect
& ) const override
;
107 bool operator<( const SwTextFootnote
* pTextFootnote
) const;
110 const SwContentFrame
*GetRef() const;
111 SwContentFrame
*GetRef();
113 const SwContentFrame
*GetRef() const { return mpReference
; }
114 SwContentFrame
*GetRef() { return mpReference
; }
116 const SwContentFrame
*GetRefFromAttr() const;
117 SwContentFrame
*GetRefFromAttr();
119 const SwFootnoteFrame
*GetFollow() const { return mpFollow
; }
120 SwFootnoteFrame
*GetFollow() { return mpFollow
; }
122 const SwFootnoteFrame
*GetMaster() const { return mpMaster
; }
123 SwFootnoteFrame
*GetMaster() { return mpMaster
; }
125 const SwTextFootnote
*GetAttr() const { return mpAttribute
; }
126 SwTextFootnote
*GetAttr() { return mpAttribute
; }
128 void SetFollow( SwFootnoteFrame
*pNew
) { mpFollow
= pNew
; }
129 void SetMaster( SwFootnoteFrame
*pNew
) { mpMaster
= pNew
; }
130 void SetRef ( SwContentFrame
*pNew
) { mpReference
= pNew
; }
132 void InvalidateNxtFootnoteCnts( SwPageFrame
const * pPage
);
134 void LockBackMove() { mbBackMoveLocked
= true; }
135 void UnlockBackMove() { mbBackMoveLocked
= false;}
136 bool IsBackMoveLocked() const { return mbBackMoveLocked
; }
138 // prevents that the last content deletes the SwFootnoteFrame as well (Cut())
139 void ColLock() { mbColLocked
= true; }
140 void ColUnlock() { mbColLocked
= false; }
143 void UnlockPosOfLowerObjs()
145 mbUnlockPosOfLowerObjs
= true;
147 void KeepLockPosOfLowerObjs()
149 mbUnlockPosOfLowerObjs
= false;
151 bool IsUnlockPosOfLowerObjs() const
153 return mbUnlockPosOfLowerObjs
;
156 /** search for last content in the current footnote frame
158 OD 2005-12-02 #i27138#
160 @return SwContentFrame*
161 pointer to found last content frame. NULL, if none is found.
163 SwContentFrame
* FindLastContent();
165 void dumpAsXml(xmlTextWriterPtr writer
= nullptr) const override
;
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */