tdf#80340: Table changes format in PPTX format

Problem:
- If the PPTX contains embedded table i.e copied from excel, when we open it in
impress it row height increase due to this table format changes.
- Table contents empty row i.e without text, then row height increase because
text height is added also added for empty row.

Solution:
- Added check whether row contents text or not.

Change-Id: I9f8a99aa407384505f0075168cf64fd51b8b4c7b
Reviewed-on: https://gerrit.libreoffice.org/14925
Tested-by: Jenkins <ci@libreoffice.org>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sd/qa/unit/data/pptx/n80340.pptx b/sd/qa/unit/data/pptx/n80340.pptx
new file mode 100755
index 0000000..6702075
--- /dev/null
+++ b/sd/qa/unit/data/pptx/n80340.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index c2f00b9..6b7f993 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -58,6 +58,7 @@
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/table/XTableRows.hpp>

#include <stlpool.hxx>

@@ -102,6 +103,7 @@ public:
#endif
    void testBulletSuffix();
    void testBnc910045();
    void testRowHeight();

    CPPUNIT_TEST_SUITE(SdImportTest);

@@ -140,6 +142,7 @@ public:
#endif
    CPPUNIT_TEST(testBulletSuffix);
    CPPUNIT_TEST(testBnc910045);
    CPPUNIT_TEST(testRowHeight);

    CPPUNIT_TEST_SUITE_END();
};
@@ -1173,6 +1176,28 @@ void SdImportTest::testBnc910045()
    CPPUNIT_ASSERT_EQUAL(sal_Int32(5210557), nColor);
}

void SdImportTest::testRowHeight()
{
    ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n80340.pptx"), PPTX );

    SdDrawDocument *pDoc = xDocShRef->GetDoc();
    CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );

    const SdrPage *pPage = pDoc->GetPage(1);
    CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );

    sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
    CPPUNIT_ASSERT( pTableObj );

    sal_Int32 nHeight;
    const OUString sHeight("Height");
    uno::Reference< com::sun::star::table::XTable > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW);
    uno::Reference< com::sun::star::table::XTableRows > xRows( xTable->getRows(), uno::UNO_QUERY_THROW);
    uno::Reference< beans::XPropertySet > xRefRow( xRows->getByIndex(0), uno::UNO_QUERY_THROW );
    xRefRow->getPropertyValue( sHeight ) >>= nHeight;
    CPPUNIT_ASSERT_EQUAL( sal_Int32(508), nHeight);
}

CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);

CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 11aedb8..71da0f1 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -727,7 +727,7 @@ sal_Int32 Cell::getMinimumHeight()
        pEditOutliner->SetMaxAutoPaperSize(aSize);
        nMinimumHeight = pEditOutliner->GetTextHeight()+1;
    }
    else /*if ( hasText() )*/
    else if ( hasText() )
    {
        Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
        rOutliner.SetPaperSize(aSize);