summaryrefslogtreecommitdiff
path: root/sw/source/core/text/frmpaint.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/text/frmpaint.cxx')
-rw-r--r--sw/source/core/text/frmpaint.cxx79
1 files changed, 57 insertions, 22 deletions
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 7f35ea7633b6..d6d47f7ae637 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -68,7 +68,7 @@ class SwExtraPainter
const SwLineNumberInfo &m_rLineInf;
SwTwips m_nX;
SwTwips m_nRedX;
- sal_uLong m_nLineNr;
+ sal_Int32 m_nLineNr;
sal_uInt16 m_nDivider;
bool m_bGoLeft;
bool IsClipChg() const { return m_aClip.IsChg(); }
@@ -82,9 +82,16 @@ public:
sal_Int16 eHor, bool bLnNm );
SwFont* GetFont() const { return m_pFnt.get(); }
void IncLineNr() { ++m_nLineNr; }
- bool HasNumber() const { return !( m_nLineNr % m_rLineInf.GetCountBy() ); }
+ bool HasNumber() const {
+ assert( m_rLineInf.GetCountBy() != 0 );
+ if( m_rLineInf.GetCountBy() == 0 )
+ return false;
+ return !( m_nLineNr % static_cast<sal_Int32>(m_rLineInf.GetCountBy()) );
+ }
bool HasDivider() const {
- if( !m_nDivider ) return false;
+ assert( m_rLineInf.GetDividerCountBy() != 0 );
+ if( !m_nDivider || m_rLineInf.GetDividerCountBy() == 0 )
+ return false;
return !(m_nLineNr % m_rLineInf.GetDividerCountBy());
}
@@ -170,7 +177,7 @@ SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, SwViewShell *pVwSh,
if( text::HoriOrientation::INSIDE == eHor || text::HoriOrientation::OUTSIDE == eHor )
{
- if (!oIsRightPage)
+ if (!oIsRightPage.has_value())
oIsRightPage = pFrame->FindPageFrame()->OnRightPage();
if (*oIsRightPage)
eHor = eHor == text::HoriOrientation::INSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
@@ -248,7 +255,7 @@ void SwExtraPainter::PaintExtra( SwTwips nY, tools::Long nAsc, tools::Long nMax,
SwRect aRct( Point( aTmpPos.X(),
aTmpPos.Y() - pTmpFnt->GetAscent( m_pSh, *m_pSh->GetOut() )
), aSize );
- if( !m_aRect.IsInside( aRct ) )
+ if( !m_aRect.Contains( aRct ) )
{
if( aRct.Intersection( m_aRect ).IsEmpty() )
bPaint = false;
@@ -280,7 +287,7 @@ void SwExtraPainter::PaintRedline( SwTwips nY, tools::Long nMax )
if( !IsClipChg() )
{
SwRect aRct( aStart, aEnd );
- if( !m_aRect.IsInside( aRct ) )
+ if( !m_aRect.Contains( aRct ) )
{
if( aRct.Intersection( m_aRect ).IsEmpty() )
return;
@@ -398,7 +405,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
bool bNum = bLineNum && ( aExtra.HasNumber() || aExtra.HasDivider() );
if( bRedInMargin || bNum )
{
- sal_uInt16 nTmpHeight, nTmpAscent;
+ SwTwips nTmpHeight, nTmpAscent;
aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
if ( bRedInMargin )
{
@@ -494,6 +501,8 @@ SwRect SwTextFrame::GetPaintSwRect()
bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
{
+ PaintParagraphStylesHighlighting();
+
SwViewShell *pSh = getRootFrame()->GetCurrShell();
if( pSh && ( pSh->GetViewOptions()->IsParagraph() || bInitFont ) )
{
@@ -532,13 +541,13 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
SwRedlineItr aRedln(rTextNode, *pFnt, aAttrHandler, nRedlPos, SwRedlineItr::Mode::Show);
const SwRangeRedline* pRedline = rIDRA.GetRedlineTable()[nRedlPos];
// show redlining only on the inserted/deleted empty paragraph, but not on the next one
- if ( rTextNode.GetIndex() != pRedline->End()->nNode.GetIndex() )
+ if ( rTextNode.GetIndex() != pRedline->End()->GetNodeIndex() )
eRedline = pRedline->GetType();
// except if the next empty paragraph starts a new redline (e.g. deletion after insertion)
else if ( nRedlPos + 1 < rIDRA.GetRedlineTable().size() )
{
const SwRangeRedline* pNextRedline = rIDRA.GetRedlineTable()[nRedlPos + 1];
- if ( rTextNode.GetIndex() == pNextRedline->Start()->nNode.GetIndex() )
+ if ( rTextNode.GetIndex() == pNextRedline->Start()->GetNodeIndex() )
eRedline = pNextRedline->GetType();
}
}
@@ -563,11 +572,13 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
pFnt->ChgPhysFnt( pSh, *pSh->GetOut() );
Point aPos = getFrameArea().Pos() + getFramePrintArea().Pos();
- const SvxLRSpaceItem &rSpace =
- GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace();
+ const SvxFirstLineIndentItem& rFirstLine(
+ GetTextNodeForParaProps()->GetSwAttrSet().GetFirstLineIndent());
- if ( rSpace.GetTextFirstLineOffset() > 0 )
- aPos.AdjustX(rSpace.GetTextFirstLineOffset() );
+ if (0 < rFirstLine.GetTextFirstLineOffset())
+ {
+ aPos.AdjustX(rFirstLine.GetTextFirstLineOffset());
+ }
std::unique_ptr<SwSaveClip, o3tl::default_delete<SwSaveClip>> xClip;
if( IsUndersized() )
@@ -594,7 +605,8 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
}
// Don't show the paragraph mark for collapsed paragraphs, when they are hidden
- if ( EmptyHeight( ) > 1 )
+ // No paragraph marker in the non-last part of a split fly anchor, either.
+ if ( EmptyHeight( ) > 1 && !HasNonLastSplitFlyDrawObj() )
{
SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), CH_PAR, 0, 1 );
aDrawInf.SetPos( aPos );
@@ -630,19 +642,13 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
return false;
}
-void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& rRect, SwPrintData const*const) const
+void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& rRect) const
{
ResetRepaint();
// #i16816# tagged pdf support
SwViewShell *pSh = getRootFrame()->GetCurrShell();
- Num_Info aNumInfo( *this );
- SwTaggedPDFHelper aTaggedPDFHelperNumbering( &aNumInfo, nullptr, nullptr, rRenderContext );
-
- Frame_Info aFrameInfo( *this );
- SwTaggedPDFHelper aTaggedPDFHelperParagraph( nullptr, &aFrameInfo, nullptr, rRenderContext );
-
if( IsEmpty() && PaintEmpty( rRect, true ) )
return;
@@ -669,6 +675,31 @@ void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
}
}
+ // tdf140219-2.odt text frame with only fly portions and a follow is not
+ // actually a paragraph - delay creating all structured elements to follow.
+ bool const isPDFTaggingEnabled(!HasFollow() || GetPara()->HasContentPortions());
+ ::std::optional<SwTaggedPDFHelper> oTaggedPDFHelperNumbering;
+ if (isPDFTaggingEnabled)
+ {
+ Num_Info aNumInfo(*this);
+ oTaggedPDFHelperNumbering.emplace(&aNumInfo, nullptr, nullptr, rRenderContext);
+ }
+
+ // Lbl unfortunately must be able to contain multiple numbering portions
+ // that may be on multiple lines of text (but apparently always in the
+ // master frame), so it gets complicated.
+ ::std::optional<SwTaggedPDFHelper> oTaggedLabel;
+ // Paragraph tag - if there is a list label, opening should be delayed.
+ ::std::optional<SwTaggedPDFHelper> oTaggedParagraph;
+
+ if (isPDFTaggingEnabled
+ && (GetTextNodeForParaProps()->IsOutline()
+ || !GetPara()->HasNumberingPortion(SwParaPortion::FootnoteToo)))
+ { // no Lbl needed => open paragraph tag now
+ Frame_Info aFrameInfo(*this, false);
+ oTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, rRenderContext);
+ }
+
// We don't want to be interrupted while painting.
// Do that after thr Format()!
TextFrameLockGuard aLock(const_cast<SwTextFrame*>(this));
@@ -753,7 +784,7 @@ void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
{
do
{
- aLine.DrawTextLine( rRect, aClip, IsUndersized() );
+ aLine.DrawTextLine(rRect, aClip, IsUndersized(), oTaggedLabel, oTaggedParagraph, isPDFTaggingEnabled);
} while( aLine.Next() && aLine.Y() <= nBottom );
}
@@ -766,10 +797,14 @@ void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
rRepaint.Clear();
}
+ PaintParagraphStylesHighlighting();
+
const_cast<SwRect&>(rRect) = aOldRect;
OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Paint" );
+ assert(!oTaggedLabel); // must have been closed if opened
+ assert(!isPDFTaggingEnabled || oTaggedParagraph || rRect.GetIntersection(getFrameArea()) != getFrameArea()); // must have been created during complete paint (PDF export is always complete paint)
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */