sw/qa/extras/ooxmlimport/data/n779642.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 ++++++++++- writerfilter/inc/resourcemodel/TableManager.hxx | 14 ++++++++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 3 +-- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 +++- 5 files changed, 28 insertions(+), 4 deletions(-)
New commits: commit f0cc8071aa5e9c058f6bf1a1144d84c5252987a7 Author: Cédric Bosdonnat <[email protected]> Date: Mon Feb 18 17:34:06 2013 +0100 n#779642: ignore framePr inside table or the table import won't work (cherry picked from commit 874f0a1be443b8027d5aba2285866f31cf4169e5) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: I72996da79ca22a09fb490d06bcd34f741d7093ac Reviewed-on: https://gerrit.libreoffice.org/2306 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> diff --git a/sw/qa/extras/ooxmlimport/data/n779642.docx b/sw/qa/extras/ooxmlimport/data/n779642.docx new file mode 100644 index 0000000..2fe9a17 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n779642.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 11fcd11..bb5e4e7 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -110,6 +110,7 @@ public: void testN773061(); void testN780645(); void testFineTableDash(); + void testN779642(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -171,7 +172,8 @@ void Test::run() {"n785767.docx", &Test::testN785767}, {"n773061.docx", &Test::testN773061}, {"n780645.docx", &Test::testN780645}, - {"tableborder-finedash.docx", &Test::testFineTableDash} + {"tableborder-finedash.docx", &Test::testFineTableDash}, + {"n779642.docx", &Test::testN779642}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1061,6 +1063,13 @@ void Test::testFineTableDash() CPPUNIT_ASSERT_EQUAL(aBorder.RightLine.LineStyle, table::BorderLineStyle::FINE_DASHED); } +void Test::testN779642() +{ + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx index b6555cc..a8ee39b 100644 --- a/writerfilter/inc/resourcemodel/TableManager.hxx +++ b/writerfilter/inc/resourcemodel/TableManager.hxx @@ -521,6 +521,11 @@ public: virtual void endLevel(); /** + Tells whether a table has been started or not + */ + bool isInTable(); + + /** Handle the start of a paragraph group. */ virtual void startParagraphGroup(); @@ -693,6 +698,15 @@ void TableManager<T, PropertiesPointer>::handle(const T & rHandle) } template <typename T, typename PropertiesPointer> +bool TableManager<T, PropertiesPointer>::isInTable() +{ + bool bInTable = false; + if ( !mTableDataStack.empty() ) + bInTable = mTableDataStack.top()->getDepth() > 0; + return bInTable; +} + +template <typename T, typename PropertiesPointer> void TableManager<T, PropertiesPointer>::startLevel() { #ifdef DEBUG_TABLE diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 5ae8e13..8e74201 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2905,7 +2905,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType } break; case NS_ooxml::LN_CT_PPrBase_framePr: - // Avoid frames if we're inside a structured document tag, would just cause outher tables fail to create. + // Avoid frames if we're inside a structured document tag, would just cause outer tables fail to create. if (!m_pImpl->GetSdt()) { PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH); @@ -2913,7 +2913,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType { ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() ); pParaContext->SetFrameMode(); - } else { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 88b4e42..a3cc27c 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -727,7 +727,9 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) { PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); TextAppendContext& rAppendContext = m_aTextAppendStack.top(); - if( rAppendContext.pLastParagraphProperties.get() && rAppendContext.pLastParagraphProperties->IsFrameMode() ) + // n#779642: ignore fly frame inside table as it could lead to messy situations + if( rAppendContext.pLastParagraphProperties.get() && rAppendContext.pLastParagraphProperties->IsFrameMode() + && !getTableManager().isInTable() ) { try {
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
