Kaydet (Commit) 850c575d authored tarafından Justin Luth's avatar Justin Luth

editeng ConvertBorderWidthToWord ensure minimum width

If the border in LO has a width, then make sure that the
converted width is non-zero.

The specific fix intended is for the "Horizontal Line"
paragraph style (double, width =1) to export to .doc
format and retain the bottom border.

Change-Id: I65392b2312360d51c290030ceb415155e6139302
Reviewed-on: https://gerrit.libreoffice.org/61006
Tested-by: Jenkins
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst 32ffb7b8
......@@ -250,6 +250,9 @@ ConvertBorderWidthFromWord(SvxBorderLineStyle const eStyle, double const i_fWidt
double
ConvertBorderWidthToWord(SvxBorderLineStyle const eStyle, double const fWidth)
{
if ( !fWidth )
return 0;
switch (eStyle)
{
// Single lines
......@@ -264,31 +267,31 @@ ConvertBorderWidthToWord(SvxBorderLineStyle const eStyle, double const fWidth)
// Double lines
case SvxBorderLineStyle::DOUBLE:
case SvxBorderLineStyle::DOUBLE_THIN:
return fWidth / 3.0;
return std::max(1.0, fWidth / 3.0);
case SvxBorderLineStyle::THINTHICK_MEDIUMGAP:
case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP:
case SvxBorderLineStyle::EMBOSSED:
case SvxBorderLineStyle::ENGRAVED:
return fWidth / 2.0;
return std::max(1.0, fWidth / 2.0);
case SvxBorderLineStyle::THINTHICK_SMALLGAP:
return fWidth - THINTHICK_SMALLGAP_line2 - THINTHICK_SMALLGAP_gap;
return std::max(1.0, fWidth - THINTHICK_SMALLGAP_line2 - THINTHICK_SMALLGAP_gap);
case SvxBorderLineStyle::THINTHICK_LARGEGAP:
return fWidth - THINTHICK_LARGEGAP_line1 - THINTHICK_LARGEGAP_line2;
return std::max(1.0, fWidth - THINTHICK_LARGEGAP_line1 - THINTHICK_LARGEGAP_line2);
case SvxBorderLineStyle::THICKTHIN_SMALLGAP:
return fWidth - THICKTHIN_SMALLGAP_line1 - THICKTHIN_SMALLGAP_gap;
return std::max(1.0, fWidth - THICKTHIN_SMALLGAP_line1 - THICKTHIN_SMALLGAP_gap);
case SvxBorderLineStyle::THICKTHIN_LARGEGAP:
return fWidth - THICKTHIN_LARGEGAP_line1 - THICKTHIN_LARGEGAP_line2;
return std::max(1.0, fWidth - THICKTHIN_LARGEGAP_line1 - THICKTHIN_LARGEGAP_line2);
case SvxBorderLineStyle::OUTSET:
return (fWidth - OUTSET_line1) / 2.0;
return std::max(1.0, (fWidth - OUTSET_line1) / 2.0);
case SvxBorderLineStyle::INSET:
return (fWidth - INSET_line2) / 2.0;
return std::max(1.0, (fWidth - INSET_line2) / 2.0);
case SvxBorderLineStyle::NONE:
return 0;
......
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