sw/qa/extras/ooxmlimport/data/n780563.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 ++++++++ writerfilter/source/dmapper/DomainMapperTableManager.cxx | 24 ++++++++------- writerfilter/source/dmapper/DomainMapperTableManager.hxx | 2 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 1 5 files changed, 28 insertions(+), 12 deletions(-)
New commits: commit 207aebf733cc568845cea5c2aeff78493e056b9a Author: Cédric Bosdonnat <cedric.bosdon...@free.fr> Date: Fri Sep 21 17:17:33 2012 +0200 n#780563: Fixed table import in shapes table handler was missing Change-Id: I7720cfc706d9612fcc1e8a53b13a31f22b91d99e diff --git a/sw/qa/extras/ooxmlimport/data/n780563.docx b/sw/qa/extras/ooxmlimport/data/n780563.docx new file mode 100644 index 0000000..508dc74 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n780563.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 6b1c425..34581e5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -92,6 +92,7 @@ public: void testN779834(); void testN779627(); void testFdo55187(); + void testN780563(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -130,6 +131,7 @@ public: CPPUNIT_TEST(testN779834); CPPUNIT_TEST(testN779627); CPPUNIT_TEST(testFdo55187); + CPPUNIT_TEST(testN780563); #endif CPPUNIT_TEST_SUITE_END(); @@ -894,6 +896,17 @@ void Test::testFdo55187() getParagraph(1, OUString("lupÄka", 7, RTL_TEXTENCODING_UTF8)); } +void Test::testN780563() +{ + /* + * Make sure we have the table in the fly frame created + */ + load("n780563.docx"); + 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( )); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index e144f6e..112b837 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1598,6 +1598,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape } appendTableManager( ); + appendTableHandler( ); getTableManager().startLevel(); } catch ( const uno::Exception& e ) commit b14b0f2b953b68612b8c230dbf3cabc15247c72d Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Thu Sep 20 13:28:37 2012 +0200 n#779627: fixed writerfilter import of grid when there are nested tables When a nested table is ended, it resets the m_nCell to 0... and thus the filter forgets about the previous cells of the outer table row it is importing. Using a vector to store the m_nCell values for each table solves the problem Change-Id: I8007960f4c95d713bfedc6b815d5783a5d25af23 diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index bdcaa70..2753d7f 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -42,7 +42,7 @@ using namespace ::std; DomainMapperTableManager::DomainMapperTableManager(bool bOOXML, bool bImplicitMerges) : m_nRow(0), - m_nCell(0), + m_nCell(), m_nGridSpan(1), m_nCellBorderIndex(0), m_nHeaderRepeat(0), @@ -343,6 +343,7 @@ void DomainMapperTableManager::startLevel( ) IntVectorPtr pNewSpans( new vector<sal_Int32> ); m_aTableGrid.push_back( pNewGrid ); m_aGridSpans.push_back( pNewSpans ); + m_nCell.push_back( 0 ); m_nTableWidth = 0; } @@ -350,6 +351,7 @@ void DomainMapperTableManager::endLevel( ) { m_aTableGrid.pop_back( ); m_aGridSpans.pop_back( ); + m_nCell.pop_back( ); m_nTableWidth = 0; DomainMapperTableManager_Base_t::endLevel( ); @@ -373,7 +375,7 @@ void DomainMapperTableManager::endOfCellAction() getCurrentSpans()->push_back(m_nGridSpan); m_nGridSpan = 1; - ++m_nCell; + ++m_nCell.back( ); } @@ -416,10 +418,10 @@ void DomainMapperTableManager::endOfRowAction() } IntVectorPtr pCurrentSpans = getCurrentSpans( ); - if( pCurrentSpans->size() < m_nCell) + if( pCurrentSpans->size() < m_nCell.back( ) ) { //fill missing elements with '1' - pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 ); + pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell.back( ) - pCurrentSpans->size(), 1 ); } #ifdef DEBUG_DOMAINMAPPER @@ -450,15 +452,15 @@ void DomainMapperTableManager::endOfRowAction() double nFullWidth = m_nTableWidth; //the positions have to be distibuted in a range of 10000 const double nFullWidthRelative = 10000.; - if( pTableGrid->size() == nGrids && m_nCell > 0 ) + if( pTableGrid->size() == nGrids && m_nCell.back( ) > 0 ) { - uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 ); + uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 ); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); sal_Int16 nLastRelPos = 0; sal_uInt32 nBorderGridIndex = 0; ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( ); - for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder ) + for( sal_uInt32 nBorder = 0; nBorder < m_nCell.back( ) - 1; ++nBorder ) { sal_Int32 nGridCount = *aSpansIter; double fGridWidth = 0.; @@ -489,14 +491,14 @@ void DomainMapperTableManager::endOfRowAction() { // 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 - 1); + 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; i > 1 && nSizeTableGrid >= i; i--) + 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 @@ -515,7 +517,7 @@ void DomainMapperTableManager::endOfRowAction() } ++m_nRow; - m_nCell = 0; + m_nCell.back( ) = 0; m_nCellBorderIndex = 0; pCurrentSpans->clear(); @@ -527,7 +529,7 @@ void DomainMapperTableManager::endOfRowAction() void DomainMapperTableManager::clearData() { - m_nRow = m_nCell = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0; + m_nRow = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0; m_sTableStyleName = OUString(); m_sTableVertAnchor = OUString(); m_pTableStyleTextProperies.reset(); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index a005c2e..e9255f7 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -35,7 +35,7 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr; sal_uInt32 m_nRow; - sal_uInt32 m_nCell; + ::std::vector< sal_uInt32 > m_nCell; sal_uInt32 m_nGridSpan; sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits