diff options
author | Paul Trojahn <paul.trojahn@gmail.com> | 2018-01-20 18:08:58 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-01-24 17:22:02 +0100 |
commit | 1fe4f041aeef2fcabd90bc07ab6a5ee5aba1dd59 (patch) | |
tree | 310da4c80d76c76260bb129adf9fc55c79ec9e7c | |
parent | b7f12d8fd7493a7201ae5fd97e80e0296538f136 (diff) |
tdf#114913 Use master if char size wasn't set
The size returned by insertAt falls back to the master size if needed.
Change-Id: I741b48616c6c848fc641c597cc72bf8b17e3cad4
Reviewed-on: https://gerrit.libreoffice.org/48456
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r-- | oox/source/drawingml/textparagraph.cxx | 11 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/tdf114913.pptx | bin | 0 -> 33238 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 14 |
3 files changed, 21 insertions, 4 deletions
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx index 8f1e5d1b061c..e1fe50b31f1b 100644 --- a/oox/source/drawingml/textparagraph.cxx +++ b/oox/source/drawingml/textparagraph.cxx @@ -93,6 +93,7 @@ void TextParagraph::insertAt( } sal_Int32 nCharHeight = 0; + sal_Int32 nCharHeightFirst = 0; if ( maRuns.empty() ) { PropertySet aPropSet( xAt ); @@ -100,7 +101,7 @@ void TextParagraph::insertAt( TextCharacterProperties aTextCharacterProps( aTextCharacterStyle ); aTextCharacterProps.assignUsed( maEndProperties ); if ( aTextCharacterProps.moHeight.has() ) - nCharHeight = aTextCharacterProps.moHeight.get(); + nCharHeight = nCharHeightFirst = aTextCharacterProps.moHeight.get(); aTextCharacterProps.pushToPropSet( aPropSet, rFilterBase ); } else @@ -112,7 +113,10 @@ void TextParagraph::insertAt( // This is currently applied to only empty runs if( !nLen && ( ( aIt + 1 ) == aEnd ) ) (*aIt)->getTextCharacterProperties().assignUsed( maEndProperties ); - nCharHeight = std::max< sal_Int32 >( nCharHeight, (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle, nDefaultCharHeight ) ); + sal_Int32 nCharHeightCurrent = (*aIt)->insertAt( rFilterBase, xText, xAt, aTextCharacterStyle, nDefaultCharHeight ); + if(aIt == maRuns.begin()) + nCharHeightFirst = nCharHeightCurrent; + nCharHeight = std::max< sal_Int32 >( nCharHeight, nCharHeightCurrent); nParagraphSize += nLen; } } @@ -137,8 +141,7 @@ void TextParagraph::insertAt( if( !aioBulletList.hasProperty( PROP_GraphicSize ) && maRuns.size() > 0 && aParaProp.getBulletList().maGraphic.hasValue()) { - float fFirstCharHeight = maRuns.front()->getTextCharacterProperties().getCharHeightPoints(12); - long nFirstCharHeightMm = TransformMetric(fFirstCharHeight * 100.f, FUNIT_POINT, FUNIT_MM); + long nFirstCharHeightMm = TransformMetric(nCharHeightFirst > 0 ? nCharHeightFirst : 1200, FUNIT_POINT, FUNIT_MM); float fBulletSizeRel = 1.f; if( aParaProp.getBulletList().mnSize.hasValue() ) fBulletSizeRel = aParaProp.getBulletList().mnSize.get<sal_Int16>() / 100.f; diff --git a/sd/qa/unit/data/pptx/tdf114913.pptx b/sd/qa/unit/data/pptx/tdf114913.pptx Binary files differnew file mode 100644 index 000000000000..cf031aba0614 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf114913.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index b3730014a4fa..8210711ee906 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -171,6 +171,7 @@ public: void testTdf100065(); void testTdf90626(); void testTdf114488(); + void testTdf114913(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); void testPatternImport(); @@ -246,6 +247,7 @@ public: CPPUNIT_TEST(testTdf100065); CPPUNIT_TEST(testTdf90626); CPPUNIT_TEST(testTdf114488); + CPPUNIT_TEST(testTdf114913); CPPUNIT_TEST_SUITE_END(); }; @@ -2316,6 +2318,18 @@ void SdImportTest::testTdf114488() CPPUNIT_ASSERT_EQUAL(OUString("image/x-wmf"), sMimeType); } +void SdImportTest::testTdf114913() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114913.pptx"), PPTX); + SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>(GetPage(1, xDocShRef)->GetObj(1)); + CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr); + const SvxNumBulletItem *pItem = pTxtObj->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); + CPPUNIT_ASSERT(pItem); + CPPUNIT_ASSERT_EQUAL(long(691), pItem->GetNumRule()->GetLevel(0).GetGraphicSize().getHeight()); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |