From d7214aba95bbdcbd40e87ef50fc66f2e2ec4f5ff Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Mon, 15 Apr 2024 13:39:03 +0200 Subject: [PATCH] tdf#160517 - chart odf: import/export formatted chart titles (main, sub, axis titles) texts properly to/from odf format. Fix odf export of formatted chart titles. The exported data structure will look like: This is . . . 3 a Fix import of formatted chart titles. Put the properties and related texts into the chart2::XFormattedString2 uno objects. Follow-up commit of: 55e9a27afd2d6a13cf76b39641bf121c3ec4b45c Related: tdf#39052 - chart ooxml: export formatted chart titles 4f994cec388377cc5c2bddb804bd92eb4cd7dc8d tdf#39052 - Chart: make characters formatable in editable chart textshapes -- TODO: chart data point / dataseries labels are handled differently since those are not editable objects, but that is a completily different issue. -- Change-Id: I1842f2c69c132bdf578bb2d354f451cc9d49c63c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166122 Reviewed-by: Michael Stahl Tested-by: Jenkins Reviewed-by: Balazs Varga --- chart2/qa/extras/chart2export3.cxx | 138 +++++++++++++++++- chart2/qa/extras/data/ods/tdf39052.ods | Bin 0 -> 15941 bytes .../chartapiwrapper/TitleWrapper.cxx | 46 ++---- chart2/source/model/main/Title.cxx | 3 + oox/source/export/chartexport.cxx | 12 +- xmloff/source/chart/SchXMLAxisContext.cxx | 22 +-- xmloff/source/chart/SchXMLChartContext.cxx | 39 ++--- xmloff/source/chart/SchXMLChartContext.hxx | 6 +- xmloff/source/chart/SchXMLExport.cxx | 77 +++++----- .../source/chart/SchXMLParagraphContext.cxx | 131 +++++++++++++++++ .../source/chart/SchXMLParagraphContext.hxx | 44 ++++++ xmloff/source/chart/SchXMLTools.cxx | 92 ++++++++++++ xmloff/source/chart/SchXMLTools.hxx | 4 + xmloff/source/chart/transporttypes.hxx | 2 +- 14 files changed, 491 insertions(+), 125 deletions(-) create mode 100644 chart2/qa/extras/data/ods/tdf39052.ods diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx index 3d05495eff40..df96a70e8e1f 100644 --- a/chart2/qa/extras/chart2export3.cxx +++ b/chart2/qa/extras/chart2export3.cxx @@ -10,6 +10,9 @@ #include "charttest.hxx" #include +#include +#include +#include using uno::Reference; using beans::XPropertySet; @@ -432,11 +435,17 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testChartSubTitle) xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart1.xml"); CPPUNIT_ASSERT(pXmlDoc); // test properties of subtitle + // paragraph props assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr"_ostr, "sz"_ostr, "1100"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr"_ostr, "b"_ostr, "1"); - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "00a933"); + // run props + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr"_ostr, "sz"_ostr, "1100"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr"_ostr, "b"_ostr, "1"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "00a933"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr/a:latin"_ostr, "typeface"_ostr, "Times New Roman"); + // text assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t"_ostr, "It is a Subtitle"); + // shape props assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "b2b2b2"); } @@ -447,13 +456,19 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testChartMainWithSubTitle) xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart1.xml"); CPPUNIT_ASSERT(pXmlDoc); // test properties of title + // paragraph props assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:pPr/a:defRPr"_ostr, "sz"_ostr, "1300"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:pPr/a:defRPr"_ostr, "b"_ostr, "0"); - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:pPr/a:defRPr"_ostr, "i"_ostr, "1"); - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:pPr/a:defRPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "f10d0c"); + // run props + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:r/a:rPr"_ostr, "sz"_ostr, "1300"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:r/a:rPr"_ostr, "b"_ostr, "0"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:r/a:rPr"_ostr, "i"_ostr, "1"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:r/a:rPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "f10d0c"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:r/a:rPr/a:latin"_ostr, "typeface"_ostr, "Arial"); + // text assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[1]/a:r/a:t"_ostr, "It is a Maintitle"); assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[2]/a:r/a:t"_ostr, "It is a Subtitle"); + // shape props assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:spPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "81d41a"); } @@ -600,8 +615,8 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testTitleCharacterPropertiesXLSX) xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart1.xml"); CPPUNIT_ASSERT(pXmlDoc); - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr"_ostr, "sz"_ostr, "2400"); - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr"_ostr, "b"_ostr, "1"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr"_ostr, "sz"_ostr, "1300"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:pPr/a:defRPr"_ostr, "b"_ostr, "0"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr"_ostr, "sz"_ostr, "2400"); assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:rPr"_ostr, "b"_ostr, "1"); @@ -812,6 +827,119 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testFormattedChartTitles) assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p[2]/a:r[4]/a:t"_ostr, "title"); } +namespace { + +void checkCharacterProps(Reference const & xTitleProp) +{ + Sequence< uno::Reference< chart2::XFormattedString > > xFormattedSubTitle; + CPPUNIT_ASSERT(xTitleProp->getPropertyValue("FormattedStrings") >>= xFormattedSubTitle); + CPPUNIT_ASSERT_EQUAL(sal_Int32(10), xFormattedSubTitle.getLength()); + // check texts + std::vector aValues = { "This", " is", "3", " a ", "custom", " erte1\n", "2dfgd ch", "ar", "t ", "title" }; + for (sal_Int32 i = 0; i < xFormattedSubTitle.getLength(); i++) + { + const OUString aText = xFormattedSubTitle.getConstArray()[i]->getString(); + CPPUNIT_ASSERT_EQUAL(aValues[i], aText); + Reference< beans::XPropertySet > xRunPropSet(xFormattedSubTitle.getConstArray()[i], uno::UNO_QUERY); + // common props + uno::Any aAny = xRunPropSet->getPropertyValue("CharFontName"); + CPPUNIT_ASSERT_EQUAL(uno::Any(OUString("Aptos Narrow")), aAny); + // unique props + if (aText == aValues[0]) + { + aAny = xRunPropSet->getPropertyValue("CharWeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontWeight::BOLD), aAny); + aAny = xRunPropSet->getPropertyValue("CharHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(14.0f), aAny); + aAny = xRunPropSet->getPropertyValue("CharColor"); + CPPUNIT_ASSERT_EQUAL(uno::Any(Color(0xff0000)), aAny); + aAny = xRunPropSet->getPropertyValue("CharEscapement"); + CPPUNIT_ASSERT_EQUAL(uno::Any(short(0)), aAny); + aAny = xRunPropSet->getPropertyValue("CharEscapementHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(short(100)), aAny); + } + else if (aText == aValues[1] || aText == aValues[3] || aText == aValues[5] || + aText == aValues[6] || aText == aValues[8]) + { + aAny = xRunPropSet->getPropertyValue("CharWeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontWeight::NORMAL), aAny); + aAny = xRunPropSet->getPropertyValue("CharHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(14.0f), aAny); + aAny = xRunPropSet->getPropertyValue("CharColor"); + CPPUNIT_ASSERT_EQUAL(uno::Any(Color(0x595959)), aAny); + } + else if (aText == aValues[2]) + { + aAny = xRunPropSet->getPropertyValue("CharWeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontWeight::NORMAL), aAny); + aAny = xRunPropSet->getPropertyValue("CharHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(14.0f), aAny); + aAny = xRunPropSet->getPropertyValue("CharColor"); + CPPUNIT_ASSERT_EQUAL(uno::Any(Color(0x595959)), aAny); + aAny = xRunPropSet->getPropertyValue("CharEscapement"); + CPPUNIT_ASSERT_EQUAL(uno::Any(short(30)), aAny); + aAny = xRunPropSet->getPropertyValue("CharEscapementHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(short(58)), aAny); + } + else if (aText == aValues[4]) + { + aAny = xRunPropSet->getPropertyValue("CharWeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontWeight::NORMAL), aAny); + aAny = xRunPropSet->getPropertyValue("CharHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(20.0f), aAny); + aAny = xRunPropSet->getPropertyValue("CharColor"); + CPPUNIT_ASSERT_EQUAL(uno::Any(Color(0x4ea72e)), aAny); + aAny = xRunPropSet->getPropertyValue("CharPosture"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontSlant_ITALIC), aAny); + aAny = xRunPropSet->getPropertyValue("CharUnderline"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontUnderline::SINGLE), aAny); + } + else if (aText == aValues[7]) + { + aAny = xRunPropSet->getPropertyValue("CharWeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontWeight::BOLD), aAny); + aAny = xRunPropSet->getPropertyValue("CharHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(14.0f), aAny); + aAny = xRunPropSet->getPropertyValue("CharColor"); + CPPUNIT_ASSERT_EQUAL(uno::Any(Color(0x595959)), aAny); + aAny = xRunPropSet->getPropertyValue("CharPosture"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontSlant_NONE), aAny); + } + else // aText == aValues[9] + { + aAny = xRunPropSet->getPropertyValue("CharWeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontWeight::NORMAL), aAny); + aAny = xRunPropSet->getPropertyValue("CharHeight"); + CPPUNIT_ASSERT_EQUAL(uno::Any(14.0f), aAny); + aAny = xRunPropSet->getPropertyValue("CharColor"); + CPPUNIT_ASSERT_EQUAL(uno::Any(Color(0x595959)), aAny); + aAny = xRunPropSet->getPropertyValue("CharPosture"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontSlant_ITALIC), aAny); + aAny = xRunPropSet->getPropertyValue("CharOverline"); + CPPUNIT_ASSERT_EQUAL(uno::Any(awt::FontUnderline::NONE), aAny); + } + } +} + +} + +CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testODSFormattedChartTitles) +{ + // The document contains a line chart with "Between tick marks" X axis position. + loadFromFile(u"ods/tdf39052.ods"); + // Check formatted strings after export. + saveAndReload("calc8"); + + Reference xChart2Doc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChart2Doc.is()); + Reference< chart::XChartDocument > xChartDoc(xChart2Doc, uno::UNO_QUERY); + CPPUNIT_ASSERT(xChartDoc.is()); + uno::Reference< beans::XPropertySet > xTitleProp(xChartDoc->getTitle(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTitleProp.is()); + + checkCharacterProps(xTitleProp); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/qa/extras/data/ods/tdf39052.ods b/chart2/qa/extras/data/ods/tdf39052.ods new file mode 100644 index 0000000000000000000000000000000000000000..68089195507e073a52f80e0a7154a04052233be0 GIT binary patch literal 15941 zcmbWe1yml%@(22n;1b+DSa5fDcXxMp_W;2yxCe*enqa}*-QC?C9_+o@WbfPE^Zu_m zbH1Ko>etoPGS$^pGU9K6kpKX20DvwuOeMgAHG~QP0K8r=j{ugYmWB?lHio)3HWsG( zx(=q+R@6>b22|F%_NMk!);5M#2G;tHmWEaiRQ5J@hPnp!CWeL%GJjx#gM&`|MLis_At5M8c`Ul+k4#^FV}UPkmF4Oa?qzWFwPAh zj4)qtv;2;}>>y%d2si<77E(Mie8!JKnSy+ls}thX8Y{3Skyv-A7YM;nU}OT~9YDcv z!Orgo4-O&_%X&+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W=lISwMZDawI&Ee2J;xul>}0KzywSya)M^x(->$g-I`f9DAj=5nZ}e+cAXSnTlSas|7-34C-%QK z>Q%_Uvj6P*KimG-+W$}Nf7QvW>i)|9SCziD@h`Ri-`M}pJ+kNh2o&WO#y80Gq3>lK z1BePr36%2b`2BNU1@g;Vl7b4nl%i5X)PDxoyo7JpD7IQ*;v+R~lPh7_6{4(d$ibI+ zio_KJ70AVO(%?t$ow!Ywu6O+3ZMzqzAVr0G&hp9XW(R_S|aV=5Cq~lvG8Fh@Y8cj9q39 zpbHEn4nayW+TPvG1prD=7_B%M1YE4Ev7jrI=g08het&kr@C1x@Ap;PcLgH|Tsqs!p zTnGq}ih62=ClA1x_rKTA5X(7RMt}>#H+qiG&Z|F^XzYN*Bc=3n_pTnc*BwWqJ7nDE$ou(IBno$iN?i}_0Isc?u?6C@YP9ShS#%&%O zZnSB~C(cbNsml8aBedmpKTwl|SQqi)o3r^N93SWn65yW`7+*X87yV3Ulo9_A*U#vn z-&1d1Qxt!Z!b|aA5*Gg#==U^|*G!#X6#w$s|C#3aXWq{Lvj3iF@S1D#ix6M-KYz0S z3SRnOfZsz0U-J=u5e>v|0KfSxeTNv*GRix1dH%D^86N%`2Q70_-}B24^aGPoL4jM7kU2;&aZ&Qe@1x?S^Pyc ze}nS>3Sj(au)m6Q_BUX^0vi7r<*$nV@G=ztx8r{gaQtVSzYZXszrp!yz~g_Ae$L9@ zqxoKU_rECl1?kT<`XvDJ=OF&c`TG&it0Dc1W?yE-KTn_Ez5cHUK)>ke#h(9}ZTG*m z{qCQ5JrVdt1Vn#1ANXI!-!}_?ZD1M2U!560Ie*U5|J_Xds#2ZypSKo2QGTlF_l5NJ g`}d2EnEv5wC?gK?vg!f=$S;33FH2er%j@0$0~z^a{{R30 literal 0 HcmV?d00001 diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index b0367cb0f478..fb94a5d74c8a 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -143,16 +143,7 @@ Any WrappedTitleFormStringsProperty::getPropertyValue( const Reference< beans::X if (xTitle.is()) { const Sequence< Reference< chart2::XFormattedString > > aStrings(xTitle->getText()); - - OUStringBuffer aBuf; - for (Reference< chart2::XFormattedString > const& formattedStr : aStrings) - { - aBuf.append(formattedStr->getString()); - } - if (!aBuf.makeStringAndClear().isEmpty()) - { - aRet <<= aStrings; - } + aRet <<= aStrings; } return aRet; } @@ -325,27 +316,12 @@ void SAL_CALL TitleWrapper::removeEventListener( m_aEventListenerContainer.removeInterface( g, aListener ); } -Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet() -{ - Reference< beans::XPropertySet > xProp; - - Reference< chart2::XTitle > xTitle( getTitleObject() ); - if( xTitle.is()) - { - Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); - if( aStrings.hasElements() ) - xProp.set( aStrings[0], uno::UNO_QUERY ); - } - - return xProp; -} - void TitleWrapper::getFastCharacterPropertyValue( sal_Int32 nHandle, Any& rValue ) { OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle && nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP ); - Reference< beans::XPropertySet > xProp = getFirstCharacterPropertySet(); + Reference< beans::XPropertySet > xProp = getInnerPropertySet(); Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY ); if(xProp.is()) { @@ -385,6 +361,16 @@ void TitleWrapper::setFastCharacterPropertyValue( else if( xFastPropertySet.is() ) xFastPropertySet->setFastPropertyValue( nHandle, rValue ); } + + Reference< beans::XPropertySet > xInnerProp = getInnerPropertySet(); + Reference< beans::XFastPropertySet > xFastInnerProp( xInnerProp, uno::UNO_QUERY ); + if (xInnerProp.is()) + { + if (pWrappedProperty) + pWrappedProperty->setPropertyValue(rValue, xInnerProp); + else if (xFastInnerProp.is()) + xFastInnerProp->setFastPropertyValue(nHandle, rValue); + } } // WrappedPropertySet @@ -418,7 +404,7 @@ beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rP sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) ) { - Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY ); + Reference< beans::XPropertyState > xPropState( getInnerPropertySet(), uno::UNO_QUERY); if( xPropState.is() ) { const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName ); @@ -451,7 +437,7 @@ Any SAL_CALL TitleWrapper::getPropertyDefault( const OUString& rPropertyName ) sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) ) { - Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY ); + Reference< beans::XPropertyState > xPropState( getInnerPropertySet(), uno::UNO_QUERY ); if( xPropState.is() ) { const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName ); @@ -472,7 +458,7 @@ void SAL_CALL TitleWrapper::addPropertyChangeListener( const OUString& rProperty sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) ) { - Reference< beans::XPropertySet > xPropSet = getFirstCharacterPropertySet(); + Reference< beans::XPropertySet > xPropSet = getInnerPropertySet(); if( xPropSet.is() ) xPropSet->addPropertyChangeListener( rPropertyName, xListener ); } @@ -484,7 +470,7 @@ void SAL_CALL TitleWrapper::removePropertyChangeListener( const OUString& rPrope sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) ) { - Reference< beans::XPropertySet > xPropSet = getFirstCharacterPropertySet(); + Reference< beans::XPropertySet > xPropSet = getInnerPropertySet(); if( xPropSet.is() ) xPropSet->removePropertyChangeListener( rPropertyName, xListener ); } diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx index 6833684e9bf2..10551ce6e318 100644 --- a/chart2/source/model/main/Title.cxx +++ b/chart2/source/model/main/Title.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -145,6 +146,7 @@ const ::chart::tPropertyValueMap& StaticTitleDefaults() { ::chart::tPropertyValueMap aTmp; + ::chart::CharacterProperties::AddDefaultsToMap( aTmp ); ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp ); ::chart::FillProperties::AddDefaultsToMap( aTmp ); @@ -178,6 +180,7 @@ const ::chart::tPropertyValueMap& StaticTitleDefaults() { std::vector< css::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); + ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 75283815a831..e4d6ead64774 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1155,13 +1155,9 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC Reference< beans::XPropertySet > xPropSubTitle( xChartDoc->getSubTitle(), UNO_QUERY ); if( xPropSubTitle.is()) { - try - { + OUString aSubTitle; + if ((xPropSubTitle->getPropertyValue("String") >>= aSubTitle) && !aSubTitle.isEmpty()) xPropSubTitle->getPropertyValue("FormattedStrings") >>= xFormattedSubTitle; - } - catch( beans::UnknownPropertyException & ) - { - } } // chart element @@ -1452,7 +1448,9 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape, Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); if( xPropSet.is()) { - xPropSet->getPropertyValue("FormattedStrings") >>= xFormattedTitle; + OUString aTitle; + if ((xPropSet->getPropertyValue("String") >>= aTitle) && !aTitle.isEmpty()) + xPropSet->getPropertyValue("FormattedStrings") >>= xFormattedTitle; } // tdf#101322: add subtitle to title diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index b54808790845..b6097590868f 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -552,26 +552,18 @@ void SchXMLAxisContext::CreateAxis() void SchXMLAxisContext::SetAxisTitle() { - if( m_aCurrentAxis.aTitle.isEmpty() ) + if( m_aCurrentAxis.maTitle.empty() ) return; Reference< chart::XAxis > xAxis( lcl_getChartAxis( m_aCurrentAxis, m_xDiagram ) ); if( !xAxis.is() ) return; - Reference< beans::XPropertySet > xTitleProp( xAxis->getAxisTitle() ); - if( xTitleProp.is() ) - { - try - { - // TODO: ODF import for formatted chart titles - xTitleProp->setPropertyValue("String", uno::Any(m_aCurrentAxis.aTitle) ); - } - catch( beans::UnknownPropertyException & ) - { - SAL_INFO("xmloff.chart", "Property String for Title not available" ); - } - } + if (m_aCurrentAxis.maTitle.back().first.isEmpty() && + m_aCurrentAxis.maTitle.back().second == OUStringChar(u'\x0D')) + m_aCurrentAxis.maTitle.pop_back(); // remove last end of paragraph break + + SchXMLTools::importFormattedText(GetImport(), m_aCurrentAxis.maTitle, xAxis->getAxisTitle()); } css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLAxisContext::createFastChildContext( @@ -583,7 +575,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLAxisContext::cre case XML_ELEMENT(CHART, XML_TITLE): { return new SchXMLTitleContext( m_rImportHelper, GetImport(), - m_aCurrentAxis.aTitle, + m_aCurrentAxis.maTitle, getTitleShape() ); } break; diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index 6072a1a09622..7066bfe1ef71 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -729,37 +729,16 @@ void SchXMLChartContext::endFastElement(sal_Int32 ) if( xProp.is()) { - if( !maMainTitle.isEmpty()) + if( !maMainTitle.empty()) { - uno::Reference< beans::XPropertySet > xTitleProp( xDoc->getTitle(), uno::UNO_QUERY ); - if( xTitleProp.is()) - { - try - { - // TODO: ODF import for formatted chart titles - xTitleProp->setPropertyValue("String", uno::Any(maMainTitle) ); - } - catch(const beans::UnknownPropertyException&) - { - SAL_WARN("xmloff.chart", "Property String for Title not available" ); - } - } + uno::Reference< beans::XPropertySet > xTitleProp(xDoc->getTitle(), uno::UNO_QUERY); + SchXMLTools::importFormattedText(GetImport(), maMainTitle, xTitleProp); } - if( !maSubTitle.isEmpty()) + + if( !maSubTitle.empty()) { - uno::Reference< beans::XPropertySet > xTitleProp( xDoc->getSubTitle(), uno::UNO_QUERY ); - if( xTitleProp.is()) - { - try - { - // TODO: ODF import for formatted chart titles - xTitleProp->setPropertyValue("String", uno::Any(maSubTitle) ); - } - catch(const beans::UnknownPropertyException&) - { - SAL_WARN("xmloff.chart", "Property String for Title not available" ); - } - } + uno::Reference< beans::XPropertySet > xTitleProp(xDoc->getSubTitle(), uno::UNO_QUERY); + SchXMLTools::importFormattedText(GetImport(), maSubTitle, xTitleProp); } } @@ -1181,7 +1160,7 @@ void SchXMLChartContext::InitChart( } SchXMLTitleContext::SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, - OUString& rTitle, + std::vector>& rTitle, uno::Reference< drawing::XShape > xTitleShape ) : SvXMLImportContext( rImport ), mrImportHelper( rImpHelper ), @@ -1247,7 +1226,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTitleContext::cr if( nElement == XML_ELEMENT(TEXT, XML_P) || nElement == XML_ELEMENT(LO_EXT, XML_P) ) { - pContext = new SchXMLParagraphContext( GetImport(), mrTitle ); + pContext = new SchXMLTitleParaContext(GetImport(), mrTitle); } else XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); diff --git a/xmloff/source/chart/SchXMLChartContext.hxx b/xmloff/source/chart/SchXMLChartContext.hxx index f79be55b88d9..6c7b6ececfa2 100644 --- a/xmloff/source/chart/SchXMLChartContext.hxx +++ b/xmloff/source/chart/SchXMLChartContext.hxx @@ -91,7 +91,7 @@ private: SchXMLTable maTable; SchXMLImportHelper& mrImportHelper; - OUString maMainTitle, maSubTitle; + std::vector> maMainTitle, maSubTitle; OUString m_aXLinkHRefAttributeToIndicateDataProvider; bool m_bHasRangeAtPlotArea; bool m_bHasTableElement; @@ -130,14 +130,14 @@ class SchXMLTitleContext : public SvXMLImportContext { private: SchXMLImportHelper& mrImportHelper; - OUString& mrTitle; + std::vector>& mrTitle; css::uno::Reference< css::drawing::XShape > mxTitleShape; OUString msAutoStyleName; public: SchXMLTitleContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, - OUString& rTitle, + std::vector>& rTitle, css::uno::Reference< css::drawing::XShape > xTitleShape ); virtual ~SchXMLTitleContext() override; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 56cdca7bdefa..778969ecf83c 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -208,6 +208,8 @@ public: ::std::queue< OUString > maAutoStyleNameQueue; void CollectAutoStyle( std::vector< XMLPropertyState >&& aStates ); + void CollectAutoTextStyle( + const css::uno::Reference< css::beans::XPropertySet >& xTitlePropSet ); void AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ); @@ -276,6 +278,7 @@ public: void addSize( const css::uno::Reference< css::drawing::XShape >& xShape ); /// exports a string as a paragraph element void exportText( const OUString& rText ); + void exportFormattedText( const css::uno::Reference< beans::XPropertySet >& xTitleProps ); public: SvXMLExport& mrExport; @@ -1322,15 +1325,14 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > if( bHasMainTitle ) { // get property states for autostyles - if( mxExpPropMapper.is()) + Reference< drawing::XShape > xShape = rChartDoc->getTitle(); + Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); + if( mxExpPropMapper.is() && xPropSet.is()) { - Reference< beans::XPropertySet > xPropSet( rChartDoc->getTitle(), uno::UNO_QUERY ); - if( xPropSet.is()) - aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) { - Reference< drawing::XShape > xShape = rChartDoc->getTitle(); if( xShape.is()) // && "hasTitleBeenMoved" addPosition( xShape ); @@ -1341,19 +1343,12 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > SvXMLElementExport aElTitle( mrExport, XML_NAMESPACE_CHART, XML_TITLE, true, true ); // content (text:p) - Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); - if( xPropSet.is()) - { - // TODO: ODF export for formatted chart titles - Any aAny( xPropSet->getPropertyValue( "String" )); - OUString aText; - aAny >>= aText; - exportText( aText ); - } + exportFormattedText(xPropSet); } else // autostyles { CollectAutoStyle( std::move(aPropertyStates) ); + CollectAutoTextStyle( xPropSet ); } // remove property states for autostyles aPropertyStates.clear(); @@ -1363,16 +1358,15 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > if( bHasSubTitle ) { // get property states for autostyles - if( mxExpPropMapper.is()) + Reference< drawing::XShape > xShape = rChartDoc->getSubTitle(); + Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); + if( mxExpPropMapper.is() && xPropSet.is()) { - Reference< beans::XPropertySet > xPropSet( rChartDoc->getSubTitle(), uno::UNO_QUERY ); - if( xPropSet.is()) - aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); + aPropertyStates = mxExpPropMapper->Filter(mrExport, xPropSet); } if( bExportContent ) { - Reference< drawing::XShape > xShape = rChartDoc->getSubTitle(); if( xShape.is()) addPosition( xShape ); @@ -1383,19 +1377,12 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument > SvXMLElementExport aElSubTitle( mrExport, XML_NAMESPACE_CHART, XML_SUBTITLE, true, true ); // content (text:p) - Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); - if( xPropSet.is()) - { - // TODO: ODF import for formatted chart titles - Any aAny( xPropSet->getPropertyValue( "String" )); - OUString aText; - aAny >>= aText; - exportText( aText ); - } + exportFormattedText(xPropSet); } else // autostyles { CollectAutoStyle( std::move(aPropertyStates) ); + CollectAutoTextStyle(xPropSet); } // remove property states for autostyles aPropertyStates.clear(); @@ -2266,11 +2253,6 @@ void SchXMLExportHelper_Impl::exportAxisTitle( const Reference< beans::XProperty std::vector aPropertyStates = mxExpPropMapper->Filter(mrExport, rTitleProps); if( bExportContent ) { - // TODO: ODF import for formatted chart titles - OUString aText; - Any aAny( rTitleProps->getPropertyValue( "String" )); - aAny >>= aText; - Reference< drawing::XShape > xShape( rTitleProps, uno::UNO_QUERY ); if( xShape.is()) addPosition( xShape ); @@ -2279,11 +2261,12 @@ void SchXMLExportHelper_Impl::exportAxisTitle( const Reference< beans::XProperty SvXMLElementExport aTitle( mrExport, XML_NAMESPACE_CHART, XML_TITLE, true, true ); // paragraph containing title - exportText( aText ); + exportFormattedText( rTitleProps ); } else { CollectAutoStyle( std::move(aPropertyStates) ); + CollectAutoTextStyle( rTitleProps ); } aPropertyStates.clear(); } @@ -3827,6 +3810,27 @@ void SchXMLExportHelper_Impl::CollectAutoStyle( std::vector< XMLPropertyState >& maAutoStyleNameQueue.push( mrAutoStylePool.Add( XmlStyleFamily::SCH_CHART_ID, std::move(aStates) )); } +void SchXMLExportHelper_Impl::CollectAutoTextStyle( const css::uno::Reference< beans::XPropertySet >& xTitlePropSet ) +{ + if (xTitlePropSet.is()) + { + Sequence< uno::Reference< chart2::XFormattedString > > xFormattedTitle; + + OUString aTitle; + if ((xTitlePropSet->getPropertyValue("String") >>= aTitle) && !aTitle.isEmpty()) + xTitlePropSet->getPropertyValue("FormattedStrings") >>= xFormattedTitle; + + if (xFormattedTitle.hasElements()) + { + for (const uno::Reference& rxFS : xFormattedTitle) + { + Reference< beans::XPropertySet > xRunPropSet(rxFS, uno::UNO_QUERY); + mrExport.GetTextParagraphExport()->Add(XmlStyleFamily::TEXT_TEXT, xRunPropSet); + } + } + } +} + void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) @@ -3843,6 +3847,11 @@ void SchXMLExportHelper_Impl::exportText( const OUString& rText ) SchXMLTools::exportText( mrExport, rText, false/*bConvertTabsLFs*/ ); } +void SchXMLExportHelper_Impl::exportFormattedText( const css::uno::Reference< beans::XPropertySet >& xTitleProps ) +{ + SchXMLTools::exportFormattedText( mrExport, xTitleProps ); +} + SchXMLExport::SchXMLExport(const Reference& xContext, OUString const& implementationName, SvXMLExportFlags nExportFlags) diff --git a/xmloff/source/chart/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx index 9ed285916188..6f9dc0ce72cb 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.cxx +++ b/xmloff/source/chart/SchXMLParagraphContext.cxx @@ -101,4 +101,135 @@ void SchXMLParagraphContext::characters( const OUString& rChars ) maBuffer.append( rChars ); } +SchXMLTitleParaContext::SchXMLTitleParaContext( SvXMLImport& rImport, + std::vector>& rParaText, + OUString * pOutId /* = 0 */ ) : + SvXMLImportContext( rImport ), + mrParaText( rParaText ), + mpId( pOutId ) +{ +} + +SchXMLTitleParaContext::~SchXMLTitleParaContext() +{} + +void SchXMLTitleParaContext::startFastElement( + sal_Int32 /*nElement*/, + const uno::Reference< xml::sax::XFastAttributeList >& xAttrList ) +{ + // remember the id. It is used for storing the original cell range string in + // a local table (cached data) + if( !mpId ) + return; + + bool bHaveXmlId( false ); + + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) + { + switch(aIter.getToken()) + { + case XML_ELEMENT(TEXT, XML_STYLE_NAME): + maStyleName = aIter.toString(); + break; + case XML_ELEMENT(XML, XML_ID): + (*mpId) = aIter.toString(); + bHaveXmlId = true; + break; + case XML_ELEMENT(TEXT, XML_ID): + { // text:id shall be ignored if xml:id exists + if (!bHaveXmlId) + { + (*mpId) = aIter.toString(); + } + break; + } + default: + XMLOFF_WARN_UNKNOWN("xmloff", aIter); + } + } +} + +void SchXMLTitleParaContext::endFastElement(sal_Int32 ) +{ + if (!maBuffer.isEmpty()) + mrParaText.push_back(std::make_pair(maStyleName, maBuffer.makeStringAndClear())); +} + +void SchXMLTitleParaContext::characters(const OUString& rChars) +{ + maBuffer.append(rChars); +} + +css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTitleParaContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) +{ + if( nElement == XML_ELEMENT(TEXT, XML_SPAN) ) + { + if (!maBuffer.isEmpty()) + mrParaText.push_back(std::make_pair(maStyleName, maBuffer.makeStringAndClear())); + + return new SchXMLTitleSpanContext(GetImport(), mrParaText, xAttrList); + } + else if( nElement == XML_ELEMENT(TEXT, XML_TAB_STOP) ) + { + maBuffer.append( u'\x0009'); // tabulator + } + else if( nElement == XML_ELEMENT(TEXT, XML_LINE_BREAK) ) + { + maBuffer.append( u'\x000A'); // linefeed + } + else + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); + + return nullptr; +} + +SchXMLTitleSpanContext::SchXMLTitleSpanContext(SvXMLImport& rImport, std::vector>& rSpanTexts, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) : + SvXMLImportContext(rImport), + mrSpanTexts(rSpanTexts) +{ + for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) ) + { + if( aIter.getToken() == XML_ELEMENT(TEXT, XML_STYLE_NAME) ) + { + maStyleName = aIter.toString(); + break; + } + } +} + +SchXMLTitleSpanContext::~SchXMLTitleSpanContext() +{} + +void SchXMLTitleSpanContext::characters(const OUString& rChars) +{ + maCharBuffer.append(rChars); +} + +css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTitleSpanContext::createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*xAttrList*/) +{ + if( nElement == XML_ELEMENT(TEXT, XML_TAB_STOP) ) + { + maCharBuffer.append( u'\x0009'); // tabulator + } + else if( nElement == XML_ELEMENT(TEXT, XML_LINE_BREAK) ) + { + maCharBuffer.append( u'\x000A'); // linefeed + } + else + XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); + + return nullptr; +} + +void SchXMLTitleSpanContext::endFastElement(sal_Int32) +{ + if (!maCharBuffer.isEmpty()) + mrSpanTexts.push_back(std::make_pair(maStyleName, maCharBuffer.makeStringAndClear())); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/chart/SchXMLParagraphContext.hxx b/xmloff/source/chart/SchXMLParagraphContext.hxx index 65e90522e860..ba2231bd5d24 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.hxx +++ b/xmloff/source/chart/SchXMLParagraphContext.hxx @@ -50,4 +50,48 @@ public: const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; }; +class SchXMLTitleParaContext : public SvXMLImportContext +{ +private: + std::vector>& mrParaText; + OUString* mpId; + OUStringBuffer maBuffer; + OUString maStyleName; + +public: + SchXMLTitleParaContext( SvXMLImport& rImport, + std::vector>& rParaText, + OUString * pOutId = nullptr ); + virtual ~SchXMLTitleParaContext() override; + + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + virtual void SAL_CALL characters( const OUString& rChars ) override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; +}; + +class SchXMLTitleSpanContext : public SvXMLImportContext +{ +private: + std::vector>& mrSpanTexts; + OUStringBuffer maCharBuffer; + OUString maStyleName; +public: + SchXMLTitleSpanContext( SvXMLImport& rImport, std::vector>& rSpanTexts, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); + virtual ~SchXMLTitleSpanContext() override; + + virtual void SAL_CALL characters( const OUString& rChars ) override; + virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& /*AttrList*/) override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 4287b731a7fb..fb3dc9e29c56 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +49,7 @@ #include #include +#include #include #include #include @@ -605,6 +608,95 @@ void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsL } } +void exportFormattedText( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xTitleProps ) +{ + Sequence< uno::Reference< chart2::XFormattedString > > xFormattedTitle; + if (xTitleProps.is()) + { + OUString aTitle; + if ((xTitleProps->getPropertyValue("String") >>= aTitle) && !aTitle.isEmpty()) + xTitleProps->getPropertyValue("FormattedStrings") >>= xFormattedTitle; + } + + if (xFormattedTitle.hasElements()) + { + SvXMLElementExport aElemP(rExport, XML_NAMESPACE_TEXT, XML_P, true, false); + for (const uno::Reference& rxFS : xFormattedTitle) + { + Reference< beans::XPropertySet > xRunPropSet(rxFS, uno::UNO_QUERY); + bool bIsUICharStyle, bHasAutoStyle = false; + OUString sStyle = rExport.GetTextParagraphExport()->FindTextStyle(xRunPropSet, bIsUICharStyle, bHasAutoStyle); + if (!sStyle.isEmpty()) + { + rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, + rExport.EncodeStyleName(sStyle)); + } + + SvXMLElementExport aSpan(rExport, !sStyle.isEmpty(), XML_NAMESPACE_TEXT, XML_SPAN, true, false); + rExport.GetDocHandler()->characters(rxFS->getString()); + } + } +} + +void importFormattedText( SvXMLImport& rImport, const std::vector>& rTitle, + const uno::Reference< beans::XPropertySet >& xTitleProp ) +{ + if (!xTitleProp.is()) + return; + + std::vector< Reference< chart2::XFormattedString > > aStringVec; + Sequence< uno::Reference< chart2::XFormattedString > > xFullTextTitle; + Reference < beans::XPropertySet > xFullTextTitleProps; + + try + { + if ((xTitleProp->getPropertyValue("FormattedStrings") >>= xFullTextTitle) && + xFullTextTitle.hasElements()) + { + // these are the properies from the textshape object - needs to apply them + // to all the string parts firstly - (necessarry for backward compatibility) + xFullTextTitleProps.set(xFullTextTitle.getArray()[0], uno::UNO_QUERY); + } + + for (auto aRIt = std::begin(rTitle); aRIt != std::end(rTitle); ++aRIt) + { + Reference< chart2::XFormattedString2 > xNewFmtStr; + xNewFmtStr = chart2::FormattedString::create(rImport.GetComponentContext()); + + if (xFullTextTitleProps.is()) + { + // these are the properies from the textshape object - needs to apply them + // to all the string parts firstly + uno::Reference< beans::XPropertySetInfo > xInfo = xNewFmtStr->getPropertySetInfo(); + for (const beans::Property& rProp : xFullTextTitleProps->getPropertySetInfo()->getProperties()) + { + if (xInfo.is() && xInfo->hasPropertyByName(rProp.Name)) + { + const uno::Any aValue = xFullTextTitleProps->getPropertyValue(rProp.Name); + xNewFmtStr->setPropertyValue(rProp.Name, aValue); + } + } + } + + if (auto pStyle = rImport.GetTextImport()->FindAutoCharStyle(aRIt->first)) + { + pStyle->FillPropertySet(xNewFmtStr); + } + + xNewFmtStr->setString(aRIt->second); + aStringVec.emplace_back(xNewFmtStr); + } + + uno::Sequence< Reference< chart2::XFormattedString > > aStringSeq = + comphelper::containerToSequence(aStringVec); + xTitleProp->setPropertyValue("FormattedStrings", uno::Any(aStringSeq)); + } + catch (const beans::UnknownPropertyException&) + { + SAL_WARN("xmloff.chart", "Property FormattedStrings for Title not available"); + } +} + void exportRangeToSomewhere( SvXMLExport& rExport, const OUString& rValue ) { //with issue #i366# and CWS chart20 ranges for error bars were introduced diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index 994308a19bc3..364c894c5634 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -38,6 +38,7 @@ namespace com::sun::star { class XMLPropStyleContext; class SvXMLStylesContext; class SvXMLExport; +class SvXMLImport; namespace SchXMLTools { @@ -98,6 +99,9 @@ namespace SchXMLTools css::uno::Any getPropertyFromContext( std::u16string_view rPropertyName, const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ); void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsLFs ); + void exportFormattedText( SvXMLExport& rExport, const css::uno::Reference< css::beans::XPropertySet >& xTitleProps ); + void importFormattedText( SvXMLImport& rImport, const std::vector>& rTitle, + const css::uno::Reference< css::beans::XPropertySet >& xTitleProp); void exportRangeToSomewhere( SvXMLExport& rExport, const OUString& rValue ); diff --git a/xmloff/source/chart/transporttypes.hxx b/xmloff/source/chart/transporttypes.hxx index 81d5de8cdb8a..b312af71cf38 100644 --- a/xmloff/source/chart/transporttypes.hxx +++ b/xmloff/source/chart/transporttypes.hxx @@ -103,7 +103,7 @@ struct SchXMLAxis enum SchXMLAxisDimension eDimension; sal_Int8 nAxisIndex;//0->primary axis; 1->secondary axis OUString aName; - OUString aTitle; + std::vector> maTitle; bool bHasCategories; SchXMLAxis() : eDimension( SCH_XML_AXIS_UNDEF ), nAxisIndex( 0 ), bHasCategories( false ) {}