23#include <rtl/ustrbuf.hxx>
48 if (nRight && rTabStop.
GetTabPos() > nRight)
53 return i ? nullptr : &rTabStop;
85 sal_uInt16 nNewTabPos;
86 bool bAutoTabStop =
true;
103 Point aPoint( nLinePos, 0 );
105 nLinePos = aPoint.
X();
110 if( nTabPos < rInf.
X() )
116 const SwTwips nCurrentAbsPos = bRTL ?
130 nMyRight = aRightTop.
Y();
134 bool bAbsoluteNextPos =
false;
138 const SwTwips nSearchPos = bRTL ?
139 nTabLeft - nCurrentAbsPos :
140 nCurrentAbsPos - nTabLeft;
146 const SwTwips nOldRight = nMyRight;
152 nMyRight = nOldRight;
159 if(!bTabsRelativeToIndent && eAdj == SvxTabAdjust::Default && nSearchPos < 0)
162 nNextPos = ( nSearchPos / nNextPos ) * nNextPos;
164 else if (pTabStop->
GetTabPos() > nMyRight
175 eAdj = SvxTabAdjust::Right;
176 bAbsoluteNextPos =
true;
177 nNextPos = rInf.
Width();
179 bAutoTabStop =
false;
184 if( USHRT_MAX == nDefTabDist )
189 nDefTabDist = o3tl::narrowing<sal_uInt16>(rTab[0].GetTabPos());
197 if (nDefTabDist <= 0)
201 nNextPos = (
nCount < 0 || ( !
nCount && nSearchPos <= 0 ) )
202 ? (
nCount * nDefTabDist )
203 : ( (
nCount + 1 ) * nDefTabDist );
207 if( ( bRTL && nTabLeft - nNextPos >= nCurrentAbsPos - nMinimumTabWidth ) ||
208 ( !bRTL && nNextPos + nTabLeft <= nCurrentAbsPos + nMinimumTabWidth ) )
210 nNextPos += nDefTabDist;
213 eAdj = SvxTabAdjust::Left;
226 if ( !bTabsRelativeToIndent )
248 nLeftMarginTabPos += pPor->
Width();
252 const bool bNewTabPortionInsideHangingIndent =
253 bRTL ? nCurrentAbsPos > nTabLeft - nLeftMarginTabPos
254 : nCurrentAbsPos < nTabLeft + nLeftMarginTabPos;
255 if ( bNewTabPortionInsideHangingIndent )
262 const bool bTabAtLeftMarginAllowed =
269 if ( bTabAtLeftMarginAllowed )
271 if ( !pTabStop || eAdj == SvxTabAdjust::Default ||
272 ( nNextPos > nLeftMarginTabPos ) )
274 eAdj = SvxTabAdjust::Default;
276 nNextPos = nLeftMarginTabPos;
282 if (!bAbsoluteNextPos)
283 nNextPos += bRTL ? nLinePos - nTabLeft : nTabLeft - nLinePos;
284 OSL_ENSURE( nNextPos >= 0,
"GetTabStop: Don't go back!" );
285 nNewTabPos = sal_uInt16(nNextPos);
291 if ( SvxTabAdjust::Decimal == eAdj &&
299 case SvxTabAdjust::Right :
304 case SvxTabAdjust::Center :
309 case SvxTabAdjust::Decimal :
316 OSL_ENSURE( SvxTabAdjust::Left == eAdj || SvxTabAdjust::Default == eAdj,
317 "+SwTextFormatter::NewTabPortion: unknown adjustment" );
331 : m_nTabPos(nTabPosition), m_cFill(cFillChar), m_bAutoTabStop( bAutoTab )
334 OSL_ENSURE(!
IsFilled() ||
' ' !=
m_cFill,
"SwTabPortion::CTOR: blanks ?!");
341 if( pLastTab ==
this )
356 OSL_ENSURE( rInf.
X() <=
GetTabPos(),
"SwTabPortion::PreFormat: rush hour" );
359 SetFix( o3tl::narrowing<sal_uInt16>(rInf.
X()) );
371 sal_uInt16 nMinimumTabWidth = 1;
377 std::optional< SwFontSave > oSave;
382 const SwFont* pNumberPortionFont =
384 oSave.emplace( rInf,
const_cast<SwFont*
>(pNumberPortionFont) );
386 OUString aTmp(
' ' );
395 bool bFull = ( bTabCompat && rInf.
IsUnderflow() ) ||
401 if( ! bFull && 0_deg10 == nDir )
419 if ((bTabOverMargin || bTabOverSpacing) &&
GetTabPos() > rInf.
Width()
422 if (bTabOverMargin ||
GetTabPos() < nTextFrameWidth)
429 assert(!bTabOverMargin && bTabOverSpacing &&
GetTabPos() >= nTextFrameWidth);
442 if ( bFull && bTabCompat &&
453 default: OSL_ENSURE(
false,
"SwTabPortion::PreFormat: unknown adjustment" );
494 bTabOverMargin =
false;
498 const sal_uInt16 nRight
506 sal_uInt16 nPorWidth = 0;
509 nPorWidth = nPorWidth + pPor->
Width();
524 sal_uInt16 nPrePorWidth =
static_cast<const SwTabDecimalPortion*
>(
this)->GetWidthOfPortionsUpToDecimalPosition();
527 if ( USHRT_MAX != nPrePorWidth )
529 if ( !bTabOverMargin && nPrePorWidth && nPorWidth - nPrePorWidth > rInf.
Width() - nRight )
531 nPrePorWidth += nPorWidth - nPrePorWidth - ( rInf.
Width() - nRight );
534 nPorWidth = nPrePorWidth - 1;
542 sal_uInt16 nNewWidth = nPorWidth /2;
543 if (!bTabOverMargin && !bTabOverSpacing && nNewWidth > rInf.
Width() - nRight)
544 nNewWidth = nPorWidth - (rInf.
Width() - nRight);
545 nPorWidth = nNewWidth;
548 const sal_uInt16 nDiffWidth = nRight -
GetFix();
550 if( nDiffWidth > nPorWidth )
553 const sal_uInt16 nAdjDiff = nDiffWidth - nPorWidth;
567 return rInf.
Width() <= rInf.
X();
578 std::optional< SwFontSave > oSave;
579 bool bAfterNumbering =
false;
588 const SwFont* pNumberPortionFont =
590 oSave.emplace( rInf,
const_cast<SwFont*
>(pNumberPortionFont) );
591 bAfterNumbering =
true;
595 if( !bAfterNumbering )
622 sal_uInt16 nChar =
Width() / nCharWidth;
623 OUStringBuffer
aBuf(nChar);
636 OSL_ENSURE( nCharWidth,
"!SwTabPortion::Paint: sophisticated tabchar" );
642 sal_uInt16 nChar =
Width() / nCharWidth;
645 OUStringBuffer
aBuf(nChar);
@ TABS_RELATIVE_TO_INDENT
@ TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST
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...
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
constexpr tools::Long Y() const
constexpr tools::Long X() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
sal_Unicode & GetDecimal()
SvxTabAdjust & GetAdjustment()
SwAttrPool * GetPool() const
virtual void Paint(const SwTextPaintInfo &rInf) const override
Ex: LineIter::DrawTab()
IDocumentSettingAccess const & getIDocumentSettingAccess() const
sal_uInt16 GetFix() const
void SetFix(const sal_uInt16 nNewFix)
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
bool IsPaintBlank() const
const SwRect & getFrameArea() const
bool IsRightToLeft() const
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
void SetFixWidth(const sal_uInt16 nNew)
sal_uInt16 GetFixWidth() const
void SetDefTabStop(sal_uInt16 nNew) const
sal_uInt16 GetDefTabStop() const
tools::Long GetListTabStopPosition() const
sal_uInt16 NumberOfTabStops() const
const SvxTabStop * GetTabStop(const SwTwips nSearchPos, SwTwips &nRight) const
#i24363# tab stops relative to indent
bool IsListTabStopIncluded() const
std::optional< SvxTabStopItem > m_oRuler
bool HasForcedLeftMargin() const
Base class for anything that can be part of a line in the Writer layout.
TextFrameIndex mnLineLength
SwLinePortion * mpNextPortion
SwLinePortion * GetNextPortion() const
void SetAscent(const SwTwips nNewAsc)
PortionType GetWhichPor() const
bool IsTabCenterPortion() const
void SetNextPortion(SwLinePortion *pNew)
TextFrameIndex GetLen() const
SwLinePortion * FindPrevPortion(const SwLinePortion *pRoot)
void SetLen(TextFrameIndex const nLen)
bool IsTabDecimalPortion() const
bool IsFlyPortion() const
void SetWhichPor(const PortionType nNew)
void PrePaint(const SwTextPaintInfo &rInf, const SwLinePortion *pLast) const
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
virtual void Text(TextFrameIndex nLength, PortionType nType)=0
(empty) destructor
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
bool PreFormat(SwTextFormatInfo &rInf)
const sal_Unicode m_cFill
virtual bool Format(SwTextFormatInfo &rInf) override
virtual void Paint(const SwTextPaintInfo &rInf) const override
Ex: LineIter::DrawTab()
bool PostFormat(SwTextFormatInfo &rInf)
virtual void FormatEOL(SwTextFormatInfo &rInf) override
sal_uInt16 GetTabPos() const
SwTabPortion(const sal_uInt16 nTabPos, const sal_Unicode cFill, const bool bAutoTab=true)
The base class is initialized without setting anything.
const bool m_bAutoTabStop
virtual void HandlePortion(SwPortionHandler &rPH) const override
SwLinePortion * GetLast()
SwTabPortion * GetLastTab()
void SetTabOverflow(bool bOverflow)
TextFrameIndex GetLineStart() const
void SetTabDecimal(const sal_Unicode cNew)
void SetLastTab(SwTabPortion *pNew)
bool IsTabOverflow() const
SwTabPortion * NewTabPortion(SwTextFormatInfo &rInf, bool bAuto) const
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout.
SwParaPortion * GetParaPortion()
SwTwips GetLeftMargin() const
SwTwips GetTabLeft() const
void DrawTab(const SwLinePortion &rPor) const
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
void DrawBackBrush(const SwLinePortion &rPor) const
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
SwTextFrame * GetTextFrame()
const SwViewOption & GetOpt() const
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
const OUString & GetText() const
TextFrameIndex GetIdx() const
bool IsTab(bool bHard=false) const
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)