summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-06 19:23:59 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-03-19 17:57:15 +0100
commit83e1130832dfb5a55b3e8e1cc17bb49dd60a865f (patch)
tree53ee1be88da1171cd51ceb4c38c52654308d3949
parentWaE: missing format string (diff)
downloadcore-83e1130832dfb5a55b3e8e1cc17bb49dd60a865f.tar.gz
core-83e1130832dfb5a55b3e8e1cc17bb49dd60a865f.zip
Nicely draw borders using drawinglayer
-rwxr-xr-xdrawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx49
-rwxr-xr-xdrawinglayer/source/primitive2d/borderlineprimitive2d.cxx355
-rwxr-xr-xediteng/inc/editeng/borderline.hxx40
-rw-r--r--editeng/source/items/frmitems.cxx173
-rwxr-xr-xsvx/inc/svx/framelink.hxx55
-rwxr-xr-xsvx/inc/svx/sdr/contact/objectcontacttools.hxx3
-rwxr-xr-xsvx/source/dialog/framelink.cxx198
-rwxr-xr-xsvx/source/dialog/frmsel.cxx28
-rwxr-xr-xsvx/source/inc/frmselimpl.hxx4
-rwxr-xr-xsvx/source/table/svdotable.cxx6
-rwxr-xr-xsvx/source/table/viewcontactoftableobj.cxx208
11 files changed, 779 insertions, 340 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 2bc5ba4db08c..12cdbbe21009 100755
--- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -32,6 +32,7 @@
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <basegfx/color/bcolor.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -60,13 +61,17 @@ namespace drawinglayer
double mfRightWidth;
/// edge overlap sizes
- double mfExtendInnerStart;
- double mfExtendInnerEnd;
- double mfExtendOuterStart;
- double mfExtendOuterEnd;
+ double mfExtendLeftStart;
+ double mfExtendLeftEnd;
+ double mfExtendRightStart;
+ double mfExtendRightEnd;
+
+ /// the line colors
+ basegfx::BColor maRGBColorRight;
+ basegfx::BColor maRGBColorLeft;
+ basegfx::BColor maRGBColorGap;
+ bool mbHasGapColor;
- /// the line color
- basegfx::BColor maRGBColor;
short mnStyle;
/// bitfield
@@ -115,6 +120,8 @@ namespace drawinglayer
return !basegfx::fTools::equalZero(mfRightWidth);
}
+ basegfx::B2DPolyPolygon getClipPolygon( ) const;
+
protected:
/// create local decomposition
virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
@@ -127,13 +134,14 @@ namespace drawinglayer
double fLeftWidth,
double fDistance,
double fRightWidth,
- double fExtendInnerStart,
- double fExtendInnerEnd,
- double fExtendOuterStart,
- double fExtendOuterEnd,
- bool bCreateInside,
- bool bCreateOutside,
- const basegfx::BColor& rRGBColor,
+ double fExtendLeftStart,
+ double fExtendLeftEnd,
+ double fExtendRightStart,
+ double fExtendRightEnd,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
const short nStyle );
/// data read access
@@ -142,13 +150,14 @@ namespace drawinglayer
double getLeftWidth() const { return mfLeftWidth; }
double getDistance() const { return mfDistance; }
double getRightWidth() const { return mfRightWidth; }
- double getExtendInnerStart() const { return mfExtendInnerStart; }
- double getExtendInnerEnd() const { return mfExtendInnerEnd; }
- double getExtendOuterStart() const { return mfExtendOuterStart; }
- double getExtendOuterEnd() const { return mfExtendOuterEnd; }
- bool getCreateInside() const { return mbCreateInside; }
- bool getCreateOutside() const { return mbCreateOutside; }
- const basegfx::BColor& getRGBColor () const { return maRGBColor; }
+ double getExtendLeftStart() const { return mfExtendLeftStart; }
+ double getExtendLeftEnd() const { return mfExtendLeftEnd; }
+ double getExtendRightStart() const { return mfExtendRightStart; }
+ double getExtendRightEnd() const { return mfExtendRightEnd; }
+ const basegfx::BColor& getRGBColorRight () const { return maRGBColorRight; }
+ const basegfx::BColor& getRGBColorLeft () const { return maRGBColorLeft; }
+ const basegfx::BColor& getRGBColorGap () const { return maRGBColorGap; }
+ bool hasGapColor( ) const { return mbHasGapColor; }
short getStyle () const { return mnStyle; }
/// compare operator
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 8a7d8b297a90..90e150c461eb 100755
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -32,10 +32,12 @@
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <svtools/borderhelper.hxx>
#include <numeric>
+#include <algorithm>
//////////////////////////////////////////////////////////////////////////////
@@ -43,146 +45,220 @@ namespace drawinglayer
{
namespace primitive2d
{
+ basegfx::B2DPolyPolygon BorderLinePrimitive2D::getClipPolygon( ) const
+ {
+ basegfx::B2DPolygon clipPolygon;
+
+ // Get the vectors
+ basegfx::B2DVector aVector( getEnd() - getStart() );
+ aVector.normalize();
+ const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector));
+
+ // Get the points
+ const basegfx::B2DVector aLeftOff(aPerpendicular * (-0.5 * (getWidth())));
+ const basegfx::B2DVector aRightOff(aPerpendicular * (0.5 * (getWidth())));
+ clipPolygon.append( basegfx::B2DPoint(getStart() + aLeftOff - (getExtendLeftStart() * aVector)) );
+ clipPolygon.append( getStart( ) );
+ clipPolygon.append( basegfx::B2DPoint(getStart() + aRightOff - (getExtendRightStart() * aVector)) );
+ clipPolygon.append( basegfx::B2DPoint(getEnd() + aRightOff + (getExtendRightEnd() * aVector)) );
+ clipPolygon.append( getEnd( ) );
+ clipPolygon.append( basegfx::B2DPoint(getEnd() + aLeftOff + (getExtendLeftEnd() * aVector)) );
+
+ clipPolygon.setClosed( true );
+
+ return basegfx::B2DPolyPolygon( clipPolygon );
+ }
+
Primitive2DSequence BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
Primitive2DSequence xRetval;
- if(!getStart().equal(getEnd()) && (getCreateInside() || getCreateOutside()))
- {
- if(isInsideUsed())
+ if(!getStart().equal(getEnd()) && getWidth() > 0)
+ {
+ // get data and vectors
+ const double fWidth(getWidth());
+ basegfx::B2DVector aVector(getEnd() - getStart());
+ aVector.normalize();
+ const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector));
+
+ const basegfx::B2DPolyPolygon& aClipRegion = getClipPolygon( );
+
+ if(isOutsideUsed() && isInsideUsed())
{
- // get data and vectors
- const double fWidth(getWidth());
- basegfx::B2DVector aVector(getEnd() - getStart());
- aVector.normalize();
- const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector));
+ double startMax = std::max( getExtendLeftStart(), std::max( getExtendRightStart(), 0.0 ) );
+ double endMax = std::max( getExtendLeftEnd(), std::max( getExtendRightEnd(), 0.0 ) );
+
+ // both used, double line definition. Create left and right offset
+ xRetval.realloc(2);
+ sal_uInt32 nInsert(0);
+
+ basegfx::B2DPolygon aGap;
- if(isOutsideUsed())
{
- // both used, double line definition. Create left and right offset
- xRetval.realloc(getCreateInside() && getCreateOutside() ? 2 : 1);
- sal_uInt32 nInsert(0);
+ // create geometry for left
+ const basegfx::B2DVector aLeftOff(aPerpendicular * (0.5 * (getCorrectedLeftWidth() - fWidth + 1)));
+ const basegfx::B2DPoint aTmpStart(getStart() + aLeftOff - ( startMax * aVector));
+ const basegfx::B2DPoint aTmpEnd(getEnd() + aLeftOff + ( endMax * aVector));
+ basegfx::B2DPolygon aLeft;
- if(getCreateInside())
+ if(leftIsHairline())
{
- // create geometry for left
- const basegfx::B2DVector aLeftOff(aPerpendicular * (0.5 * (getCorrectedLeftWidth() - fWidth)));
- const basegfx::B2DPoint aTmpStart(getStart() + aLeftOff - (getExtendInnerStart() * aVector));
- const basegfx::B2DPoint aTmpEnd(getEnd() + aLeftOff + (getExtendInnerEnd() * aVector));
- basegfx::B2DPolygon aLeft;
-
- if(leftIsHairline())
- {
- // create hairline primitive
- aLeft.append(aTmpStart);
- aLeft.append(aTmpEnd);
-
- xRetval[nInsert++] = Primitive2DReference(new PolygonHairlinePrimitive2D(
- aLeft,
- getRGBColor()));
- }
- else
- {
- // create filled polygon primitive. Already tried to create thick lines
- // with the correct LineWidth, but this leads to problems when no AA
- // is available and fat line special case reductions between 0.5 < x < 2.5 line widths
- // are executed due to the FilledPolygon-do-not-paint-their-bottom-and-right-lines.
- const basegfx::B2DVector aLineWidthOffset((getCorrectedLeftWidth() * 0.5) * aPerpendicular);
-
- aLeft.append(aTmpStart + aLineWidthOffset);
- aLeft.append(aTmpEnd + aLineWidthOffset);
- aLeft.append(aTmpEnd - aLineWidthOffset);
- aLeft.append(aTmpStart - aLineWidthOffset);
- aLeft.setClosed(true);
-
- xRetval[nInsert++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(aLeft), getRGBColor()));
- }
- }
+ // create hairline primitive
+ aLeft.append(aTmpStart);
+ aLeft.append(aTmpEnd);
+
+ xRetval[nInsert++] = Primitive2DReference(new PolygonHairlinePrimitive2D(
+ aLeft,
+ getRGBColorLeft()));
- if(getCreateOutside())
+ aGap.append( aTmpStart );
+ aGap.append( aTmpEnd );
+ }
+ else
{
- // create geometry for right
- const basegfx::B2DVector aRightOff(aPerpendicular * (0.5 * (fWidth - getCorrectedRightWidth())));
- const basegfx::B2DPoint aTmpStart(getStart() + aRightOff - (getExtendOuterStart() * aVector));
- const basegfx::B2DPoint aTmpEnd(getEnd() + aRightOff + (getExtendOuterEnd() * aVector));
- basegfx::B2DPolygon aRight;
-
- if(rightIsHairline())
- {
- // create hairline primitive
- aRight.append(aTmpStart);
- aRight.append(aTmpEnd);
-
- xRetval[nInsert++] = Primitive2DReference(new PolygonHairlinePrimitive2D(
- aRight,
- getRGBColor()));
- }
- else
- {
- // create filled polygon primitive
- const basegfx::B2DVector aLineWidthOffset((getCorrectedRightWidth() * 0.5) * aPerpendicular);
-
- aRight.append(aTmpStart + aLineWidthOffset);
- aRight.append(aTmpEnd + aLineWidthOffset);
- aRight.append(aTmpEnd - aLineWidthOffset);
- aRight.append(aTmpStart - aLineWidthOffset);
- aRight.setClosed(true);
-
- xRetval[nInsert++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(aRight), getRGBColor()));
- }
+ // create filled polygon primitive. Already tried to create thick lines
+ // with the correct LineWidth, but this leads to problems when no AA
+ // is available and fat line special case reductions between 0.5 < x < 2.5 line widths
+ // are executed due to the FilledPolygon-do-not-paint-their-bottom-and-right-lines.
+ const basegfx::B2DVector aLineWidthOffset((getCorrectedLeftWidth() * 0.5) * aPerpendicular);
+
+ aLeft.append(aTmpStart + aLineWidthOffset);
+ aLeft.append(aTmpEnd + aLineWidthOffset);
+ aLeft.append(aTmpEnd - aLineWidthOffset);
+ aLeft.append(aTmpStart - aLineWidthOffset);
+ aLeft.setClosed(true);
+
+ basegfx::B2DPolyPolygon aClipped = basegfx::tools::clipPolygonOnPolyPolygon(
+ aLeft, aClipRegion, true, false );
+
+ aGap.append( aTmpStart + aLineWidthOffset );
+ aGap.append( aTmpEnd + aLineWidthOffset );
+
+ xRetval[nInsert++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
+ aClipped, getRGBColorLeft()));
}
}
- else
+
{
- // single line, create geometry
- basegfx::B2DPolygon aPolygon;
- const double fMaxExtStart(::std::max(getExtendInnerStart(), getExtendOuterStart()));
- const double fMaxExtEnd(::std::max(getExtendInnerEnd(), getExtendOuterEnd()));
- const basegfx::B2DPoint aTmpStart(getStart() - (fMaxExtStart * aVector));
- const basegfx::B2DPoint aTmpEnd(getEnd() + (fMaxExtEnd * aVector));
- xRetval.realloc(1);
+ // create geometry for right
+ const basegfx::B2DVector aRightOff(aPerpendicular * (0.5 * (fWidth - getCorrectedRightWidth() + 1)));
+ const basegfx::B2DPoint aTmpStart(getStart() + aRightOff - ( startMax * aVector));
+ const basegfx::B2DPoint aTmpEnd(getEnd() + aRightOff + ( endMax * aVector));
+ basegfx::B2DPolygon aRight;
- if(leftIsHairline())
+ if(rightIsHairline())
{
// create hairline primitive
- aPolygon.append(aTmpStart);
- aPolygon.append(aTmpEnd);
+ aRight.append(aTmpStart);
+ aRight.append(aTmpEnd);
+
+ xRetval[nInsert++] = Primitive2DReference(new PolygonHairlinePrimitive2D(
+ aRight,
+ getRGBColorRight()));
- xRetval[0] = Primitive2DReference(new PolygonHairlinePrimitive2D(
- aPolygon,
- getRGBColor()));
+ aGap.append( aTmpEnd );
+ aGap.append( aTmpStart );
}
else
{
// create filled polygon primitive
- const basegfx::B2DVector aLineWidthOffset((getCorrectedLeftWidth() * 0.5) * aPerpendicular);
+ const basegfx::B2DVector aLineWidthOffset((getCorrectedRightWidth() * 0.5) * aPerpendicular);
- aPolygon.append( aTmpStart );
- aPolygon.append( aTmpEnd );
-
- basegfx::B2DPolyPolygon aDashed = svtools::ApplyLineDashing(
- aPolygon, getStyle(), MAP_100TH_MM );
- for (sal_uInt32 i = 0; i < aDashed.count(); i++ )
- {
- basegfx::B2DPolygon aDash = aDashed.getB2DPolygon( i );
- basegfx::B2DPoint aDashStart = aDash.getB2DPoint( 0 );
- basegfx::B2DPoint aDashEnd = aDash.getB2DPoint( aDash.count() - 1 );
-
- basegfx::B2DPolygon aDashPolygon;
- aDashPolygon.append( aDashStart + aLineWidthOffset );
- aDashPolygon.append( aDashEnd + aLineWidthOffset );
- aDashPolygon.append( aDashEnd - aLineWidthOffset );
- aDashPolygon.append( aDashStart - aLineWidthOffset );
- aDashPolygon.setClosed( true );
-
- aDashed.setB2DPolygon( i, aDashPolygon );
- }
-
- xRetval[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon( aDashed ), getRGBColor()));
+ aRight.append(aTmpStart + aLineWidthOffset);
+ aRight.append(aTmpEnd + aLineWidthOffset);
+ aRight.append(aTmpEnd - aLineWidthOffset);
+ aRight.append(aTmpStart - aLineWidthOffset);
+ aRight.setClosed(true);
+
+ basegfx::B2DPolyPolygon aClipped = basegfx::tools::clipPolygonOnPolyPolygon(
+ aRight, aClipRegion, true, false );
+
+ xRetval[nInsert++] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
+ aClipped, getRGBColorRight()));
+
+ aGap.append( aTmpEnd - aLineWidthOffset );
+ aGap.append( aTmpStart - aLineWidthOffset );
+ }
+ }
+
+ if (hasGapColor() && aGap.count() == 4)
+ {
+ xRetval.realloc( xRetval.getLength() + 1 );
+ // create geometry for filled gap
+ aGap.setClosed( true );
+
+ basegfx::B2DPolyPolygon aClipped = basegfx::tools::clipPolygonOnPolyPolygon(
+ aGap, aClipRegion, true, false );
+
+ xRetval[nInsert++] = Primitive2DReference( new PolyPolygonColorPrimitive2D(
+ aClipped, getRGBColorGap() ) );
+ }
+ }
+ else
+ {
+ // single line, create geometry
+ basegfx::B2DPolygon aPolygon;
+ const double fMaxExtStart = std::max( getExtendLeftStart(),
+ std::max( getExtendRightStart(), 0.0 ) );
+ const double fMaxExtEnd = std::max( getExtendLeftEnd(),
+ std::max( getExtendRightEnd(), 0.0 ) );
+ const basegfx::B2DPoint aTmpStart(getStart() - (fMaxExtStart * aVector));
+ const basegfx::B2DPoint aTmpEnd(getEnd() + (fMaxExtEnd * aVector));
+ xRetval.realloc(1);
+
+ // Get which is the line to show
+ bool bIsHairline = leftIsHairline();
+ double nWidth = getCorrectedLeftWidth();
+ basegfx::BColor aColor = getRGBColorLeft();
+ if ( basegfx::fTools::equal( 0.0, mfLeftWidth ) )
+ {
+ bIsHairline = rightIsHairline();
+ nWidth = getCorrectedRightWidth();
+ aColor = getRGBColorRight();
+ }
+
+ if(bIsHairline)
+ {
+ // create hairline primitive
+ aPolygon.append(aTmpStart);
+ aPolygon.append(aTmpEnd);
+
+ xRetval[0] = Primitive2DReference(new PolygonHairlinePrimitive2D(
+ aPolygon,
+ aColor));
+ }
+ else
+ {
+ // create filled polygon primitive
+ const basegfx::B2DVector aLineWidthOffset(((nWidth + 1) * 0.5) * aPerpendicular);
+
+ aPolygon.append( aTmpStart );
+ aPolygon.append( aTmpEnd );
+
+ basegfx::B2DPolyPolygon aDashed = svtools::ApplyLineDashing(
+ aPolygon, getStyle(), MAP_100TH_MM );
+ for (sal_uInt32 i = 0; i < aDashed.count(); i++ )
+ {
+ basegfx::B2DPolygon aDash = aDashed.getB2DPolygon( i );
+ basegfx::B2DPoint aDashStart = aDash.getB2DPoint( 0 );
+ basegfx::B2DPoint aDashEnd = aDash.getB2DPoint( aDash.count() - 1 );
+
+ basegfx::B2DPolygon aDashPolygon;
+ aDashPolygon.append( aDashStart + aLineWidthOffset );
+ aDashPolygon.append( aDashEnd + aLineWidthOffset );
+ aDashPolygon.append( aDashEnd - aLineWidthOffset );
+ aDashPolygon.append( aDashStart - aLineWidthOffset );
+ aDashPolygon.setClosed( true );
+
+ basegfx::B2DPolyPolygon aClipped = basegfx::tools::clipPolygonOnPolyPolygon(
+ aDashPolygon, aClipRegion, true, false );
+
+ if ( aClipped.count() )
+ aDashed.setB2DPolygon( i, aClipped.getB2DPolygon( 0 ) );
}
+
+ xRetval[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon( aDashed ), aColor));
}
}
}
@@ -196,13 +272,14 @@ namespace drawinglayer
double fLeftWidth,
double fDistance,
double fRightWidth,
- double fExtendInnerStart,
- double fExtendInnerEnd,
- double fExtendOuterStart,
- double fExtendOuterEnd,
- bool bCreateInside,
- bool bCreateOutside,
- const basegfx::BColor& rRGBColor,
+ double fExtendLeftStart,
+ double fExtendLeftEnd,
+ double fExtendRightStart,
+ double fExtendRightEnd,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
const short nStyle)
: BufferedDecompositionPrimitive2D(),
maStart(rStart),
@@ -210,14 +287,15 @@ namespace drawinglayer
mfLeftWidth(fLeftWidth),
mfDistance(fDistance),
mfRightWidth(fRightWidth),
- mfExtendInnerStart(fExtendInnerStart),
- mfExtendInnerEnd(fExtendInnerEnd),
- mfExtendOuterStart(fExtendOuterStart),
- mfExtendOuterEnd(fExtendOuterEnd),
- maRGBColor(rRGBColor),
- mnStyle(nStyle),
- mbCreateInside(bCreateInside),
- mbCreateOutside(bCreateOutside)
+ mfExtendLeftStart(fExtendLeftStart),
+ mfExtendLeftEnd(fExtendLeftEnd),
+ mfExtendRightStart(fExtendRightStart),
+ mfExtendRightEnd(fExtendRightEnd),
+ maRGBColorRight(rRGBColorRight),
+ maRGBColorLeft(rRGBColorLeft),
+ maRGBColorGap(rRGBColorGap),
+ mbHasGapColor(bHasGapColor),
+ mnStyle(nStyle)
{
}
@@ -232,13 +310,14 @@ namespace drawinglayer
&& getLeftWidth() == rCompare.getLeftWidth()
&& getDistance() == rCompare.getDistance()
&& getRightWidth() == rCompare.getRightWidth()
- && getExtendInnerStart() == rCompare.getExtendInnerStart()
- && getExtendInnerEnd() == rCompare.getExtendInnerEnd()
- && getExtendOuterStart() == rCompare.getExtendOuterStart()
- && getExtendOuterEnd() == rCompare.getExtendOuterEnd()
- && getCreateInside() == rCompare.getCreateInside()
- && getCreateOutside() == rCompare.getCreateOutside()
- && getRGBColor() == rCompare.getRGBColor()
+ && getExtendLeftStart() == rCompare.getExtendLeftStart()
+ && getExtendLeftEnd() == rCompare.getExtendLeftEnd()
+ && getExtendRightStart() == rCompare.getExtendRightStart()
+ && getExtendRightEnd() == rCompare.getExtendRightEnd()
+ && getRGBColorRight() == rCompare.getRGBColorRight()
+ && getRGBColorLeft() == rCompare.getRGBColorLeft()
+ && getRGBColorGap() == rCompare.getRGBColorGap()
+ && hasGapColor() == rCompare.hasGapColor()
&& getStyle() == rCompare.getStyle());
}
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx
index 076c9e076200..1c6701f41253 100755
--- a/editeng/inc/editeng/borderline.hxx
+++ b/editeng/inc/editeng/borderline.hxx
@@ -95,7 +95,18 @@ enum SvxBorderStyle
{
SOLID,
DOTTED,
- DASHED
+ DASHED,
+ DOUBLE,
+ THINTHICK_SMALLGAP,
+ THINTHICK_MEDIUMGAP,
+ THINTHICK_LARGEGAP,
+ THICKTHIN_SMALLGAP,
+ THICKTHIN_MEDIUMGAP,
+ THICKTHIN_LARGEGAP,
+ EMBOSSED,
+ ENGRAVED,
+ OUTSET,
+ INSET
};
class EDITENG_DLLPUBLIC SvxBorderLine
@@ -107,14 +118,25 @@ protected:
sal_uInt16 nInWidth;
sal_uInt16 nDistance;
+ bool m_bUseLeftTop;
+ Color (*m_pColorOutFn)( Color );
+ Color (*m_pColorInFn)( Color );
+ Color (*m_pColorGapFn)( Color );
+
public:
SvxBorderLine( const Color *pCol = 0, sal_uInt16 nOut = 0, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0,
- SvxBorderStyle nStyle = SOLID );
+ SvxBorderStyle nStyle = SOLID, bool bUseLeftTop = false,
+ Color (*pColorOutFn)( Color ) = &darkColor, Color (*pColorInFn)( Color ) = &darkColor,
+ Color (*pColorGapFn)( Color ) = NULL );
SvxBorderLine( const SvxBorderLine& r );
SvxBorderLine& operator=( const SvxBorderLine& r );
const Color& GetColor() const { return aColor; }
+ Color GetColorOut( bool bLeftOrTop = true ) const;
+ Color GetColorIn( bool bLeftOrTop = true ) const;
+ bool HasGapColor() const { return m_pColorGapFn != NULL; }
+ Color GetColorGap() const;
sal_uInt16 GetOutWidth() const { return nOutWidth; }
sal_uInt16 GetInWidth() const { return nInWidth; }
sal_uInt16 GetDistance() const { return nDistance; }
@@ -122,10 +144,14 @@ public:
SvxBorderStyle GetStyle() const { return m_nStyle; }
void SetColor( const Color &rColor ) { aColor = rColor; }
- void SetStyle( SvxBorderStyle nNew ) { m_nStyle = nNew; }
+ void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; }
+ void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; }
+ void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; }
+ void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; }
void SetOutWidth( sal_uInt16 nNew ) { nOutWidth = nNew; }
void SetInWidth( sal_uInt16 nNew ) { nInWidth = nNew; }
void SetDistance( sal_uInt16 nNew ) { nDistance = nNew; }
+ void SetStyle( SvxBorderStyle nNew );
void ScaleMetrics( long nMult, long nDiv );
sal_Bool operator==( const SvxBorderLine &rCmp ) const;
@@ -139,6 +165,14 @@ public:
bool isEmpty() const { return (0 == nOutWidth && 0 == nInWidth && 0 == nDistance); }
bool isDouble() const { return (0 != nOutWidth && 0 != nInWidth); }
sal_uInt16 getWidth() const { return nOutWidth + nInWidth + nDistance; }
+
+ static Color darkColor( Color aMain );
+ static Color lightColor( Color aMain );
+
+ static Color threeDLightColor( Color aMain );
+ static Color threeDMediumColor( Color aMain );
+ static Color threeDDarkColor( Color aMain );
+
};
// ============================================================================
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index b6f0cd2ee601..23ac50c0df71 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -63,6 +63,7 @@
#include <svl/memberid.hrc>
#include <svtools/wallitem.hxx>
#include <svl/cntwall.hxx>
+#include <svtools/borderhelper.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <svtools/filter.hxx>
@@ -93,6 +94,9 @@
#include <editeng/memberids.hrc>
#include <editeng/editerr.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolortools.hxx>
+
using namespace ::rtl;
using namespace ::com::sun::star;
@@ -105,7 +109,6 @@ using namespace ::com::sun::star;
// STATIC DATA -----------------------------------------------------------
-
inline void SetValueProp( XubString& rStr, const sal_uInt16 nValue,
const sal_uInt16 nProp )
{
@@ -142,7 +145,6 @@ TYPEINIT1_FACTORY(SvxFmtKeepItem, SfxBoolItem, new SvxFmtKeepItem(sal_False, 0))
TYPEINIT1_FACTORY(SvxLineItem, SfxPoolItem, new SvxLineItem(0));
TYPEINIT1_FACTORY(SvxFrameDirectionItem, SfxUInt16Item, new SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, 0));
-
// class SvxPaperBinItem ------------------------------------------------
SfxPoolItem* SvxPaperBinItem::Clone( SfxItemPool* ) const
@@ -380,7 +382,6 @@ bool SvxSizeItem::HasMetrics() const
// -----------------------------------------------------------------------
-
SfxPoolItem* SvxSizeItem::Create( SvStream& rStrm, sal_uInt16 ) const
{
long nWidth, nHeight;
@@ -894,7 +895,6 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
break;
-
default:
OSL_FAIL("unknown MemberId");
return false;
@@ -1033,7 +1033,6 @@ bool SvxULSpaceItem::HasMetrics() const
return true;
}
-
// class SvxPrintItem ----------------------------------------------------
SfxPoolItem* SvxPrintItem::Clone( SfxItemPool* ) const
@@ -1547,12 +1546,73 @@ void SvxShadowItem::SetEnumValue( sal_uInt16 nVal )
// class SvxBorderLine --------------------------------------------------
+Color SvxBorderLine::darkColor( Color aMain )
+{
+ return aMain;
+}
+
+Color SvxBorderLine::lightColor( Color aMain )
+{
+
+ // Divide Luminance by 2
+ basegfx::BColor color = aMain.getBColor( );
+ basegfx::BColor hsl = basegfx::tools::rgb2hsl( color );
+ hsl.setZ( hsl.getZ() * 0.5 );
+ color = basegfx::tools::hsl2rgb( hsl );
+
+ return Color( color );
+}
+
+Color lcl_compute3DColor( Color aMain, int nLight, int nMedium, int nDark )
+{
+ basegfx::BColor color = aMain.getBColor( );
+ basegfx::BColor hsl = basegfx::tools::rgb2hsl( color );
+
+ int nCoef = 0;
+ if ( hsl.getZ( ) >= 0.5 )
+ nCoef = nLight;
+ else if ( 0.5 > hsl.getZ() && hsl.getZ() >= 0.25 )
+ nCoef = nMedium;
+ else
+ nCoef = nDark;
+
+ double L = hsl.getZ() * 255.0 + nCoef;
+ hsl.setZ( L / 255.0 );
+ color = basegfx::tools::hsl2rgb( hsl );
+
+ return Color( color );
+}
+
+Color SvxBorderLine::threeDLightColor( Color aMain )
+{
+ // These values have been defined in an empirical way
+ return lcl_compute3DColor( aMain, 3, 40, 83 );
+}
+
+Color SvxBorderLine::threeDDarkColor( Color aMain )
+{
+ // These values have been defined in an empirical way
+ return lcl_compute3DColor( aMain, -85, -43, -1 );
+}
+
+Color SvxBorderLine::threeDMediumColor( Color aMain )
+{
+ // These values have been defined in an empirical way
+ return lcl_compute3DColor( aMain, -42, -0, 42 );
+}
+
SvxBorderLine::SvxBorderLine( const Color *pCol, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist,
- SvxBorderStyle nStyle )
+ SvxBorderStyle nStyle, bool bUseLeftTop,
+ Color (*pColorOutFn)( Color ), Color (*pColorInFn)( Color ),
+ Color (*pColorGapFn)( Color ) )
: m_nStyle( nStyle )
, nOutWidth( nOut )
, nInWidth ( nIn )
, nDistance( nDist )
+, m_bUseLeftTop( bUseLeftTop )
+, m_pColorOutFn( pColorOutFn )
+, m_pColorInFn( pColorInFn )
+, m_pColorGapFn( pColorGapFn )
{
if ( pCol )
aColor = *pCol;
@@ -1574,6 +1634,10 @@ SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r )
nInWidth = r.nInWidth;
nDistance = r.nDistance;
m_nStyle = r.m_nStyle;
+ m_bUseLeftTop = r.m_bUseLeftTop;
+ m_pColorOutFn = r.m_pColorOutFn;
+ m_pColorInFn = r.m_pColorInFn;
+ m_pColorGapFn = r.m_pColorGapFn;
return *this;
}
@@ -1590,11 +1654,95 @@ void SvxBorderLine::ScaleMetrics( long nMult, long nDiv )
sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const
{
- return ( ( aColor == rCmp.GetColor() ) &&
- ( nInWidth == rCmp.GetInWidth() ) &&
- ( nOutWidth == rCmp.GetOutWidth() ) &&
- ( nDistance == rCmp.GetDistance() ) &&
- ( m_nStyle == rCmp.GetStyle() ) );
+ return ( ( aColor == rCmp.aColor ) &&
+ ( nInWidth == rCmp.GetInWidth() ) &&
+ ( nOutWidth == rCmp.GetOutWidth() ) &&
+ ( nDistance == rCmp.GetDistance() ) &&
+ ( m_nStyle == rCmp.GetStyle() ) &&
+ ( m_bUseLeftTop == rCmp.m_bUseLeftTop ) &&
+ ( m_pColorOutFn == rCmp.m_pColorOutFn ) &&
+ ( m_pColorInFn == rCmp.m_pColorInFn ) &&
+ ( m_pColorGapFn == rCmp.m_pColorGapFn ) );
+}
+
+void SvxBorderLine::SetStyle( SvxBorderStyle nNew )
+{
+ m_nStyle = nNew;
+ switch ( nNew )
+ {
+ case EMBOSSED:
+ m_pColorOutFn = threeDLightColor;
+ m_pColorInFn = threeDDarkColor;
+ m_pColorGapFn = threeDMediumColor;
+ m_bUseLeftTop = true;
+ break;
+ case ENGRAVED:
+ m_pColorOutFn = threeDDarkColor;
+ m_pColorInFn = threeDLightColor;
+ m_pColorGapFn = threeDMediumColor;
+ m_bUseLeftTop = true;
+ break;
+ case OUTSET:
+ m_pColorOutFn = lightColor;
+ m_pColorInFn = darkColor;
+ m_bUseLeftTop = true;
+ m_pColorGapFn = NULL;
+ break;
+ case INSET:
+ m_pColorOutFn = darkColor;
+ m_pColorInFn = lightColor;
+ m_bUseLeftTop = true;
+ m_pColorGapFn = NULL;
+ break;
+ default:
+ m_pColorOutFn = darkColor;
+ m_pColorInFn = darkColor;
+ m_bUseLeftTop = false;
+ m_pColorGapFn = NULL;
+ break;
+ }
+}
+
+Color SvxBorderLine::GetColorOut( bool bLeftOrTop ) const
+{
+ Color aResult = aColor;
+
+ if ( nInWidth > 0 && nOutWidth > 0 && m_pColorOutFn != NULL )
+ {
+ if ( !bLeftOrTop && m_bUseLeftTop )
+ aResult = (*m_pColorInFn)( aColor );
+ else
+ aResult = (*m_pColorOutFn)( aColor );
+ }
+
+ return aResult;
+}
+
+Color SvxBorderLine::GetColorIn( bool bLeftOrTop ) const
+{
+ Color aResult = aColor;
+
+ if ( nInWidth > 0 && nOutWidth > 0 && m_pColorInFn != NULL )
+ {
+ if ( !bLeftOrTop && m_bUseLeftTop )
+ aResult = (*m_pColorOutFn)( aColor );
+ else
+ aResult = (*m_pColorInFn)( aColor );
+ }
+
+ return aResult;
+}
+
+Color SvxBorderLine::GetColorGap( ) const
+{
+ Color aResult = aColor;
+
+ if ( nInWidth > 0 && nOutWidth > 0 && m_pColorGapFn != NULL )
+ {
+ aResult = (*m_pColorGapFn)( aColor );
+ }
+
+ return aResult;
}
// -----------------------------------------------------------------------
@@ -2640,7 +2788,6 @@ void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, sal_uInt16 nLine )
}
}
-
// -----------------------------------------------------------------------
SfxPoolItem* SvxBoxInfoItem::Clone( SfxItemPool* ) const
@@ -3174,7 +3321,6 @@ SvxLineItem::SvxLineItem( const SvxLineItem& rCpy ) :
pLine = rCpy.GetLine() ? new SvxBorderLine( *rCpy.GetLine() ) : 0;
}
-
// -----------------------------------------------------------------------
SvxLineItem::~SvxLineItem()
@@ -4188,7 +4334,6 @@ WallpaperStyle SvxBrushItem::GraphicPos2WallpaperStyle( SvxGraphicPosition ePos
return eResult;
}
-
SvxBrushItem::SvxBrushItem( const CntWallpaperItem& rItem, sal_uInt16 _nWhich ) :
SfxPoolItem( _nWhich ),
pImpl( new SvxBrushItem_Impl( 0 ) ),
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx
index 17b5fcb89d8c..6cfc8f0f7a2e 100755
--- a/svx/inc/svx/framelink.hxx
+++ b/svx/inc/svx/framelink.hxx
@@ -37,6 +37,8 @@
#include <vcl/outdev.hxx>
#include <editeng/borderline.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
class OutputDevice;
namespace svx {
@@ -114,15 +116,16 @@ class SVX_DLLPUBLIC Style
{
public:
/** Constructs an invisible frame style. */
- inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mnDashing( SOLID ) {}
+ inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mnType( SOLID ) {}
/** Constructs a frame style with passed line widths. */
- inline explicit Style( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) :
- meRefMode( REFMODE_CENTERED ), mnDashing( SOLID )
+ inline explicit Style( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS, SvxBorderStyle nType ) :
+ meRefMode( REFMODE_CENTERED ), mnType( nType )
{ Set( nP, nD, nS ); }
/** Constructs a frame style with passed color and line widths. */
- inline explicit Style( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS, SvxBorderStyle nDashing = SOLID ) :
- meRefMode( REFMODE_CENTERED ), mnDashing( nDashing )
- { Set( rColor, nP, nD, nS ); }
+ inline explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor,
+ sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS, SvxBorderStyle nType ) :
+ meRefMode( REFMODE_CENTERED ), mnType( nType )
+ { Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); }
/** Constructs a frame style from the passed SvxBorderLine struct. */
inline explicit Style( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) :
meRefMode( REFMODE_CENTERED ) { Set( rBorder, fScale, nMaxWidth ); }
@@ -131,22 +134,25 @@ public:
meRefMode( REFMODE_CENTERED ) { Set( pBorder, fScale, nMaxWidth ); }
inline RefMode GetRefMode() const { return meRefMode; }
- inline const Color& GetColor() const { return maColor; }
+ inline const Color& GetColorPrim() const { return maColorPrim; }
+ inline const Color& GetColorSecn() const { return maColorSecn; }
+ inline const Color& GetColorGap() const { return maColorGap; }
+ inline bool UseGapColor() const { return mbUseGapColor; }
inline sal_uInt16 Prim() const { return mnPrim; }
inline sal_uInt16 Dist() const { return mnDist; }
inline sal_uInt16 Secn() const { return mnSecn; }
- inline SvxBorderStyle Dashing() const { return mnDashing; }
+ inline SvxBorderStyle Type() const { return mnType; }
/** Returns the total width of this frame style. */
inline sal_uInt16 GetWidth() const { return mnPrim + mnDist + mnSecn; }
-
/** Sets the frame style to invisible state. */
void Clear();
/** Sets the frame style to the passed line widths. */
void Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS );
/** Sets the frame style to the passed line widths. */
- void Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS );
+ void Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor,
+ sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS );
/** Sets the frame style to the passed SvxBorderLine struct. */
void Set( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
/** Sets the frame style to the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */
@@ -155,9 +161,11 @@ public:
/** Sets a new reference point handling mode, does not modify other settings. */
inline void SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; }
/** Sets a new color, does not modify other settings. */
- inline void SetColor( const Color& rColor ) { maColor = rColor; }
+ inline void SetColorPrim( const Color& rColor ) { maColorPrim = rColor; }
+ inline void SetColorSecn( const Color& rColor ) { maColorSecn = rColor; }
+ inline void SetColorGap( bool bUseIt, const Color& rColor ) { maColorGap = rColor; mbUseGapColor = bUseIt; }
/** Sets whether to use dotted style for single hair lines. */
- inline void SetDashing( SvxBorderStyle nDashing ) { mnDashing = nDashing; }
+ inline void SetType( SvxBorderStyle nType ) { mnType = nType; }
/** Scales the style by the specified scaling factor. Ensures that visible lines keep visible. */
Style& ScaleSelf( double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
@@ -170,12 +178,15 @@ public:
Style Mirror() const;
private:
- Color maColor; /// The color of the line(s) of this frame border.
+ Color maColorPrim;
+ Color maColorSecn;
+ Color maColorGap;
+ bool mbUseGapColor;
RefMode meRefMode; /// Reference point handling for this frame border.
sal_uInt16 mnPrim; /// Width of primary (single, left, or top) line.
sal_uInt16 mnDist; /// Distance between primary and secondary line.
sal_uInt16 mnSecn; /// Width of secondary (right or bottom) line.
- SvxBorderStyle mnDashing;
+ SvxBorderStyle mnType;
};
bool operator==( const Style& rL, const Style& rR );
@@ -450,6 +461,22 @@ SVX_DLLPUBLIC bool CheckFrameBorderConnectable(
// Drawing functions
// ============================================================================
+SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
+ const Point& rLPos, /// Reference point for left end of the processed frame border.
+ const Point& rRPos, /// Reference point for right end of the processed frame border.
+ const Style& rBorder, /// Style of the processed frame border.
+
+ const Style& rLFromT, /// Vertical frame border from top to left end of rBorder.
+ const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder.
+ const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder.
+
+ const Style& rRFromT, /// Vertical frame border from top to right end of rBorder.
+ const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder.
+ const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder.
+
+ const Color* pForceColor = 0 /// If specified, overrides frame border color.
+);
+
/** Draws a horizontal frame border, regards all connected frame styles.
The frame style to draw is passed as parameter rBorder. The function
diff --git a/svx/inc/svx/sdr/contact/objectcontacttools.hxx b/svx/inc/svx/sdr/contact/objectcontacttools.hxx
index efa8c1911869..83f704004555 100755
--- a/svx/inc/svx/sdr/contact/objectcontacttools.hxx
+++ b/svx/inc/svx/sdr/contact/objectcontacttools.hxx
@@ -30,6 +30,7 @@
#define _SDR_CONTACT_OBJECTCONTACTTOOLS_HXX
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include "svx/svxdllapi.h"
//////////////////////////////////////////////////////////////////////////////
// predeclarations
@@ -49,7 +50,7 @@ namespace sdr
// create a mating VCL-Provessor for given OutputDevice. This includes
// looking for MetaFile-recording. The returned renderer changes owner,
// deletion is duty of the caller
- drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ SVX_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index e9ae076dde1f..35758d713648 100755
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -55,6 +55,8 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#endif
+#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+
namespace svx {
namespace frame {
@@ -133,8 +135,9 @@ struct BorderEndResult
{
LineEndResult maPrim; /// Result for primary line.
LineEndResult maSecn; /// Result for secondary line.
+ LineEndResult maGap; /// Result for gap line.
- inline void Negate() { maPrim.Negate(); maSecn.Negate(); }
+ inline void Negate() { maPrim.Negate(); maSecn.Negate(); maGap.Negate(); }
};
/** Result struct used by the horizontal/vertical frame link functions.
@@ -260,7 +263,6 @@ sal_uInt16 lclScaleValue( long nValue, double fScale, sal_uInt16 nMaxWidth )
|
|<- middle of the frame border
-
lclGetDistEnd() ->||<- lclGetSecnBeg()
||
lclGetBeg() ->| lclGetDistBeg() ->| || |<- lclGetEnd()
@@ -510,6 +512,23 @@ void lclLinkLeftEnd_Secn(
rResult.Swap();
}
+void lclLinkLeftEnd_Gap(
+ LineEndResult& rResult, const Style& rBorder,
+ const DiagStyle& /*rLFromTR*/, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& /*rLFromBR*/ )
+
+{
+ if ( rLFromT.Secn() )
+ rResult.mnOffs1 = lclGetDistBeg( rLFromT );
+ else if ( rLFromL.Secn( ) )
+ rResult.mnOffs1 = ( rLFromL.GetWidth() == rBorder.GetWidth() )?
+ 0 : lclGetBehindEnd( rLFromT );
+ else if ( rLFromB.Secn( ) )
+ rResult.mnOffs1 = lclGetDistBeg( rLFromB );
+ else
+ rResult.mnOffs1 = std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) );
+
+ rResult.mnOffs2 = rResult.mnOffs1;
+}
// ----------------------------------------------------------------------------
// Linking of horizontal frame border ends.
@@ -531,6 +550,7 @@ void lclLinkLeftEnd(
// current frame border is double
lclLinkLeftEnd_Prim( rResult.maPrim, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
lclLinkLeftEnd_Secn( rResult.maSecn, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
+ lclLinkLeftEnd_Gap( rResult.maGap, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR );
}
else if( rBorder.Prim() )
{
@@ -756,11 +776,11 @@ Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3,
@param rStyle
The border style that contains the line color to be set to the device.
*/
-void lclSetColorToOutDev( OutputDevice& rDev, const Style& rStyle, const Color* pForceColor )
+void lclSetColorToOutDev( OutputDevice& rDev, const Color& rColor, const Color* pForceColor )
{
rDev.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- rDev.SetLineColor( pForceColor ? *pForceColor : rStyle.GetColor() );
- rDev.SetFillColor( pForceColor ? *pForceColor : rStyle.GetColor() );
+ rDev.SetLineColor( pForceColor ? *pForceColor : rColor );
+ rDev.SetFillColor( pForceColor ? *pForceColor : rColor );
}
// ----------------------------------------------------------------------------
@@ -811,13 +831,26 @@ void lclDrawHorFrameBorder(
DBG_ASSERT( rLPos.Y() == rRPos.Y(), "svx::frame::lclDrawHorFrameBorder - line not horizontal" );
if( rLPos.X() <= rRPos.X() )
{
- lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ if ( rBorder.UseGapColor( ) )
+ {
+ lclSetColorToOutDev( rDev, rBorder.GetColorGap(), pForceColor );
+ lclDrawHorLine( rDev, rLPos, rResult.maBeg.maGap, rRPos, rResult.maEnd.maGap,
+ lclGetPrimEnd( rBorder ), lclGetSecnBeg( rBorder ), rBorder.Type() );
+ rDev.Pop(); // Gap color
+ }
+
+ lclSetColorToOutDev( rDev, rBorder.GetColorPrim(), pForceColor );
lclDrawHorLine( rDev, rLPos, rResult.maBeg.maPrim, rRPos, rResult.maEnd.maPrim,
- lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() );
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Type() );
+ rDev.Pop(); // colors
+
if( rBorder.Secn() )
+ {
+ lclSetColorToOutDev( rDev, rBorder.GetColorSecn(), pForceColor );
lclDrawHorLine( rDev, rLPos, rResult.maBeg.maSecn, rRPos, rResult.maEnd.maSecn,
- lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() );
- rDev.Pop(); // colors
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Type() );
+ rDev.Pop(); // colors
+ }
}
}
@@ -868,13 +901,25 @@ void lclDrawVerFrameBorder(
DBG_ASSERT( rTPos.X() == rBPos.X(), "svx::frame::lclDrawVerFrameBorder - line not vertical" );
if( rTPos.Y() <= rBPos.Y() )
{
- lclSetColorToOutDev( rDev, rBorder, pForceColor );
+ if ( rBorder.UseGapColor( ) )
+ {
+ lclSetColorToOutDev( rDev, rBorder.GetColorGap(), pForceColor );
+ lclDrawVerLine( rDev, rTPos, rResult.maBeg.maGap, rBPos, rResult.maEnd.maGap,
+ lclGetPrimEnd( rBorder ), lclGetSecnBeg( rBorder ), rBorder.Type() );
+ rDev.Pop(); // Gap color
+ }
+
+ lclSetColorToOutDev( rDev, rBorder.GetColorPrim(), pForceColor );
lclDrawVerLine( rDev, rTPos, rResult.maBeg.maPrim, rBPos, rResult.maEnd.maPrim,
- lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() );
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Type() );
+ rDev.Pop(); // colors
if( rBorder.Secn() )
+ {
+ lclSetColorToOutDev( rDev, rBorder.GetColorSecn(), pForceColor );
lclDrawVerLine( rDev, rTPos, rResult.maBeg.maSecn, rBPos, rResult.maEnd.maSecn,
- lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() );
- rDev.Pop(); // colors
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Type() );
+ rDev.Pop(); // colors
+ }
}
}
@@ -1049,11 +1094,22 @@ void lclDrawDiagFrameBorder(
if( bClip )
lclPushCrossingClipRegion( rDev, rRect, bTLBR, rCrossStyle );
- lclSetColorToOutDev( rDev, rBorder, pForceColor );
- lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() );
- if( rBorder.Secn() )
- lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() );
+ lclSetColorToOutDev( rDev, rBorder.GetColorPrim(), pForceColor );
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Type() );
rDev.Pop(); // colors
+ if( rBorder.Secn() )
+ {
+ if ( rBorder.UseGapColor( ) )
+ {
+ lclSetColorToOutDev( rDev, rBorder.GetColorGap(), pForceColor );
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetDistBeg( rBorder ), lclGetDistEnd( rBorder ), rBorder.Type() );
+ rDev.Pop(); // colors
+ }
+
+ lclSetColorToOutDev( rDev, rBorder.GetColorSecn(), pForceColor );
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Type() );
+ rDev.Pop(); // colors
+ }
if( bClip )
rDev.Pop(); // clipping region
@@ -1106,7 +1162,7 @@ void lclDrawDiagFrameBorders(
void Style::Clear()
{
- Set( Color(), 0, 0, 0 );
+ Set( Color(), Color(), Color(), false, 0, 0, 0 );
}
void Style::Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
@@ -1123,29 +1179,34 @@ void Style::Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
mnSecn = (nP && nD) ? nS : 0;
}
-void Style::Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
+void Style::Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS )
{
- maColor = rColor;
+ maColorPrim = rColorPrim;
+ maColorSecn = rColorSecn;
+ maColorGap = rColorGap;
+ mbUseGapColor = bUseGapColor;
Set( nP, nD, nS );
}
void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth )
{
- maColor = rBorder.GetColor();
+ maColorPrim = rBorder.GetColorOut();
+ maColorSecn = rBorder.GetColorIn();
+ maColorGap = rBorder.GetColorGap();
+ mbUseGapColor = rBorder.HasGapColor();
sal_uInt16 nPrim = rBorder.GetOutWidth();
sal_uInt16 nDist = rBorder.GetDistance();
sal_uInt16 nSecn = rBorder.GetInWidth();
+ mnType = rBorder.GetStyle();
if( !nSecn ) // no or single frame border
{
Set( SCALEVALUE( nPrim ), 0, 0 );
- mnDashing = rBorder.GetStyle();
}
else
{
Set( SCALEVALUE( nPrim ), SCALEVALUE( nDist ), SCALEVALUE( nSecn ) );
- mnDashing = SOLID;
// Enlarge the style if distance is too small due to rounding losses.
sal_uInt16 nPixWidth = SCALEVALUE( nPrim + nDist + nSecn );
if( nPixWidth > GetWidth() )
@@ -1185,7 +1246,7 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid
else
{
Clear();
- mnDashing = SOLID;
+ mnType = SOLID;
}
}
@@ -1217,8 +1278,9 @@ Style Style::Mirror() const
bool operator==( const Style& rL, const Style& rR )
{
return (rL.Prim() == rR.Prim()) && (rL.Dist() == rR.Dist()) && (rL.Secn() == rR.Secn()) &&
- (rL.GetColor() == rR.GetColor()) && (rL.GetRefMode() == rR.GetRefMode()) &&
- (rL.Dashing() == rR.Dashing());
+ (rL.GetColorPrim() == rR.GetColorPrim()) && (rL.GetColorSecn() == rR.GetColorSecn()) &&
+ (rL.GetColorGap() == rR.GetColorGap()) && (rL.GetRefMode() == rR.GetRefMode()) &&
+ (rL.UseGapColor() == rR.UseGapColor() ) && (rL.Type() == rR.Type());
}
bool operator<( const Style& rL, const Style& rR )
@@ -1235,7 +1297,7 @@ bool operator<( const Style& rL, const Style& rR )
if( (rL.Secn() && rR.Secn()) && (rL.Dist() != rR.Dist()) ) return rL.Dist() > rR.Dist();
// both lines single and 1 unit thick, only one is dotted -> rL<rR, if rL is dotted
- if( (nLW == 1) && (rL.Dashing() != rR.Dashing()) ) return rL.Dashing();
+ if( (nLW == 1) && (rL.Type() != rR.Type()) ) return rL.Type();
// seem to be equal
return false;
@@ -1303,6 +1365,68 @@ bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder,
// Drawing functions
// ============================================================================
+double lcl_GetExtent( const Style& rSide, const Style& rOpposite )
+{
+ double nExtent = 0.0;
+
+ if ( rSide.Prim() + rSide.Secn() > 0 )
+ nExtent = - rSide.GetWidth( ) / 2.0;
+ else
+ nExtent = rOpposite.GetWidth() / 2.0;
+
+ return nExtent;
+}
+
+drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives(
+ const Point& rLPos, const Point& rRPos, const Style& rBorder,
+ const Style& rLFromT, const Style& rLFromL, const Style& rLFromB,
+ const Style& rRFromT, const Style& rRFromR, const Style& rRFromB,
+ const Color* pForceColor )
+{
+ const DiagStyle aNoStyle;
+ drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 );
+
+ basegfx::B2DPoint aStart( rLPos.getX(), rLPos.getY() );
+ basegfx::B2DPoint aEnd( rRPos.getX(), rRPos.getY() );
+
+ // Compute the offset for the start and end points
+ basegfx::B2DVector aVector( aStart - aEnd );
+ aVector.normalize();
+ double nOffStart = rBorder.GetWidth() / 2.0;
+ double nOffEnd = rBorder.GetWidth() / 2.0;
+ if ( aVector.getY( ) == 1.0 && aVector.getX() == 0.0 )
+ {
+ // Deal with vertical lines
+ sal_uInt16 nWS1 = ( rLFromT.GetWidth() == 0 ) ? -1 : rLFromT.GetWidth( );
+ sal_uInt16 nWS2 = ( rLFromB.GetWidth() == 0 ) ? -1 : rLFromB.GetWidth( );
+ nOffStart = std::min( nWS1, nWS2 ) / 2.0;
+
+ sal_uInt16 nWE1 = ( rRFromT.GetWidth() == 0 ) ? -1 : rRFromT.GetWidth( );
+ sal_uInt16 nWE2 = ( rRFromB.GetWidth() == 0 ) ? -1 : rRFromB.GetWidth( );
+ nOffEnd = std::min( nWE1, nWE2 ) / 2.0;
+ }
+
+ basegfx::B2DVector aOffsetV( 0.0, 1.0 );
+ aStart = aStart + aOffsetV * nOffStart;
+ aEnd = aEnd + aOffsetV * nOffEnd;
+
+ aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D(
+ aStart, aEnd,
+ rBorder.Prim() + 1,
+ rBorder.Dist() + 1,
+ rBorder.Secn() + 1,
+ lcl_GetExtent( rLFromT, rLFromB ),
+ lcl_GetExtent( rRFromT, rRFromB ),
+ lcl_GetExtent( rLFromB, rLFromT ),
+ lcl_GetExtent( rRFromB, rRFromT ),
+ rBorder.GetColorSecn().getBColor(),
+ rBorder.GetColorPrim().getBColor(),
+ rBorder.GetColorGap().getBColor(),
+ rBorder.UseGapColor(), rBorder.Type() );
+
+ return aSequence;
+}
+
void DrawHorFrameBorder( OutputDevice& rDev,
const Point& rLPos, const Point& rRPos, const Style& rBorder,
const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR,
@@ -1400,13 +1524,25 @@ void DrawVerFrameBorderSlanted( OutputDevice& rDev,
Style aScaled( rBorder );
aScaled.ScaleSelf( 1.0 / cos( GetVerDiagAngle( rTPos, rBPos ) ) );
- lclSetColorToOutDev( rDev, aScaled, pForceColor );
+ lclSetColorToOutDev( rDev, aScaled.GetColorPrim(), pForceColor );
lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Dashing() );
+ lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Type() );
+ rDev.Pop(); // colors
if( aScaled.Secn() )
+ {
+ if ( aScaled.UseGapColor( ) )
+ {
+ lclSetColorToOutDev( rDev, aScaled.GetColorGap(), pForceColor );
+ lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
+ lclGetDistBeg( aScaled ), lclGetDistEnd( aScaled ), aScaled.Type() );
+ rDev.Pop(); // colors
+ }
+
+ lclSetColorToOutDev( rDev, aScaled.GetColorSecn(), pForceColor );
lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Dashing() );
- rDev.Pop(); // colors
+ lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Type() );
+ rDev.Pop(); // colors
+ }
}
}
}
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index bedb2cc61b9c..56ab07dad111 100755
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -84,7 +84,7 @@ const long FRAMESEL_GEOM_ADD_CLICK_INNER = 2;
// ----------------------------------------------------------------------------
-static const frame::Style OBJ_FRAMESTYLE_DONTCARE( 3, 0, 0 );
+static const frame::Style OBJ_FRAMESTYLE_DONTCARE( 3, 0, 0, SOLID );
static const FrameBorder OBJ_FRAMEBORDER_NONE( FRAMEBORDER_NONE );
// ----------------------------------------------------------------------------
@@ -627,8 +627,10 @@ void FrameSelectorImpl::DrawAllFrameBorders()
// Translate core colors to current UI colors (regards current background and HC mode).
for( FrameBorderIter aIt( maEnabBorders ); aIt.Is(); ++aIt )
{
- Color aCoreColor = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColor();
- (*aIt)->SetUIColor( GetDrawLineColor( aCoreColor ) );
+ Color aCoreColorPrim = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColorOut();
+ Color aCoreColorSecn = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColorIn();
+ (*aIt)->SetUIColorPrim( GetDrawLineColor( aCoreColorPrim ) );
+ (*aIt)->SetUIColorSecn( GetDrawLineColor( aCoreColorSecn ) );
}
// Copy all frame border styles to the helper array
@@ -637,9 +639,11 @@ void FrameSelectorImpl::DrawAllFrameBorders()
// Invert the style for the right line
const frame::Style rRightStyle = maRight.GetUIStyle( );
- frame::Style rInvertedRight( rRightStyle.GetColor(),
+ frame::Style rInvertedRight( rRightStyle.GetColorPrim(),
+ rRightStyle.GetColorSecn(), rRightStyle.GetColorGap(),
+ rRightStyle.UseGapColor(),
rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ),
- rRightStyle.Dashing( ) );
+ rRightStyle.Type( ) );
maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight );
maArray.SetRowStyleTop( 0, maTop.GetUIStyle() );
@@ -647,17 +651,21 @@ void FrameSelectorImpl::DrawAllFrameBorders()
{
// Invert the style for the hor line to match the real borders
const frame::Style rHorStyle = maHor.GetUIStyle();
- frame::Style rInvertedHor( rHorStyle.GetColor(),
+ frame::Style rInvertedHor( rHorStyle.GetColorPrim(),
+ rHorStyle.GetColorSecn(), rHorStyle.GetColorGap(),
+ rHorStyle.UseGapColor(),
rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ),
- rHorStyle.Dashing() );
+ rHorStyle.Type() );
maArray.SetRowStyleTop( 1, rInvertedHor );
}
// Invert the style for the bottom line
const frame::Style rBottomStyle = maBottom.GetUIStyle( );
- frame::Style rInvertedBottom( rBottomStyle.GetColor(),
+ frame::Style rInvertedBottom( rBottomStyle.GetColorPrim(),
+ rBottomStyle.GetColorSecn(), rBottomStyle.GetColorGap(),
+ rBottomStyle.UseGapColor(),
rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ),
- rBottomStyle.Dashing() );
+ rBottomStyle.Type() );
maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom );
for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol )
@@ -962,7 +970,7 @@ void FrameSelector::SelectAllVisibleBorders( bool bSelect )
}
void FrameSelector::SetStyleToSelection( sal_uInt16 nPrim, sal_uInt16 nDist, sal_uInt16 nSecn,
- SvxBorderStyle nStyle )
+ SvxBorderStyle nStyle )
{
mxImpl->maCurrStyle.SetOutWidth( nPrim );
mxImpl->maCurrStyle.SetDistance( nDist );
diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx
index e40ad8482035..ab1c5d06c4e4 100755
--- a/svx/source/inc/frmselimpl.hxx
+++ b/svx/source/inc/frmselimpl.hxx
@@ -60,7 +60,9 @@ public:
const SvxBorderLine& GetCoreStyle() const { return maCoreStyle; }
void SetCoreStyle( const SvxBorderLine* pStyle );
- inline void SetUIColor( const Color& rColor ) {maUIStyle.SetColor( rColor ); }
+ inline void SetUIColorPrim( const Color& rColor ) {maUIStyle.SetColorPrim( rColor ); }
+ inline void SetUIColorSecn( const Color& rColor ) {maUIStyle.SetColorSecn( rColor ); }
+ inline void SetUIColorGap( bool bUseIt, const Color& rColor ) {maUIStyle.SetColorGap(bUseIt, rColor);}
inline const frame::Style& GetUIStyle() const { return maUIStyle; }
inline void ClearFocusArea() { maFocusArea.Clear(); }
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index b746de8aa849..84ee34be44b7 100755
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1914,15 +1914,15 @@ void lcl_VertLine( OutputDevice& rDev, const Point& rTop, const Point& rBottom,
svx::frame::Style aScaled( rLine );
aScaled.ScaleSelf( 1.0 / cos( svx::frame::GetVerDiagAngle( rTop, rBottom ) ) );
if( pForceColor )
- aScaled.SetColor( *pForceColor );
+ aScaled.SetColorPrim( *pForceColor );
long nXOffs = (aScaled.GetWidth() - 1) / -2L;
- lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColor(),
+ lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColorPrim(),
nXOffs, aScaled.Prim(), rTopLine, rBottomLine );
if( aScaled.Secn() )
- lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColor(),
+ lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColorPrim(),
nXOffs + aScaled.Prim() + aScaled.Dist(), aScaled.Secn(), rTopLine, rBottomLine );
}
}
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 96c9db837488..4fe67a7af3dc 100755
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -171,6 +171,16 @@ namespace drawinglayer
SvxBorderLine maRightLine;
SvxBorderLine maTopLine;
+ // Neighbor cells' borders
+ SvxBorderLine maLeftFromTLine;
+ SvxBorderLine maLeftFromBLine;
+ SvxBorderLine maRightFromTLine;
+ SvxBorderLine maRightFromBLine;
+ SvxBorderLine maTopFromLLine;
+ SvxBorderLine maTopFromRLine;
+ SvxBorderLine maBottomFromLLine;
+ SvxBorderLine maBottomFromRLine;
+
// bitfield
unsigned mbLeftIsOutside : 1;
unsigned mbBottomIsOutside : 1;
@@ -189,6 +199,14 @@ namespace drawinglayer
const SvxBorderLine& rBottomLine,
const SvxBorderLine& rRightLine,
const SvxBorderLine& rTopLine,
+ const SvxBorderLine& rLeftFromTLine,
+ const SvxBorderLine& rLeftFromBLine,
+ const SvxBorderLine& rRightFromTLine,
+ const SvxBorderLine& rRightFromBLine,
+ const SvxBorderLine& rTopFromLLine,
+ const SvxBorderLine& rTopFromRLine,
+ const SvxBorderLine& rBottomFromLLine,
+ const SvxBorderLine& rBottomFromRLine,
bool bLeftIsOutside,
bool bBottomIsOutside,
bool bRightIsOutside,
@@ -200,6 +218,14 @@ namespace drawinglayer
maBottomLine(rBottomLine),
maRightLine(rRightLine),
maTopLine(rTopLine),
+ maLeftFromTLine(rLeftFromTLine),
+ maLeftFromBLine(rLeftFromBLine),
+ maRightFromTLine(rRightFromTLine),
+ maRightFromBLine(rRightFromBLine),
+ maTopFromLLine(rTopFromLLine),
+ maTopFromRLine(rTopFromRLine),
+ maBottomFromLLine(rBottomFromLLine),
+ maBottomFromRLine(rBottomFromRLine),
mbLeftIsOutside(bLeftIsOutside),
mbBottomIsOutside(bBottomIsOutside),
mbRightIsOutside(bRightIsOutside),
@@ -208,7 +234,6 @@ namespace drawinglayer
{
}
-
// data access
const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
const SvxBorderLine& getLeftLine() const { return maLeftLine; }
@@ -248,34 +273,20 @@ namespace drawinglayer
return getBorderLineOutWidth(rLineA) + getBorderLineDistance(rLineA) + getBorderLineInWidth(rLineA);
}
- double getInnerExtend(const SvxBorderLine& rLineA, bool bSideToUse)
+ double getExtend(const SvxBorderLine& rLineSide, const SvxBorderLine& rLineOpposite)
{
- if(!rLineA.isEmpty())
+ double nExtend = 0.0;
+ if(!rLineSide.isEmpty())
{
- if(rLineA.isDouble())
- {
- // reduce to inner edge of associated matching line
- return -((getBorderLineWidth(rLineA) / 2.0) - (bSideToUse ? getBorderLineOutWidth(rLineA) : getBorderLineInWidth(rLineA)));
- }
- else
- {
- // extend to overlap with single line
- return getBorderLineWidth(rLineA) / 2.0;
- }
+ // reduce to inner edge of associated matching line
+ nExtend = -((getBorderLineWidth(rLineSide) / 2.0));
}
-
- return 0.0;
- }
-
- double getOuterExtend(const SvxBorderLine& rLineA)
- {
- if(!rLineA.isEmpty())
+ else
{
- // extend to overlap with single line
- return getBorderLineWidth(rLineA) / 2.0;
+ nExtend = ((getBorderLineWidth(rLineOpposite) / 2.0));
}
- return 0.0;
+ return nExtend;
}
double getChangedValue(sal_uInt16 nValue, bool bChangeToMM)
@@ -303,23 +314,10 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendIS(getInnerExtend(getTopLine(), false));
- const double fExtendIE(getInnerExtend(getBottomLine(), true));
- double fExtendOS(0.0);
- double fExtendOE(0.0);
-
- if(getLeftIsOutside())
- {
- if(getTopIsOutside())
- {
- fExtendOS = getOuterExtend(getTopLine());
- }
-
- if(getBottomIsOutside())
- {
- fExtendOE = getOuterExtend(getBottomLine());
- }
- }
+ const double fExtendIS(getExtend(getTopLine(), maTopFromLLine));
+ const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine));
+ const double fExtendOS(getExtend(maTopFromLLine, getTopLine()));
+ const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine()));
xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
aStart,
@@ -331,14 +329,15 @@ namespace drawinglayer
fExtendIE * fTwipsToMM,
fExtendOS * fTwipsToMM,
fExtendOE * fTwipsToMM,
- true,
- getLeftIsOutside(),
- getLeftLine().GetColor().getBColor(),
+ getLeftLine().GetColorOut(true).getBColor(),
+ getLeftLine().GetColorIn(true).getBColor(),
+ getLeftLine().GetColorGap().getBColor(),
+ getLeftLine().HasGapColor(),
getLeftLine().GetStyle()));
}
}
- if(!getBottomLine().isEmpty())
+ if(!getBottomLine().isEmpty() && getBottomIsOutside())
{
// create bottom line from left to right
const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 1.0));
@@ -346,23 +345,10 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendIS(getInnerExtend(getLeftLine(), true));
- const double fExtendIE(getInnerExtend(getRightLine(), false));
- double fExtendOS(0.0);
- double fExtendOE(0.0);
-
- if(getBottomIsOutside())
- {
- if(getLeftIsOutside())
- {
- fExtendOS = getOuterExtend(getLeftLine());
- }
-
- if(getRightIsOutside())
- {
- fExtendOE = getOuterExtend(getRightLine());
- }
- }
+ const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine ));
+ const double fExtendIE(getExtend(getRightLine(), maRightFromBLine));
+ const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine()));
+ const double fExtendOE(getExtend(maRightFromBLine, getRightLine()));
xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
aStart,
@@ -374,14 +360,15 @@ namespace drawinglayer
fExtendIE * fTwipsToMM,
fExtendOS * fTwipsToMM,
fExtendOE * fTwipsToMM,
- true,
- getBottomIsOutside(),
- getBottomLine().GetColor().getBColor(),
+ getBottomLine().GetColorOut(false).getBColor(),
+ getBottomLine().GetColorIn(false).getBColor(),
+ getBottomLine().GetColorGap().getBColor(),
+ getBottomLine().HasGapColor(),
getBottomLine().GetStyle()));
}
}
- if(!getRightLine().isEmpty())
+ if(!getRightLine().isEmpty() && getRightIsOutside())
{
// create right line from top to bottom
const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(1.0, 0.0));
@@ -389,23 +376,10 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendIS(getInnerExtend(getTopLine(), false));
- const double fExtendIE(getInnerExtend(getBottomLine(), true));
- double fExtendOS(0.0);
- double fExtendOE(0.0);
-
- if(getRightIsOutside())
- {
- if(getTopIsOutside())
- {
- fExtendOS = getOuterExtend(getTopLine());
- }
-
- if(getBottomIsOutside())
- {
- fExtendOE = getOuterExtend(getBottomLine());
- }
- }
+ const double fExtendIS(getExtend(getTopLine(), maTopFromRLine));
+ const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine));
+ const double fExtendOS(getExtend(maTopFromRLine, getTopLine()));
+ const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine()));
xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
aStart,
@@ -417,9 +391,10 @@ namespace drawinglayer
fExtendOE * fTwipsToMM,
fExtendIS * fTwipsToMM,
fExtendIE * fTwipsToMM,
- getRightIsOutside(),
- true,
- getRightLine().GetColor().getBColor(),
+ getRightLine().GetColorOut(true).getBColor(),
+ getRightLine().GetColorIn(true).getBColor(),
+ getRightLine().GetColorGap().getBColor(),
+ getRightLine().HasGapColor(),
getRightLine().GetStyle()));
}
}
@@ -432,23 +407,10 @@ namespace drawinglayer
if(!aStart.equal(aEnd))
{
- const double fExtendIS(getInnerExtend(getLeftLine(), true));
- const double fExtendIE(getInnerExtend(getRightLine(), false));
- double fExtendOS(0.0);
- double fExtendOE(0.0);
-
- if(getTopIsOutside())
- {
- if(getLeftIsOutside())
- {
- fExtendOS = getOuterExtend(getLeftLine());
- }
-
- if(getRightIsOutside())
- {
- fExtendOE = getOuterExtend(getRightLine());
- }
- }
+ const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine));
+ const double fExtendIE(getExtend(getRightLine(), maRightFromTLine));
+ const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine()));
+ const double fExtendOE(getExtend(maRightFromTLine, getRightLine()));
xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D(
aStart,
@@ -460,9 +422,10 @@ namespace drawinglayer
fExtendOE * fTwipsToMM,
fExtendIS * fTwipsToMM,
fExtendIE * fTwipsToMM,
- getTopIsOutside(),
- true,
- getTopLine().GetColor().getBColor(),
+ getTopLine().GetColorOut(false).getBColor(),
+ getTopLine().GetColorIn(false).getBColor(),
+ getTopLine().GetColorGap().getBColor(),
+ getTopLine().HasGapColor(),
getTopLine().GetStyle()));
}
}
@@ -482,6 +445,14 @@ namespace drawinglayer
&& getBottomLine() == rCompare.getBottomLine()
&& getRightLine() == rCompare.getRightLine()
&& getTopLine() == rCompare.getTopLine()
+ && maLeftFromTLine == rCompare.maLeftFromTLine
+ && maLeftFromBLine == rCompare.maLeftFromBLine
+ && maRightFromTLine == rCompare.maRightFromTLine
+ && maRightFromBLine == rCompare.maRightFromBLine
+ && maTopFromLLine == rCompare.maTopFromLLine
+ && maTopFromRLine == rCompare.maTopFromRLine
+ && maBottomFromLLine == rCompare.maBottomFromLLine
+ && maBottomFromRLine == rCompare.maBottomFromRLine
&& getLeftIsOutside() == rCompare.getLeftIsOutside()
&& getBottomIsOutside() == rCompare.getBottomIsOutside()
&& getRightIsOutside() == rCompare.getRightIsOutside()
@@ -587,6 +558,15 @@ namespace sdr
SvxBorderLine aRightLine;
SvxBorderLine aTopLine;
+ SvxBorderLine aLeftFromTLine;
+ SvxBorderLine aLeftFromBLine;
+ SvxBorderLine aRightFromTLine;
+ SvxBorderLine aRightFromBLine;
+ SvxBorderLine aTopFromLLine;
+ SvxBorderLine aTopFromRLine;
+ SvxBorderLine aBottomFromLLine;
+ SvxBorderLine aBottomFromRLine;
+
// create single primitives per cell
for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++)
{
@@ -658,6 +638,16 @@ namespace sdr
impGetLine(aRightLine, rTableLayouter, nXRight, nY, false, nColCount, nRowCount, bIsRTL);
impGetLine(aTopLine, rTableLayouter, nX, nY, true, nColCount, nRowCount, bIsRTL);
+ // get the neighbor cells' borders
+ impGetLine(aLeftFromTLine, rTableLayouter, nX, nY - 1, false, nColCount, nRowCount, bIsRTL);
+ impGetLine(aLeftFromBLine, rTableLayouter, nX, nYBottom + 1, false, nColCount, nRowCount, bIsRTL);
+ impGetLine(aRightFromTLine, rTableLayouter, nXRight, nY - 1, false, nColCount, nRowCount, bIsRTL);
+ impGetLine(aRightFromBLine, rTableLayouter, nXRight, nYBottom + 1, false, nColCount, nRowCount, bIsRTL);
+ impGetLine(aTopFromLLine, rTableLayouter, nX - 1, nY, true, nColCount, nRowCount, bIsRTL);
+ impGetLine(aTopFromRLine, rTableLayouter, nXRight + 1, nY, true, nColCount, nRowCount, bIsRTL);
+ impGetLine(aBottomFromLLine, rTableLayouter, nX - 1, nYBottom, true, nColCount, nRowCount, bIsRTL);
+ impGetLine(aBottomFromRLine, rTableLayouter, nXRight + 1, nYBottom, true, nColCount, nRowCount, bIsRTL);
+
// create the primtive containing all data for one cell with borders
xBorderSequence[nBorderInsert++] = drawinglayer::primitive2d::Primitive2DReference(
new drawinglayer::primitive2d::SdrBorderlinePrimitive2D(
@@ -666,6 +656,14 @@ namespace sdr
aBottomLine,
aRightLine,
aTopLine,
+ aLeftFromTLine,
+ aLeftFromBLine,
+ aRightFromTLine,
+ aRightFromBLine,
+ aTopFromLLine,
+ aTopFromRLine,
+ aBottomFromLLine,
+ aBottomFromRLine,
bIsRTL ? nX == nColCount : 0 == nX,
nRowCount == nYBottom,
bIsRTL ? 0 == nXRight : nXRight == nColCount,