29#include <editeng/editrids.hrc>
34#include <com/sun/star/util/XComplexColor.hpp>
36using namespace ::com::sun::star::table::BorderLineStyle;
43 Color lcl_compute3DColor(
Color aMain,
int nLight,
int nMedium,
int nDark )
49 if ( hsl.
getZ( ) >= 0.5 )
51 else if ( 0.5 > hsl.
getZ() && hsl.
getZ() >= 0.25 )
56 double L = std::min(hsl.
getZ() * 255.0 + nCoef, 255.0);
57 hsl.
setZ( L / 255.0 );
69 css::uno::Reference<css::util::XComplexColor> xComplexColor;
70 if (!(rValue >>= xComplexColor))
73 if (xComplexColor.is())
102 return lcl_compute3DColor( aMain, 3, 40, 83 );
108 return lcl_compute3DColor( aMain, -85, -43, -1 );
114 return lcl_compute3DColor( aMain, -42, -0, 42 );
123 , m_pColorOutFn(pColorOutFn)
124 , m_pColorInFn(pColorInFn)
125 , m_pColorGapFn(nullptr)
128 , m_bMirrorWidths(false)
129 , m_bUseLeftTop(false)
138 switch (nWordLineStyle)
206 int const nWordLineStyle)
209 double const fWidth((i_fWidth == 0.0) ? 15.0 : i_fWidth);
214 switch (nWordLineStyle)
217 return (fWidth * 2.0);
219 return std::max(fWidth, 1.0);
233 return (fWidth > 0 && fWidth < 20) ? 20 : fWidth;
289 return std::max(1.0, fWidth / 3.0);
295 return std::max(1.0, fWidth / 2.0);
313 return std::max(1.0, (fWidth -
INSET_line2) / 2.0);
353 BorderWidthImplFlags::CHANGE_LINE1 | BorderWidthImplFlags::CHANGE_LINE2 | BorderWidthImplFlags::CHANGE_DIST,
356 1.0/3.0, 1.0/3.0, 1.0/3.0 );
360 aImpl =
BorderWidthImpl(BorderWidthImplFlags::CHANGE_DIST, 10.0, 10.0, 1.0);
370 BorderWidthImplFlags::CHANGE_LINE1 | BorderWidthImplFlags::CHANGE_LINE2 | BorderWidthImplFlags::CHANGE_DIST,
386 BorderWidthImplFlags::CHANGE_LINE1 | BorderWidthImplFlags::CHANGE_LINE2 | BorderWidthImplFlags::CHANGE_DIST,
404 BorderWidthImplFlags::CHANGE_LINE1 | BorderWidthImplFlags::CHANGE_LINE2 | BorderWidthImplFlags::CHANGE_DIST,
415 BorderWidthImplFlags::CHANGE_LINE2 | BorderWidthImplFlags::CHANGE_DIST,
421 BorderWidthImplFlags::CHANGE_LINE1 | BorderWidthImplFlags::CHANGE_DIST,
440 if ( nOut > 0 && nIn > 0 )
461 for (
size_t i = 0;
i < len && nWidth == 0; ++
i)
463 nTestStyle = aDoubleStyles[
i];
465 nWidth = aWidthImpl.
GuessWidth( nOut, nIn, nDist );
483 BorderWidthImplFlags::CHANGE_LINE1 | BorderWidthImplFlags::CHANGE_LINE2 | BorderWidthImplFlags::CHANGE_DIST,
484 static_cast<double>(nOut ) /
static_cast<double>(
m_nWidth),
485 static_cast<double>(nIn ) /
static_cast<double>(
m_nWidth),
486 static_cast<double>(nDist) /
static_cast<double>(
m_nWidth));
493 if (nOut == 0 && nIn > 0)
506 std::swap( nOut, nIn);
599 aResult = (*m_pColorInFn)(
m_aColor);
601 aResult = (*m_pColorOutFn)(
m_aColor);
614 aResult = (*m_pColorOutFn)(
m_aColor);
616 aResult = (*m_pColorInFn)(
m_aColor);
628 aResult = (*m_pColorGapFn)(
m_aColor);
642 bool bMetricStr)
const
650 RID_THINTHICK_SMALLGAP,
651 RID_THINTHICK_MEDIUMGAP,
652 RID_THINTHICK_LARGEGAP,
653 RID_THICKTHIN_SMALLGAP,
654 RID_THICKTHIN_MEDIUMGAP,
655 RID_THICKTHIN_LARGEGAP,
696 if ( nThisSize > nOtherSize )
700 else if ( nThisSize < nOtherSize )
714 return !(rLeft == rRight);
@ FINE_DASHED
Finely dashed border line.
@ THICKTHIN_MEDIUMGAP
Double border line with a thick line outside and a thin line inside separated by a medium gap.
@ INSET
Inset border line.
@ EMBOSSED
3D embossed border line.
@ ENGRAVED
3D engraved border line.
@ THINTHICK_SMALLGAP
Double border line with a thin line outside and a thick line inside separated by a small gap.
@ DASHED
Dashed border line.
@ THICKTHIN_LARGEGAP
Double border line with a thick line outside and a thin line inside separated by a large gap.
@ DASH_DOT
Line consisting of a repetition of one dash and one dot.
@ OUTSET
Outset border line.
@ DOUBLE_THIN
Double border line consisting of two fixed thin lines separated by a variable gap.
@ THINTHICK_MEDIUMGAP
Double border line with a thin line outside and a thick line inside separated by a medium gap.
@ SOLID
Solid border line.
@ DASH_DOT_DOT
Line consisting of a repetition of one dash and 2 dots.
@ THICKTHIN_SMALLGAP
Double border line with a thick line outside and a thin line inside separated by a small gap.
@ THINTHICK_LARGEGAP
Double border line with a thin line outside and a thick line inside separated by a large gap.
@ DOTTED
Dotted border line.
@ DOUBLE
Double border line.
static tools::Long Scale(tools::Long nVal, tools::Long nMult, tools::Long nDiv)
tools::Long GetLine2(tools::Long nWidth) const
tools::Long GetGap(tools::Long nWidth) const
tools::Long GuessWidth(tools::Long nLine1, tools::Long nLine2, tools::Long nGap)
tools::Long GetLine1(tools::Long nWidth) const
basegfx::BColor getBColor() const
sal_uInt16 GetDistance() const
bool setComplexColorFromAny(css::uno::Any const &rValue)
SvxBorderLine(const Color *pCol=nullptr, tools::Long nWidth=0, SvxBorderLineStyle nStyle=SvxBorderLineStyle::SOLID, Color(*pColorOutFn)(Color)=&darkColor, Color(*pColorInFn)(Color)=&darkColor)
bool operator==(const SvxBorderLine &rCmp) const
void SetWidth(tools::Long nWidth)
Color(* m_pColorInFn)(Color)
static Color darkColor(Color aMain)
Color(* m_pColorGapFn)(Color)
Color GetColorIn(bool bLeftOrTop=true) const
OUString GetValueString(MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl, bool bMetricStr=false) const
SvxBorderLineStyle m_nStyle
static Color lightColor(Color aMain)
Color(* m_pColorOutFn)(Color)
sal_uInt16 GetOutWidth() const
BorderWidthImpl m_aWidthImpl
static Color threeDMediumColor(Color aMain)
sal_uInt16 GetScaledWidth() const
bool HasPriority(const SvxBorderLine &rOtherLine) const
static BorderWidthImpl getWidthImpl(SvxBorderLineStyle nStyle)
Get the BorderWithImpl object corresponding to the given #nStyle, all the units handled by the result...
model::ComplexColor m_aComplexColor
static Color threeDDarkColor(Color aMain)
sal_uInt16 GetInWidth() const
Color GetColorOut(bool bLeftOrTop=true) const
void setComplexColor(model::ComplexColor const &rComplexColor)
void ScaleMetrics(tools::Long nMult, tools::Long nDiv)
void SetBorderLineStyle(SvxBorderLineStyle nNew)
Color GetColorGap() const
static Color threeDLightColor(Color aMain)
SvxBorderLineStyle GetBorderLineStyle() const
void GuessLinesWidths(SvxBorderLineStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn=0, sal_uInt16 nDist=0)
Guess the style and width from the three lines widths values.
OUString EditResId(TranslateId aId)
OUString GetColorString(const Color &rCol)
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
TranslateId GetMetricId(MapUnit eUnit)
constexpr OUStringLiteral cpDelim
#define SAL_N_ELEMENTS(arr)
BColor rgb2hsl(const BColor &rRGBColor)
BColor hsl2rgb(const BColor &rHSLColor)
const double THINTHICK_SMALLGAP_gap
const double THICKTHIN_LARGEGAP_line1
const double THINTHICK_LARGEGAP_line1
bool operator!=(const SvxBorderLine &rLeft, const SvxBorderLine &rRight)
double ConvertBorderWidthFromWord(SvxBorderLineStyle const eStyle, double const i_fWidth, int const nWordLineStyle)
const double THICKTHIN_LARGEGAP_line2
const double THICKTHIN_SMALLGAP_line1
const double THINTHICK_SMALLGAP_line2
const double THINTHICK_LARGEGAP_line2
const double OUTSET_line1
SvxBorderLineStyle ConvertBorderStyleFromWord(int const nWordLineStyle)
const double THICKTHIN_SMALLGAP_gap
double ConvertBorderWidthToWord(SvxBorderLineStyle const eStyle, double const fWidth)
convert border width in twips between Word formats and LO
model::ComplexColor getFromXComplexColor(uno::Reference< util::XComplexColor > const &rxColor)