Kaydet (Commit) 1fe4f041 authored tarafından Paul Trojahn's avatar Paul Trojahn Kaydeden (comit) Tamás Zolnai

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/48456Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst b7f12d8f
......@@ -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;
......
......@@ -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();
......
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