summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drawinglayer/source/primitive2d/borderlineprimitive2d.cxx56
-rw-r--r--include/svx/framelink.hxx19
-rw-r--r--svx/source/dialog/framelink.cxx53
-rw-r--r--sw/source/core/layout/paintfrm.cxx70
4 files changed, 84 insertions, 114 deletions
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 67efa09da581..7b9348dc6fec 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -183,37 +183,33 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive(
xRetval.realloc(2);
- {
- // "inside" line
- double fWidth = getLeftWidth();
- basegfx::BColor aColor = getRGBColorLeft();
- bool bIsHairline = lcl_UseHairline(
- fWidth, getStart(), getEnd(), rViewInformation);
- fWidth = lcl_GetCorrectedWidth(fWidth,
- getStart(), getEnd(), rViewInformation);
-
- if (bIsHairline)
- xRetval[0] = makeHairLinePrimitive(getStart(), getEnd(), aVector, aColor, 0.0);
- else
- xRetval[0] = makeSolidLinePrimitive(
- aClipRegion, aTmpStart, aTmpEnd, aVector, aColor, fWidth, 0.0);
- }
+ double fLeftWidth = getLeftWidth();
+ bool bLeftHairline = lcl_UseHairline(fLeftWidth, getStart(), getEnd(), rViewInformation);
+ if (bLeftHairline)
+ fLeftWidth = 0.0;
- {
- // "outside" line
- double fWidth = getRightWidth();
- basegfx::BColor aColor = getRGBColorRight();
- bool bIsHairline = lcl_UseHairline(
- fWidth, getStart(), getEnd(), rViewInformation);
- fWidth = lcl_GetCorrectedWidth(fWidth,
- getStart(), getEnd(), rViewInformation);
-
- if (bIsHairline)
- xRetval[1] = makeHairLinePrimitive(getStart(), getEnd(), aVector, aColor, mfDistance);
- else
- xRetval[1] = makeSolidLinePrimitive(
- aClipRegion, aTmpStart, aTmpEnd, aVector, aColor, fWidth, mfDistance);
- }
+ double fRightWidth = getRightWidth();
+ bool bRightHairline = lcl_UseHairline(fRightWidth, getStart(), getEnd(), rViewInformation);
+ if (bRightHairline)
+ fRightWidth = 0.0;
+
+ // "inside" line
+
+ if (bLeftHairline)
+ xRetval[0] = makeHairLinePrimitive(
+ getStart(), getEnd(), aVector, getRGBColorLeft(), 0.0);
+ else
+ xRetval[0] = makeSolidLinePrimitive(
+ aClipRegion, aTmpStart, aTmpEnd, aVector, getRGBColorLeft(), fLeftWidth, -fLeftWidth/2.0);
+
+ // "outside" line
+
+ if (bRightHairline)
+ xRetval[1] = makeHairLinePrimitive(
+ getStart(), getEnd(), aVector, getRGBColorRight(), fLeftWidth+mfDistance);
+ else
+ xRetval[1] = makeSolidLinePrimitive(
+ aClipRegion, aTmpStart, aTmpEnd, aVector, getRGBColorRight(), fRightWidth, mfDistance+fRightWidth/2.0);
}
else
{
diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index afae83e428e7..708643811eda 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -124,14 +124,15 @@ public:
inline const Color& GetColorSecn() const { return maColorSecn; }
inline const Color& GetColorGap() const { return maColorGap; }
inline bool UseGapColor() const { return mbUseGapColor; }
- inline double Prim() const { return mnPrim; }
- inline double Dist() const { return mnDist; }
- inline double Secn() const { return mnSecn; }
- double Scale() const;
+ inline double Prim() const { return mfPrim; }
+ inline double Dist() const { return mfDist; }
+ inline double Secn() const { return mfSecn; }
+ double PatternScale() const;
+ void SetPatternScale( double fScale );
inline editeng::SvxBorderStyle Type() const { return mnType; }
/** Returns the total width of this frame style. */
- inline double GetWidth() const { return mnPrim + mnDist + mnSecn; }
+ inline double GetWidth() const { return mfPrim + mfDist + mfSecn; }
/** Sets the frame style to invisible state. */
void Clear();
@@ -165,10 +166,10 @@ private:
Color maColorGap;
bool mbUseGapColor;
RefMode meRefMode; /// Reference point handling for this frame border.
- double mnPrim; /// Width of primary (single, left, or top) line.
- double mnDist; /// Distance between primary and secondary line.
- double mnSecn; /// Width of secondary (right or bottom) line.
- double mfScale;
+ double mfPrim; /// Width of primary (single, left, or top) line.
+ double mfDist; /// Distance between primary and secondary line.
+ double mfSecn; /// Width of secondary (right or bottom) line.
+ double mfPatternScale; /// Scale used for line pattern spacing.
editeng::SvxBorderStyle mnType;
};
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;
}
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();