summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga.extern@allotropia.de>2024-03-28 17:17:47 +0100
committerBalazs Varga <balazs.varga.extern@allotropia.de>2024-04-02 23:26:13 +0200
commitf31a8ff9ea15ad81aeac265fce6eafe6342a68b7 (patch)
treeaafa5e1cef35fc44e0c8ba25ab1cf817e35a1697 /oox
parent878ab17b0fad66fb7accd9573ef7f66403d593b9 (diff)
tdf#78027 - Fix Chart OOXML Import with non-uniform formatted titles
Character formats are disappeared from Chart Title textobjects if they were formatted non-uniform. In this patch only the OOXML import and the chartview part will be fixed which make it visible after the import. (Note: next patch will contain the chart controller part where the characters can be formatted during title editing). Change-Id: I4fb5c3d80b7889935d198e70fb49e2c68108b235 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165500 Tested-by: Jenkins Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/textcharacterproperties.hxx8
-rw-r--r--oox/source/drawingml/chart/titleconverter.cxx11
-rw-r--r--oox/source/drawingml/textcharacterpropertiescontext.cxx3
3 files changed, 20 insertions, 2 deletions
diff --git a/oox/inc/drawingml/textcharacterproperties.hxx b/oox/inc/drawingml/textcharacterproperties.hxx
index 40842585d10a..9750407b817c 100644
--- a/oox/inc/drawingml/textcharacterproperties.hxx
+++ b/oox/inc/drawingml/textcharacterproperties.hxx
@@ -64,6 +64,12 @@ struct TextCharacterProperties
/// Set if there was a property set that alters run visually during import
bool mbHasVisualRunProperties;
+ /// Set if there was an empty paragraph property set during import
+ /// <a:pPr><a:defRPr/></a:pPr>
+ /// In that case we use the default paragraph properties from the
+ /// <c:txPr><a:p><a:pPr><a:defRPr>...</a:defRPr>
+ bool mbHasEmptyParaProperties;
+
std::vector<css::beans::PropertyValue> maTextEffectsProperties;
/** Overwrites all members that are explicitly set in rSourceProps. */
@@ -84,7 +90,7 @@ struct TextCharacterProperties
PropertySet& rPropSet,
const ::oox::core::XmlFilterBase& rFilter ) const;
- TextCharacterProperties() : mbHasVisualRunProperties(false) {}
+ TextCharacterProperties() : mbHasVisualRunProperties(false), mbHasEmptyParaProperties(false) {}
};
diff --git a/oox/source/drawingml/chart/titleconverter.cxx b/oox/source/drawingml/chart/titleconverter.cxx
index 91684393c627..e09108f6a171 100644
--- a/oox/source/drawingml/chart/titleconverter.cxx
+++ b/oox/source/drawingml/chart/titleconverter.cxx
@@ -90,7 +90,16 @@ Sequence< Reference< XFormattedString > > TextConverter::createStringSequence(
bool bAddNewLine = ((aRIt + 1 == aREnd) && (aPIt + 1 != aPEnd)) || rTextRun.isLineBreak();
Reference< XFormattedString > xFmtStr = appendFormattedString( aStringVec, rTextRun.getText(), bAddNewLine );
PropertySet aPropSet( xFmtStr );
- TextCharacterProperties aRunProps( rParaProps );
+ TextCharacterProperties aRunProps;
+ if (rParaProps.mbHasEmptyParaProperties && rxTextProp.is() && rxTextProp->hasParagraphProperties())
+ {
+ const TextParagraphVector rDefTextParas = rxTextProp->getParagraphs();
+ TextParagraphVector::const_iterator aDefPIt = rDefTextParas.begin();
+ const TextParagraph& rDefTextPara = **aDefPIt;
+ aRunProps = rDefTextPara.getProperties().getTextCharacterProperties();
+ }
+ else
+ aRunProps = rParaProps;
aRunProps.assignUsed( rTextRun.getTextCharacterProperties() );
getFormatter().convertTextFormatting( aPropSet, aRunProps, eObjType );
}
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index fb4390e4c7a7..4935e8a75a68 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -50,6 +50,9 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext(
int nVisualTokenAmount = sax_fastparser::castToFastAttributeList(
rAttribs.getFastAttributeList() ).getFastAttributeTokens().size();
+ if (nVisualTokenAmount == 0)
+ mrTextCharacterProperties.mbHasEmptyParaProperties = true;
+
if ( rAttribs.hasAttribute( XML_lang ) )
{
mrTextCharacterProperties.moLang = rAttribs.getString( XML_lang );