Kaydet (Commit) 4f2c8194 authored tarafından yogesh.bharate001's avatar yogesh.bharate001 Kaydeden (comit) Caolán McNamara

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/14925Tested-by: 's avatarJenkins <ci@libreoffice.org>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7ff58e1a
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/table/BorderLine2.hpp> #include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/table/XTableRows.hpp>
#include <stlpool.hxx> #include <stlpool.hxx>
...@@ -102,6 +103,7 @@ public: ...@@ -102,6 +103,7 @@ public:
#endif #endif
void testBulletSuffix(); void testBulletSuffix();
void testBnc910045(); void testBnc910045();
void testRowHeight();
CPPUNIT_TEST_SUITE(SdImportTest); CPPUNIT_TEST_SUITE(SdImportTest);
...@@ -140,6 +142,7 @@ public: ...@@ -140,6 +142,7 @@ public:
#endif #endif
CPPUNIT_TEST(testBulletSuffix); CPPUNIT_TEST(testBulletSuffix);
CPPUNIT_TEST(testBnc910045); CPPUNIT_TEST(testBnc910045);
CPPUNIT_TEST(testRowHeight);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -1173,6 +1176,28 @@ void SdImportTest::testBnc910045() ...@@ -1173,6 +1176,28 @@ void SdImportTest::testBnc910045()
CPPUNIT_ASSERT_EQUAL(sal_Int32(5210557), nColor); 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_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -727,7 +727,7 @@ sal_Int32 Cell::getMinimumHeight() ...@@ -727,7 +727,7 @@ sal_Int32 Cell::getMinimumHeight()
pEditOutliner->SetMaxAutoPaperSize(aSize); pEditOutliner->SetMaxAutoPaperSize(aSize);
nMinimumHeight = pEditOutliner->GetTextHeight()+1; nMinimumHeight = pEditOutliner->GetTextHeight()+1;
} }
else /*if ( hasText() )*/ else if ( hasText() )
{ {
Outliner& rOutliner=rTableObj.ImpGetDrawOutliner(); Outliner& rOutliner=rTableObj.ImpGetDrawOutliner();
rOutliner.SetPaperSize(aSize); rOutliner.SetPaperSize(aSize);
......
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