22 #include <string_view>
57 #include <com/sun/star/beans/XPropertySet.hpp>
58 #include <com/sun/star/awt/CharSet.hpp>
59 #include <com/sun/star/text/XTextRange.hpp>
109 ? GetFollow()->GetOffset()
122 if( GetOffset() <= nIdx )
141 bool bReArrange =
true;
179 "lcl_GetFootnoteLower with swapped frame" );
200 OSL_ENSURE( pTabFrame && pRow &&
203 const bool bDontSplit = !pTabFrame->
IsFollow() &&
209 else if ( !static_cast<const SwRowFrame*>(pRow)->IsRowSplitAllowed() )
212 if ( nMin && aRectFnSet.
YDiff( nMin, nLower ) > 0 )
222 if ( aRectFnSet.
IsVert() )
231 OSL_ENSURE( pStartFrame,
"Upper has no lower" );
233 while ( pStartFrame != pFrame )
235 OSL_ENSURE( pStartFrame,
"Frame chain is broken" );
241 SwRect aRect( pAnchoredObj->GetObjRect() );
243 auto pFlyFrame =
dynamic_cast<SwFlyFrame*
>( pAnchoredObj );
245 pFlyFrame->isFrameAreaDefinitionValid() )
248 if ( aRectFnSet.
YDiff( nBottom, nFlyLower ) > 0 )
254 pStartFrame = pStartFrame->
GetNext();
257 if ( aRectFnSet.
IsVert() )
258 nRet = std::min( nRet, nFlyLower );
260 nRet = std::max( nRet, nFlyLower );
268 "SwTextFrame::GetFootnoteLine with swapped frame" );
314 GetFootnote().IsEndNote() ) )
332 #if OSL_DEBUG_LEVEL > 0
335 bool bInvalidPos =
false;
337 while( !bInvalidPos && pTmp )
345 OSL_ENSURE( bInvalidPos,
"Hanging below FootnoteCont" );
385 if( !pFootnoteFrame )
396 }
while( pCnt && pFootnoteFrame->
IsAnLower( pCnt ) );
410 nEnd = nStart + nLen;
422 bool bRemove =
false;
439 SwTextFootnote const*
const pFootnote(static_cast<SwTextFootnote const*>(pHt));
457 bFootnoteEndDoc =
false;
478 const bool bEndDoc = bEndn || bFootnoteEndDoc;
481 while (pFootnoteFrame)
483 pFootnoteFrame->
SetRef(
this );
484 pFootnoteFrame = pFootnoteFrame->
GetFollow();
495 pDest,pFootnote),
"SwTextFrame::RemoveFootnote: footnote exists");
503 if( pUpdate && pUpdate != pTmp )
506 while ( pFootnoteFrame )
508 pFootnoteFrame->
SetRef( pDest );
509 pFootnoteFrame = pFootnoteFrame->
GetFollow();
520 pFootnote),
"SwTextFrame::RemoveFootnote: footnote ChgRef failed");
524 if (!bEndDoc || ( bEndn && pEndBoss->
IsInSct() &&
532 bRemove = bRemove || !bEndDoc;
534 "SwTextFrame::RemoveFootnote: can't get off that footnote" );
544 if (bRemove && !bFootnoteEndDoc &&
HasPara())
588 "SwTextFrame::ConnectFootnote with swapped frame" );
616 bool bDocEnd = bEnd ? !( pSect && pSect->
IsEndnAtEnd() ) :
625 if ((pSect || bContinuousEndnotes) && pSrcFrame)
628 if (pFootnoteFrame && (pFootnoteFrame->
IsInSct() || bContinuousEndnotes))
639 else if( bEnd && pSect )
642 if( pFootnoteFrame && !pFootnoteFrame->
GetUpper() )
643 pFootnoteFrame =
nullptr;
654 else if( pSrcFrame !=
this )
662 if( !pFootnoteBoss->
IsInSct() ||
671 if( bDocEnd || bEnd )
675 else if( pSrcFrame !=
this )
690 bool bBrutal =
false;
692 if( pFootnoteBoss == pBoss )
704 if ( pSrcFrame !=
this )
708 if ( pFootnoteFrame->
GetFollow() && nDiff > 0 )
730 while( pTmp->
GetNext() && pSrcFrame != pTmp )
732 if( pSrcFrame == pTmp )
740 else if ( !pFootnoteFrame->
GetPrev() ||
758 std::unique_ptr<SwSaveFootnoteHeight> pHeight(bEnd ?
nullptr :
new SwSaveFootnoteHeight( pBoss, nDeadLine ));
789 "NewFootnotePortion with unswapped frame" );
811 if( nReal < nOldReal )
858 ( pSct && pBoss->
GetPrev() ) ) )
869 if( pSct && !bAtSctEnd )
876 if( pTmpFrame && *pTmpFrame < pFootnote )
895 if( pScrFrame && nDiff < 0 )
900 if( pFootnoteBoss != pBoss )
928 "This is the wrong place for a ftnnumber" );
950 std::unique_ptr<SwFont> pNumFnt(
new SwFont( pParSet, pIDSA ));
967 const auto xAnchor = rFootnote.
getAnchor(*pDoc);
968 uno::Reference<beans::XPropertySet> xAnchorProps(xAnchor, uno::UNO_QUERY);
969 if (xAnchorProps.is())
971 auto aAny = xAnchorProps->getPropertyValue(
"CharFontCharSet");
973 if ((aAny >>= eCharSet) && eCharSet == awt::CharSet::SYMBOL)
976 aAny = xAnchorProps->getPropertyValue(
"CharFontName");
977 if (aAny >>= aFontName)
990 pNumFnt->SetDiffFnt(&rSet, pIDSA );
1000 OSL_ENSURE( pPage,
"GetPageNumber: Homeless TextFrame" );
1037 "SwTextFormatter::FormatQuoVadis with swapped frame" );
1051 while( pCol && !pCol->
GetNext() )
1060 if( pPage == pErgoPage )
1077 std::pair<SwTextNode const*, sal_Int32>
const pos(
1086 sal_uInt16 nLastLeft = 0;
1090 nLastLeft = static_cast<SwFlyPortion*>(pPor)->GetFix() +
1098 const sal_uInt16 nOldRealWidth = rInf.
RealWidth();
1099 rInf.
RealWidth( nOldRealWidth - nLastLeft );
1105 pQuo->Format( rInf );
1106 sal_uInt16 nQuoWidth = pQuo->Width();
1113 pCurrPor->
Move( rInf );
1116 "Quo Vadis, rest of QuoVadisPortion" );
1120 nQuoWidth = nQuoWidth + pFollow->
Width();
1122 pCurrPor->
Append( pFollow );
1135 Right( rInf.
Left() + nOldRealWidth - 1 );
1156 nLastLeft = nLastLeft - nQuoWidth;
1159 if( nLastLeft > pQuo->GetAscent() )
1163 case SvxAdjust::Block:
1167 nLastLeft = pQuo->GetAscent();
1168 nQuoWidth = nQuoWidth + nLastLeft;
1171 case SvxAdjust::Right:
1173 nLastLeft = pQuo->GetAscent();
1174 nQuoWidth = nQuoWidth + nLastLeft;
1177 case SvxAdjust::Center:
1179 nQuoWidth = nQuoWidth + pQuo->GetAscent();
1183 nLastLeft = pQuo->GetAscent();
1184 nQuoWidth =
static_cast<sal_uInt16
>(-nDiff + nLastLeft);
1189 nLastLeft = sal_uInt16(( pQuo->GetAscent() + nDiff ) / 2);
1194 nQuoWidth = nQuoWidth + nLastLeft;
1198 nQuoWidth = nQuoWidth + nLastLeft;
1202 pGlue->
Width( nLastLeft );
1215 pPor->
Append( pCurrPor );
1245 pLay->
Height( nRstHeight );
1254 class SwFootnoteSave
1258 std::unique_ptr<SwFont> m_pOld;
1260 SwFootnoteSave(
const SwFootnoteSave&) =
delete;
1261 SwFootnoteSave& operator=(
const SwFootnoteSave&) =
delete;
1266 const bool bApplyGivenScriptType,
1268 ~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE;
1274 const
bool bApplyGivenScriptType,
1279 if( pTextFootnote && rInf.GetTextFrame() )
1282 m_pOld.reset(
new SwFont(*m_pFnt));
1283 m_pOld->GetTox() = m_pFnt->
GetTox();
1286 const SwDoc *
const pDoc = &rInf.GetTextFrame()->GetDoc();
1289 if ( bApplyGivenScriptType )
1296 OUString aTmpStr(rFootnote.
GetViewNumStr(*pDoc, rInf.GetTextFrame()->getRootFrame()));
1309 if (!m_pOld->GetEscapement() && 50 == m_pOld->GetPropr())
1319 m_pFnt->
SetVertical(static_cast<const SvxCharRotateItem*>(pItem)->GetValue(),
1320 rInf.GetTextFrame()->IsVertical());
1326 m_pFnt->
SetBackColor(static_cast<const SvxBrushItem*>(pItem)->GetColor());
1332 SwFootnoteSave::~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE
1338 m_pFnt->
GetTox() = m_pOld->GetTox();
1347 , m_pFootnote(pFootn)
1348 , m_nOrigHeight( nReal )
1350 , mbPreferredScriptTypeSet( false )
1467 SwTextSlot aDiffText( &rInf,
this,
true,
false );
1521 while( pPor && !pQuo )
1524 pQuo = static_cast<SwQuoVadisPortion*>(pPor);
1543 while( pPor && !pQuo )
1546 pQuo = static_cast<SwQuoVadisPortion*>(pPor);
bool IsAnLower(const SwFrame *) const
void SetHasRotatedPortions(bool bHasRotatedPortions)
OUString GetNumStr(sal_Int32 nNo) const
virtual bool Format(SwTextFormatInfo &rInf)
Base class of the Writer layout elements.
void Move(SwTextPaintInfo &rInf)
const sal_Unicode CH_BREAK
Represents the visualization of a paragraph.
TextFrameIndex FormatQuoVadis(TextFrameIndex nStart)
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
SwFontScript WhichFont(TextFrameIndex nIdx) const
bool IsLayoutSplitAllowed() const
const SwSortedObjs * GetDrawObjs() const
sal_uInt16 GetLineNr() const
virtual SwFieldPortion * Clone(const OUString &rExpand) const override
SwContentFrame * GetNextContentFrame() const
virtual void HandlePortion(SwPortionHandler &rPH) const override
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
sal_uInt16 Height() const
void MakeDummyLine()
This function creates a Line that reaches to the other Page Margin.
SwFootnoteFrame * ImplFindFootnoteFrame()
bool SeekStartAndChg(SwTextSizeInfo &rInf, const bool bPara=false)
bool IsBefore(const SwLayoutFrame *_pCheckRefLayFrame) const
method to check relative position of layout frame to a given layout frame.
void SetFootnoteInside(const bool bNew)
void Left(const tools::Long nLeft)
virtual void Paint(const SwTextPaintInfo &rInf) const override
bool IsInFootnote() const
void SetFixWidth(const sal_uInt16 nNew)
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout...
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
SwTabFrame is one table in the document layout, containing rows (which contain cells).
void SetFakeLineStart(const bool bNew)
sal_uInt16 GetTextHeight() const
SwParaPortion * GetPara()
void SetErgoSumNum(const OUString &rErgo)
SwTextAttr const * PrevAttr(SwTextNode const **ppNode=nullptr)
short Seek(SwFont &rFnt, sal_uLong nNode, sal_Int32 nNew, sal_Int32 nOld)
void SetLen(TextFrameIndex const nLen)
void CharToLine(TextFrameIndex)
std::unique_ptr< SwFont > m_pFont
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
const SwLineLayout * Next()
sal_uInt16 RealWidth() const
const Size & GetSize(SwFontScript nWhich) const
Of course Writer needs its own rectangles.
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
void SetPara(SwParaPortion *pNew, bool bDelete=true)
SwTextAttr const * NextAttr(SwTextNode const **ppNode=nullptr)
void CalcFootnoteFlag(TextFrameIndex nStop=TextFrameIndex(COMPLETE_STRING))
Does the Frame have a local footnote (in this Frame or Follow)?
const OUString & GetQuoText() const
SwTextFormatInfo & GetInfo()
tools::Long GetTop(const SwRect &rRect) const
SwSectionFrame * ImplFindSctFrame()
constexpr tools::Long Width() const
bool IsMarginPortion() const
virtual void Paint(const SwTextPaintInfo &rInf) const override
static bool Collecting(SwDoc *pDoc, SwSectionFrame const *pSect, SwFootnoteFrame *pFootnote)
wrapper class for the positioning of Writer fly frames and drawing objects
const SwRect & getFrameArea() const
void CollectEndnote(SwFootnoteFrame *pFootnote)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
sal_Unicode GetChar(TextFrameIndex const nPos) const
void SetNumber(const OUString &rStr)
SwTwips GetFootnoteLine(const SwTextFootnote *pFootnote) const
If we're a Footnote that grows towards its reference ...
sal_Int32 GetStart() const
void CalcRealHeight(bool bNewLine=false)
void ChgPhysFnt(SwViewShell const *pSh, OutputDevice &rOut)
TextFrameIndex GetLineStart() const
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
SwFontScript GetActual() const
virtual SwFieldPortion * Clone(const OUString &rExpand) const override
SwTextFrame * GetFollow()
TextFrameIndex GetOffset() const
virtual void Special(TextFrameIndex nLength, const OUString &rText, PortionType nType, sal_Int32 nHeight=0, sal_Int32 nWidth=0, const SwFont *pFont=nullptr)=0
special portion.
sal_uInt16 GetVirtPageNum() const
SwQuoVadisPortion(const OUString &rExp, const OUString &rStr)
SwFootnoteFrame * FindFootnoteFrame()
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
void SetRealHeight(sal_uInt16 nNew)
void CheckScript(const SwTextSizeInfo &rInf)
virtual SwLinePortion * Append(SwLinePortion *pPortion)
virtual void Height(const sal_uInt16 nNew, const bool bText=true) override
SwFootnotePortion * NewFootnotePortion(SwTextFormatInfo &rInf, SwTextAttr *pHt)
The portion for the Footnote Reference in the Text.
void ConnectFootnote(SwTextFootnote *pFootnote, const SwTwips nDeadLine)
We basically only have two possibilities:
SwFrame * GetIndPrev() const
const SwContentFrame * GetFollow() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Collection of SwLinePortion instances, representing one line of text.
vcl::RenderContext * GetOut()
void SetStop(const bool bNew)
SwPageFrame * FindPageFrame()
void SetWhichPor(const PortionType nNew)
bool IsFlyPortion() const
bool IsInFootnoteConnect() const
TextFrameIndex MapModelToView(MergedPara const &, SwTextNode const *pNode, sal_Int32 nIndex)
const SwFrame * Lower() const
virtual SwLayouter * GetLayouter()=0
void SetVertical(Degree10 nDir, const bool bVertLayout=false, const bool bVertLayoutLRBT=false)
SwPageDesc * GetPageDesc()
void ManipOfst(TextFrameIndex const nNewOfst)
SwLinePortion * GetFirstPortion() const
tools::Long GetHeight(const SwRect &rRect) const
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(MergedPara const &, TextFrameIndex nIndex)
SwLayoutFrame * GetUpper()
static SwTwips lcl_GetFootnoteLower(const SwTextFrame *pFrame, SwTwips nLower)
Local helper function.
::rtl::Reference< Content > pContent
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
Provides access to settings of a document.
sal_uInt16 GetLineHeight() const
TextFrameIndex GetIdx() const
Marks a node in the document model.
SwTwips GetFootnoteFrameHeight_() const
Calculates the maximum reachable height for the TextFrame in the Footnote Area.
bool isFrameAreaPositionValid() const
void TruncLines(bool bNoteFollow=false)
tools::Long YDiff(tools::Long n1, tools::Long n2) const
static OUString lcl_GetPageNumber(const SwPageFrame *pPage)
SwErgoSumPortion(const OUString &rExp, std::u16string_view rStr)
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
TextFrameIndex GetLen() const
A page of the document layout.
const SwFormatFootnote & GetFootnote() const
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
SwErgoSumPortion * NewErgoSumPortion(SwTextFormatInfo const &rInf) const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
void InvalidateWindows(const SwRect &rRect)
Used in footnotes if they break across pages, master has this portion at the end. ...
const SwAttrSet & GetCharAttr() const
SwSectionFrame * FindSctFrame()
const SwFrameFormat * GetDfltFrameFormat() const
bool IsFootnoteNumFrame_() const
Base class for anything that can be part of a line in the Writer layout.
void Bottom(const tools::Long nBottom)
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_BACKGROUND(21)
SwTextNode is a paragraph in the document model.
virtual bool Format(SwTextFormatInfo &rInf) override
bool Growable() const
checks whether the SectionFrame is still able to grow, as case may be the environment has to be asked...
TextFrameIndex FormatLine(TextFrameIndex nStart)
SwCharFormat * GetCharFormat(SwDoc &rDoc) const
Used in footnotes if they break across pages, follow starts with this portion.
tools::Long GetBottomMargin(const SwFrame &rFrame) const
For the text replacement and restoration of SwTextSizeInfo.
bool UpdateQuoVadis(std::u16string_view rQuo)
Is called in SwTextFrame::Prepare()
general base class for all free-flowing frames
void CalcAdjustLine(SwLineLayout *pCurr)
void SetBackColor(std::optional< Color > xNewColor)
SwTextFrame * FindMaster() const
constexpr tools::Long Height() const
void SetSize(const Size &rSize, const SwFontScript nWhich)
PortionType GetWhichPor() const
void SetFootnoteDone(const bool bNew)
void SetFootnote(const bool bNew)
Will be moved soon.
SwLinePortion * GetRest()
SwTextFrame * FindFootnoteRef(const SwTextFootnote *pFootnote)
Looks for the TextFrame matching the SwTextFootnote within a master-follow chain. ...
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
SwLinePortion * FindLastPortion()
void SetActual(SwFontScript nNew)
IDocumentSettingAccess const & getIDocumentSettingAccess() const
SvxAdjust GetAdjust() const
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
bool CalcPrepFootnoteAdjust()
bool IsRightToLeft() const
TextFrameIndex GetLen() const
void SetErgoDone(const bool bNew)
bool IsFootnoteAllowed() const
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
SwNumberPortion * NewFootnoteNumPortion(SwTextFormatInfo const &rInf) const
The portion for the Footnote Numbering in the Footnote Area.
void SetNextPortion(SwLinePortion *pNew)
void FeedInf(SwTextFormatInfo &rInf) const
sal_uInt16 GetRealHeight() const
void SetAscent(const sal_uInt16 nNewAsc)
tools::Long GetBottom(const SwRect &rRect) const
void Insert(SwLineLayout *pLine)
bool IsFootnoteAtEnd() const
void SetDiffFnt(const SfxItemSet *pSet, const IDocumentSettingAccess *pIDocumentSettingAccess)
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
SwTextFrame * GetTextFrame()
virtual bool Format(SwTextFormatInfo &rInf) override
bool IsQuoVadisPortion() const
sal_uInt16 PrtWidth() const
SwLinePortion * GetNextPortion() const
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
SwViewShell * GetCurrShell() const
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...
class for collecting anchored objects
void SetRest(SwLinePortion *pNewRest)
sal_uInt16 GetFrameRstHeight() const
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
void RemoveFootnote(TextFrameIndex nStart, TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING))
Footnote.
SwTextFrame * FindQuoVadisFrame()
Find the page number of ErgoSum and QuoVadis.
bool mbHasRotatedPortions
Contains rotated portions.
const SwFootnoteInfo & GetFootnoteInfo() const
SwRedlineItr * GetRedln()
TextFrameIndex GetTextStart() const
const sal_Int32 COMPLETE_STRING
SwRootFrame * getRootFrame()
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich) const
bool IsFootnoteDone() const
const SwEndNoteInfo & GetEndNoteInfo() const
virtual bool Format(SwTextFormatInfo &rInf) override
sal_uInt16 GetAscent() const
const SvxNumberType & GetNumType() const