LibreOffice Module sw (master)  1
ftnfrm.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_FTNFRM_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_FTNFRM_HXX
22 
23 #include "layfrm.hxx"
24 
25 class SwContentFrame;
26 class SwRootFrame;
27 class SwTextNode;
28 class SwTextFootnote;
29 class SwBorderAttrs;
30 class SwFootnoteFrame;
31 
32 void sw_RemoveFootnotes( SwFootnoteBossFrame* pBoss, bool bPageOnly, bool bEndNotes );
33 
34 namespace sw {
35 
37  SwRootFrame const& rLayout, SwTextNode const& rTextNode,
38  std::vector<std::pair<sal_Int32, sal_Int32>> const*const pExtents);
39 
40 }
41 
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.
47 {
48  static SwFootnoteFrame* AddChained(bool bAppend, SwFrame *pNewUpper, bool bDefaultFormat);
49 
50 public:
52 
53  const SwFootnoteFrame* FindFootNote() const;
54 
55  static inline SwFootnoteFrame* AppendChained(SwFrame* pThis, bool bDefaultFormat);
56  static inline SwFootnoteFrame* PrependChained(SwFrame* pThis, bool bDefaultFormat);
57 
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(
62  const SwRect&,
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;
67 };
68 
69 inline SwFootnoteFrame* SwFootnoteContFrame::AppendChained(SwFrame* pThis, bool bDefaultFormat)
70 {
71  return AddChained(true, pThis, bDefaultFormat);
72 }
73 
74 inline SwFootnoteFrame* SwFootnoteContFrame::PrependChained(SwFrame* pThis, bool bDefaultFormat)
75 {
76  return AddChained(false, pThis, bDefaultFormat);
77 }
78 
80 {
81  // Pointer to FootnoteFrame in which the footnote will be continued:
82  // - 0 no following existent
83  // - this for the last one
84  // - otherwise the following FootnoteFrame
86  SwFootnoteFrame *mpMaster; // FootnoteFrame from which I am the following
87  SwContentFrame *mpReference; // in this ContentFrame is the footnote reference
88  SwTextFootnote *mpAttribute; // footnote attribute (for recognition)
89 
90  // if true paragraphs in this footnote are NOT permitted to flow backwards
91  bool mbBackMoveLocked : 1;
92  // #i49383# - control unlock of position of lower anchored objects.
94 
95 public:
97 
98  virtual bool IsDeleteForbidden() const override;
99  virtual void Cut() override;
100  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
101 
102  virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const override;
103 
104  bool operator<( const SwTextFootnote* pTextFootnote ) const;
105 
106 #ifdef DBG_UTIL
107  const SwContentFrame *GetRef() const;
109 #else
110  const SwContentFrame *GetRef() const { return mpReference; }
111  SwContentFrame *GetRef() { return mpReference; }
112 #endif
113  const SwContentFrame *GetRefFromAttr() const;
115 
116  const SwFootnoteFrame *GetFollow() const { return mpFollow; }
118 
119  const SwFootnoteFrame *GetMaster() const { return mpMaster; }
121 
122  const SwTextFootnote *GetAttr() const { return mpAttribute; }
124 
125  void SetFollow( SwFootnoteFrame *pNew ) { mpFollow = pNew; }
126  void SetMaster( SwFootnoteFrame *pNew ) { mpMaster = pNew; }
127  void SetRef ( SwContentFrame *pNew ) { mpReference = pNew; }
128 
129  void InvalidateNxtFootnoteCnts( SwPageFrame const * pPage );
130 
131  void LockBackMove() { mbBackMoveLocked = true; }
132  void UnlockBackMove() { mbBackMoveLocked = false;}
133  bool IsBackMoveLocked() const { return mbBackMoveLocked; }
134 
135  // prevents that the last content deletes the SwFootnoteFrame as well (Cut())
136  void ColLock() { mbColLocked = true; }
137  void ColUnlock() { mbColLocked = false; }
138 
139  // #i49383#
141  {
142  mbUnlockPosOfLowerObjs = true;
143  }
145  {
146  mbUnlockPosOfLowerObjs = false;
147  }
149  {
150  return mbUnlockPosOfLowerObjs;
151  }
152 
161 };
162 
163 #endif
164 
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFollow(SwFootnoteFrame *pNew)
Definition: ftnfrm.hxx:125
static SwFootnoteFrame * AppendChained(SwFrame *pThis, bool bDefaultFormat)
Definition: ftnfrm.hxx:69
Base class of the Writer layout elements.
Definition: frame.hxx:297
void ColLock()
Definition: ftnfrm.hxx:136
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"format" the frame (Fixsize is not set here).
Definition: ftnfrm.cxx:229
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: ftnfrm.cxx:591
void SetMaster(SwFootnoteFrame *pNew)
Definition: ftnfrm.hxx:126
virtual bool IsDeleteForbidden() const override
Definition: ftnfrm.cxx:519
long SwTwips
Definition: swtypes.hxx:49
Dialog to specify the properties of date form field.
virtual void Cut() override
Definition: ftnfrm.cxx:540
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void InvalidateNxtFootnoteCnts(SwPageFrame const *pPage)
Definition: ftnfrm.cxx:495
void KeepLockPosOfLowerObjs()
Definition: ftnfrm.hxx:144
SwFootnoteFrame * GetFollow()
Definition: ftnfrm.hxx:117
SwFootnoteContFrame(SwFrameFormat *, SwFrame *)
Definition: ftnfrm.cxx:150
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
bool mbUnlockPosOfLowerObjs
Definition: ftnfrm.hxx:93
bool IsUnlockPosOfLowerObjs() const
Definition: ftnfrm.hxx:148
SwTextFootnote * mpAttribute
Definition: ftnfrm.hxx:88
virtual void PaintSubsidiaryLines(const SwPageFrame *, const SwRect &) const override
This method is overridden in order to have no subsidiary lines around the footnotes containers...
Definition: paintfrm.cxx:6806
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: ftnfrm.cxx:452
SwFootnoteFrame * mpMaster
Definition: ftnfrm.hxx:86
bool mbBackMoveLocked
Definition: ftnfrm.hxx:91
void UnlockPosOfLowerObjs()
Definition: ftnfrm.hxx:140
Style of a layout element.
Definition: frmfmt.hxx:57
virtual void PaintSwFrameShadowAndBorder(const SwRect &, const SwPageFrame *pPage, const SwBorderAttrs &) const override
Special implementation because of the footnote line.
Definition: paintfrm.cxx:5237
void RemoveFootnotesForNode(SwRootFrame const &rLayout, SwTextNode const &rTextNode, std::vector< std::pair< sal_Int32, sal_Int32 >> const *const pExtents)
Definition: txtfrm.cxx:802
void UnlockBackMove()
Definition: ftnfrm.hxx:132
A page of the document layout.
Definition: pagefrm.hxx:41
void LockBackMove()
Definition: ftnfrm.hxx:131
SwFootnoteFrame(SwFrameFormat *, SwFrame *, SwContentFrame *, SwTextFootnote *)
Definition: ftnfrm.cxx:482
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:119
void sw_RemoveFootnotes(SwFootnoteBossFrame *pBoss, bool bPageOnly, bool bEndNotes)
remove all footnotes (not the references) and all footnote pages
Definition: ftnfrm.cxx:905
const SwFootnoteFrame * FindFootNote() const
Definition: findfrm.cxx:564
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
void SetRef(SwContentFrame *pNew)
Definition: ftnfrm.hxx:127
bool IsBackMoveLocked() const
Definition: ftnfrm.hxx:133
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
bool mbColLocked
Definition: frame.hxx:426
bool operator<(const SwTextFootnote *pTextFootnote) const
Definition: ftnfrm.cxx:63
const SwContentFrame * GetRef() const
Definition: ftnfrm.cxx:2888
const SwTextFootnote * GetAttr() const
Definition: ftnfrm.hxx:122
SwContentFrame * mpReference
Definition: ftnfrm.hxx:87
SwFootnoteFrame * mpFollow
Definition: ftnfrm.hxx:85
static SwFootnoteFrame * AddChained(bool bAppend, SwFrame *pNewUpper, bool bDefaultFormat)
Definition: ftnfrm.cxx:156
const SwContentFrame * GetRefFromAttr() const
Definition: ftnfrm.cxx:2909
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
SwFootnoteFrame * GetMaster()
Definition: ftnfrm.hxx:120
void ColUnlock()
Definition: ftnfrm.hxx:137
SwTextFootnote * GetAttr()
Definition: ftnfrm.hxx:123
virtual void PaintSubsidiaryLines(const SwPageFrame *, const SwRect &) const override
This method is overridden in order to have no subsidiary lines around the footnotes.
Definition: paintfrm.cxx:6797
void PaintLine(const SwRect &, const SwPageFrame *) const
Paint footnote lines.
Definition: paintfrm.cxx:5251
static SwFootnoteFrame * PrependChained(SwFrame *pThis, bool bDefaultFormat)
Definition: ftnfrm.hxx:74
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: ftnfrm.cxx:318
SwContentFrame * FindLastContent()
search for last content in the current footnote frame
Definition: ftnfrm.cxx:2928