sw/source/core/layout/paintfrm.cxx | 63 +++++++++++++++---------------------- 1 file changed, 27 insertions(+), 36 deletions(-)
New commits: commit d2eb2c5a02718b83475bc718e117eb6255cbac98 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon Mar 17 19:41:07 2014 -0400 fdo#76195: Set the border type to NONE to ensure it won't be drawn. We can no longer rely on the width being zero for no border condition. Change-Id: I02c5c825661b4a0aa4190306e8276bdfd8bff944 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 41aadc1..57d662d 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -108,13 +108,6 @@ using ::drawinglayer::primitive2d::BorderLinePrimitive2D; using ::std::pair; using ::std::make_pair; -//subsidiary lines enabled? -#define IS_SUBS_TABLE \ - (pGlobalShell->GetViewOptions()->IsTable() && \ - !pGlobalShell->GetViewOptions()->IsPagePreview()&&\ - !pGlobalShell->GetViewOptions()->IsReadonly()&&\ - !pGlobalShell->GetViewOptions()->IsFormView() &&\ - SwViewOption::IsTableBoundaries()) //other subsidiary lines enabled? #define IS_SUBS (!pGlobalShell->GetViewOptions()->IsPagePreview() && \ !pGlobalShell->GetViewOptions()->IsReadonly() && \ @@ -260,6 +253,27 @@ static sal_Bool bTableHack = sal_False; //To optimize the expensive RetouchColor determination Color aGlobalRetoucheColor; +namespace { + +bool isTableBoundariesEnabled() +{ + if (!pGlobalShell->GetViewOptions()->IsTable()) + return false; + + if (pGlobalShell->GetViewOptions()->IsPagePreview()) + return false; + + if (pGlobalShell->GetViewOptions()->IsReadonly()) + return false; + + if (pGlobalShell->GetViewOptions()->IsFormView()) + return false; + + return SwViewOption::IsTableBoundaries(); +} + +} + // Set borders alignment statics. // adjustment for 'small' twip-to-pixel relations: // For 'small' twip-to-pixel relations (less then 2:1) @@ -2540,8 +2554,10 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const const Color* pTmpColor = 0; if (0 == aStyles[ 0 ].GetWidth()) { - if (IS_SUBS_TABLE && pGlobalShell->GetWin()) + if (isTableBoundariesEnabled() && pGlobalShell->GetWin()) aStyles[ 0 ].Set( rCol, rCol, rCol, false, 1, 0, 0 ); + else + aStyles[0].SetType(table::BorderLineStyle::NONE); } else pTmpColor = pHCColor; @@ -4242,12 +4258,8 @@ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const PaintShadow( rRect, aRect, rAttrs ); } - if (pViewOption->IsTableBoundaries()) - { - // fdo#75118 Paint border lines only when it's enabled. - SwTabFrmPainter aHelper(*this); - aHelper.PaintLines(*pGlobalShell->GetOut(), rRect); - } + SwTabFrmPainter aHelper(*this); + aHelper.PaintLines(*pGlobalShell->GetOut(), rRect); } SwLayoutFrm::Paint( rRect ); @@ -6482,7 +6494,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, /// Refreshes all subsidiary lines of a page. void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const { - if ( IS_SUBS || IS_SUBS_TABLE || IS_SUBS_SECTION || IS_SUBS_FLYS ) + if ( IS_SUBS || isTableBoundariesEnabled() || IS_SUBS_SECTION || IS_SUBS_FLYS ) { SwRect aRect( rRect ); if ( aRect.HasArea() ) commit 1c6fb266567c8e397e3c65663b21f0fa50696aa5 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Mon Mar 17 19:11:35 2014 -0400 fdo#75260: These old hacks no longer make sense. The clip region in fact cuts off the lower part of the bottom border, both on screen and when printing / exporting to PDF. Change-Id: Id350531f09b3ded66fd05ea7ebeefe8771260b62 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 120634e..41aadc1 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2420,9 +2420,6 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const // #i16816# tagged pdf support SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, rDev ); - const SwFrm* pTmpFrm = &mrTabFrm; - const bool bVert = pTmpFrm->IsVertical(); - SwLineEntryMapConstIter aIter = maHoriLines.begin(); bool bHori = true; @@ -2440,17 +2437,6 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const rDev.SetDrawMode( 0 ); } - // set clip region: - rDev.Push( PUSH_CLIPREGION ); - Size aSize( rRect.SSize() ); - // Hack! Necessary, because the layout is not pixel aligned! - aSize.Width() += nPixelSzW; aSize.Height() += nPixelSzH; - rDev.SetClipRegion(Region(Rectangle(rRect.Pos(), aSize))); - - // The following stuff is necessary to have the new table borders fit - // into a ::SwAlignRect adjusted world. - const SwTwips nTwipXCorr = bVert ? 0 : std::max( 0L, nHalfPixelSzW - 2 ); // 1 < 2 < 3 ;-) - const SwTwips nTwipYCorr = !bVert ? 0 : std::max( 0L, nHalfPixelSzW - 2 ); // 1 < 2 < 3 ;-) const SwFrm* pUpper = mrTabFrm.GetUpper(); SwRect aUpper( pUpper->Prt() ); aUpper.Pos() += pUpper->Frm().Pos(); @@ -2636,12 +2622,6 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const aPaintEnd.Y() += static_cast<long>(offsetEnd + 0.5); } - aPaintStart.X() -= nTwipXCorr; // nHalfPixelSzW - 2 to assure that we do not leave the pixel - aPaintEnd.X() -= nTwipXCorr; - aPaintStart.Y() -= nTwipYCorr; - aPaintEnd.Y() -= nTwipYCorr; - - // Here comes the painting stuff: Thank you, DR, great job!!! if (bHori) { mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives( @@ -2678,7 +2658,6 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const } // restore output device: - rDev.Pop(); rDev.SetDrawMode( nOldDrawMode ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits