borderline: Fixed PatternScale
The applied PatternScale factor was not consequently used in
svx::frame::Style so that the Previews in the Dialogs look weird.
Fixed that and stumbled over Writer applying it's own scale
which then was leading to double scaling, ceaned that up.
Change-Id: I89f41bfd7884e5e743080301e219491e215054c3
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index 1b130ef..414f23a 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -159,11 +159,11 @@ public:
/** Constructs an invisible frame style. */
explicit Style();
/** Constructs a frame style with passed line widths. */
explicit Style( double nP, double nD, double nS, SvxBorderLineStyle nType );
explicit Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale );
/** Constructs a frame style with passed color and line widths. */
explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType );
explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale );
/** Constructs a frame style from the passed SvxBorderLine struct. */
explicit Style( const editeng::SvxBorderLine* pBorder, double fScale = 1.0 );
explicit Style( const editeng::SvxBorderLine* pBorder, double fScale );
RefMode GetRefMode() const { if(!maImplStyle) return RefMode::Centered; return maImplStyle->meRefMode; }
const Color GetColorPrim() const { if(!maImplStyle) return Color(); return maImplStyle->maColorPrim; }
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index b755443..ea5b333 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -56,19 +56,21 @@ Style::Style() :
{
}
Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType ) :
Style::Style( double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
maImplStyle(new implStyle()),
mpUsingCell(nullptr)
{
maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale;
Set( nP, nD, nS );
}
Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType ) :
Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, SvxBorderLineStyle nType, double fScale ) :
maImplStyle(new implStyle()),
mpUsingCell(nullptr)
{
maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale;
Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS );
}
@@ -154,6 +156,7 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid
const sal_uInt16 nSecn(pBorder->GetInWidth());
pTarget->mnType = pBorder->GetBorderLineStyle();
pTarget->mfPatternScale = fScale;
if( !nSecn ) // no or single frame border
{
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index 9678339..291d479 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -132,7 +132,7 @@ void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle )
maCoreStyle = SvxBorderLine();
// from twips to points
maUIStyle.Set( &maCoreStyle, 0.05, FRAMESEL_GEOM_WIDTH );
maUIStyle.Set( &maCoreStyle, FrameBorder::GetDefaultPatternScale(), FRAMESEL_GEOM_WIDTH );
meState = maUIStyle.IsUsed() ? FrameBorderState::Show : FrameBorderState::Hide;
}
@@ -150,7 +150,7 @@ void FrameBorder::SetState( FrameBorderState eState )
break;
case FrameBorderState::DontCare:
maCoreStyle = SvxBorderLine();
maUIStyle = frame::Style(3, 0, 0, SvxBorderLineStyle::SOLID); //OBJ_FRAMESTYLE_DONTCARE
maUIStyle = frame::Style(3, 0, 0, SvxBorderLineStyle::SOLID, FrameBorder::GetDefaultPatternScale()); //OBJ_FRAMESTYLE_DONTCARE
break;
}
}
@@ -643,7 +643,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
rRightStyle.GetColorSecn(), rRightStyle.GetColorGap(),
rRightStyle.UseGapColor(),
rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ),
rRightStyle.Type( ) );
rRightStyle.Type( ), rRightStyle.PatternScale() );
maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight );
maArray.SetRowStyleTop( 0, maTop.GetUIStyle() );
@@ -655,7 +655,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
rHorStyle.GetColorSecn(), rHorStyle.GetColorGap(),
rHorStyle.UseGapColor(),
rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ),
rHorStyle.Type() );
rHorStyle.Type(), rHorStyle.PatternScale() );
maArray.SetRowStyleTop( 1, rInvertedHor );
}
@@ -665,7 +665,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
rBottomStyle.GetColorSecn(), rBottomStyle.GetColorGap(),
rBottomStyle.UseGapColor(),
rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ),
rBottomStyle.Type() );
rBottomStyle.Type(), rBottomStyle.PatternScale() );
maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom );
for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol )
diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx
index 7e2e73b..62a0d7f 100644
--- a/svx/source/inc/frmselimpl.hxx
+++ b/svx/source/inc/frmselimpl.hxx
@@ -36,6 +36,7 @@ class FrameBorder
{
public:
explicit FrameBorder(FrameBorderType eType);
static double GetDefaultPatternScale() { return 0.05; }
FrameBorderType GetType() const
{
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 89c4351..4098b2a 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2758,20 +2758,11 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte
bool const bVert = mrTabFrame.IsVertical();
bool const bR2L = mrTabFrame.IsRightToLeft();
SwViewShell* pViewShell = mrTabFrame.getRootFrame()->GetCurrShell();
OutputDevice* pOutDev = pViewShell->GetOut();
const MapMode& rMapMode = pOutDev->GetMapMode();
const Fraction& rFracX = rMapMode.GetScaleX();
const Fraction& rFracY = rMapMode.GetScaleY();
svx::frame::Style aL(rBoxItem.GetLeft(), rFracY);
// aL.SetPatternScale(rFracY);
svx::frame::Style aR(rBoxItem.GetRight(), rFracY);
// aR.SetPatternScale(rFracY);
svx::frame::Style aT(rBoxItem.GetTop(), rFracX);
// aT.SetPatternScale(rFracX);
svx::frame::Style aB(rBoxItem.GetBottom(), rFracX);
// aB.SetPatternScale(rFracX);
// no scaling needed, it's all in the primitives and the target device
svx::frame::Style aL(rBoxItem.GetLeft(), 1.0);
svx::frame::Style aR(rBoxItem.GetRight(), 1.0);
svx::frame::Style aT(rBoxItem.GetTop(), 1.0);
svx::frame::Style aB(rBoxItem.GetBottom(), 1.0);
aR.MirrorSelf();
aB.MirrorSelf();