Kaydet (Commit) e1d6ed94 authored tarafından Szymon Kłos's avatar Szymon Kłos

tdf#116350 Correctly display text on arc

Change-Id: Ice8c141db20d43ccc8d6e2b56004a4a28d2b257a
Reviewed-on: https://gerrit.libreoffice.org/58729
Tested-by: Jenkins
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 63c91b9c
......@@ -548,13 +548,22 @@ static inline void lcl_createPresetShape( uno::Reference<drawing::XShape>& xShap
lcl_resetPropertyValue( aGeomPropVec, sEquations );
lcl_resetPropertyValue( aGeomPropVec, sPath );
// Some shapes don't need scaling
bool bScale = true;
if ( rPresetType == "textRingInside"
|| rPresetType == "textRingOutside"
|| rPresetType == "textCirclePour" )
{
bScale = false;
}
// Apply geometry properties
uno::Sequence<beans::PropertyValue> aPropertyValues(
comphelper::InitPropertySequence(
{ { sTextPath, uno::makeAny( true ) },
{ "TextPathMode",
uno::Any( drawing::EnhancedCustomShapeTextPathMode_PATH ) },
{ "ScaleX", uno::Any( false ) } } ) );
{ "ScaleX", uno::Any( bScale ) } } ) );
lcl_setPropertyValue( aGeomPropVec, sTextPath,
comphelper::makePropertyValue( sTextPath, aPropertyValues ) );
......
......@@ -1816,6 +1816,39 @@ static inline double getAdjustmentValue( uno::Reference<beans::XPropertySet>& xS
return -1.0;
}
static inline bool getScaleXValue(uno::Reference<beans::XPropertySet>& xSet)
{
bool bScaleX = false;
auto aGeomPropSeq = xSet->getPropertyValue("CustomShapeGeometry")
.get<uno::Sequence<beans::PropertyValue>>();
auto aGeomPropVec
= comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(
aGeomPropSeq);
const OUString sName = "TextPath";
auto aIterator = std::find_if(
aGeomPropVec.begin(), aGeomPropVec.end(),
[sName](const beans::PropertyValue& rValue) { return rValue.Name == sName; });
if (aIterator != aGeomPropVec.end())
{
uno::Sequence<beans::PropertyValue> aTextPathProperties;
aIterator->Value >>= aTextPathProperties;
const OUString sScaleX = "ScaleX";
auto aIterator2 = std::find_if(
aTextPathProperties.begin(), aTextPathProperties.end(),
[sScaleX](const beans::PropertyValue& rValue) { return rValue.Name == sScaleX; });
if (aIterator2 != aTextPathProperties.end())
{
aIterator2->Value >>= bScaleX;
}
}
return bScaleX;
}
void SdOOXMLExportTest2::testTdf116350TextEffects()
{
::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( "sd/qa/unit/data/pptx/tdf116350-texteffects.pptx" ), PPTX );
......@@ -1825,16 +1858,25 @@ void SdOOXMLExportTest2::testTdf116350TextEffects()
double fAdjust = getAdjustmentValue( xShape0 );
CPPUNIT_ASSERT_EQUAL( 180.0, fAdjust );
bool bScaleX = getScaleXValue( xShape0 );
CPPUNIT_ASSERT_EQUAL( true, bScaleX );
// Default angle for ArchDown
uno::Reference<beans::XPropertySet> xShape14( getShapeFromPage( 14, 0, xDocShRef ) );
fAdjust = getAdjustmentValue( xShape14 );
CPPUNIT_ASSERT_EQUAL( 0.0, fAdjust );
bScaleX = getScaleXValue( xShape14 );
CPPUNIT_ASSERT_EQUAL( true, bScaleX );
// Angle directly set
uno::Reference<beans::XPropertySet> xShape1( getShapeFromPage( 1, 0, xDocShRef ) );
fAdjust = getAdjustmentValue( xShape1 );
CPPUNIT_ASSERT_EQUAL( 213.25, fAdjust );
bScaleX = getScaleXValue( xShape1 );
CPPUNIT_ASSERT_EQUAL( true, bScaleX );
// Export
utl::TempFile tempFile;
xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile );
......
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