summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorC├ędric Bosdonnat <cedric.bosdonnat@free.fr>2013-02-18 17:34:06 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-02-25 08:49:05 +0000
commitf0cc8071aa5e9c058f6bf1a1144d84c5252987a7 (patch)
treedd34de0fbcdd6c9dfec6e0767d00d3f4b4fd6329
parentea371cfb1d36058214fd036448ba0467dfe9f14f (diff)
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 <vmiklos@suse.cz> Tested-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r--sw/qa/extras/ooxmlimport/data/n779642.docxbin0 -> 85485 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx11
-rw-r--r--writerfilter/inc/resourcemodel/TableManager.hxx14
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx3
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx4
5 files changed, 28 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/n779642.docx b/sw/qa/extras/ooxmlimport/data/n779642.docx
new file mode 100644
index 000000000000..2fe9a176689b
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/n779642.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 11fcd11ed785..bb5e4e7667e7 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 b6555cc00264..a8ee39be69a1 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 5ae8e1389589..8e74201c19ed 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 88b4e4224ac8..a3cc27cbe412 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
{