26 #if OSL_DEBUG_LEVEL > 0
35 OSL_ENSURE( nCount < 200 && pPor != pStart,
36 "ChkChain(): lost in chains" );
37 if( nCount >= 200 || pPor == pStart )
67 mpNextPortion( nullptr ),
70 mnHangingBaseline( 0 ),
72 m_bJoinBorderWithPrev(
false),
73 m_bJoinBorderWithNext(
false)
80 OSL_ENSURE( rInf.
OnWin(),
"SwLinePortion::PrePaint: don't prepaint on a printer");
81 OSL_ENSURE( !
Width(),
"SwLinePortion::PrePaint: For Width()==0 only!");
88 const sal_uInt16 nHalfView = nViewWidth / 2;
89 sal_uInt16 nLastWidth = pLast->
Width();
106 if (nLastWidth > nHalfView || pLast ==
this)
111 nPos = sal_uInt16( rInf.
X() );
112 nPos += nLastWidth - nHalfView;
116 nPos = sal_uInt16( rInf.
Y() );
117 nPos -= nLastWidth - nHalfView;
121 nPos = sal_uInt16( rInf.
X() );
122 nPos -= nLastWidth - nHalfView;
126 nPos = sal_uInt16( rInf.
Y() );
127 nPos += nLastWidth - nHalfView;
134 pThis->
Width( nViewWidth );
142 *static_cast<SwPosSize*>(
this) =
GetTextSize( rInf );
157 OSL_ENSURE( pPos !=
this,
"SwLinePortion::Truncate: loop" );
173 #if OSL_DEBUG_LEVEL > 0
195 #if OSL_DEBUG_LEVEL > 0
204 OSL_ENSURE( pPrev,
"SwLinePortion::Cut(): can't cut" );
212 OSL_ENSURE( pRoot !=
this,
"SwLinePortion::FindPrevPortion(): invalid root" );
219 "SwLinePortion::FindPrevPortion: blowing in the wind");
233 OSL_ENSURE(
false,
"SwLinePortion::GetTextSize: don't ask me about sizes, "
234 "I'm only a stupid SwLinePortion" );
240 if( rInf.
X() > rInf.
Width() )
250 const sal_uInt16 nNewWidth = o3tl::narrowing<sal_uInt16>(rInf.
X() +
PrtWidth());
256 if( nNewWidth > rInf.
Width() )
280 rInf.
Y( rInf.
Y() + ( bB2T ? -nTmp : nTmp ) );
281 else if ( bCounterDir )
282 rInf.
X( rInf.
X() - nTmp );
284 rInf.
X( rInf.
X() + nTmp );
295 else if ( bCounterDir )
323 (
void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwLinePortion"));
327 (
void)xmlTextWriterEndElement(pWriter);
332 (
void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
333 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"symbol"), BAD_CAST(
typeid(*this).name()));
334 (
void)xmlTextWriterWriteAttribute(
335 pWriter, BAD_CAST(
"width"),
336 BAD_CAST(OString::number(
Width()).getStr()));
337 (
void)xmlTextWriterWriteAttribute(
338 pWriter, BAD_CAST(
"height"),
339 BAD_CAST(OString::number(
Height()).getStr()));
340 (
void)xmlTextWriterWriteAttribute(
341 pWriter, BAD_CAST(
"length"),
342 BAD_CAST(OString::number(static_cast<sal_Int32>(
mnLineLength)).getStr()));
343 (
void)xmlTextWriterWriteAttribute(
344 pWriter, BAD_CAST(
"type"),
346 OUString aText( rText.substr(sal_Int32(nOffset), sal_Int32(
GetLen())) );
347 for (
int i = 0;
i < 32; ++
i)
348 aText = aText.replace(
i,
'*');
349 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"portion"),
350 BAD_CAST(aText.toUtf8().getStr()));
virtual bool Format(SwTextFormatInfo &rInf)
void Move(SwTextPaintInfo &rInf)
virtual tools::Long CalcSpacing(tools::Long nSpaceAdd, const SwTextSizeInfo &rInf) const
const char * PortionTypeToString(PortionType nType)
void CalcTextSize(const SwTextSizeInfo &rInfo)
static bool ChkChain(SwLinePortion *pStart)
void dumpAsXmlAttributes(xmlTextWriterPtr writer, std::u16string_view rText, TextFrameIndex nOffset) const
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
tools::Long GetSpaceAdd() const
vcl::text::ComplexTextLayoutFlags GetLayoutMode() const
Degree10 GetOrientation(const bool bVertLayout=false, const bool bVertFormatLRBT=false) const
virtual SwLinePortion * Compress()
bool IsMarginPortion() const
virtual void Paint(const SwTextPaintInfo &rInf) const =0
sal_uInt8 GetDirection() const
bool InFixMargGrp() 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.
virtual void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &rOffset) const
virtual SwLinePortion * Append(SwLinePortion *pPortion)
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const
the parameter is actually SwTwips apparently?
virtual sal_uInt16 GetViewWidth(const SwTextSizeInfo &rInf) const
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const
vcl::RenderContext * GetOut()
void SetUnderflow(SwLinePortion *pNew)
bool IsKernPortion() const
virtual void HandlePortion(SwPortionHandler &rPH) const
TextFrameIndex GetIdx() const
void PrePaint(const SwTextPaintInfo &rInf, const SwLinePortion *pLast) const
SwLinePortion * Cut(SwLinePortion *pVictim)
TextFrameIndex GetLen() const
SwTextFrame * GetTextFrame()
SwLinePortion * mpNextPortion
bool IsMultiPortion() const
Base class for anything that can be part of a line in the Writer layout.
TextFrameIndex mnLineLength
void SetLen(const TextFrameIndex nNew)
PortionType GetWhichPor() const
SwLinePortion * FindLastPortion()
bool IsRightToLeft() const
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const
TextFrameIndex GetLen() const
SwLinePortion * FindPrevPortion(const SwLinePortion *pRoot)
SwLinePortion * GetLast()
void SetNextPortion(SwLinePortion *pNew)
struct _xmlTextWriter * xmlTextWriterPtr
virtual void FormatEOL(SwTextFormatInfo &rInf)
SwLinePortion * GetNextPortion() const
void SetIdx(const TextFrameIndex nNew)
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 SwLinePortion * Insert(SwLinePortion *pPortion)
bool m_bDetectedRangeSegmentation false
SwPosSize(const SwTwips nW=0, const SwTwips nH=0)
void SetAscent(const SwTwips nNewAsc)