21#include <com/sun/star/text/HoriOrientation.hpp>
28#include <lineinfo.hxx>
52#define REDLINE_DISTANCE 567/4
53#define REDLINE_MINDIST 567/10
67 std::unique_ptr<SwFont> m_pFnt;
72 sal_uInt16 m_nDivider;
74 bool IsClipChg()
const {
return m_aClip.
IsChg(); }
76 SwExtraPainter(
const SwExtraPainter&) =
delete;
77 SwExtraPainter& operator=(
const SwExtraPainter&) =
delete;
82 sal_Int16 eHor,
bool bLnNm );
84 void IncLineNr() { ++m_nLineNr; }
85 bool HasNumber()
const {
89 return !( m_nLineNr %
static_cast<sal_Int32
>(m_rLineInf.
GetCountBy()) );
91 bool HasDivider()
const {
106 sal_Int16 eHor,
bool bLineNum )
107 : m_aClip( pVwSh->GetWin() || pFrame->IsUndersized() ? pVwSh->GetOut() : nullptr )
109 , m_pTextFrame( pFrame )
111 , m_rLineInf( rLnInf )
118 if( pFrame->IsUndersized() )
121 if( m_aRect.Bottom() > nBottom )
122 m_aRect.Bottom( nBottom );
124 std::optional<bool> oIsRightPage;
135 m_nDivider = !m_rLineInf.GetDivider().isEmpty() ? m_rLineInf.GetDividerCountBy() : 0;
138 OSL_ENSURE( pFormat,
"PaintExtraData without CharFormat" );
140 m_pFnt->Invalidate();
141 m_pFnt->ChgPhysFnt( m_pSh, *m_pSh->GetOut() );
142 m_pFnt->SetVertical( 0_deg10, pFrame->
IsVertical() );
159 oIsRightPage =
false;
167 m_nX -= m_rLineInf.GetPosFromLeft();
178 if( text::HoriOrientation::INSIDE == eHor || text::HoriOrientation::OUTSIDE == eHor )
183 eHor = eHor == text::HoriOrientation::INSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
185 eHor = eHor == text::HoriOrientation::OUTSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
196 const OUString aTmp( pRedlineText
201 ? m_rLineInf.GetNumType().GetNumStr( m_nLineNr )
202 : m_rLineInf.GetDivider() ) );
211 if ( !m_pSh->GetViewOptions()->IsShowChangesInMargin2() )
212 m_pFnt->SetStrikeout( STRIKEOUT_SINGLE );
213 m_pFnt->SetSize(
Size( 0, 200), m_pFnt->GetActual() );
216 SwDrawTextInfo aDrawInf( m_pSh, *m_pSh->GetOut(), aTmp, 0, aTmp.getLength() );
217 aDrawInf.SetSpace( 0 );
218 aDrawInf.SetWrong(
nullptr );
219 aDrawInf.SetGrammarCheck(
nullptr );
220 aDrawInf.SetSmartTags(
nullptr );
221 aDrawInf.SetFrame( m_pTextFrame );
222 aDrawInf.SetFont( m_pFnt.get() );
223 aDrawInf.SetSnapToGrid(
false );
224 aDrawInf.SetIgnoreFrameRTL(
true );
226 bool bTooBig = m_pFnt->GetSize( m_pFnt->GetActual() ).Height() > nMax &&
227 m_pFnt->GetHeight( m_pSh, *m_pSh->GetOut() ) > nMax;
241 Point aTmpPos( m_nX, nY );
242 aTmpPos.AdjustY(nAsc );
246 aTmpPos.AdjustX( -(aSize.
Width()) - 200 );
253 aTmpPos.AdjustX( -(aSize.
Width()) );
256 aTmpPos.Y() - pTmpFnt->
GetAscent( m_pSh, *m_pSh->GetOut() )
258 if( !m_aRect.Contains( aRct ) )
260 if( aRct.Intersection( m_aRect ).IsEmpty() )
263 m_aClip.ChgClip( m_aRect, m_pTextFrame );
268 aDrawInf.SetPos( aTmpPos );
276 tools::Long nDiff = m_bGoLeft ? m_nRedX - m_nX : m_nX - m_nRedX;
278 PaintRedline( nY, nMax );
284 Point aStart( m_nRedX, nY );
285 Point aEnd( m_nRedX, nY + nMax );
289 SwRect aRct( aStart, aEnd );
290 if( !m_aRect.Contains( aRct ) )
292 if( aRct.Intersection( m_aRect ).IsEmpty() )
294 m_aClip.ChgClip( m_aRect, m_pTextFrame );
297 const Color aOldCol( m_pSh->GetOut()->GetLineColor() );
298 m_pSh->GetOut()->SetLineColor(
SW_MOD()->GetRedlineMarkColor() );
300 if ( m_pTextFrame->IsVertical() )
302 m_pTextFrame->SwitchHorizontalToVertical( aStart );
303 m_pTextFrame->SwitchHorizontalToVertical( aEnd );
306 m_pSh->GetOut()->DrawLine( aStart, aEnd );
307 m_pSh->GetOut()->SetLineColor( aOldCol );
323 sal_Int16 eHor =
static_cast<sal_Int16
>(
SW_MOD()->GetRedlineMarkPos());
331 if ( !bLineNum && !bRedLine )
345 aLayoutModeModifier.
Modify(
false );
350 SwExtraPainter aExtra(
this, pSh, rLineInf, rRect, eHor, bLineNum );
361 aLayoutModeModifier.
Modify(
false );
364 bool bNoDummy = !aLine.
GetNext();
374 const_cast<SwRect&
>(rRect) = rOldRect;
404 bool bRedInMargin = bIsShowChangesInMargin && bRed;
405 bool bNum = bLineNum && ( aExtra.HasNumber() || aExtra.HasDivider() );
406 if( bRedInMargin || bNum )
408 SwTwips nTmpHeight, nTmpAscent;
413 if( !pRedlineText->isEmpty() )
415 aExtra.PaintExtra( aLine.
Y(), nTmpAscent,
416 nTmpHeight, bRed, pRedlineText );
423 aExtra.PaintExtra( aLine.
Y(), nTmpAscent, nTmpHeight, bRed );
432 }
while( aLine.
Next() && aLine.
Y() <= nBottom );
443 ( aExtra.HasNumber() || aExtra.HasDivider() ) )
452 const_cast<SwRect&
>(rRect) = rOldRect;
478 if( l && l > rRepaint.
Right() )
489 aRet.
Left(pPageFrame->getFrameArea().Left());
513 if( bCheck && aTextFly.
IsOn() && aTextFly.
IsAnyObj( aRect ) )
517 std::unique_ptr<SwFont> pFnt;
545 eRedline = pRedline->
GetType();
551 eRedline = pNextRedline->
GetType();
572 pFnt->ChgPhysFnt( pSh, *pSh->
GetOut() );
583 std::unique_ptr<SwSaveClip, o3tl::default_delete<SwSaveClip>> xClip;
587 xClip->ChgClip( rRect );
600 pFnt->GetHeight( pSh, *pSh->
GetOut() ) ) / 2 );
619 aDrawInf.
SetFont( pFnt.get() );
624 if ( eRedline != RedlineType::None )
626 pFnt->DrawText_( aDrawInf );
627 if ( eRedline == RedlineType::Delete )
634 pFnt->DrawText_( aDrawInf );
673 OSL_ENSURE(
false,
"+SwTextFrame::PaintSwFrame: missing format information" );
680 bool const isPDFTaggingEnabled(!HasFollow() ||
GetPara()->HasContentPortions());
681 ::std::optional<SwTaggedPDFHelper> oTaggedPDFHelperNumbering;
682 if (isPDFTaggingEnabled)
685 oTaggedPDFHelperNumbering.emplace(&aNumInfo,
nullptr,
nullptr, rRenderContext);
691 ::std::optional<SwTaggedPDFHelper> oTaggedLabel;
693 ::std::optional<SwTaggedPDFHelper> oTaggedParagraph;
698 oTaggedParagraph.emplace(
nullptr, &aFrameInfo,
nullptr, rRenderContext);
728 OSL_ENSURE( !
IsSwapped(),
"A frame is swapped before Paint" );
764 const bool bOnWin = pSh->
GetWin() !=
nullptr;
785 aLine.
DrawTextLine(rRect, aClip, IsUndersized(), oTaggedLabel, oTaggedParagraph, isPDFTaggingEnabled);
787 }
while( aLine.
Next() && aLine.
Y() <= nBottom );
800 const_cast<SwRect&
>(rRect) = aOldRect;
802 OSL_ENSURE( !
IsSwapped(),
"A frame is swapped after Paint" );
804 assert(!oTaggedLabel);
css::chart::ChartAxisLabelPosition ePos
static bool IsShowChanges(const RedlineFlags eM)
virtual SwRedlineTable::size_type GetRedlinePos(const SwNode &rNode, RedlineType nType) const =0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
Access to the style pool.
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long Width() const
short GetTextFirstLineOffset() const
Used by Attribute Iterators to organize attributes on stacks to find the valid attribute in each cate...
void Init(const SwAttrSet &rAttrSet, const IDocumentSettingAccess &rIDocumentSettingAccess)
const SwFormatLineNumber & GetLineNumber(bool=true) const
bool HasSwAttrSet() const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
SwFormatColl & GetAnyFormatColl() const
const SwLineNumberInfo & GetLineNumberInfo() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
void SetSnapToGrid(bool bNew)
void SetPos(const Point &rNew)
void SetFont(SwFont *pNew)
void SetSmartTags(sw::WrongListIterator *const pNew)
void SetKanaComp(short nNew)
void SetFrame(const SwTextFrame *pNewFrame)
void SetGrammarCheck(sw::WrongListIterator *const pNew)
void SetSpace(tools::Long nNew)
void SetWrong(sw::WrongListIterator *const pNew)
general base class for all free-flowing frames
bool IsFlyInContentFrame() const
To take Asian or other languages into consideration, an SwFont object consists of 3 SwSubFonts (Latin...
void DrawText_(SwDrawTextInfo &rInf)
Size GetTextSize_(SwDrawTextInfo &rInf)
void SetSize(const Size &rSize, const SwFontScript nWhich)
SwFontScript GetActual() const
sal_uInt16 GetAscent(SwViewShell const *pSh, const OutputDevice &rOut)
const SwRect & getFrameArea() const
bool isFrameAreaPositionValid() const
const SwRect & getFramePrintArea() const
Helper class which can be used instead of the macros if a function has too many returns.
Base class of the Writer layout elements.
SwFlyFrame * FindFlyFrame()
SwTabFrame * FindTabFrame()
bool IsRightToLeft() const
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
SwLayoutFrame * GetUpper()
SwRootFrame * getRootFrame()
SwPageFrame * FindPageFrame()
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
void Modify(bool bChgToRTL)
const OUString * GetRedlineText() const
< purpose of derivation from SwClient: character style for displaying the numbers.
sal_uInt16 GetCountBy() const
bool IsPaintLineNumbers() const
bool IsCountBlankLines() const
bool IsCountInFlys() const
sal_uInt16 GetDividerCountBy() const
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
SwNodeOffset GetIndex() const
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
const SwPosition * End() const
const SwPosition * Start() const
Collection of SwLineLayout instances, represents the paragraph text in Writer layout.
RedlineType GetType(sal_uInt16 nPos=0) const
Of course Writer needs its own rectangles.
void Chg(const Point &rNP, const Size &rNS)
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Bottom(const tools::Long nBottom)
SwRect GetIntersection(const SwRect &rRect) const
void Pos(const Point &rNew)
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
static constexpr size_type npos
vector_type::size_type size_type
SwTwips GetOffset() const
SwTwips GetRightOfst() const
void SetOffset(const SwTwips nNew)
SwViewShell * GetCurrShell() const
SwFontScript WhichFont(TextFrameIndex nIdx) const
The purpose of this class is to be the universal interface between formatting/text output and the pos...
bool IsAnyObj(const SwRect &rRect) const
true when a frame or DrawObj must be taken in account.
bool Relax(const SwRect &rRect)
If there is no flying object frame standing in rRect (usually the current row), then we are turning o...
Represents the visualization of a paragraph.
void PaintParagraphStylesHighlighting() const
SwTextFrame * GetFormatted(bool bForceQuickFormat=false)
In case the SwLineLayout was cleared out of the s_pTextCache, recreate it.
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
void SwitchVerticalToHorizontal(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from vertical to horizontal layout.
void SwitchLTRtoRTL(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from LTR to RTL layout.
void ResetRepaint() const
void SwitchRTLtoLTR(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from RTL to LTR layout.
sal_Int32 GetAllLines() const
For displaying the line numbers.
SwTwips EmptyHeight() const
SwParaPortion * GetPara()
void PaintOutlineContentVisibilityButton() const
void SwitchHorizontalToVertical(SwRect &rRect) const
Calculates the coordinates of a rectangle when switching from horizontal to vertical layout.
bool IsHiddenNow() const
Hidden.
bool HasNonLastSplitFlyDrawObj() const
This text frame may have a split fly frames anchored to it.
void PaintExtraData(const SwRect &rRect) const
sal_Int32 GetThisLines() const
SwTextNode * GetTextNodeFirst()
SwRect GetPaintSwRect()
Page number etc.
bool PaintEmpty(const SwRect &, bool bCheck) const
SwTextNode const * GetTextNodeForParaProps() const
static tools::Long GetMinPrtLine()
sal_uInt16 GetBaseHeight() const
bool GetRubyTextBelow() const
sal_uInt16 GetRubyHeight() const
const SwLineLayout * GetNext() const
void TwipsToLine(const SwTwips)
SwTwips GetLineHeight() const
const SwLineLayout * Next()
const SwLineLayout * GetCurr() const
void CalcAscentAndHeight(SwTwips &rAscent, SwTwips &rHeight) const
SwParaPortion * GetPara()
SwTextNode is a paragraph in the document model.
SwWrongList * GetSmartTags()
SwGrammarMarkUp * GetGrammarCheck()
void SetSmartTags(sw::WrongListIterator *const pNew)
void SetWrongList(sw::WrongListIterator *const pNew)
void SetGrammarCheckList(sw::WrongListIterator *const pNew)
void DrawTextLine(const SwRect &rPaint, SwSaveClip &rClip, const bool bUnderSz, ::std::optional< SwTaggedPDFHelper > &roTaggedLabel, ::std::optional< SwTaggedPDFHelper > &roTaggedParagraph, bool isPDFTaggingEnabled)
vcl::RenderContext * GetOut()
bool IsParagraph(bool bHard=false) const
bool IsShowChangesInMargin() const
vcl::RenderContext * GetOut() const
const SwViewOption * GetViewOptions() const
vcl::Window * GetWin() const
OUString const & GetDefBulletFontname()
retrieve font family name used for the default bullet list characters
void swap(cow_wrapper< T, P > &a, cow_wrapper< T, P > &b)
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
SwTextGridItem const * GetGridItem(SwPageFrame const *const)
SwNodeOffset GetNodeIndex() const
constexpr OUStringChar CH_PAR
#define NON_PRINTING_CHARACTER_COLOR