editeng/source/items/borderline.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
New commits: commit 850c575d67162a97c1b7acd4fb75c32d0884e7b9 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Wed Sep 26 17:46:33 2018 +0300 Commit: Justin Luth <justin_l...@sil.org> CommitDate: Thu Sep 27 06:37:14 2018 +0200 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_l...@sil.org> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits