LibreOffice Module sw (master) 1
sectfrm.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#ifndef INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
20#define INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
21
22#include "layfrm.hxx"
23#include "flowfrm.hxx"
24
25#include <svl/listener.hxx>
26
27class SwSection;
28class SwSectionFormat;
29class SwAttrSetChg;
31class SwLayouter;
32
33enum class SwFindMode
34{
35 None = 0, EndNote = 1, LastCnt = 2, MyLast = 4
36};
37
39{
40 NONE = 0x00,
41 InvalidateSize = 0x01,
42 SetCompletePaint = 0x10,
43};
44
45namespace o3tl {
46 template<> struct typed_flags<SwSectionFrameInvFlags> : is_typed_flags<SwSectionFrameInvFlags, 0x0011> {};
47}
48
49class SwSectionFrame final: public SwLayoutFrame, public SwFlowFrame
50 , public SvtListener // TODO?
51{
53 bool m_bFootnoteAtEnd; // footnotes at the end of section
54 bool m_bEndnAtEnd; // endnotes at the end of section
55 bool m_bContentLock; // content locked
56 bool m_bOwnFootnoteNum; // special numbering of footnotes
57 bool m_bFootnoteLock; // ftn, don't leave this section bwd
58
60 SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
61 void Cut_( bool bRemove );
62 // Is there a FootnoteContainer?
63 // An empty sectionfrm without FootnoteCont is superfluous
64 bool IsSuperfluous() const { return !ContainsAny() && !ContainsFootnoteCont(); }
66 void CalcEndAtEndFlag();
68 bool IsEndnoteAtMyEnd() const;
69
70 virtual void DestroyImpl() override;
71 virtual ~SwSectionFrame() override;
72
73 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
74 virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat ) override;
75 virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
76 virtual void Notify(SfxHint const& rHint) override;
77 virtual void SwClientNotify( const SwModify&, const SfxHint& ) override;
78
79public:
80 SwSectionFrame( SwSection &, SwFrame* ); // Content is not created!
81 SwSectionFrame( SwSectionFrame &, bool bMaster ); // _ONLY_ for creating Master/Follows!
82
83 void Init();
84 virtual void CheckDirection( bool bVert ) override;
85
86 virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const override;
87
88 virtual void Cut() override;
89 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
90
91 inline const SwSectionFrame *GetFollow() const;
92 inline SwSectionFrame *GetFollow();
94
96 inline const SwContentFrame *FindLastContent() const;
98 const SwSection* GetSection() const { return m_pSection; }
99 void ColLock() { mbColLocked = true; }
100 void ColUnlock() { mbColLocked = false; }
101
102 void CalcFootnoteContent();
103 void SimpleFormat();
104 bool IsDescendantFrom( const SwSectionFormat* pSect ) const;
105 bool HasToBreak( const SwFrame* pFrame ) const;
106 void MergeNext( SwSectionFrame* pNxt );
107
112 SwSectionFrame* SplitSect( SwFrame* pFrameStartAfter, SwFrame* pFramePutAfter );
113 void DelEmpty( bool bRemove ); // Like Cut(), except for that Follow chaining is maintained
114 SwFootnoteContFrame* ContainsFootnoteCont( const SwFootnoteContFrame* pCont = nullptr ) const;
115 bool Growable() const;
116 SwTwips Shrink_( SwTwips, bool bTst );
117 SwTwips Grow_ ( SwTwips, bool bTst );
118
124 bool ToMaximize( bool bCheckFollow ) const;
125 bool ToMaximize_() const {
126 if( !m_pSection ) return false;
127 return ToMaximize( false );
128 }
129 bool MoveAllowed( const SwFrame* ) const;
130 bool CalcMinDiff( SwTwips& rMinDiff ) const;
131
142 SwTwips CalcUndersize() const;
143
145 void CheckClipping( bool bGrow, bool bMaximize );
146
148 void CollectEndnotes( SwLayouter* pLayouter );
150 if( IsEndnAtEnd() ) return GetEndSectFormat_();
151 return nullptr;
152 }
153
154 static void MoveContentAndDelete( SwSectionFrame* pDel, bool bSave );
155
156 bool IsBalancedSection() const;
157
158 virtual void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
159 virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
160
161 bool IsFootnoteAtEnd() const { return m_bFootnoteAtEnd; }
162 bool IsEndnAtEnd() const { return m_bEndnAtEnd; }
163 bool IsAnyNoteAtEnd() const { return m_bFootnoteAtEnd || m_bEndnAtEnd; }
164
165 void SetContentLock( bool bNew ) { m_bContentLock = bNew; }
166 bool IsContentLocked() const { return m_bContentLock; }
167
168 bool IsOwnFootnoteNum() const { return m_bOwnFootnoteNum; }
169
170 void SetFootnoteLock( bool bNew ) { m_bFootnoteLock = bNew; }
171 bool IsFootnoteLock() const { return m_bFootnoteLock; }
172};
173
175{
176 return static_cast<const SwSectionFrame*>(SwFlowFrame::GetFollow());
177}
179{
180 return static_cast<SwSectionFrame*>(SwFlowFrame::GetFollow());
181}
183{
184 return const_cast<SwSectionFrame*>(this)->FindLastContent();
185}
186
187#endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
188
189/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool mbColLocked
Definition: frame.hxx:443
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
friend class SwFlowFrame
Definition: layfrm.hxx:38
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method <ContainsAny()> doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:131
A page of the document layout.
Definition: pagefrm.hxx:60
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
SwSection * GetSection()
Definition: sectfrm.hxx:97
bool IsAnyNoteAtEnd() const
Definition: sectfrm.hxx:163
bool IsOwnFootnoteNum() const
Definition: sectfrm.hxx:168
void CheckClipping(bool bGrow, bool bMaximize)
Adapt size to surroundings.
Definition: sectfrm.cxx:1097
bool MoveAllowed(const SwFrame *) const
Definition: sectfrm.cxx:2418
bool m_bFootnoteLock
Definition: sectfrm.hxx:57
bool IsEndnAtEnd() const
Definition: sectfrm.hxx:162
void DelEmpty(bool bRemove)
Definition: sectfrm.cxx:192
bool IsContentLocked() const
Definition: sectfrm.hxx:166
bool m_bFootnoteAtEnd
Definition: sectfrm.hxx:53
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: sectfrm.cxx:796
virtual void Notify(SfxHint const &rHint) override
Definition: sectfrm.cxx:2596
const SwSectionFormat * GetEndSectFormat() const
Definition: sectfrm.hxx:149
bool CalcMinDiff(SwTwips &rMinDiff) const
Definition: sectfrm.cxx:972
const SwSection * GetSection() const
Definition: sectfrm.hxx:98
SwSection * m_pSection
Definition: sectfrm.hxx:52
SwTwips Shrink_(SwTwips, bool bTst)
Definition: sectfrm.cxx:2315
virtual void PaintSubsidiaryLines(const SwPageFrame *, const SwRect &) const override
Definition: paintfrm.cxx:7189
virtual void dumpAsXml(xmlTextWriterPtr writer=nullptr) const override
Definition: sectfrm.cxx:2959
virtual ~SwSectionFrame() override
Definition: sectfrm.cxx:188
bool m_bEndnAtEnd
Definition: sectfrm.hxx:54
void CalcFootnoteAtEndFlag()
Definition: sectfrm.cxx:2554
void CollectEndnotes(SwLayouter *pLayouter)
Definition: sectfrm.cxx:1069
bool Growable() const
checks whether the SectionFrame is still able to grow, as case may be the environment has to be asked
Definition: sectfrm.cxx:2170
virtual void Cut() override
Definition: sectfrm.cxx:260
void MergeNext(SwSectionFrame *pNxt)
|* Merges two SectionFrames, in case it's about the same section.
Definition: sectfrm.cxx:476
SwTwips Grow_(SwTwips, bool bTst)
Definition: sectfrm.cxx:2180
const SwSectionFormat * GetEndSectFormat_() const
Definition: sectfrm.cxx:892
bool ToMaximize_() const
Definition: sectfrm.hxx:125
bool IsEndnoteAtMyEnd() const
Definition: sectfrm.cxx:2577
bool IsBalancedSection() const
Definition: sectfrm.cxx:2949
bool IsSuperfluous() const
Definition: sectfrm.hxx:64
void CalcEndAtEndFlag()
Definition: sectfrm.cxx:2582
virtual void DestroyImpl() override
Definition: sectfrm.cxx:155
void ColUnlock()
Definition: sectfrm.hxx:100
const SwContentFrame * FindLastContent() const
Definition: sectfrm.hxx:182
bool HasToBreak(const SwFrame *pFrame) const
|* Here it's decided whether the this-SectionFrame should break up |* the passed (Section)frm (or not...
Definition: sectfrm.cxx:453
bool m_bOwnFootnoteNum
Definition: sectfrm.hxx:56
SwTwips CalcUndersize() const
Definition: sectfrm.cxx:2842
void CalcFootnoteContent()
Definition: sectfrm.cxx:2855
SwSectionFrame(SwSection &, SwFrame *)
Definition: sectfrm.cxx:69
void SimpleFormat()
Definition: sectfrm.cxx:1190
void SetFootnoteLock(bool bNew)
Definition: sectfrm.hxx:170
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"formats" the frame; Frame and PrtArea
Definition: sectfrm.cxx:1359
virtual bool ShouldBwdMoved(SwLayoutFrame *pNewUpper, bool &rReformat) override
Definition: sectfrm.cxx:886
bool m_bContentLock
Definition: sectfrm.hxx:55
void SetContentLock(bool bNew)
Definition: sectfrm.hxx:165
void UpdateAttr_(const SfxPoolItem *, const SfxPoolItem *, SwSectionFrameInvFlags &, SwAttrSetChg *pa=nullptr, SwAttrSetChg *pb=nullptr)
Definition: sectfrm.cxx:2650
SwFootnoteContFrame * ContainsFootnoteCont(const SwFootnoteContFrame *pCont=nullptr) const
Check every Column for FootnoteContFrames.
Definition: sectfrm.cxx:2802
static void MoveContentAndDelete(SwSectionFrame *pDel, bool bSave)
Definition: sectfrm.cxx:691
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: sectfrm.cxx:347
SwSectionFrame * FindMaster() const
Definition: flowfrm.cxx:778
void InvalidateFootnotePos()
Definition: sectfrm.cxx:2831
bool ToMaximize(bool bCheckFollow) const
A sectionfrm has to maximize, if he has a follow or a ftncontainer at the end of the page.
Definition: sectfrm.cxx:2773
SwSectionFrame * SplitSect(SwFrame *pFrameStartAfter, SwFrame *pFramePutAfter)
Splits the SectionFrame surrounding the pFrame up in two parts: pFrame and the start of the 2nd part.
Definition: sectfrm.cxx:523
SwTwips Undersize()
Returns the size delta that the section would like to be greater if it has undersized TextFrames in i...
Definition: sectfrm.cxx:2848
bool IsFootnoteAtEnd() const
Definition: sectfrm.hxx:161
bool IsDescendantFrom(const SwSectionFormat *pSect) const
Definition: sectfrm.cxx:2539
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:327
void Cut_(bool bRemove)
Definition: sectfrm.cxx:265
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:415
bool IsFootnoteLock() const
Definition: sectfrm.hxx:171
void ColLock()
Definition: sectfrm.hxx:99
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: sectfrm.cxx:2603
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:174
struct _xmlTextWriter * xmlTextWriterPtr
NONE
None
SwFindMode
Definition: sectfrm.hxx:34
SwSectionFrameInvFlags
Definition: sectfrm.hxx:39
tools::Long SwTwips
Definition: swtypes.hxx:51
unsigned char sal_uInt8