65#include <com/sun/star/beans/XPropertySet.hpp>
66#include <com/sun/star/awt/CharSet.hpp>
67#include <com/sun/star/text/XTextRange.hpp>
93 pFrame->IsFollow() ? pFrame->
FindMaster() :
nullptr;
117 ? GetFollow()->GetOffset()
130 if( GetOffset() <= nIdx )
149 bool bReArrange =
true;
187 "lcl_GetFootnoteLower with swapped frame" );
208 OSL_ENSURE( pTabFrame && pRow &&
211 const bool bDontSplit = !pTabFrame->IsFollow() &&
217 else if ( !
static_cast<const SwRowFrame*
>(pRow)->IsRowSplitAllowed() )
220 if ( nMin && aRectFnSet.
YDiff( nMin, nLower ) > 0 )
230 if ( aRectFnSet.
IsVert() )
239 OSL_ENSURE( pStartFrame,
"Upper has no lower" );
241 while ( pStartFrame != pFrame )
243 OSL_ENSURE( pStartFrame,
"Frame chain is broken" );
249 SwRect aRect( pAnchoredObj->GetObjRect() );
251 auto pFlyFrame = pAnchoredObj->DynCastFlyFrame();
253 pFlyFrame->isFrameAreaDefinitionValid() )
256 if ( aRectFnSet.
YDiff( nBottom, nFlyLower ) > 0 )
262 pStartFrame = pStartFrame->
GetNext();
265 if ( aRectFnSet.
IsVert() )
268 nRet = std::max( nRet, nFlyLower );
276 "SwTextFrame::GetFootnoteLine with swapped frame" );
316 OSL_ENSURE( !IsFollow() &&
IsInFootnote(),
"SwTextFrame::SetFootnoteLine: moon walk" );
322 GetFootnote().IsEndNote() ) )
340#if OSL_DEBUG_LEVEL > 0
343 bool bInvalidPos =
false;
345 while( !bInvalidPos && pTmp )
353 OSL_ENSURE( bInvalidPos,
"Hanging below FootnoteCont" );
393 if( !pFootnoteFrame )
404 }
while( pCnt && pFootnoteFrame->
IsAnLower( pCnt ) );
418 nEnd = nStart + nLen;
430 bool bRemove =
false;
465 bFootnoteEndDoc =
false;
486 const bool bEndDoc = bEndn || bFootnoteEndDoc;
489 while (pFootnoteFrame)
491 pFootnoteFrame->
SetRef(
this );
492 pFootnoteFrame = pFootnoteFrame->
GetFollow();
503 pDest,pFootnote),
"SwTextFrame::RemoveFootnote: footnote exists");
511 if( pUpdate && pUpdate != pTmp )
514 while ( pFootnoteFrame )
516 pFootnoteFrame->
SetRef( pDest );
517 pFootnoteFrame = pFootnoteFrame->
GetFollow();
528 pFootnote),
"SwTextFrame::RemoveFootnote: footnote ChgRef failed");
532 if (!bEndDoc || ( bEndn && pEndBoss->
IsInSct() &&
540 bRemove = bRemove || !bEndDoc;
542 "SwTextFrame::RemoveFootnote: can't get off that footnote" );
552 if (bRemove && !bFootnoteEndDoc &&
HasPara())
563 if( HasFollow() && nStart >
GetOffset() )
596 "SwTextFrame::ConnectFootnote with swapped frame" );
624 bool bDocEnd = bEnd ? !( pSect && pSect->
IsEndnAtEnd() ) :
633 if ((pSect || bContinuousEndnotes) && pSrcFrame)
636 if (pFootnoteFrame && (pFootnoteFrame->
IsInSct() || bContinuousEndnotes))
647 else if( bEnd && pSect )
650 if( pFootnoteFrame && !pFootnoteFrame->
GetUpper() )
651 pFootnoteFrame =
nullptr;
662 else if( pSrcFrame !=
this )
667 else if (pSrcFrame && pFootnoteFrame)
670 if( !pFootnoteBoss->
IsInSct() ||
679 if( bDocEnd || bEnd )
683 else if( pSrcFrame !=
this )
698 bool bBrutal =
false;
700 if( pFootnoteBoss == pBoss )
712 if ( pSrcFrame !=
this )
716 if ( pFootnoteFrame->
GetFollow() && nDiff > 0 )
738 while( pTmp->
GetNext() && pSrcFrame != pTmp )
740 if( pSrcFrame == pTmp )
748 else if ( !pFootnoteFrame->
GetPrev() ||
766 std::unique_ptr<SwSaveFootnoteHeight> pHeight(bEnd ?
nullptr :
new SwSaveFootnoteHeight( pBoss, nDeadLine ));
797 "NewFootnotePortion with unswapped frame" );
819 if( nReal < nOldReal )
866 ( pSct && pBoss->
GetPrev() ) ) )
877 if( pSct && !bAtSctEnd )
884 if( pTmpFrame && *pTmpFrame < pFootnote )
903 if( pScrFrame && nDiff < 0 )
908 if( pFootnoteBoss != pBoss )
936 "This is the wrong place for a ftnnumber" );
958 std::unique_ptr<SwFont> pNumFnt(
new SwFont( pParSet, pIDSA ));
975 const auto xAnchor = rFootnote.
getAnchor(*pDoc);
976 uno::Reference<beans::XPropertySet> xAnchorProps(xAnchor, uno::UNO_QUERY);
977 if (xAnchorProps.is())
979 auto aAny = xAnchorProps->getPropertyValue(
"CharFontCharSet");
981 if ((aAny >>= eCharSet) && eCharSet == awt::CharSet::SYMBOL)
984 aAny = xAnchorProps->getPropertyValue(
"CharFontName");
985 if (aAny >>= aFontName)
998 pNumFnt->SetDiffFnt(&
rSet, pIDSA );
1017 if ( RedlineType::Delete == pRedline->
GetType() )
1018 SW_MOD()->GetDeletedAuthorAttr(aAuthor, aSet);
1020 SW_MOD()->GetInsertAuthorAttr(aAuthor, aSet);
1023 pNumFnt->SetColor(pItem->GetValue());
1025 pNumFnt->SetUnderline(pItem->GetLineStyle());
1027 pNumFnt->SetStrikeout( pItem->GetStrikeout() );
1038 OSL_ENSURE( pPage,
"GetPageNumber: Homeless TextFrame" );
1075 "SwTextFormatter::FormatQuoVadis with swapped frame" );
1081 if( !pErgoFrame &&
m_pFrame->HasFollow() )
1089 while( pCol && !pCol->
GetNext() )
1098 if( pPage == pErgoPage )
1115 std::pair<SwTextNode const*, sal_Int32>
const pos(
1124 sal_uInt16 nLastLeft = 0;
1128 nLastLeft =
static_cast<SwFlyPortion*
>(pPor)->GetFix() +
1136 const sal_uInt16 nOldRealWidth = rInf.
RealWidth();
1137 rInf.
RealWidth( nOldRealWidth - nLastLeft );
1144 sal_uInt16 nQuoWidth = pQuo->
Width();
1151 pCurrPor->
Move( rInf );
1154 "Quo Vadis, rest of QuoVadisPortion" );
1158 nQuoWidth = nQuoWidth + pFollow->
Width();
1160 pCurrPor->
Append( pFollow );
1173 Right( rInf.
Left() + nOldRealWidth - 1 );
1194 nLastLeft = nLastLeft - nQuoWidth;
1201 case SvxAdjust::Block:
1206 nQuoWidth = nQuoWidth + nLastLeft;
1209 case SvxAdjust::Right:
1212 nQuoWidth = nQuoWidth + nLastLeft;
1215 case SvxAdjust::Center:
1217 nQuoWidth = nQuoWidth + pQuo->
GetAscent();
1222 nQuoWidth = o3tl::narrowing<sal_uInt16>(-nDiff + nLastLeft);
1227 nLastLeft = sal_uInt16(( pQuo->
GetAscent() + nDiff ) / 2);
1232 nQuoWidth = nQuoWidth + nLastLeft;
1236 nQuoWidth = nQuoWidth + nLastLeft;
1240 pGlue->
Width( nLastLeft );
1253 pPor->
Append( pCurrPor );
1283 pLay->
Height( nRstHeight );
1296 std::unique_ptr<SwFont> m_pOld;
1298 SwFootnoteSave(
const SwFootnoteSave&) =
delete;
1299 SwFootnoteSave& operator=(
const SwFootnoteSave&) =
delete;
1304 const bool bApplyGivenScriptType,
1306 ~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE;
1312 const
bool bApplyGivenScriptType,
1317 if( pTextFootnote && rInf.GetTextFrame() )
1320 m_pOld.reset(
new SwFont(*m_pFnt));
1321 m_pOld->GetTox() = m_pFnt->
GetTox();
1324 const SwDoc *
const pDoc = &rInf.GetTextFrame()->GetDoc();
1327 if ( bApplyGivenScriptType )
1334 OUString aTmpStr(rFootnote.
GetViewNumStr(*pDoc, rInf.GetTextFrame()->getRootFrame()));
1347 if (!m_pOld->GetEscapement() && 50 == m_pOld->GetPropr())
1356 rInf.GetTextFrame()->IsVertical());
1367SwFootnoteSave::~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE
1373 m_pFnt->
GetTox() = m_pOld->GetTox();
1382 , m_pFootnote(pFootn)
1383 , m_nOrigHeight( nReal )
1385 , mbPreferredScriptTypeSet( false )
1502 SwTextSlot aDiffText( &rInf,
this,
true,
false );
1556 while( pPor && !pQuo )
1578 while( pPor && !pQuo )
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
virtual SwLayouter * GetLayouter()=0
virtual const SwRedlineTable & GetRedlineTable() const =0
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
OUString GetNumStr(sal_Int32 nNo) const
wrapper class for the positioning of Writer fly frames and drawing objects
SwRedlineItr * GetRedln()
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
const SwContentFrame * GetFollow() const
SwContentFrame * GetNextContentFrame() const
SwTextFrame * FindMaster() const
const SwFootnoteInfo & GetFootnoteInfo() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
const SwEndNoteInfo & GetEndNoteInfo() const
const SwAttrPool & GetAttrPool() const
const SwFrameFormat * GetDfltFrameFormat() const
SwCharFormat * GetCharFormat(SwDoc &rDoc) const
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
Used in footnotes if they break across pages, follow starts with this portion.
SwErgoSumPortion(const OUString &rExp, std::u16string_view rStr)
virtual bool Format(SwTextFormatInfo &rInf) override
virtual SwFieldPortion * Clone(const OUString &rExpand) const override
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
virtual void Paint(const SwTextPaintInfo &rInf) const override
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
std::unique_ptr< SwFont > m_pFont
virtual bool Format(SwTextFormatInfo &rInf) override
void CheckScript(const SwTextSizeInfo &rInf)
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
void SetDiffFnt(const SfxItemSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
const Size & GetSize(SwFontScript nWhich) const
void SetVertical(Degree10 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
void SetSize(const Size &rSize, const SwFontScript nWhich)
void SetBackColor(std::optional< Color > xNewColor)
SwFontScript GetActual() const
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
void SetActual(SwFontScript nNew)
const SwRect & getFrameArea() const
bool isFrameAreaPositionValid() const
Base class of the Writer layout elements.
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
SwSectionFrame * ImplFindSctFrame()
SwFrame * GetIndPrev() const
sal_uInt16 GetVirtPageNum() const
SwSectionFrame * FindSctFrame()
bool IsInFootnote() const
const SwSortedObjs * GetDrawObjs() const
bool IsRightToLeft() const
SwFootnoteFrame * ImplFindFootnoteFrame()
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
bool IsFootnoteAllowed() const
SwPageFrame * FindPageFrame()
SwFootnoteFrame * FindFootnoteFrame()
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
A glue portion is either a base class for other portions that want to have a certain width to push te...
void SetFixWidth(const sal_uInt16 nNew)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
bool IsAnLower(const SwFrame *) const
bool IsBefore(const SwLayoutFrame *_pCheckRefLayFrame) const
method to check relative position of layout frame to a given layout frame.
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
const SwFrame * Lower() const
static bool Collecting(SwDoc *pDoc, SwSectionFrame const *pSect, SwFootnoteFrame *pFootnote)
void CollectEndnote(SwFootnoteFrame *pFootnote)
Collection of SwLinePortion instances, representing one line of text.
SwLinePortion * GetFirstPortion() const
virtual void Height(const SwTwips nNew, const bool bText=true) override
void SetRealHeight(SwTwips nNew)
SwTwips GetRealHeight() const
Base class for anything that can be part of a line in the Writer layout.
bool IsMarginPortion() const
SwLinePortion * GetNextPortion() const
void SetAscent(const SwTwips nNewAsc)
PortionType GetWhichPor() const
void SetNextPortion(SwLinePortion *pNew)
virtual SwLinePortion * Append(SwLinePortion *pPortion)
TextFrameIndex GetLen() const
void Move(SwTextPaintInfo &rInf)
SwLinePortion * FindLastPortion()
bool IsQuoVadisPortion() const
void SetLen(TextFrameIndex const nLen)
bool IsFlyPortion() const
virtual bool Format(SwTextFormatInfo &rInf)
void SetWhichPor(const PortionType nNew)
Marks a node in the document model.
SwNodeOffset GetIndex() const
const SwPosition * Start() const
const SvxNumberType & GetNumType() const
A page of the document layout.
SwPageDesc * GetPageDesc()
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
void SetErgoSumNum(const OUString &rErgo)
bool UpdateQuoVadis(std::u16string_view rQuo)
Is called in SwTextFrame::Prepare()
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
virtual void Special(TextFrameIndex nLength, const OUString &rText, PortionType nType)=0
special portion.
Used in footnotes if they break across pages, master has this portion at the end.
virtual void HandlePortion(SwPortionHandler &rPH) const override
const OUString & GetQuoText() const
void SetNumber(const OUString &rStr)
virtual SwFieldPortion * Clone(const OUString &rExpand) const override
SwQuoVadisPortion(const OUString &rExp, OUString aStr)
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
virtual bool Format(SwTextFormatInfo &rInf) override
virtual void Paint(const SwTextPaintInfo &rInf) const override
sal_uInt16 GetStackCount() const
std::size_t GetAuthor(sal_uInt16 nPos=0) const
RedlineType GetType(sal_uInt16 nPos=0) const
tools::Long GetHeight(const SwRect &rRect) const
tools::Long GetTop(const SwRect &rRect) const
tools::Long GetBottomMargin(const SwFrame &rFrame) const
tools::Long YDiff(tools::Long n1, tools::Long n2) const
tools::Long GetBottom(const SwRect &rRect) const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Of course Writer needs its own rectangles.
void Bottom(const tools::Long nBottom)
void Left(const tools::Long nLeft)
short Seek(SwFont &rFnt, SwNodeOffset nNode, sal_Int32 nNew, sal_Int32 nOld)
vector_type::size_type size_type
const SwRangeRedline * FindAtPosition(const SwPosition &startPosition, size_type &tableIndex, bool next=true) const
Find the redline at the given position.
SwViewShell * GetCurrShell() const
SwRowFrame is one table row in the document layout.
SwFontScript WhichFont(TextFrameIndex nIdx) const
bool Growable() const
checks whether the SectionFrame is still able to grow, as case may be the environment has to be asked
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
bool IsFootnoteAtEnd() const
class for collecting anchored objects
SwTabFrame is one table in the document layout, containing rows (which contain cells).
bool IsLayoutSplitAllowed() const
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const SwFormatFootnote & GetFootnote() const
sal_Int32 GetStart() const
void SetStop(const bool bNew)
void SetErgoDone(const bool bNew)
void SetRest(SwLinePortion *pNewRest)
sal_uInt16 RealWidth() const
TextFrameIndex GetLineStart() const
SwLinePortion * GetRest()
const SwAttrSet & GetCharAttr() const
bool IsFootnoteDone() const
void SetFakeLineStart(const bool bNew)
void SetFootnoteDone(const bool bNew)
sal_uInt16 GetFrameRstHeight() const
SwErgoSumPortion * NewErgoSumPortion(SwTextFormatInfo const &rInf) const
void MakeDummyLine()
This function creates a Line that reaches to the other Page Margin.
TextFrameIndex FormatQuoVadis(TextFrameIndex nStart)
void CalcAdjustLine(SwLineLayout *pCurr)
TextFrameIndex FormatLine(TextFrameIndex nStart)
SwFootnotePortion * NewFootnotePortion(SwTextFormatInfo &rInf, SwTextAttr *pHt)
The portion for the Footnote Reference in the Text.
SwNumberPortion * NewFootnoteNumPortion(SwTextFormatInfo const &rInf) const
The portion for the Footnote Numbering in the Footnote Area.
void CalcRealHeight(bool bNewLine=false)
void FeedInf(SwTextFormatInfo &rInf) const
SwTextFormatInfo & GetInfo()
void Insert(SwLineLayout *pLine)
Represents the visualization of a paragraph.
bool CalcPrepFootnoteAdjust()
SwTextFrame * GetFollow()
void CalcFootnoteFlag(TextFrameIndex nStop=TextFrameIndex(COMPLETE_STRING))
Does the Frame have a local footnote (in this Frame or Follow)?
TextFrameIndex GetOffset() const
bool IsFootnoteNumFrame_() const
void RemoveFootnote(TextFrameIndex nStart, TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING))
Footnote.
bool mbHasRotatedPortions
Contains rotated portions.
void ConnectFootnote(SwTextFootnote *pFootnote, const SwTwips nDeadLine)
We basically only have two possibilities:
void SetFootnote(const bool bNew)
Will be moved soon.
void SetPara(SwParaPortion *pNew, bool bDelete=true)
SwTwips GetFootnoteLine(const SwTextFootnote *pFootnote) const
If we're a Footnote that grows towards its reference ... public, because it's needed by SwContentFram...
SwParaPortion * GetPara()
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
void SetHasRotatedPortions(bool bHasRotatedPortions)
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout.
SwTextFrame * FindQuoVadisFrame()
Find the page number of ErgoSum and QuoVadis.
bool IsInFootnoteConnect() const
void ManipOfst(TextFrameIndex const nNewOfst)
SwTextFrame * FindFootnoteRef(const SwTextFootnote *pFootnote)
Looks for the TextFrame matching the SwTextFootnote within a master-follow chain.
SwTwips GetFootnoteFrameHeight_() const
Calculates the maximum reachable height for the TextFrame in the Footnote Area.
TextFrameIndex GetTextStart() const
void TruncLines(bool bNoteFollow=false)
bool SeekStartAndChg(SwTextSizeInfo &rInf, const bool bPara=false)
SwTwips GetLineHeight() const
const SwLineLayout * Next()
void CharToLine(TextFrameIndex)
sal_Int32 GetLineNr() const
SwTextFrame * GetTextFrame()
SvxAdjust GetAdjust() const
SwTextNode is a paragraph in the document model.
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
vcl::RenderContext * GetOut()
sal_uInt16 GetTextHeight() const
sal_uInt16 GetAscent() const
sal_Unicode GetChar(TextFrameIndex const nPos) const
TextFrameIndex GetLen() const
void SetFootnoteInside(const bool bNew)
TextFrameIndex GetIdx() const
For the text replacement and restoration of SwTextSizeInfo.
void InvalidateWindows(const SwRect &rRect)
SwTextAttr const * PrevAttr(SwTextNode const **ppNode=nullptr)
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
constexpr TypedWhichId< SvxCrossedOutItem > RES_CHRATR_CROSSEDOUT(5)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(MergedPara const &, TextFrameIndex nIndex)
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
const sal_Unicode CH_BREAK
constexpr sal_Int32 COMPLETE_STRING
static OUString lcl_GetPageNumber(const SwPageFrame *pPage)
static SwTwips lcl_GetFootnoteLower(const SwTextFrame *pFrame, SwTwips nLower)
Local helper function.