Kaydet (Commit) 2f162197 authored tarafından Armin Le Grand's avatar Armin Le Grand

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
üst 16fd7af9
...@@ -159,11 +159,11 @@ public: ...@@ -159,11 +159,11 @@ public:
/** Constructs an invisible frame style. */ /** Constructs an invisible frame style. */
explicit Style(); explicit Style();
/** Constructs a frame style with passed line widths. */ /** 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. */ /** 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. */ /** 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; } RefMode GetRefMode() const { if(!maImplStyle) return RefMode::Centered; return maImplStyle->meRefMode; }
const Color GetColorPrim() const { if(!maImplStyle) return Color(); return maImplStyle->maColorPrim; } const Color GetColorPrim() const { if(!maImplStyle) return Color(); return maImplStyle->maColorPrim; }
......
...@@ -56,19 +56,21 @@ Style::Style() : ...@@ -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()), maImplStyle(new implStyle()),
mpUsingCell(nullptr) mpUsingCell(nullptr)
{ {
maImplStyle->mnType = nType; maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale;
Set( nP, nD, nS ); 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()), maImplStyle(new implStyle()),
mpUsingCell(nullptr) mpUsingCell(nullptr)
{ {
maImplStyle->mnType = nType; maImplStyle->mnType = nType;
maImplStyle->mfPatternScale = fScale;
Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS );
} }
...@@ -154,6 +156,7 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid ...@@ -154,6 +156,7 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid
const sal_uInt16 nSecn(pBorder->GetInWidth()); const sal_uInt16 nSecn(pBorder->GetInWidth());
pTarget->mnType = pBorder->GetBorderLineStyle(); pTarget->mnType = pBorder->GetBorderLineStyle();
pTarget->mfPatternScale = fScale;
if( !nSecn ) // no or single frame border if( !nSecn ) // no or single frame border
{ {
......
...@@ -132,7 +132,7 @@ void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle ) ...@@ -132,7 +132,7 @@ void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle )
maCoreStyle = SvxBorderLine(); maCoreStyle = SvxBorderLine();
// from twips to points // 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; meState = maUIStyle.IsUsed() ? FrameBorderState::Show : FrameBorderState::Hide;
} }
...@@ -150,7 +150,7 @@ void FrameBorder::SetState( FrameBorderState eState ) ...@@ -150,7 +150,7 @@ void FrameBorder::SetState( FrameBorderState eState )
break; break;
case FrameBorderState::DontCare: case FrameBorderState::DontCare:
maCoreStyle = SvxBorderLine(); 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; break;
} }
} }
...@@ -643,7 +643,7 @@ void FrameSelectorImpl::DrawAllFrameBorders() ...@@ -643,7 +643,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
rRightStyle.GetColorSecn(), rRightStyle.GetColorGap(), rRightStyle.GetColorSecn(), rRightStyle.GetColorGap(),
rRightStyle.UseGapColor(), rRightStyle.UseGapColor(),
rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ), rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ),
rRightStyle.Type( ) ); rRightStyle.Type( ), rRightStyle.PatternScale() );
maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight ); maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight );
maArray.SetRowStyleTop( 0, maTop.GetUIStyle() ); maArray.SetRowStyleTop( 0, maTop.GetUIStyle() );
...@@ -655,7 +655,7 @@ void FrameSelectorImpl::DrawAllFrameBorders() ...@@ -655,7 +655,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
rHorStyle.GetColorSecn(), rHorStyle.GetColorGap(), rHorStyle.GetColorSecn(), rHorStyle.GetColorGap(),
rHorStyle.UseGapColor(), rHorStyle.UseGapColor(),
rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ), rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ),
rHorStyle.Type() ); rHorStyle.Type(), rHorStyle.PatternScale() );
maArray.SetRowStyleTop( 1, rInvertedHor ); maArray.SetRowStyleTop( 1, rInvertedHor );
} }
...@@ -665,7 +665,7 @@ void FrameSelectorImpl::DrawAllFrameBorders() ...@@ -665,7 +665,7 @@ void FrameSelectorImpl::DrawAllFrameBorders()
rBottomStyle.GetColorSecn(), rBottomStyle.GetColorGap(), rBottomStyle.GetColorSecn(), rBottomStyle.GetColorGap(),
rBottomStyle.UseGapColor(), rBottomStyle.UseGapColor(),
rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ), rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ),
rBottomStyle.Type() ); rBottomStyle.Type(), rBottomStyle.PatternScale() );
maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom ); maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom );
for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol ) for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol )
......
...@@ -36,6 +36,7 @@ class FrameBorder ...@@ -36,6 +36,7 @@ class FrameBorder
{ {
public: public:
explicit FrameBorder(FrameBorderType eType); explicit FrameBorder(FrameBorderType eType);
static double GetDefaultPatternScale() { return 0.05; }
FrameBorderType GetType() const FrameBorderType GetType() const
{ {
......
...@@ -2758,20 +2758,11 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte ...@@ -2758,20 +2758,11 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxIte
bool const bVert = mrTabFrame.IsVertical(); bool const bVert = mrTabFrame.IsVertical();
bool const bR2L = mrTabFrame.IsRightToLeft(); bool const bR2L = mrTabFrame.IsRightToLeft();
SwViewShell* pViewShell = mrTabFrame.getRootFrame()->GetCurrShell(); // no scaling needed, it's all in the primitives and the target device
OutputDevice* pOutDev = pViewShell->GetOut(); svx::frame::Style aL(rBoxItem.GetLeft(), 1.0);
const MapMode& rMapMode = pOutDev->GetMapMode(); svx::frame::Style aR(rBoxItem.GetRight(), 1.0);
const Fraction& rFracX = rMapMode.GetScaleX(); svx::frame::Style aT(rBoxItem.GetTop(), 1.0);
const Fraction& rFracY = rMapMode.GetScaleY(); svx::frame::Style aB(rBoxItem.GetBottom(), 1.0);
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);
aR.MirrorSelf(); aR.MirrorSelf();
aB.MirrorSelf(); aB.MirrorSelf();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment