diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/qa/unit/data/shape-text-alignment.pptx | bin | 0 -> 30844 bytes | |||
-rw-r--r-- | oox/qa/unit/drawingml.cxx | 20 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/textbodypropertiescontext.cxx | 5 |
4 files changed, 27 insertions, 1 deletions
diff --git a/oox/qa/unit/data/shape-text-alignment.pptx b/oox/qa/unit/data/shape-text-alignment.pptx Binary files differnew file mode 100644 index 000000000000..ff4ff06f2fdf --- /dev/null +++ b/oox/qa/unit/data/shape-text-alignment.pptx diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index d88f91797304..43609435c468 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> #include <com/sun/star/chart2/XDataPointCustomLabelField.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> #include <unotools/mediadescriptor.hxx> #include <unotools/tempfile.hxx> @@ -226,6 +227,25 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGradientMultiStepTransparency) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffff), aTransparence.EndColor); } +CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAlignment) +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "shape-text-alignment.pptx"; + load(aURL); + + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); + sal_Int16 nParaAdjust = -1; + CPPUNIT_ASSERT(xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 0 + // - Actual : 3 + // i.e. text which is meant to be left-aligned was centered at a paragraph level. + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, + static_cast<style::ParagraphAdjust>(nParaAdjust)); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 99fa848741b3..90d9e5379dde 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -210,7 +210,8 @@ void Shape::setDefaults(bool bHeight) if (bHeight) maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< float >( 18.0 )); maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, TextVerticalAdjust_TOP); - maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< sal_Int16 >( ParagraphAdjust_CENTER )); + maDefaultShapeProperties.setProperty(PROP_ParaAdjust, + static_cast<sal_Int16>(ParagraphAdjust_LEFT)); } ::oox::vml::OleObjectInfo& Shape::setOleObjectType() diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index c70b50273b2f..b72fa194401a 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -116,6 +116,11 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons { mrTextBodyProp.meVA = GetTextVerticalAdjust( rAttribs.getToken( XML_anchor, XML_t ) ); mrTextBodyProp.maPropertyMap.setProperty( PROP_TextVerticalAdjust, mrTextBodyProp.meVA); + if (mrTextBodyProp.meVA == drawing::TextVerticalAdjust_CENTER) + { + mrTextBodyProp.maPropertyMap.setProperty(PROP_TextHorizontalAdjust, + TextHorizontalAdjust_CENTER); + } } // Push defaults |