https://bugs.documentfoundation.org/show_bug.cgi?id=171263
--- Comment #10 from [email protected] <[email protected]> --- SwTextFrame::PaintSwFrame() has this line: SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : nullptr ); but in the PDF export case bOnWin is not set (and IsUndersized() rarely is) so no clipping is done, because aClip is initialized with NULL. That causes SwSaveClip::ChgClip_() to exit early because there is no m_pOut. If we do something like: SwSaveClip aClip( bOnWin || IsUndersized() || pOut->GetConnectMetaFile() ? pOut : nullptr ); to try and capture the PDF export case we do get a good SwSaveClip, but SwTextPainter::DrawTextLine() never actually updates the clip region via SwSaveClip::ChgClip_() because const bool bDrawInWindow = GetInfo().OnWin(); is always false for PDF export, which causes bClip to be false: bool bClip = ( bDrawInWindow || bUnderSized ) && !rClip.IsChg(); and no clipping is added to the metafile for the table cell text. If we do something like this: diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 5ba872f0bc27..e165179f38ba 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -778,7 +779,7 @@ void SwTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& OutputDevice* pOut = aInf.GetOut(); const bool bOnWin = pSh->GetWin() != nullptr; - SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : nullptr ); + SwSaveClip aClip( bOnWin || IsUndersized() || pOut->GetConnectMetaFile() ? pOut : nullptr ); // Output loop: For each Line ... (which is still visible) ... // adapt rRect (Top + 1, Bottom - 1) diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index fc1fbd0cf3e5..7526f7e8b257 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -245,7 +245,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, GetInfo().SetIdx( GetStart() ); GetInfo().SetPos( GetTopLeft() ); - const bool bDrawInWindow = GetInfo().OnWin(); + const bool bDrawInWindow = GetInfo().OnWin() || GetInfo().GetOut()->GetConnectMetaFile(); // 6882: blank lines can't be optimized by removing them if Formatting Marks are shown const bool bEndPor = GetInfo().GetOpt().IsParagraph() && GetInfo().GetText().isEmpty(); Then PDF export works correctly in this case, though I'm unsure what side-effects this might have. Jonathan, can you think of any cases where we *don't* want to clip a text line to the bounding box passed in from it's parent node? -- You are receiving this mail because: You are the assignee for the bug.
