From 28e9b5bc01ee25d8f456cf7acb1d618a5c0a8db8 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 6 Jun 2014 16:32:01 +0200 Subject: oox: support non-TextFrame shapes in WpsContext::onCreateContext Change-Id: I692fa22132cd3a722b58de22e3dbb759ff888e5d --- oox/source/shape/WpsContext.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'oox') diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index ed2b1de4de2d..90628b2f0c18 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -75,8 +75,9 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken uno::Reference xServiceInfo(mxShape, uno::UNO_QUERY); uno::Reference xPropertySet(mxShape, uno::UNO_QUERY); - if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.text.TextFrame")) + if (xServiceInfo.is()) { + bool bTextFrame = xServiceInfo->supportsService("com.sun.star.text.TextFrame"); // Handle inset attributes for Writer textframes. sal_Int32 aInsets[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns }; boost::optional oInsets[4]; @@ -87,9 +88,10 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken oInsets[i] = oox::drawingml::GetCoordinate(oValue.get()); } OUString aProps[] = { OUString("LeftBorderDistance"), OUString("TopBorderDistance"), OUString("RightBorderDistance"), OUString("BottomBorderDistance") }; - for (size_t i = 0; i < SAL_N_ELEMENTS(aProps); ++i) + OUString aShapeProps[] = { OUString("TextLeftDistance"), OUString("TextUpperDistance"), OUString("TextRightDistance"), OUString("TextLowerDistance") }; + for (size_t i = 0; i < SAL_N_ELEMENTS(bTextFrame ? aProps : aShapeProps); ++i) if (oInsets[i]) - xPropertySet->setPropertyValue(aProps[i], uno::makeAny(*oInsets[i])); + xPropertySet->setPropertyValue((bTextFrame ? aProps : aShapeProps)[i], uno::makeAny(*oInsets[i])); } // Handle text vertical adjustment inside a text frame -- cgit