Kaydet (Commit) 874f0a1b authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

n#779642: ignore framePr inside table or the table import won't work

üst a5cf6acf
......@@ -114,6 +114,7 @@ public:
void testN793262();
void testN793998();
void testGroupshapeLine();
void testN779642();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -180,6 +181,7 @@ void Test::run()
{"n793262.docx", &Test::testN793262},
{"n793998.docx", &Test::testN793998},
{"groupshape-line.docx", &Test::testGroupshapeLine},
{"n779642.docx", &Test::testN779642},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
......@@ -1159,6 +1161,13 @@ void Test::testN793998()
CPPUNIT_ASSERT(nTextPortion + nTabPortion > nParagraph - nRightMargin);
}
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();
......
......@@ -520,6 +520,11 @@ public:
*/
virtual void endLevel();
/**
Tells whether a table has been started or not
*/
bool isInTable();
/**
Handle the start of a paragraph group.
*/
......@@ -692,6 +697,15 @@ void TableManager<T, PropertiesPointer>::handle(const T & rHandle)
setHandle(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()
{
......
......@@ -2902,7 +2902,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);
......@@ -2910,7 +2910,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
{
ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pContext.get() );
pParaContext->SetFrameMode();
}
else
{
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment