[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/inc oox/source sc/qa
oox/inc/drawingml/textbodyproperties.hxx|2 + oox/source/drawingml/shape.cxx |7 oox/source/drawingml/textbodypropertiescontext.cxx |4 +- oox/source/export/drawingml.cxx | 19 +- sc/qa/unit/data/xlsx/tdf91251_missingOverflowRoundtrip.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 21 6 files changed, 49 insertions(+), 4 deletions(-) New commits: commit 08dbab21fa11088af519716013bcffc3bfa17b69 Author: Regényi Balázs AuthorDate: Tue Sep 22 17:12:59 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 25 15:13:13 2021 +0100 tdf#91251 XLSX textbox export: fix missing overflow properties by grab-bagging them. Co-authored-by: Szabolcs Toth Change-Id: I242bf33e1272d913805c90a2ef902be8633618fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103182 Tested-by: László Németh Reviewed-by: László Németh Reviewed-on: https://gerrit.libreoffice.org/c/core/+/75 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx index 27ca26fabc67..017e30f74941 100644 --- a/oox/inc/drawingml/textbodyproperties.hxx +++ b/oox/inc/drawingml/textbodyproperties.hxx @@ -47,6 +47,8 @@ struct TextBodyProperties sal_Int32 mnNumCol = 1; /// Normal autofit: font scale (default: 100%). sal_Int32 mnFontScale = 10; +OUString msHorzOverflow; +OUString msVertOverflow; explicitTextBodyProperties(); diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index c5c77e29038f..8d15beca453e 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1449,6 +1449,13 @@ Reference< XShape > const & Shape::createAndInsert( degrees anticlockwise. */ mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 6); } + +auto sHorzOverflow = getTextBody()->getTextProperties().msHorzOverflow; +if (!sHorzOverflow.isEmpty()) +putPropertyToGrabBag("horzOverflow", uno::makeAny(getTextBody()->getTextProperties().msHorzOverflow)); +auto nVertOverflow = getTextBody()->getTextProperties().msVertOverflow; +if (!nVertOverflow.isEmpty()) +putPropertyToGrabBag("vertOverflow", uno::makeAny(getTextBody()->getTextProperties().msVertOverflow)); } // Note that the script oox/source/drawingml/customshapes/generatePresetsData.pl looks diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 699c15ec2632..5bc244b73fc2 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -80,9 +80,9 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons mrTextBodyProp.maPropertyMap.setProperty(PROP_FromWordArt, bFromWordArt); // ST_TextHorzOverflowType -// sal_Int32 nHorzOverflow = rAttribs.getToken( XML_horzOverflow, XML_overflow ); +mrTextBodyProp.msHorzOverflow = rAttribs.getString(XML_horzOverflow, ""); // ST_TextVertOverflowType -// sal_Int32 nVertOverflow = rAttribs.getToken( XML_vertOverflow, XML_overflow ); +mrTextBodyProp.msVertOverflow = rAttribs.getString(XML_vertOverflow, ""); // ST_TextColumnCount mrTextBodyProp.mnNumCol = rAttribs.getInteger( XML_numCol, 1 ); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 7ccb5209c7e3..1532ce2b2ad2 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2864,18 +2864,31 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin } bool isUpright = false; +std::optional sHorzOverflow; +std::optional sVertOverflow; if (GetProperty(rXPropSet, "InteropGrabBag")) { if (rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag")) { uno::Sequence aGrabBag; rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag; -for (auto& aProp : aGrabBag) +for (const auto& aProp : std::as_const(aGrabBag)) { if (aProp.Name == "Upright") { aProp.Value >>= isUpright; -break; +} +else if (aProp.Name == "horzOverflow") +{ +OUString sValue; +aProp.Value >>= sValue; +sHorzOverflow = sValue; +} +else if (aProp.Name ==
[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/inc oox/source sc/qa
oox/inc/drawingml/textbodyproperties.hxx |1 oox/source/drawingml/shape.cxx | 24 +-- oox/source/drawingml/textbodypropertiescontext.cxx |5 +- oox/source/export/drawingml.cxx| 37 - sc/qa/unit/data/xlsx/tdf106197_import_upright.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 45 + 6 files changed, 89 insertions(+), 23 deletions(-) New commits: commit 2967aae06af4c6c56da53db67e2e6fb297b4881e Author: Szabolcs Toth AuthorDate: Wed Sep 16 14:41:24 2020 +0200 Commit: Gabor Kelemen CommitDate: Thu Feb 18 16:18:53 2021 +0100 tdf#106197 XLSX shape import: keep text upright Handle and grab-bag attribute upright to keep text upright regardless of shape rotation, fixing the text direction after import and after a round-trip. Co-authored-by: Balázs Regényi Change-Id: If4c73aeaebad55af967cea894a94756068ca3766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102870 Tested-by: László Németh Reviewed-by: László Németh (cherry picked from commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/43 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx index eddf78a5f97f..27ca26fabc67 100644 --- a/oox/inc/drawingml/textbodyproperties.hxx +++ b/oox/inc/drawingml/textbodyproperties.hxx @@ -35,6 +35,7 @@ struct TextBodyProperties OptValue< sal_Int32 > moRotation; boolmbAnchorCtr; OptValue< sal_Int32 > moVert; +boolmoUpright = false; std::optional< sal_Int32 >moInsets[4]; std::optional< sal_Int32 >moTextOffUpper; std::optional< sal_Int32 >moTextOffLeft; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 567564479846..173095b37df2 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1429,10 +1429,26 @@ Reference< XShape > const & Shape::createAndInsert( sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) ); nTextRotateAngle -= mnDiagramRotation; -/* OOX measures text rotation clockwise in 1/6th degrees, - relative to the containing shape. setTextRotateAngle wants - degrees anticlockwise. */ -mpCustomShapePropertiesPtr->setTextRotateAngle( -1 * nTextRotateAngle / 6 ); + +bool isUpright = getTextBody()->getTextProperties().moUpright; +if (isUpright) +{ +// When upright is set, we want the text without any rotation. +// But if we set 0 here, the text is still rotated if the +// shape containing it is rotated. +// Hence, we rotate the text into the the opposite direction of +// the rotation of the shape, by as much as the shape was rotated. +mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 6); +// Also put this away in a Gabbag. +putPropertyToGrabBag("Upright", Any(isUpright)); +} +else +{ +/* OOX measures text rotation clockwise in 1/6th degrees, + relative to the containing shape. setTextRotateAngle wants + degrees anticlockwise. */ +mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 6); +} } // Note that the script oox/source/drawingml/customshapes/generatePresetsData.pl looks diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 14f23c935b34..699c15ec2632 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -94,7 +94,10 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper cons // ST_PositiveCoordinate // sal_Int32 nSpcCol = rAttribs.getInteger( XML_spcCol, 0 ); // bool bSpcFirstLastPara = rAttribs.getBool( XML_spcFirstLastPara, 0 ); -// bool bUpRight = rAttribs.getBool( XML_upright, 0 ); + +bool bUpright = rAttribs.getBool(XML_upright, false); +if (bUpright) +mrTextBodyProp.moUpright = true; // ST_TextVerticalType if( rAttribs.hasAttribute( XML_vert ) ) { diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 70ecafec02f9..0728a131550f 100644 ---