nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / core / inc / layfrm.hxx
blob3f73602e6bfad46e927d8652d36d094d74b42e4f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
22 #include "frame.hxx"
23 #include <swdllapi.h>
25 class SwAnchoredObject;
26 class SwContentFrame;
27 class SwFormatCol;
28 struct SwCursorMoveState;
29 class SwFrameFormat;
30 class SwBorderAttrs;
31 class SwFormatFrameSize;
32 class SwCellFrame;
34 /// A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
35 class SW_DLLPUBLIC SwLayoutFrame: public SwFrame
37 // The SwFrame in disguise
38 friend class SwFlowFrame;
39 friend class SwFrame;
41 // Releases the Lower while restructuring columns
42 friend SwFrame* SaveContent( SwLayoutFrame *, SwFrame * );
43 friend void RestoreContent( SwFrame *, SwLayoutFrame *, SwFrame *pSibling );
45 protected:
47 virtual void DestroyImpl() override;
48 virtual ~SwLayoutFrame() override;
50 virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
51 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
53 SwFrame * m_pLower;
54 std::vector<SwAnchoredObject*> m_VertPosOrientFramesFor;
56 virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
57 virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
59 tools::Long CalcRel( const SwFormatFrameSize &rSz ) const;
61 public:
62 // --> #i28701#
64 virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const;
65 void RefreshLaySubsidiary( const SwPageFrame*, const SwRect& ) const;
66 void RefreshExtraData( const SwRect & ) const;
68 /// Change size of lowers proportionally
69 void ChgLowersProp( const Size& rOldSize );
71 void AdjustColumns( const SwFormatCol *pCol, bool bAdjustAttributes );
73 void ChgColumns( const SwFormatCol &rOld, const SwFormatCol &rNew,
74 const bool bChgFootnote = false );
76 /// Paints the column separation line for the inner columns
77 void PaintColLines( const SwRect &, const SwFormatCol &,
78 const SwPageFrame * ) const;
80 virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const override;
82 virtual bool GetModelPositionForViewPoint( SwPosition *, Point&,
83 SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
85 virtual void Cut() override;
86 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
88 /**
89 * Finds the closest Content for the SPoint
90 * Is used for Pages, Flys and Cells if GetModelPositionForViewPoint failed
92 const SwContentFrame* GetContentPos( Point &rPoint, const bool bDontLeave,
93 const bool bBodyOnly = false,
94 SwCursorMoveState *pCMS = nullptr,
95 const bool bDefaultExpand = true ) const;
97 SwLayoutFrame( SwFrameFormat*, SwFrame* );
99 virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
100 SwPrintData const*const pPrintData = nullptr ) const override;
101 const SwFrame *Lower() const { return m_pLower; }
102 SwFrame *Lower() { return m_pLower; }
103 const SwContentFrame *ContainsContent() const;
104 inline SwContentFrame *ContainsContent();
105 const SwCellFrame *FirstCell() const;
106 inline SwCellFrame *FirstCell();
109 * Method <ContainsAny()> doesn't investigate content of footnotes by default.
110 * But under certain circumstances this investigation is intended.
111 * Thus, introduce new optional parameter <_bInvestigateFootnoteForSections>.
112 * It's default is <false>, still indicating that content of footnotes isn't
113 * investigated for sections.
115 const SwFrame *ContainsAny( const bool _bInvestigateFootnoteForSections = false ) const;
116 inline SwFrame *ContainsAny( const bool _bInvestigateFootnoteForSections = false );
117 bool IsAnLower( const SwFrame * ) const;
119 virtual const SwFrameFormat *GetFormat() const;
120 virtual SwFrameFormat *GetFormat();
121 void SetFrameFormat( SwFrameFormat* );
124 * Moving the Footnotes of all Lowers - starting from StartContent
126 * @returns true if at least one Footnote was moved
127 * Calls the page number update if bFootnoteNums is set
129 bool MoveLowerFootnotes( SwContentFrame *pStart, SwFootnoteBossFrame *pOldBoss,
130 SwFootnoteBossFrame *pNewBoss, const bool bFootnoteNums );
132 // --> #i28701# - change purpose of method and its name
133 // --> #i44016# - add parameter <_bUnlockPosOfObjs> to
134 /// force an unlockposition call for the lower objects.
135 void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
138 * Invalidates the inner Frames, whose width and/or height are
139 * calculated using percentages.
140 * Frames that are anchored to this or inner Frames, are also invalidated.
142 void InvaPercentLowers( SwTwips nDiff = 0 );
144 /// Called by Format for Frames and Areas with columns
145 void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
146 const SwTwips nMinHeight );
149 * InnerHeight returns the height of the content and may be bigger or
150 * less than the PrtArea-Height of the layoutframe himself
152 SwTwips InnerHeight() const;
154 /** method to check relative position of layout frame to
155 a given layout frame.
157 refactoring of pseudo-local method <lcl_Apres(..)> in
158 <txtftn.cxx> for #104840#.
160 @param _aCheckRefLayFrame
161 constant reference of an instance of class <SwLayoutFrame> which
162 is used as the reference for the relative position check.
164 @return true, if <this> is positioned before the layout frame <p>
166 bool IsBefore( const SwLayoutFrame* _pCheckRefLayFrame ) const;
168 const SwFrame* GetLastLower() const;
169 inline SwFrame* GetLastLower();
171 virtual void PaintBreak() const;
173 void SetVertPosOrientFrameFor(SwAnchoredObject *pObj)
175 m_VertPosOrientFramesFor.push_back(pObj);
178 void ClearVertPosOrientFrameFor(SwAnchoredObject *pObj)
180 m_VertPosOrientFramesFor.erase(
181 std::remove(m_VertPosOrientFramesFor.begin(),
182 m_VertPosOrientFramesFor.end(), pObj),
183 m_VertPosOrientFramesFor.end());
188 * In order to save us from duplicating implementations, we cast here
189 * a little.
191 inline SwContentFrame* SwLayoutFrame::ContainsContent()
193 return const_cast<SwContentFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsContent());
196 inline SwCellFrame* SwLayoutFrame::FirstCell()
198 return const_cast<SwCellFrame*>(static_cast<const SwLayoutFrame*>(this)->FirstCell());
201 inline SwFrame* SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSections )
203 return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsAny( _bInvestigateFootnoteForSections ));
207 * These SwFrame inlines are here, so that frame.hxx does not need to include layfrm.hxx
209 inline bool SwFrame::IsColBodyFrame() const
211 return mnFrameType == SwFrameType::Body && GetUpper()->IsColumnFrame();
214 inline bool SwFrame::IsPageBodyFrame() const
216 return mnFrameType == SwFrameType::Body && GetUpper()->IsPageFrame();
219 inline SwFrame* SwLayoutFrame::GetLastLower()
221 return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->GetLastLower());
224 #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */