summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-17 19:11:35 -0400
committerMichael Stahl <mstahl@redhat.com>2014-03-18 20:40:02 +0000
commit7dca4fda3ede573eef6582e71facc95b3f79be55 (patch)
tree42c6ac4978a03833b1541453cbdb470c15df59ac /sw/source/core
parente1823627f35e4419880769fdd05acddbd0a9c25c (diff)
fdo#75260: Improve double line drawing for writer table.
(cherry picked from commit 1c6fb266567c8e397e3c65663b21f0fa50696aa5) (cherry picked from commit 77b6c1602aaa0bd059077765e7fabb53d9e6ddeb) (cherry picked from commit 32391d25293935fbbf0075e3ccf68625951427f0) (cherry picked from commit 24b4fbfa39f212c769bf4d966258a8fb4c98c201) (cherry picked from commit 07909e0045d9f94329861fe2e7b3403a5c4befed) (cherry picked from commit 335470edf00cabb47abb9d7dcc4dd3a5a0e79616) Change-Id: Id350531f09b3ded66fd05ea7ebeefe8771260b62 Reviewed-on: https://gerrit.libreoffice.org/8635 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/layout/paintfrm.cxx70
1 files changed, 19 insertions, 51 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index e6b9a66dcfb0..c2719ddbda05 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2451,9 +2451,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;
@@ -2471,17 +2468,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();
@@ -2593,25 +2579,6 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const
else
pTmpColor = pHCColor;
- // The line sizes stored in the line style have to be adjusted as
- // well. This will guarantee that lines with the same twip size
- // will have the same pixel size.
- for ( int i = 0; i < 7; ++i )
- {
- sal_uInt16 nPrim = aStyles[ i ].Prim();
- sal_uInt16 nDist = aStyles[ i ].Dist();
- sal_uInt16 nSecn = aStyles[ i ].Secn();
-
- if (nPrim > 0)
- nPrim = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nPrim / nPixelSzH ) ) );
- if (nDist > 0)
- nDist = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nDist / nPixelSzH ) ) );
- if (nSecn > 0)
- nSecn = (sal_uInt16)( std::max( 1L, nPixelSzH * ( nSecn / nPixelSzH ) ) );
-
- aStyles[ i ].Set( nPrim, nDist, nSecn );
- }
-
// The (twip) positions will be adjusted to meet these requirements:
// 1. The y coordinates are located in the middle of the pixel grid
// 2. The x coordinated are located at the beginning of the pixel grid
@@ -2669,12 +2636,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(
@@ -2711,7 +2672,6 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const
}
// restore output device:
- rDev.Pop();
rDev.SetDrawMode( nOldDrawMode );
}
@@ -2835,13 +2795,17 @@ void calcOffsetForDoubleLine( SwLineEntryMap& rLines )
for (size_t i = 0; itSet != itSetEnd; ++itSet, ++i)
{
SwLineEntry aLine = *itSet;
- aLine.mnOffset = static_cast<SwTwips>(aLine.maAttribute.Dist());
- aLine.mbOffsetPerp = true;
-
- if (i == 0)
- aLine.mbOffsetStart = true;
- if (i == nEntryCount - 1)
- aLine.mbOffsetEnd = true;
+ if (aLine.maAttribute.Secn())
+ {
+ // Apply offset only for double lines.
+ aLine.mnOffset = static_cast<SwTwips>(aLine.maAttribute.Dist());
+ aLine.mbOffsetPerp = true;
+
+ if (i == 0)
+ aLine.mbOffsetStart = true;
+ if (i == nEntryCount - 1)
+ aLine.mbOffsetEnd = true;
+ }
aNewSet.insert(aLine);
}
@@ -2903,10 +2867,14 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem )
const Fraction& rFracX = rMapMode.GetScaleX();
const Fraction& rFracY = rMapMode.GetScaleY();
- svx::frame::Style aL(rBoxItem.GetLeft(), rFracX);
- svx::frame::Style aR(rBoxItem.GetRight(), rFracY);
- svx::frame::Style aT(rBoxItem.GetTop(), rFracX);
- svx::frame::Style aB(rBoxItem.GetBottom(), rFracY);
+ svx::frame::Style aL(rBoxItem.GetLeft());
+ aL.SetPatternScale(rFracY);
+ svx::frame::Style aR(rBoxItem.GetRight());
+ aR.SetPatternScale(rFracY);
+ svx::frame::Style aT(rBoxItem.GetTop());
+ aT.SetPatternScale(rFracX);
+ svx::frame::Style aB(rBoxItem.GetBottom());
+ aB.SetPatternScale(rFracX);
aR.MirrorSelf();
aB.MirrorSelf();