[Libreoffice-commits] core.git: sw/qa writerfilter/inc writerfilter/source

Cédric Bosdonnat cedric.bosdonnat at free.fr
Mon Feb 18 08:42:34 PST 2013


 sw/qa/extras/ooxmlimport/data/n779642.docx        |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx          |    9 +++++++++
 writerfilter/inc/resourcemodel/TableManager.hxx   |   14 ++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx      |    3 +--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    4 +++-
 5 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 874f0a1be443b8027d5aba2285866f31cf4169e5
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Mon Feb 18 17:34:06 2013 +0100

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

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 3abfa6d..ce07b6f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -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();
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 84f344e..9e2fdff 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -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
         {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c808d76..fe100ff 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
         {


More information about the Libreoffice-commits mailing list