diff options
author | Justin Luth <justin_luth@sil.org> | 2018-09-26 17:46:33 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-09-27 06:37:14 +0200 |
commit | 850c575d67162a97c1b7acd4fb75c32d0884e7b9 (patch) | |
tree | 84926f758fc71f0f08c450737973f024cc0d7d2d /editeng | |
parent | 32ffb7b875ee229744f0b880a32817e948ff10a4 (diff) |
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: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/items/borderline.cxx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 5c9042f307fe..33cd0ca6de31 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -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; |