33#include <objectformatter.hxx>
35#include <osl/diagnose.h>
70 nTmp =
static_cast<SwTextFrame*
>(pFrame)->GetParHeight()
104 OSL_ENSURE( rCnt.
GetContentIdx(),
"No content for Header." );
122 nMinHeight -= pAttrs->
CalcTop();
130 nOverlap = -nMinHeight;
141 nHeight = nMinHeight;
143 if (nHeight < nMinHeight)
144 nHeight = nMinHeight;
161 nOverlap += nHeight - nMinHeight;
162 if (nOverlap < nSpace - nLine)
169 nUL = pAttrs->
CalcTop() + nSpace;
231 nMinHeight -= pAttrs->
CalcTop();
240 SwTwips nRemaining, nOldHeight;
244 Point aOldFooterPrtPos;
257 int nLoopControl = 0;
269 "<SwHeadFootFrame::FormatSize(..)> - text frame invalid and not locked." );
276 if (nLoopControl++ < 20)
283 SAL_WARN(
"sw",
"SwHeadFootFrame::FormatSize: loop detection triggered");
296 static_cast<SwTextFrame*
>(pFrame)->IsUndersized() )
298 nRemaining +=
static_cast<SwTextFrame*
>(pFrame)->GetParHeight()
305 if ( nRemaining < nMinHeight )
306 nRemaining = nMinHeight;
308 SwTwips nDiff = nRemaining - nOldHeight;
314 nMaxHeight = nOldHeight;
316 if( nRemaining <= nMinHeight )
317 nRemaining = ( nMaxHeight + nMinHeight + 1 ) / 2;
321 if (nOldHeight > nMinHeight)
322 nMinHeight = nOldHeight;
324 if( nRemaining >= nMaxHeight )
325 nRemaining = ( nMaxHeight + nMinHeight + 1 ) / 2;
328 nDiff = nRemaining - nOldHeight;
344 if (pTmpFrame->IsUndersized() )
356 if (pTmpFrame->IsUndersized() )
381 if ( nBot > nDeadLine )
417 OSL_ENSURE( pAttrs,
"SwFooterFrame::Format, pAttrs is 0." );
456 std::optional<SwBorderAttrAccess> oAccess(std::in_place,
SwFrame::GetCache(),
this);
457 OSL_ENSURE(oAccess,
"no border attributes");
480 if (nFrameTooSmall > 0)
481 nEat -= nFrameTooSmall;
486 else if (nEat > nMaxEat)
492 bool bNotifyFlys =
false;
500 aPrt.
Top(aPrt.
Top() - nEat);
515 if (nDist - nEat > 0)
520 nResult += nFrameGrow;
521 if ( nFrameGrow > 0 )
528 if ( ( nResult > 0 ) && bNotifyFlys )
534 if ( nResult && !bTst )
560 if ( nOldHeight >= nMinHeight )
567 SwTwips nBiggerThanMin = nOldHeight - nMinHeight;
569 if (nBiggerThanMin < nDist)
571 nRest = nDist - nBiggerThanMin;
582 bool bNotifyFlys =
false;
585 std::optional<SwBorderAttrAccess> oAccess(std::in_place,
SwFrame::GetCache(),
this);
586 OSL_ENSURE(oAccess,
"no border attributes");
591 SwTwips nMinPrtHeight = nMinHeight
595 if (nMinPrtHeight < 0)
605 if (nShrink > nMaxShrink)
608 nShrink = nMaxShrink;
616 aPrt.
Top(aPrt.
Top() + nShrink);
632 if (nDist - nRest > 0)
635 nResult += nShrinkAmount;
636 if ( nShrinkAmount > 0 )
643 if ( ( nResult > 0 ) && bNotifyFlys )
655 OSL_ENSURE(pFormat,
"SwHeadFootFrame: no format?");
696 OSL_ENSURE( rH.
GetHeaderFormat(),
"FrameFormat for Header not found." );
708 OSL_ENSURE( pLay,
"Where to with the Header?" );
710 pH->
Paste(
this, pLay );
739 OSL_ENSURE( rF.
GetFooterFormat(),
"FrameFormat for Footer not found." );
770 (void)xmlTextWriterStartElement(writer,
reinterpret_cast<const xmlChar*
>(
"header"));
773 (void)xmlTextWriterStartElement(writer, BAD_CAST(
"infos"));
775 (void)xmlTextWriterEndElement(writer);
778 (void)xmlTextWriterEndElement(writer);
783 (void)xmlTextWriterStartElement(writer,
reinterpret_cast<const xmlChar*
>(
"footer"));
786 (void)xmlTextWriterStartElement(writer, BAD_CAST(
"infos"));
788 (void)xmlTextWriterEndElement(writer);
791 (void)xmlTextWriterEndElement(writer);
constexpr tools::Long Height() const
tools::Long GetHeight() const
wrapper class for the positioning of Writer fly frames and drawing objects
virtual const SwFlyFrame * DynCastFlyFrame() const
const Size & GetSize() const
tools::Long CalcLeft(const SwFrame *pCaller) const
sal_uInt16 CalcTopLine() const
sal_uInt16 CalcTop() const
sal_uInt16 CalcBottomLine() const
tools::Long CalcRight(const SwFrame *pCaller) const
sal_uInt16 CalcBottom() const
general base class for all free-flowing frames
Content, content of frame (header, footer, fly).
const SwNodeIndex * GetContentIdx() const
const SwRect & getFrameArea() const
bool isFrameAreaDefinitionValid() const
const SwRect & getFramePrintArea() const
void setFramePrintAreaValid(bool bNew)
bool isFramePrintAreaValid() const
bool isFrameAreaSizeValid() const
void setFrameAreaSizeValid(bool bNew)
Base class of the Writer layout elements.
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
SwTwips Shrink(SwTwips, bool bTst=false, bool bInfo=false)
bool IsHeaderFrame() const
virtual void Calc(vcl::RenderContext *pRenderContext) const
virtual void MakePos()
Calculates the frame area position, in case it's invalid.
static SwCache & GetCache()
void dumpInfosAsXml(xmlTextWriterPtr writer) const
bool IsFooterFrame() const
SwLayoutFrame * GetUpper()
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const
SwRootFrame * getRootFrame()
void SetCompletePaint() const
SwPageFrame * FindPageFrame()
sw::BroadcastingModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
virtual Size ChgSize(const Size &aNewSize)
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
void dumpChildrenAsXml(xmlTextWriterPtr writer) const
void SetDerivedVert(bool bNew)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the Frame; Frame and PrtArea.
bool IsAnLower(const SwFrame *) const
virtual const SwFrameFormat * GetFormat() const
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false) override
void NotifyLowerObjs(const bool _bUnlockPosOfObjs=false)
force an unlockposition call for the lower objects.
const SwFrame * Lower() const
virtual void Cut() override
SwNodeOffset GetIndex() const
A page of the document layout.
void PrepareFooter()
Creates or removes footer.
const SwSortedObjs * GetSortedObjs() const
void PrepareHeader()
Make this public, so that the SwViewShell can access it when switching from browse mode Add/remove he...
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Bottom(const tools::Long nBottom)
void Pos(const Point &rNew)
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
SwViewShell * GetCurrShell() const
SwTwips Undersize()
Returns the size delta that the section would like to be greater if it has undersized TextFrames in i...
Represents the visualization of a paragraph.
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault!...
bool getBrowseMode() const
bool IsWhitespaceHidden() const
const SwViewOption * GetViewOptions() const
const SwRect & VisArea() const
void InvalidateWindows(const SwRect &rRect)
struct _xmlTextWriter * xmlTextWriterPtr
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
static void lcl_LayoutFrameEnsureMinHeight(SwLayoutFrame &rFrame)
static SwTwips lcl_GetFrameMinHeight(const SwLayoutFrame &rFrame)
static SwTwips lcl_CalcContentHeight(SwLayoutFrame &frm)
static void DelFlys(const SwLayoutFrame &rFrame, SwPageFrame &rPage)
#define SAL_WARN(area, stream)
tools::Long const nBorder
@ AdjustSizeWithoutFormatting