summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-01-25 22:43:39 +0100
committerNoel Power <noel.power@novell.com>2012-01-30 11:32:20 +0000
commited41167d5ffae11efdd9cb43b2d88a8147e6d13f (patch)
tree0f093cdafdcb0821eed60109b9e827e0ef05d656
parent756045dcffcdf2da3bc4d0c7bf0a55e5fc75106e (diff)
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. Signed-off-by: C├ędric Bosdonnat <cedric.bosdonnat.ooo@free.fr> Signed-off-by: Noel Power <noel.power@novell.com>
-rw-r--r--editeng/qa/items/borderline_test.cxx2
-rw-r--r--editeng/source/items/borderline.cxx21
2 files changed, 19 insertions, 4 deletions
diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx
index 5d67b62f82..05172d6d61 100644
--- a/editeng/qa/items/borderline_test.cxx
+++ b/editeng/qa/items/borderline_test.cxx
@@ -85,7 +85,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 de24284b92..88adf29e0a 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -279,10 +279,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
{