20#include <com/sun/star/i18n/ScriptType.hpp>
21#include <com/sun/star/i18n/XBreakIterator.hpp>
44using namespace ::com::sun::star::i18n::ScriptType;
150 const bool bDoNotAddSpace =
152 ( i18n::ScriptType::COMPLEX ==
156 if ( bDoNotAddSpace )
185 bool bOldOnWin = rInf.
OnWin();
198 if(
ASIAN == nNextScript )
224 const sal_uInt16
nLineWidth = o3tl::narrowing<sal_uInt16>(rInf.
Width() - rInf.
X());
238 sal_uInt16 nItalic = 0;
277 return rField.
GetExpText( rInf, aText ) && !aText.isEmpty();
289 const bool bHyph = rInf.
ChgHyph(
true );
297 OSL_ENSURE( bFull,
"Problem with hyphenation!!!" );
305 const bool bFull = !aGuess.
Guess( *
this, rInf,
Height() );
330 if( nKern > 0 && rInf.
Width() < rInf.
X() +
Width() + nKern )
332 nKern =
static_cast<short>(rInf.
Width() - rInf.
X() -
Width() - 1);
407 "Trouble with expanded field portions during line break" );
456 "SwTextPortion::Format: missing real width" );
457 OSL_ENSURE(
Height(),
"SwTextPortion::Format: missing height" );
489 sal_uInt16 nBlankSize;
490 if( nHoleLen ==
GetLen() )
491 nBlankSize =
Width();
495 rInf.
X( rInf.
X() - nBlankSize );
498 static_cast<SwHolePortion *
>( pHole )->SetBlankWidth( nBlankSize );
506 OSL_ENSURE(
false,
"SwTextPortion::GetModelPositionForViewPoint: don't use this method!" );
559 const bool bWrong =
nullptr != pWrongList;
560 const bool bGrammarCheck =
nullptr != pGrammarCheckList;
561 const bool bSmartTags =
nullptr != pSmarttags;
563 if ( bWrong || bSmartTags || bGrammarCheck )
599 bool bOldOnWin = rInf.
OnWin();
615 rCharCnt = rCharCnt +
nPos;
639 bool bOldOnWin = rInf.
OnWin();
649 nSpaceAdd = -nSpaceAdd;
660 nSpaceAdd = -nSpaceAdd;
699 SwTextSlot aPaintText( &rInf,
this,
true,
true, OUString() );
708 aIntersect.
Left(aIntersect.
Left() - aAreaWidth/2);
709 aIntersect.
Width(aAreaWidth);
719 pOut->SetLineColor();
728 sal_Int32 nIdx(rInf.
GetIdx());
746 SwTextSlot aFormatText( &rInf,
this,
true,
false );
796 std::unique_ptr<SwFont> pHoleFont;
797 std::optional<SwFontSave> oFontSave;
802 pHoleFont.reset(
new SwFont( *pOrigFont ));
806 oFontSave.emplace( rInf, pHoleFont.get() );
836 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwHolePortion"));
840 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"blank-width"),
843 (void)xmlTextWriterEndElement(pWriter);
865 "Where is my form field bookmark???");
869 const ICheckboxFieldmark* pCheckboxFm =
dynamic_cast<ICheckboxFieldmark const*
>(pBM);
870 bool bChecked = pCheckboxFm && pCheckboxFm->IsChecked();
879 OSL_ENSURE(pBM && pBM->GetFieldname( ) ==
ODF_FORMCHECKBOX,
"Where is my form field bookmark???");
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 ::sw::mark::IFieldmark * getFieldmarkAt(const SwPosition &rPos) const =0
get Fieldmark for CH_TXT_ATR_FIELDSTART/CH_TXT_ATR_FIELDEND at rPos
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static bool isKorean(LanguageType nLang)
static sal_uInt16 MayUnderflow(const SwTextFormatInfo &rInf, TextFrameIndex nIdx, bool bUnderflow)
If a Line is full of HardBlanks and overflows, we must not generate underflows! Causes problems with ...
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
IDocumentMarkAccess * getIDocumentMarkAccess()
virtual bool Format(SwTextFormatInfo &rInf) override
virtual void Paint(const SwTextPaintInfo &rInf) const override
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
FontItalic GetItalic() const
sal_uInt16 GetBottomBorderSpace() const
sal_uInt16 GetTopBorderSpace() const
FontLineStyle GetUnderline() const
sal_uInt16 GetRightBorderSpace() const
FontStrikeout GetStrikeout() const
FontLineStyle GetOverline() const
void SetUnderline(const FontLineStyle eUnderline)
sal_uInt16 GetLeftBorderSpace() const
bool IsRightToLeft() const
SwPageFrame * FindPageFrame()
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
virtual SwLinePortion * Compress() override
virtual bool Format(SwTextFormatInfo &rInf) override
SwHolePortion(const SwTextPortion &rPor)
virtual void Paint(const SwTextPaintInfo &rInf) const override
void dumpAsXml(xmlTextWriterPtr pWriter, const OUString &rText, TextFrameIndex &nOffset) const override
virtual void HandlePortion(SwPortionHandler &rPH) const override
void SetMidHyph(const bool bNew)
void SetEndHyph(const bool bNew)
Base class for anything that can be part of a line in the Writer layout.
bool IsBlankPortion() const
void dumpAsXmlAttributes(xmlTextWriterPtr writer, std::u16string_view rText, TextFrameIndex nOffset) const
SwLinePortion * mpNextPortion
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const
the parameter is actually SwTwips apparently?
SwLinePortion * GetNextPortion() const
void SetAscent(const SwTwips nNewAsc)
bool GetJoinBorderWithPrev() const
PortionType GetWhichPor() const
void SetNextPortion(SwLinePortion *pNew)
bool IsPostItsPortion() const
TextFrameIndex GetLen() const
bool IsKernPortion() const
bool GetJoinBorderWithNext() const
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const
bool IsControlCharPortion() const
bool IsFootnotePortion() const
bool IsErgoSumPortion() const
bool IsDropPortion() const
bool IsBreakPortion() const
void CalcTextSize(const SwTextSizeInfo &rInfo)
void SetLen(TextFrameIndex const nLen)
bool IsCombinedPortion() const
bool IsHolePortion() const
bool IsFlyPortion() const
SwTwips ExtraBlankWidth() const
void SetWhichPor(const PortionType nNew)
bool InFixMargGrp() const
void PrePaint(const SwTextPaintInfo &rInf, const SwLinePortion *pLast) const
virtual SwLinePortion * Insert(SwLinePortion *pPortion)
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
The SwPortionHandler interface implements a visitor for the layout engine's text portions.
virtual void Text(TextFrameIndex nLength, PortionType nType)=0
(empty) destructor
SwPosSize(const SwTwips nW=0, const SwTwips nH=0)
Of course Writer needs its own rectangles.
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
sal_Int16 ScriptType(const TextFrameIndex nPos) const
sal_Int32 KashidaJustify(KernArray *pKernArray, sal_Bool *pKashidaArray, TextFrameIndex nStt, TextFrameIndex nLen, tools::Long nSpaceAdd=0) const
Performs a kashida justification on the kerning array.
static TextFrameIndex CountCJKCharacters(const OUString &rText, TextFrameIndex nPos, TextFrameIndex nEnd, LanguageType aLang)
static TextFrameIndex ThaiJustify(std::u16string_view aText, KernArray *pKernArray, TextFrameIndex nIdx, TextFrameIndex nLen, TextFrameIndex nNumberOfBlanks=TextFrameIndex(0), tools::Long nSpaceAdd=0)
Performs a thai justification on the kerning array.
size_t CountKashida() const
static bool IsArabicText(const OUString &rText, TextFrameIndex nStt, TextFrameIndex nLen)
Checks if text is Arabic text.
static bool IsExportTaggedPDF(const OutputDevice &rOut)
SwLinePortion * GetLast()
bool IsFakeLineStart() const
sal_uInt16 RealWidth() const
TextFrameIndex GetLineStart() const
TextFrameIndex GetSoftHyphPos() const
bool IsHyphenate() const
If the Hyphenator returns ERROR or the language is set to NOLANGUAGE we do not hyphenate.
SwTwips GetLineWidth()
Returns the distance between the current horizontal position and the end of the line.
void SetUnderflow(SwLinePortion *pNew)
void SetSoftHyphPos(TextFrameIndex const nNew)
bool ChgHyph(const bool bNew)
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
LanguageType GetLangOfChar(TextFrameIndex nIndex, sal_uInt16 nScript, bool bNoChar=false) const
SwTextGrid GetGridType() const
bool IsSnapToChars() const
bool AlternativeSpelling(const SwTextFormatInfo &rInf, const TextFrameIndex nPos)
SwHangingPortion * GetHangingPortion() const
TextFrameIndex FieldDiff() const
sal_uInt16 BreakWidth() const
SwHangingPortion * ReleaseHangingPortion()
TextFrameIndex BreakStart() const
const css::uno::Reference< css::linguistic2::XHyphenatedWord > & HyphWord() const
TextFrameIndex CutPos() const
TextFrameIndex BreakPos() const
bool Guess(const SwTextPortion &rPor, SwTextFormatInfo &rInf, const sal_uInt16 nHeight)
sal_uInt16 ExtraBlankWidth() const
SwParaPortion * GetParaPortion()
virtual bool Format(SwTextFormatInfo &rInf) override
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
virtual void Paint(const SwTextPaintInfo &rInf) const override
SwTextInputFieldPortion()
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
void DrawCSDFHighlighting(const SwLinePortion &rPor) const
void DrawMarkedText(const SwLinePortion &rPor, TextFrameIndex nLen, const bool bWrong, const bool bSmartTags, const bool bGrammarCheck) const
sw::WrongListIterator * GetpWrongList() const
void DrawText(const OUString &rText, const SwLinePortion &rPor, TextFrameIndex nIdx=TextFrameIndex(0), TextFrameIndex nLen=TextFrameIndex(COMPLETE_STRING), const bool bKern=false) const
void CalcRect(const SwLinePortion &rPor, SwRect *pRect, SwRect *pIntersect=nullptr, const bool bInsideBox=false) const
Calculate the rectangular area where the portion takes place.
void DrawBackBrush(const SwLinePortion &rPor) const
sw::WrongListIterator * GetGrammarCheckList() const
void DrawViewOpt(const SwLinePortion &rPor, PortionType nWhich, const Color *pColor=nullptr) const
void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
void DrawBorder(const SwLinePortion &rPor) const
Draw character border around a line portion.
sw::WrongListIterator * GetSmartTags() const
This portion represents a part of the paragraph string.
virtual SwPosSize GetTextSize(const SwTextSizeInfo &rInfo) const override
virtual bool GetExpText(const SwTextSizeInfo &rInf, OUString &rText) const override
bool CreateHyphen(SwTextFormatInfo &rInf, SwTextGuess const &rGuess)
virtual void Paint(const SwTextPaintInfo &rInf) const override
virtual void HandlePortion(SwPortionHandler &rPH) const override
void BreakUnderflow(SwTextFormatInfo &rInf)
virtual TextFrameIndex GetModelPositionForViewPoint(sal_uInt16 nOfst) const override
the parameter is actually SwTwips apparently?
void BreakCut(SwTextFormatInfo &rInf, const SwTextGuess &rGuess)
TextFrameIndex GetSpaceCnt(const SwTextSizeInfo &rInf, TextFrameIndex &rCnt) const
static SwTextPortion * CopyLinePortion(const SwLinePortion &rPortion)
virtual bool Format(SwTextFormatInfo &rInf) override
bool Format_(SwTextFormatInfo &rInf)
virtual void FormatEOL(SwTextFormatInfo &rInf) override
virtual tools::Long CalcSpacing(tools::Long nSpaceAdd, const SwTextSizeInfo &rInf) const override
SwTextFrame * GetTextFrame()
vcl::RenderContext * GetOut()
const SwViewOption & GetOpt() const
void SetLen(const TextFrameIndex nNew)
sal_uInt16 GetTextHeight() const
SwPosSize GetTextSize(OutputDevice *pOut, const SwScriptInfo *pSI, const OUString &rText, TextFrameIndex nIdx, TextFrameIndex nLen) const
sal_uInt16 GetAscent() const
sal_Unicode GetChar(TextFrameIndex const nPos) const
TextFrameIndex GetLen() const
bool IsOtherThanFootnoteInside() const
bool IsFirstMulti() const
const OUString & GetText() const
TextFrameIndex GetIdx() const
For the text replacement and restoration of SwTextSizeInfo.
bool IsPagePreview() const
const Color & GetFieldShadingsColor() const
bool IsFieldShadings() const
const SwViewOption * GetViewOptions() const
struct _xmlTextWriter * xmlTextWriterPtr
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDSTART
#define CH_TXT_ATR_INPUTFIELDSTART
constexpr OUStringLiteral CH_TXT_ATR_SUBST_FIELDEND
#define CH_TXT_ATR_INPUTFIELDEND
#define CH_TXT_ATR_FIELDEND
#define CH_TXT_ATR_FIELDSTART
#define CH_TXTATR_BREAKWORD
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
constexpr OUStringLiteral ODF_FORMCHECKBOX
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
static TextFrameIndex lcl_AddSpace(const SwTextSizeInfo &rInf, const OUString *pStr, const SwLinePortion &rPor)
static bool lcl_HasContent(const SwFieldPortion &rField, SwTextFormatInfo const &rInf)
#define SPACING_PRECISION_FACTOR
Marks a position in the document model.
const sal_Unicode CH_SIX_PER_EM
const sal_Unicode CH_BLANK
const sal_Unicode CH_FULL_BLANK
constexpr sal_Int32 COMPLETE_STRING