diff options
author | yogesh.bharate001 <yogesh.bharate@synerzip.com> | 2015-03-20 20:37:52 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-05-12 09:26:38 +0000 |
commit | 4f2c8194f485b1527fb4f4dfe23ce804937f1f9c (patch) | |
tree | eb366db4c08d492c339a31a3394e2de4896d9b73 | |
parent | 7ff58e1a8965606a9fb45153a377b84593746420 (diff) |
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>
-rwxr-xr-x | sd/qa/unit/data/pptx/n80340.pptx | bin | 0 -> 83909 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 25 | ||||
-rw-r--r-- | svx/source/table/cell.cxx | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/sd/qa/unit/data/pptx/n80340.pptx b/sd/qa/unit/data/pptx/n80340.pptx Binary files differnew file mode 100755 index 000000000000..6702075592a8 --- /dev/null +++ b/sd/qa/unit/data/pptx/n80340.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index c2f00b943272..6b7f99325ca8 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 11aedb88cacf..71da0f146c39 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); |