oox/inc/drawingml/textparagraphproperties.hxx | 2 ++ oox/source/drawingml/textparagraphproperties.cxx | 7 +++++++ oox/source/drawingml/textparagraphpropertiescontext.cxx | 12 ++++++++---- oox/source/token/properties.txt | 1 + sd/qa/unit/import-tests2.cxx | 4 ++-- 5 files changed, 20 insertions(+), 6 deletions(-)
New commits: commit 44271f3997f2374d81a2336131fef7ac79499048 Author: Sarper Akdemir <sarper.akde...@collabora.com> AuthorDate: Tue Feb 28 16:36:40 2023 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Mar 16 14:12:00 2023 +0000 tdf#102261: pptx import: handle defTabSz Introduce import of defTabSz using ParaTabStopDefaultDistance. Change-Id: Ied59c2bc5d9dfffa6254ef87849c3dbad4c48d07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148059 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/oox/inc/drawingml/textparagraphproperties.hxx b/oox/inc/drawingml/textparagraphproperties.hxx index 083b61e37da7..d3742e7377e0 100644 --- a/oox/inc/drawingml/textparagraphproperties.hxx +++ b/oox/inc/drawingml/textparagraphproperties.hxx @@ -89,6 +89,7 @@ public: TextSpacing& getParaBottomMargin() { return maParaBottomMargin; } std::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; } std::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; } + std::optional<sal_Int32>& getDefaultTabSize() { return moDefaultTabSize; } std::optional< css::style::ParagraphAdjust >& getParaAdjust() { return moParaAdjust; } void setParaAdjust( css::style::ParagraphAdjust nParaAdjust ) { moParaAdjust = nParaAdjust; } @@ -125,6 +126,7 @@ private: std::optional< sal_Int32 > moParaLeftMargin; std::optional< sal_Int32 > moFirstLineIndentation; std::optional< css::style::ParagraphAdjust > moParaAdjust; + std::optional< sal_Int32 > moDefaultTabSize; sal_Int16 mnLevel; TextSpacing maLineSpacing; }; diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx index 0006b7530a76..af65e0037d16 100644 --- a/oox/source/drawingml/textparagraphproperties.cxx +++ b/oox/source/drawingml/textparagraphproperties.cxx @@ -395,6 +395,8 @@ void TextParagraphProperties::apply( const TextParagraphProperties& rSourceProps moParaLeftMargin = rSourceProps.moParaLeftMargin; if ( rSourceProps.moFirstLineIndentation ) moFirstLineIndentation = rSourceProps.moFirstLineIndentation; + if ( rSourceProps.moDefaultTabSize ) + moDefaultTabSize = rSourceProps.moDefaultTabSize; if( rSourceProps.mnLevel ) mnLevel = rSourceProps.mnLevel; if( rSourceProps.moParaAdjust ) @@ -501,6 +503,11 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p } } + if ( moDefaultTabSize ) + { + aPropSet.setProperty( PROP_ParaTabStopDefaultDistance, *moDefaultTabSize ); + } + if ( moParaAdjust ) { aPropSet.setProperty( PROP_ParaAdjust, *moParaAdjust); diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 4e83d2ece24b..e75d65913cd9 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -93,10 +93,14 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler2H // TODO see to do the same with RubyAdjust // ST_Coordinate32 -// sValue = rAttribs.getString( XML_defTabSz ).get(); SJ: we need to be able to set the default tab size for each text object, -// this is possible at the moment only for the whole document. -// sal_Int32 nDefTabSize = ( sValue.getLength() == 0 ? 0 : GetCoordinate( sValue ) ); - // TODO + if ( rAttribs.hasAttribute(XML_defTabSz)) + { + sValue = rAttribs.getStringDefaulted(XML_defTabSz); + if(!sValue.isEmpty()) + { + mrTextParagraphProperties.getDefaultTabSize() = GetCoordinate(sValue); + } + } // bool bEaLineBrk = rAttribs.getBool( XML_eaLnBrk, true ); if ( rAttribs.hasAttribute( XML_latinLnBrk ) ) diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 43bed81c5d62..edf799c2c8df 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -385,6 +385,7 @@ ParaLeftMargin ParaLineSpacing ParaRightMargin ParaTabStops +ParaTabStopDefaultDistance ParaTopMargin Path PercentageNumberFormat diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 37a185c4d3f8..9d44f11552d8 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -1343,8 +1343,8 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf120028) double fCharHeight = 0; xPropSet->getPropertyValue("CharHeight") >>= fCharHeight; CPPUNIT_ASSERT_DOUBLES_EQUAL(13.5, fCharHeight, 1E-12); - // 13.5 * 87% is approx. 11.7 (the correct scaled font size) - CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(87)), xShape->getPropertyValue("TextFitToSizeScale")); + // 13.5 * 90% is approx. 12.1 (the correct scaled font size) + CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int16(90)), xShape->getPropertyValue("TextFitToSizeScale")); } CPPUNIT_TEST_FIXTURE(SdImportTest2, testDescriptionImport)