[Libreoffice-commits] core.git: sw/qa sw/source
Vasily Melenchuk
Vasily.Melenchuk at cib.de
Thu Jun 8 01:39:54 UTC 2017
sw/qa/extras/htmlimport/data/table_border_1px.html | 22 ++++++++++++++
sw/qa/extras/htmlimport/htmlimport.cxx | 32 +++++++++++++++++++++
sw/source/filter/html/htmltab.cxx | 9 -----
3 files changed, 55 insertions(+), 8 deletions(-)
New commits:
commit 74d9b711d71cbaf4f853559211f6525db4a4b5db
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date: Tue Jun 6 15:35:17 2017 +0300
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/38454
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/htmlimport/data/table_border_1px.html b/sw/qa/extras/htmlimport/data/table_border_1px.html
new file mode 100644
index 000000000000..6181aa0f82f2
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/table_border_1px.html
@@ -0,0 +1,22 @@
+<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
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx
index ebc665fcdd55..19f51c1824ea 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -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: */
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 0a499420f247..2f1daece276a 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -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 );
More information about the Libreoffice-commits
mailing list