From bef64b011337fa60b27339a00c30303143b4397d Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 28 Mar 2012 09:30:00 +0200 Subject: add name attribute to chart's layout dumper --- chart2/source/view/main/ChartView.cxx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index bb49dce71f12..77fe6aba9b42 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -3070,7 +3070,15 @@ void dumpXShape( uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlW uno::Reference< lang::XServiceInfo > xServiceInfo( xShape, uno::UNO_QUERY_THROW ); uno::Sequence< rtl::OUString > aServiceNames = xServiceInfo->getSupportedServiceNames(); - sal_Int32 nServices = aServiceNames.getLength(); + + uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW); + uno::Any aAny = xPropSet->getPropertyValue("Name"); + rtl::OUString aName; + if (aAny >>= aName) + { + if (!aName.isEmpty()) + xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr()); + } if (xServiceInfo->supportsService("com.sun.star.drawing.Text")) { uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY_THROW); @@ -3078,19 +3086,20 @@ void dumpXShape( uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlW if(!aText.isEmpty()) xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("text"), "%s", rtl::OUStringToOString(aText, RTL_TEXTENCODING_UTF8).getStr()); } - for (sal_Int32 i = 0; i < nServices; ++i) + else if(xServiceInfo->supportsService("com.sun.star.drawing.GroupShape")) { - if (aServiceNames[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GroupShape"))) - { - uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW); - dumpXShapes(xShapes, xmlWriter); - } + uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY_THROW); + dumpXShapes(xShapes, xmlWriter); + } #if DEBUG_DUMPER + sal_Int32 nServices = aServiceNames.getLength(); + for (sal_Int32 i = 0; i < nServices; ++i) + { xmlTextWriterStartElement(xmlWriter, BAD_CAST( "ServiceName" )); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST( "name" ), "%s", rtl::OUStringToOString(aServiceNames[i], RTL_TEXTENCODING_UTF8).getStr()); xmlTextWriterEndElement( xmlWriter ); -#endif } +#endif xmlTextWriterEndElement( xmlWriter ); } -- cgit v1.2.3