Kaydet (Commit) e549f52f authored tarafından Michael Stahl's avatar Michael Stahl Kaydeden (comit) Cédric Bosdonnat

fdo#38542: SvxBorderLine::GuessLinesWidths:

Importing style:border-line-width="0.002cm 0.088cm 0.141cm" (which older
OOo/LO apparently could write) fails, because GuessLinesWidths can't find
a matching style (result: standard "double" border, 3 equal width parts).
Try to create a custom BorderWidthImpl of type DOUBLE instead, that
preserves the individual widths.
üst 7add8abf
......@@ -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()
......
......@@ -277,12 +277,27 @@ 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;
}
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
{
SetStyle( nStyle );
m_nWidth = m_aWidthImpl.GuessWidth( nOut, nIn, nDist );
......
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