svx/source/dialog/framelink.cxx | 18 -------- sw/source/core/layout/paintfrm.cxx | 76 ++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 51 deletions(-)
New commits: commit d0bbbfdef6b31650a351883de09b5338562048a2 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 27 23:10:00 2012 +0200 fdo#39415: sw: fix vertical collapsing border painting: For borders in vertically oriented text it's necessary to correct positions at different sides, i.e., right and left instead of top and bottom; refactor SwTabFrmPainter::Insert some more to handle this properly. Change-Id: If20b9477415e9bd12e63aab4eed2f070065eb473 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 133a6c2..d880a62 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2710,42 +2710,44 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) bool const bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( mrTabFrm, rFrm, rBoxItem)); - - // these are positions of the lines - const SwTwips nLeft = aBorderRect._Left(); - const SwTwips nRight = aBorderRect._Right(); - const SwTwips nTop = aBorderRect._Top(); - const SwTwips nBottom = aBorderRect._Bottom(); + bool const bVert = mrTabFrm.IsVertical(); + bool const bR2L = mrTabFrm.IsRightToLeft(); svx::frame::Style aL( rBoxItem.GetLeft() ); svx::frame::Style aR( rBoxItem.GetRight() ); svx::frame::Style aT( rBoxItem.GetTop() ); svx::frame::Style aB( rBoxItem.GetBottom() ); + aR.MirrorSelf(); + aB.MirrorSelf(); + const SwTwips nHalfBottomWidth = aB.GetWidth() / 2; const SwTwips nHalfTopWidth = (bBottomAsTop) ? nHalfBottomWidth : aT.GetWidth() / 2; - aR.MirrorSelf(); - aB.MirrorSelf(); - - bool bVert = mrTabFrm.IsVertical(); - bool bR2L = mrTabFrm.IsRightToLeft(); + // these are positions of the lines + const SwTwips nLeft = + aBorderRect._Left() - ((bVert) ? nHalfBottomWidth : 0); + const SwTwips nRight = + aBorderRect._Right() - ((bVert) ? nHalfTopWidth : 0); + const SwTwips nTop = + aBorderRect._Top() + ((bVert) ? 0 : nHalfTopWidth); + const SwTwips nBottom = + aBorderRect._Bottom()+ ((bVert) ? 0 : nHalfBottomWidth); aL.SetRefMode( svx::frame::REFMODE_CENTERED ); aR.SetRefMode( svx::frame::REFMODE_CENTERED ); aT.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END ); aB.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END ); - SwLineEntry aLeft ( nLeft, nTop + nHalfTopWidth, - nBottom + nHalfBottomWidth, bVert ? aB : ( bR2L ? aR : aL ) ); - SwLineEntry aRight ( nRight, nTop + nHalfTopWidth, - nBottom + nHalfBottomWidth, - bVert ? ((bBottomAsTop) ? aB : aT) : ( bR2L ? aL : aR ) ); - SwLineEntry aTop ( nTop + nHalfTopWidth, - nLeft, nRight, bVert ? aL : ((bBottomAsTop) ? aB : aT) ); - SwLineEntry aBottom( nBottom + nHalfBottomWidth, - nLeft, nRight, bVert ? aR : aB ); + SwLineEntry aLeft (nLeft, nTop, nBottom, + (bVert) ? aB : ((bR2L) ? aR : aL)); + SwLineEntry aRight (nRight, nTop, nBottom, + (bVert) ? ((bBottomAsTop) ? aB : aT) : ((bR2L) ? aL : aR)); + SwLineEntry aTop (nTop, nLeft, nRight, + (bVert) ? aL : ((bBottomAsTop) ? aB : aT)); + SwLineEntry aBottom(nBottom, nLeft, nRight, + (bVert) ? aR : aB); Insert( aLeft, false ); Insert( aRight, false ); commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 27 20:51:24 2012 +0200 fdo#39415: sw: fix collapsing border painting more: There is a special case for i#9860, which is for first line in follow table (i.e. continued on new page) without repeated headlines: Here the bottom border of the cell is used as the top border in case the cell does not have a top border; this is fixed now with a bit of refactoring, so the correct half width adjustment can be made. Change-Id: I58ef81b7e13544014ef75973ea793f673a242488 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index ca3d761..133a6c2 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2680,6 +2680,24 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, } } +// special case: #i9860# +// first line in follow table without repeated headlines +static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( + SwTabFrm const& rTabFrm, SwFrm const& rFrm, SvxBoxItem const& rBoxItem) +{ + SwRowFrm const*const pThisRowFrm = + dynamic_cast<const SwRowFrm*>(rFrm.GetUpper()); + return (pThisRowFrm + && (pThisRowFrm->GetUpper() == &rTabFrm) + && rTabFrm.IsFollow() + && !rTabFrm.GetTable()->GetRowsToRepeat() + && ( !pThisRowFrm->GetPrev() + || static_cast<const SwRowFrm*>(pThisRowFrm->GetPrev()) + ->IsRowSpanLine()) + && !rBoxItem.GetTop() + && rBoxItem.GetBottom()); +} + void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) { // build 4 line entries for the 4 borders: @@ -2690,6 +2708,10 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) aBorderRect.Pos() += rFrm.Frm().Pos(); } + bool const bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( + mrTabFrm, rFrm, rBoxItem)); + + // these are positions of the lines const SwTwips nLeft = aBorderRect._Left(); const SwTwips nRight = aBorderRect._Right(); const SwTwips nTop = aBorderRect._Top(); @@ -2700,8 +2722,9 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) svx::frame::Style aT( rBoxItem.GetTop() ); svx::frame::Style aB( rBoxItem.GetBottom() ); - const SwTwips nHalfTopWidth = aT.GetWidth() / 2; const SwTwips nHalfBottomWidth = aB.GetWidth() / 2; + const SwTwips nHalfTopWidth = (bBottomAsTop) + ? nHalfBottomWidth : aT.GetWidth() / 2; aR.MirrorSelf(); aB.MirrorSelf(); @@ -2717,9 +2740,10 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) SwLineEntry aLeft ( nLeft, nTop + nHalfTopWidth, nBottom + nHalfBottomWidth, bVert ? aB : ( bR2L ? aR : aL ) ); SwLineEntry aRight ( nRight, nTop + nHalfTopWidth, - nBottom + nHalfBottomWidth, bVert ? aT : ( bR2L ? aL : aR ) ); + nBottom + nHalfBottomWidth, + bVert ? ((bBottomAsTop) ? aB : aT) : ( bR2L ? aL : aR ) ); SwLineEntry aTop ( nTop + nHalfTopWidth, - nLeft, nRight, bVert ? aL : aT ); + nLeft, nRight, bVert ? aL : ((bBottomAsTop) ? aB : aT) ); SwLineEntry aBottom( nBottom + nHalfBottomWidth, nLeft, nRight, bVert ? aR : aB ); @@ -2727,22 +2751,6 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) Insert( aRight, false ); Insert( aTop, true ); Insert( aBottom, true ); - - const SwRowFrm* pThisRowFrm = dynamic_cast<const SwRowFrm*>(rFrm.GetUpper()); - - // special case: #i9860# - // first line in follow table without repeated headlines - if ( pThisRowFrm && - pThisRowFrm->GetUpper() == &mrTabFrm && - mrTabFrm.IsFollow() && - !mrTabFrm.GetTable()->GetRowsToRepeat() && - (!pThisRowFrm->GetPrev() || static_cast<const SwRowFrm*>(pThisRowFrm->GetPrev())->IsRowSpanLine()) && - !rBoxItem.GetTop() && - rBoxItem.GetBottom() ) - { - SwLineEntry aFollowTop( !bVert ? nTop : nRight, !bVert ? nLeft : nTop, !bVert ? nRight : nBottom, aB ); - Insert( aFollowTop, !bVert ); - } } void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) commit aa8240e80394887a4af45710de69aacacec66d25 Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 27 15:58:16 2012 +0200 fdo#39415: sw: fix collapsing border painting: In a table with collapsing borders, the horizontal borders need to be painted "below" the reference line, and not "centered" on the line like the vertical borders. a0486f02433703744f487e599422714d03937956 was apparently an attempt to fix this, but unfortunately it adjusted both top and bottom borders with the top border width, which has horrible results if the top and bottom borders have different widths. Change-Id: I7605eda6ef8111612ceb1ded79c0811de9ca7b25 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5f8ee13..ca3d761 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2701,6 +2701,7 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) svx::frame::Style aB( rBoxItem.GetBottom() ); const SwTwips nHalfTopWidth = aT.GetWidth() / 2; + const SwTwips nHalfBottomWidth = aB.GetWidth() / 2; aR.MirrorSelf(); aB.MirrorSelf(); @@ -2713,10 +2714,14 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) aT.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END ); aB.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END ); - SwLineEntry aLeft ( nLeft, nTop + nHalfTopWidth, nBottom + nHalfTopWidth, bVert ? aB : ( bR2L ? aR : aL ) ); - SwLineEntry aRight ( nRight, nTop + nHalfTopWidth, nBottom + nHalfTopWidth, bVert ? aT : ( bR2L ? aL : aR ) ); - SwLineEntry aTop ( nTop + nHalfTopWidth, nLeft, nRight, bVert ? aL : aT ); - SwLineEntry aBottom( nBottom + nHalfTopWidth, nLeft, nRight, bVert ? aR : aB ); + SwLineEntry aLeft ( nLeft, nTop + nHalfTopWidth, + nBottom + nHalfBottomWidth, bVert ? aB : ( bR2L ? aR : aL ) ); + SwLineEntry aRight ( nRight, nTop + nHalfTopWidth, + nBottom + nHalfBottomWidth, bVert ? aT : ( bR2L ? aL : aR ) ); + SwLineEntry aTop ( nTop + nHalfTopWidth, + nLeft, nRight, bVert ? aL : aT ); + SwLineEntry aBottom( nBottom + nHalfBottomWidth, + nLeft, nRight, bVert ? aR : aB ); Insert( aLeft, false ); Insert( aRight, false ); commit 30f76f083a6b587d0069f175fa24f3c0dafb051c Author: Michael Stahl <mst...@redhat.com> Date: Tue Jun 26 20:41:56 2012 +0200 SwTabFrmPainter::Insert: remove clutter Change-Id: I2390151acf1c71f9ad7416357b5b34230c9672a6 diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f7c483d..5f8ee13 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2682,11 +2682,6 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) { - std::vector< const SwFrm* > aTestVec; - aTestVec.push_back( &rFrm ); - aTestVec.push_back( &rFrm ); - aTestVec.push_back( &rFrm ); - // build 4 line entries for the 4 borders: SwRect aBorderRect = rFrm.Frm(); if ( rFrm.IsTabFrm() ) commit 233431e09ef85cb3579e55bd2a8d1f9d7439f8da Author: Michael Stahl <mst...@redhat.com> Date: Wed Jun 27 14:22:20 2012 +0200 remove obsolete SVX_FRAME_USE_LINEINFO: the code using that was removed in 7db30f7aa037f52eb07cbb4fd2796bd869204af8. Change-Id: I384d4c9850c7a3f2111827407106137ff0f93236 diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index 8e38b61..63ac882 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -33,25 +33,8 @@ #include <editeng/borderline.hxx> #include <svtools/borderhelper.hxx> -// ---------------------------------------------------------------------------- - -/** Define to select the drawing mode of thin dotted lines. - - 0 = Draw lines using an own implementation (recommended). Draws always - little dots in an appropriate distance. - 1 = Draw dotted lines using vcl/LineInfo. Results in dashed lines instead - of dotted lines, which may look ugly for diagonal lines. - */ -#define SVX_FRAME_USE_LINEINFO 0 - -// ---------------------------------------------------------------------------- - -#if SVX_FRAME_USE_LINEINFO -#include <vcl/lineinfo.hxx> -#else #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#endif #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> #include <drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx> @@ -62,7 +45,6 @@ namespace svx { namespace frame { // ============================================================================ -// ============================================================================ namespace { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits