Change in core[libreoffice-4-0]: fdo#59393 fdo#44053 fix this again and this time add a testc...
Miklos Vajna (via Code Review)
gerrit at gerrit.libreoffice.org
Thu Jan 31 07:19:32 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1947
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/47/1947/1
fdo#59393 fdo#44053 fix this again and this time add a testcase as well
This was about importing RTF tables where different rows had different
number of cells. In the meantime, a better implementation was added for
DOCX, just using that for RTF fixes the import of this bugdoc.
Also fixes a crasher while loading ooo43817-1.rtf.
(cherry picked from commit d276d3f3ae112a11c8cb5768650d147cbb94275e)
Change-Id: I0970275272eca7f33a442bd6acc97a4f8d9dabeb
---
A sw/qa/extras/rtfimport/data/fdo44053.rtf
M sw/qa/extras/rtfimport/rtfimport.cxx
M writerfilter/source/dmapper/DomainMapperTableManager.cxx
M writerfilter/source/dmapper/DomainMapperTableManager.hxx
M writerfilter/source/dmapper/DomainMapper_Impl.hxx
5 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/sw/qa/extras/rtfimport/data/fdo44053.rtf b/sw/qa/extras/rtfimport/data/fdo44053.rtf
new file mode 100644
index 0000000..ef5f975
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo44053.rtf
@@ -0,0 +1,15 @@
+{\rtf1
+Title\par
+\trowd \cellx550\cellx7000
+0000000\cell
+Name\cell
+\pard
+\trowd \cellx550\cellx7000\row
+\trowd \cellx550\cellx1650\cellx5550\cellx7000
+\cell
+\pard \intbl
+Cell1\cell\cell\cell
+\pard
+\trowd \cellx550\cellx1650\cellx5550\cellx7000\row
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 3dc2f1b..d2a5c31 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -136,6 +136,7 @@
void testFdo45183();
void testFdo54612();
void testFdo58933();
+ void testFdo44053();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -222,6 +223,7 @@
{"fdo45183.rtf", &Test::testFdo45183},
{"fdo54612.rtf", &Test::testFdo54612},
{"fdo58933.rtf", &Test::testFdo58933},
+ {"fdo44053.rtf", &Test::testFdo44053},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -1052,6 +1054,17 @@
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
}
+void Test::testFdo44053()
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
+ // The with of the table's A1 and A2 cell should equal.
+ CPPUNIT_ASSERT_EQUAL(getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position,
+ getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index afe9d6c..448d6e1 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -41,7 +41,7 @@
using namespace ::std;
-DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool bImplicitMerges) :
+DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
m_nRow(0),
m_nCell(),
m_nGridSpan(1),
@@ -51,7 +51,6 @@
m_nHeaderRepeat(0),
m_nTableWidth(0),
m_bOOXML( bOOXML ),
- m_bImplicitMerges(bImplicitMerges),
m_bPushCurrentWidth(false),
m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) )
{
@@ -525,34 +524,6 @@
TablePropertyMapPtr pPropMap( new TablePropertyMap );
pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) );
-#ifdef DEBUG_DOMAINMAPPER
- dmapper_logger->startElement("rowProperties");
- pPropMap->dumpXml( dmapper_logger );
- dmapper_logger->endElement();
-#endif
- insertRowProps(pPropMap);
- }
- else if (m_bImplicitMerges && pTableGrid->size())
- {
- // More grid than cells definitions? Then take the last ones.
- // This feature is used by the RTF implicit horizontal cell merges.
- uno::Sequence< text::TableColumnSeparator > aSeparators(m_nCell.back( ) - 1);
- text::TableColumnSeparator* pSeparators = aSeparators.getArray();
-
- sal_Int16 nSum = 0;
- sal_uInt32 nPos = 0;
- sal_uInt32 nSizeTableGrid = pTableGrid->size();
- // Ignoring the i=0 case means we assume that the width of the last cell matches the table width
- for (sal_uInt32 i = m_nCell.back( ); i > 1 && nSizeTableGrid >= i; i--)
- {
- nSum += (*pTableGrid.get())[pTableGrid->size() - i]; // Size of the current cell
- pSeparators[nPos].Position = nSum * nFullWidthRelative / nFullWidth; // Relative position
- pSeparators[nPos].IsVisible = sal_True;
- nPos++;
- }
-
- TablePropertyMapPtr pPropMap( new TablePropertyMap );
- pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) );
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->startElement("rowProperties");
pPropMap->dumpXml( dmapper_logger );
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index e7965bd..bba5b5e 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -43,7 +43,6 @@
sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
sal_Int32 m_nTableWidth; //might be set directly or has to be calculated from the column positions
bool m_bOOXML;
- bool m_bImplicitMerges;
OUString m_sTableStyleName;
OUString m_sTableVertAnchor;
PropertyMapPtr m_pTableStyleTextProperies;
@@ -62,7 +61,7 @@
public:
- DomainMapperTableManager(bool bOOXML, bool bImplicitMerges);
+ DomainMapperTableManager(bool bOOXML);
virtual ~DomainMapperTableManager();
// use this method to avoid adding the properties for the table
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 5857455..20065e7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -588,7 +588,7 @@
void appendTableManager( )
{
boost::shared_ptr< DomainMapperTableManager > pMngr(
- new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML || m_eDocumentType == DOCUMENT_RTF, m_eDocumentType == DOCUMENT_RTF ) );
+ new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML || m_eDocumentType == DOCUMENT_RTF ) );
m_aTableManagers.push( pMngr );
}
--
To view, visit https://gerrit.libreoffice.org/1947
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0970275272eca7f33a442bd6acc97a4f8d9dabeb
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos at suse.cz>
More information about the LibreOffice
mailing list