summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/dialog/framelink.cxx53
1 files changed, 29 insertions, 24 deletions
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 82683743302c..28383a920456 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1126,7 +1126,7 @@ void lclDrawDiagFrameBorders(
Style::Style() :
meRefMode(REFMODE_CENTERED),
- mfScale(1.0),
+ mfPatternScale(1.0),
mnType(table::BorderLineStyle::SOLID)
{
Clear();
@@ -1134,7 +1134,7 @@ Style::Style() :
Style::Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) :
meRefMode(REFMODE_CENTERED),
- mfScale(1.0),
+ mfPatternScale(1.0),
mnType(nType)
{
Clear();
@@ -1144,7 +1144,7 @@ Style::Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) :
Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor,
double nP, double nD, double nS, editeng::SvxBorderStyle nType ) :
meRefMode(REFMODE_CENTERED),
- mfScale(1.0),
+ mfPatternScale(1.0),
mnType(nType)
{
Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS );
@@ -1152,21 +1152,26 @@ Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rCo
Style::Style( const editeng::SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth ) :
meRefMode(REFMODE_CENTERED),
- mfScale(fScale)
+ mfPatternScale(fScale)
{
Set( rBorder, fScale, nMaxWidth );
}
Style::Style( const editeng::SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth ) :
meRefMode(REFMODE_CENTERED),
- mfScale(fScale)
+ mfPatternScale(fScale)
{
Set( pBorder, fScale, nMaxWidth );
}
-double Style::Scale() const
+double Style::PatternScale() const
{
- return mfScale;
+ return mfPatternScale;
+}
+
+void Style::SetPatternScale( double fScale )
+{
+ mfPatternScale = fScale;
}
void Style::Clear()
@@ -1183,9 +1188,9 @@ void Style::Set( double nP, double nD, double nS )
>0 0 >0 nP 0 0
>0 >0 >0 nP nD nS
*/
- mnPrim = rtl::math::round(nP ? nP : nS, 2);
- mnDist = rtl::math::round((nP && nS) ? nD : 0, 2);
- mnSecn = rtl::math::round((nP && nD) ? nS : 0, 2);
+ mfPrim = rtl::math::round(nP ? nP : nS, 2);
+ mfDist = rtl::math::round((nP && nS) ? nD : 0, 2);
+ mfSecn = rtl::math::round((nP && nD) ? nS : 0, 2);
}
void Style::Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS )
@@ -1219,29 +1224,29 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid
// Enlarge the style if distance is too small due to rounding losses.
double nPixWidth = SCALEVALUE( nPrim + nDist + nSecn );
if( nPixWidth > GetWidth() )
- mnDist = nPixWidth - mnPrim - mnSecn;
+ mfDist = nPixWidth - mfPrim - mfSecn;
// Shrink the style if it is too thick for the control.
while( GetWidth() > nMaxWidth )
{
// First decrease space between lines.
- if( mnDist )
- --mnDist;
+ if( mfDist )
+ --mfDist;
// Still too thick? Decrease the line widths.
if( GetWidth() > nMaxWidth )
{
- if( rtl::math::approxEqual(mnPrim, 0.0) && rtl::math::approxEqual(mnPrim, mnSecn) )
+ if( rtl::math::approxEqual(mfPrim, 0.0) && rtl::math::approxEqual(mfPrim, mfSecn) )
{
// Both lines equal - decrease both to keep symmetry.
- --mnPrim;
- --mnSecn;
+ --mfPrim;
+ --mfSecn;
}
else
{
// Decrease each line for itself
- if( mnPrim )
- --mnPrim;
- if( (GetWidth() > nMaxWidth) && !rtl::math::approxEqual(mnSecn, 0.0) )
- --mnSecn;
+ if( mfPrim )
+ --mfPrim;
+ if( (GetWidth() > nMaxWidth) && !rtl::math::approxEqual(mfSecn, 0.0) )
+ --mfSecn;
}
}
}
@@ -1261,8 +1266,8 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid
Style& Style::MirrorSelf()
{
- if( mnSecn )
- std::swap( mnPrim, mnSecn );
+ if( mfSecn )
+ std::swap( mfPrim, mfSecn );
if( meRefMode != REFMODE_CENTERED )
meRefMode = (meRefMode == REFMODE_BEGIN) ? REFMODE_END : REFMODE_BEGIN;
return *this;
@@ -1429,7 +1434,7 @@ drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives (
rBorder.GetColorSecn().getBColor(),
rBorder.GetColorPrim().getBColor(),
rBorder.GetColorGap().getBColor(),
- rBorder.UseGapColor(), rBorder.Type(), rBorder.Scale() );
+ rBorder.UseGapColor(), rBorder.Type(), rBorder.PatternScale() );
return aSequence;
}
@@ -1457,7 +1462,7 @@ drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
rBorder.GetColorSecn().getBColor(),
rBorder.GetColorPrim().getBColor(),
rBorder.GetColorGap().getBColor(),
- rBorder.UseGapColor(), rBorder.Type(), rBorder.Scale() );
+ rBorder.UseGapColor(), rBorder.Type(), rBorder.PatternScale() );
return aSequence;
}