summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-06-27 20:51:24 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-28 14:21:03 +0200
commitaee5c2ec17ffdfacc9190f6467d7ecc291ac8e3d (patch)
tree7a24ad93b72fe04c32738e94ec9e934add125291 /sw
parent426dec966e09c0a43d00b80a4bd262d64ea208ee (diff)
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 (cherry picked from commit 3a4b7c3555f2ffb4e89502bb04ff063d8c08f628) Signed-off-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/paintfrm.cxx46
1 files changed, 27 insertions, 19 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 36e4d8b035af..9ecd59a4ff4e 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2681,6 +2681,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 )
{
std::vector< const SwFrm* > aTestVec;
@@ -2696,6 +2714,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();
@@ -2706,8 +2728,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();
@@ -2723,9 +2746,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 );
@@ -2733,22 +2757,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 )