From d2eb2c5a02718b83475bc718e117eb6255cbac98 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 17 Mar 2014 19:41:07 -0400 Subject: 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 --- sw/source/core/layout/paintfrm.cxx | 42 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 41aadc1115f0..57d662d23b53 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() ) -- cgit v1.2.3