diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-03-29 23:00:50 +0100 |
---|---|---|
committer | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-04-02 23:27:26 +0200 |
commit | 55e9a27afd2d6a13cf76b39641bf121c3ec4b45c (patch) | |
tree | cca55acf82159f454ceec3b9f98574b0a6be4ac1 /chart2/source/tools | |
parent | 4f994cec388377cc5c2bddb804bd92eb4cd7dc8d (diff) |
Related: tdf#39052 - chart ooxml: export formatted chart titles
texts properly to ooxml.
Also adding "FormattedStrings" property for title objects
to simplify the working of character formattings in editable
chart shapes.
TODO: odf import/export
Change-Id: Ie27b4dee72c24fa6a2a4e2a7db8da7fa50eb8937
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165583
Tested-by: Jenkins
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'chart2/source/tools')
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index ca137cb6e072..6fdb4f5adef3 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -327,32 +327,47 @@ OUString TitleHelper::getUnstackedStr(const OUString& rNewText) return aUnstackedStr.makeStringAndClear(); } +void TitleHelper::setFormattedString( const rtl::Reference< Title >& xTitle, + const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& aNewFormattedTitle ) +{ + if (!xTitle.is() || !aNewFormattedTitle.hasElements()) + return; + + bool bStacked = false; + xTitle->getPropertyValue("StackCharacters") >>= bStacked; + + if (bStacked) + { + for (uno::Reference< chart2::XFormattedString >const& formattedStr : aNewFormattedTitle) + { + formattedStr->setString(TitleHelper::getUnstackedStr(formattedStr->getString())); + } + } + + xTitle->setText(aNewFormattedTitle); +} + void TitleHelper::setCompleteString( const OUString& rNewText , const rtl::Reference< Title >& xTitle , const uno::Reference< uno::XComponentContext > & xContext , const float * pDefaultCharHeight /* = 0 */ , bool bDialogTitle /*= false*/ ) { - if(!xTitle.is()) + if (!xTitle.is()) return; - OUString aNewText = rNewText; - bool bStacked = false; if( xTitle.is() ) xTitle->getPropertyValue( "StackCharacters" ) >>= bStacked; - uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText(); + OUString aNewText = rNewText; if( bStacked ) { aNewText = getUnstackedStr(rNewText); - for (uno::Reference< XFormattedString >const & formattedStr : aOldStringList) - { - formattedStr->setString(getUnstackedStr(formattedStr->getString())); - } } uno::Sequence< uno::Reference< XFormattedString > > aNewStringList; + uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText(); if( aOldStringList.hasElements()) { const OUString aFullString = getCompleteString(xTitle); |