Kaydet (Commit) 74d9b711 authored tarafından Vasily Melenchuk's avatar Vasily Melenchuk Kaydeden (comit) Thorsten Behrens

html import: kill ancient hack screwing up vertical table borders

HTML tables with border="1" were parsed and displayed incorrectly:
no vertical borders; invalid border width.

Also fixing problem with strange condition allowing setting right
border.

Change-Id: Ibe87e630ef9ef0a4352bbe659340f69c8ebc0d0d
Reviewed-on: https://gerrit.libreoffice.org/38454Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst cb444c17
<table border="1">
<tr>
<td>Schlüssel</td>
<td>Name_des_Tests</td>
<td>3</td>
</tr>
<tr>
<td>Öffnen der "Document Type" Maske</td>
<td>AF01.01</td>
<td>3</td>
</tr>
<tr>
<td>Öffnen der "Document Type" Maske</td>
<td>Öffnen der "Document Type" Maske</td>
<td>3</td>
</tr>
<tr>
<td>Öffnen der "Document Type" Maske</td>
<td>Öffnen der "Document Type" Maske</td>
<td>3</td>
</tr>
</table>
\ No newline at end of file
......@@ -221,6 +221,38 @@ DECLARE_HTMLIMPORT_TEST(testChangedby, "meta-changedby.html")
CPPUNIT_ASSERT(!xFields->hasMoreElements());
}
DECLARE_HTMLIMPORT_TEST(testTableBorder1px, "table_border_1px.html")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCellA1(xTable->getCellByName("A1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA1,"TopBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellA1,"BottomBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA1,"LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA1,"RightBorder"));
uno::Reference<text::XTextRange> xCellB1(xTable->getCellByName("B1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellB1,"TopBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB1,"BottomBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB1,"LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellB1,"RightBorder"));
uno::Reference<text::XTextRange> xCellA2(xTable->getCellByName("A2"), uno::UNO_QUERY);
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0,0,0,0,0,0), getProperty<table::BorderLine2>(xCellA2,"TopBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellA2,"BottomBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA2,"LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellA2,"RightBorder"));
uno::Reference<text::XTextRange> xCellB2(xTable->getCellByName("B2"), uno::UNO_QUERY);
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0,0,0,0,0,0), getProperty<table::BorderLine2>(xCellB2,"TopBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB2,"BottomBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,0,2,4,3,2), getProperty<table::BorderLine2>(xCellB2,"LeftBorder"));
CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x808080,9,9,9,3,26), getProperty<table::BorderLine2>(xCellB2,"RightBorder"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -962,13 +962,6 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
if( nBorderOpt==USHRT_MAX )
nPWidth = 0;
// HACK: one pixel wide lines should be hairlines when we'll use double bordering
if( pOptions->nCellSpacing!=0 && nBorderOpt==1 )
{
nPWidth = 1;
nPHeight = 1;
}
if ( pOptions->nCellSpacing != 0 )
{
m_aTopBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
......@@ -1395,7 +1388,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
nInnerFrameWidth -= GetBorderWidth( rBorderLine );
bSet = true;
}
if( nCol+nColSpan == m_nCols && m_bRightBorder )
if( m_bRightBorder )
{
aBoxItem.SetLine( &m_aRightBorderLine, SvxBoxItemLine::RIGHT );
nInnerFrameWidth -= GetBorderWidth( m_aRightBorderLine );
......
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