diff options
-rw-r--r-- | editeng/qa/items/borderline_test.cxx | 2 | ||||
-rw-r--r-- | editeng/source/items/borderline.cxx | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx index 80a840c72389..4b32ec6f65b4 100644 --- a/editeng/qa/items/borderline_test.cxx +++ b/editeng/qa/items/borderline_test.cxx @@ -106,7 +106,7 @@ void BorderLineTest::testGuessWidthNoMatch() line.GuessLinesWidths( DOUBLE, TEST_WIDTH + 1, TEST_WIDTH + 2, TEST_WIDTH + 3 ); CPPUNIT_ASSERT_EQUAL( DOUBLE, line.GetStyle() ); - CPPUNIT_ASSERT_EQUAL( long( 0 ), line.GetWidth() ); + CPPUNIT_ASSERT_EQUAL( long( (3 * TEST_WIDTH) + 6 ), line.GetWidth() ); } void BorderLineTest::testGuessWidthThinthickSmallgap() diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index e72934355bd1..61ceccead0cc 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -277,10 +277,25 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sa // If anything matched, then set it if ( nWidth > 0 ) + { nStyle = nTestStyle; - - SetStyle( nStyle ); - m_nWidth = nWidth; + SetStyle( nStyle ); + m_nWidth = nWidth; + } + else + { + // fdo#38542: not a known double, default to something custom... + SetStyle( nStyle ); + m_nWidth = nOut + nIn + nDist; + if (nOut + nIn + nDist) + { + m_aWidthImpl = BorderWidthImpl( + CHANGE_LINE1 | CHANGE_LINE2 | CHANGE_DIST, + static_cast<double>(nOut ) / static_cast<double>(m_nWidth), + static_cast<double>(nIn ) / static_cast<double>(m_nWidth), + static_cast<double>(nDist) / static_cast<double>(m_nWidth)); + } + } } else { |