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;
54 const SwFootnoteFrame
* FindEndNote() const;
56 static inline SwFootnoteFrame
* AppendChained(SwFrame
* pThis
, bool bDefaultFormat
);
57 static inline SwFootnoteFrame
* PrependChained(SwFrame
* pThis
, bool bDefaultFormat
);
59 virtual SwTwips
ShrinkFrame( SwTwips
, bool bTst
= false, bool bInfo
= false ) override
;
60 virtual SwTwips
GrowFrame(SwTwips
, SwResizeLimitReason
&, bool bTst
, bool bInfo
) override
;
61 virtual void Format( vcl::RenderContext
* pRenderContext
, const SwBorderAttrs
*pAttrs
= nullptr ) override
;
62 virtual void PaintSwFrameShadowAndBorder(
64 const SwPageFrame
* pPage
,
65 const SwBorderAttrs
&) const override
;
66 virtual void PaintSubsidiaryLines( const SwPageFrame
*, const SwRect
& ) const override
;
67 void PaintLine( const SwRect
&, const SwPageFrame
* ) const;
69 void dumpAsXml(xmlTextWriterPtr writer
= nullptr) const override
;
72 inline SwFootnoteFrame
* SwFootnoteContFrame::AppendChained(SwFrame
* pThis
, bool bDefaultFormat
)
74 return AddChained(true, pThis
, bDefaultFormat
);
77 inline SwFootnoteFrame
* SwFootnoteContFrame::PrependChained(SwFrame
* pThis
, bool bDefaultFormat
)
79 return AddChained(false, pThis
, bDefaultFormat
);
82 /// Represents one footnote or endnote in the layout. Typical upper is an SwFootnoteContFrame,
83 /// typical lower is an SwTextFrame.
84 class SwFootnoteFrame final
: public SwLayoutFrame
86 // Pointer to FootnoteFrame in which the footnote will be continued:
87 // - 0 no following existent
88 // - otherwise the following FootnoteFrame
89 SwFootnoteFrame
*mpFollow
;
90 SwFootnoteFrame
*mpMaster
; // FootnoteFrame from which I am the following
91 SwContentFrame
*mpReference
; // in this ContentFrame is the footnote reference
92 SwTextFootnote
*mpAttribute
; // footnote attribute (for recognition)
94 // if true paragraphs in this footnote are NOT permitted to flow backwards
95 bool mbBackMoveLocked
: 1;
96 // #i49383# - control unlock of position of lower anchored objects.
97 bool mbUnlockPosOfLowerObjs
: 1;
100 SwFootnoteFrame( SwFrameFormat
*, SwFrame
*, SwContentFrame
*, SwTextFootnote
* );
102 virtual bool IsDeleteForbidden() const override
;
103 virtual void Cut() override
;
104 virtual void Paste( SwFrame
* pParent
, SwFrame
* pSibling
= nullptr ) override
;
106 virtual void PaintSubsidiaryLines( const SwPageFrame
*, const SwRect
& ) const override
;
108 bool operator<( const SwTextFootnote
* pTextFootnote
) const;
111 const SwContentFrame
*GetRef() const;
112 SwContentFrame
*GetRef();
114 const SwContentFrame
*GetRef() const { return mpReference
; }
115 SwContentFrame
*GetRef() { return mpReference
; }
117 const SwContentFrame
*GetRefFromAttr() const;
118 SwContentFrame
*GetRefFromAttr();
120 const SwFootnoteFrame
*GetFollow() const { return mpFollow
; }
121 SwFootnoteFrame
*GetFollow() { return mpFollow
; }
123 const SwFootnoteFrame
*GetMaster() const { return mpMaster
; }
124 SwFootnoteFrame
*GetMaster() { return mpMaster
; }
126 const SwTextFootnote
*GetAttr() const { return mpAttribute
; }
127 SwTextFootnote
*GetAttr() { return mpAttribute
; }
129 void SetFollow( SwFootnoteFrame
*pNew
) { mpFollow
= pNew
; }
130 void SetMaster( SwFootnoteFrame
*pNew
) { mpMaster
= pNew
; }
131 void SetRef ( SwContentFrame
*pNew
) { mpReference
= pNew
; }
133 void InvalidateNxtFootnoteCnts( SwPageFrame
const * pPage
);
135 void LockBackMove() { mbBackMoveLocked
= true; }
136 void UnlockBackMove() { mbBackMoveLocked
= false;}
137 bool IsBackMoveLocked() const { return mbBackMoveLocked
; }
139 // prevents that the last content deletes the SwFootnoteFrame as well (Cut())
140 void ColLock() { mbColLocked
= true; }
141 void ColUnlock() { mbColLocked
= false; }
144 void UnlockPosOfLowerObjs()
146 mbUnlockPosOfLowerObjs
= true;
148 void KeepLockPosOfLowerObjs()
150 mbUnlockPosOfLowerObjs
= false;
152 bool IsUnlockPosOfLowerObjs() const
154 return mbUnlockPosOfLowerObjs
;
157 /** search for last content in the current footnote frame
159 OD 2005-12-02 #i27138#
161 @return SwContentFrame*
162 pointer to found last content frame. NULL, if none is found.
164 SwContentFrame
* FindLastContent();
166 void dumpAsXml(xmlTextWriterPtr writer
= nullptr) const override
;
167 void dumpAsXmlAttributes(xmlTextWriterPtr writer
) const override
;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */