[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/source sw/qa

2021-04-29 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/shape.cxx   |9 --
 sw/qa/extras/ooxmlimport/data/tdf118693.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |   12 +---
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   37 +++
 4 files changed, 40 insertions(+), 18 deletions(-)

New commits:
commit fe2a5e1c51f538d4d2457efe6bc42192edc8d54f
Author: Xisco Fauli 
AuthorDate: Thu Mar 18 00:48:49 2021 +0100
Commit: Gabor Kelemen 
CommitDate: Thu Apr 29 12:28:06 2021 +0200

tdf#118693: no need to use convertMm100ToTwip() for line shapes anymore

It was introduced in 11129d89b152db54c86bb2bda58c24b8abb6c5a8
< tdf#85232 WPG import: fix handling of line shapes >
and later in 36bade04d3780bc54c51b46bb0b63e69789658a5
< tdf106792 Get rid of SvxShapePolyPolygonBezier >
ForceMetricToItemPoolMetric was added to 
SvxShapePolyPolygon::setPropertyValueImpl
to convert from 100thmm to twips as can be read
in the comment in testTdf85232
With this change, xShape->getPosition().X in testTdf85232
is 2267, which was already in twips

Change-Id: I30b757885327a477213f96f8f84541971f435164
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112663
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit c9e5640c8fcad7beb42a66f9bee0252eee9fe323)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112619
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112671
(cherry picked from commit ddf13fc815903238c90aa963af7e0ea96fe7280d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114857
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index a69404094db1..e583ac438607 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -846,7 +846,6 @@ Reference< XShape > const & Shape::createAndInsert(
 uno::Sequence< awt::Point > aPointSequence( nNumPoints );
 awt::Point* pPoints = aPointSequence.getArray();
 uno::Reference xModelInfo(rFilterBase.getModel(), 
uno::UNO_QUERY);
-bool bIsWriter = 
xModelInfo->supportsService("com.sun.star.text.TextDocument");
 for( i = 0; i < nNumPoints; ++i )
 {
 const basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
@@ -854,13 +853,7 @@ Reference< XShape > const & Shape::createAndInsert(
 // tdf#106792 Not needed anymore due to the change in 
SdrPathObj::NbcResize:
 // tdf#96674: Guard against zero width or height.
 
-if (bIsWriter && bNoTranslation)
-// Writer's draw page is in twips, and these points get passed
-// to core without any unit conversion when Writer
-// postprocesses only the group shape itself.
-pPoints[i] = 
awt::Point(static_cast(convertMm100ToTwip(aPoint.getX())), 
static_cast(convertMm100ToTwip(aPoint.getY(;
-else
-pPoints[i] = awt::Point(static_cast(aPoint.getX()), 
static_cast(aPoint.getY()));
+pPoints[i] = awt::Point(static_cast(aPoint.getX()), 
static_cast(aPoint.getY()));
 }
 uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( 1 );
 aPolyPolySequence.getArray()[ 0 ] = aPointSequence;
diff --git a/sw/qa/extras/ooxmlimport/data/tdf118693.docx 
b/sw/qa/extras/ooxmlimport/data/tdf118693.docx
new file mode 100644
index ..4e832398bcd5
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf118693.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3ed3e2b6bc24..cf75df9fe5b7 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1315,16 +1315,8 @@ DECLARE_OOXMLIMPORT_TEST(testTdf85232, "tdf85232.docx")
 // Make sure we're not testing the ellipse child.
 CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.LineShape"), 
xShapeDescriptor->getShapeType());
 
-// tdf#106792 checked that during load of tdf85232.docx the method
-// SvxShapePolyPolygon::setPropertyValueImpl is used three times. In
-// that method, a call to ForceMetricToItemPoolMetric was missing so
-// that the import did not convert the input values from 100thmm
-// to twips what is needed due to the object residing in Writer. The
-// UNO API by definition is in 100thmm. Result is that in 
SwXShape::getPosition
-// the offset (aOffset) now is (0, 0) instead of an existing offset in
-// the load of the document before (what is plausible for a GroupObject).
-// Thus, I will adapt the result value here to the now (hopefully) correct 
one.
-CPPUNIT_ASSERT_EQUAL(static_cast(1630), 
xShape->getPosition().X); // was: 2267
+// This was 2900: horizontal position of the line was incorrect, the 3 
children were 

[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/source sw/qa

2021-02-24 Thread Regényi Balázs (via logerrit)
 oox/source/export/shapes.cxx  |   36 +++---
 sw/qa/extras/ooxmlexport/data/tdf99810-lost-arrow.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |   10 +
 3 files changed, 33 insertions(+), 13 deletions(-)

New commits:
commit 72be5a9973d4df86e74e8e8c836fa5e372ecb56e
Author: Regényi Balázs 
AuthorDate: Tue Oct 6 15:52:18 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Feb 24 15:04:03 2021 +0100

tdf#99810 DOCX export: fix lost arrow shape

by saving connector shape as shape element
wps:wps instead of the invalid wps:cxnSp.

Co-author-by: Szabolcs Tóth

Change-Id: I0ed435eff8e4284f04f71f8fa8c1dc4cfbee5af9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104032
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 7b2f0094f86266c64972d3e505a28b2d4e5caef6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111453
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 6828bc629152..8a86bb07152c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1347,19 +1347,29 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 aRect.setHeight( aStartPoint.Y - aEndPoint.Y );
 }
 
-pFS->startElementNS(mnXmlNamespace, XML_cxnSp);
+// tdf#99810 connector shape (cxnSp) is not valid with namespace 'wps'
+const auto nShapeNode = (mnXmlNamespace == XML_wps ? XML_wsp : XML_cxnSp);
+pFS->startElementNS(mnXmlNamespace, nShapeNode);
 
-// non visual shape properties
-pFS->startElementNS(mnXmlNamespace, XML_nvCxnSpPr);
-pFS->singleElementNS( mnXmlNamespace, XML_cNvPr,
-  XML_id, OString::number(GetNewShapeID(xShape)),
-  XML_name, IDS( Line ) );
-// non visual connector shape drawing properties
-pFS->startElementNS(mnXmlNamespace, XML_cNvCxnSpPr);
-WriteConnectorConnections( aConnectorEntry, GetShapeID( rXShapeA ), 
GetShapeID( rXShapeB ) );
-pFS->endElementNS( mnXmlNamespace, XML_cNvCxnSpPr );
-pFS->singleElementNS(mnXmlNamespace, XML_nvPr);
-pFS->endElementNS( mnXmlNamespace, XML_nvCxnSpPr );
+if (mnXmlNamespace == XML_wps)
+{
+// non visual connector shape drawing properties
+pFS->singleElementNS(mnXmlNamespace, XML_cNvCnPr);
+}
+else
+{
+// non visual shape properties
+pFS->startElementNS(mnXmlNamespace, XML_nvCxnSpPr);
+pFS->singleElementNS(mnXmlNamespace, XML_cNvPr,
+XML_id, OString::number(GetNewShapeID(xShape)),
+XML_name, IDS(xShape));
+// non visual connector shape drawing properties
+pFS->startElementNS(mnXmlNamespace, XML_cNvCxnSpPr);
+WriteConnectorConnections(aConnectorEntry, GetShapeID(rXShapeA), 
GetShapeID(rXShapeB));
+pFS->endElementNS(mnXmlNamespace, XML_cNvCxnSpPr);
+pFS->singleElementNS(mnXmlNamespace, XML_nvPr);
+pFS->endElementNS(mnXmlNamespace, XML_nvCxnSpPr);
+}
 
 // visual shape properties
 pFS->startElementNS(mnXmlNamespace, XML_spPr);
@@ -1374,7 +1384,7 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 // write text
 WriteTextBox( xShape, mnXmlNamespace );
 
-pFS->endElementNS( mnXmlNamespace, XML_cxnSp );
+pFS->endElementNS(mnXmlNamespace, nShapeNode);
 
 return *this;
 }
diff --git a/sw/qa/extras/ooxmlexport/data/tdf99810-lost-arrow.odt 
b/sw/qa/extras/ooxmlexport/data/tdf99810-lost-arrow.odt
new file mode 100644
index ..20e60f6cef06
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf99810-lost-arrow.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 61ba601ed1c5..3848bc0f5d13 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1200,6 +1200,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBodyPrUpright, 
"tdf123610_handle_upright
 "/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", "upright", "1");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testLostArrow, "tdf99810-lost-arrow.odt")
+{
+// tdf#99810: check whether we use normal shape instead of connector shape 
if the XML namespace
+// is wps, because wps:
+xmlDocUniquePtr pDoc = parseExport("word/document.xml");
+
+assertXPath(pDoc, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+"/a:graphic/a:graphicData/wps:wsp");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/source sw/qa

2021-02-18 Thread Szabolcs Toth (via logerrit)
 oox/source/export/drawingml.cxx |   19 
 oox/source/shape/WpsContext.cxx |   11 ++
 sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx   |   10 ++
 4 files changed, 40 insertions(+)

New commits:
commit 691de5dc45a86844c53723b4e32180876a0fc1c9
Author: Szabolcs Toth 
AuthorDate: Mon Sep 14 17:16:51 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Feb 18 15:59:47 2021 +0100

tdf#123610 DOCX shape import: keep text upright

Grab-bag attribute upright to keep text upright
regardless of shape rotation, fixing the text
direction in MSO after a round-trip.

Co-authored-by: Balázs Regényi

Change-Id: If18a12c7728317a7af093048b07bc392d2964389
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102690
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit d3094b98231730b8e6d863c6a2fc0dd62f3e991a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/41
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index de2d34979471..70ecafec02f9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2813,6 +2813,24 @@ void DrawingML::WriteText( const Reference< XInterface 
>& rXIface, const OUStrin
 else if( bVertical && eHorizontalAlignment == TextHorizontalAdjust_LEFT )
 sVerticalAlignment = "b";
 
+bool isUpright = false;
+if (GetProperty(rXPropSet, "InteropGrabBag"))
+{
+if 
(rXPropSet->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
+{
+uno::Sequence aGrabBag;
+rXPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+for (auto& aProp : aGrabBag)
+{
+if (aProp.Name == "Upright")
+{
+aProp.Value >>= isUpright;
+break;
+}
+}
+}
+}
+
 bool bHasWrap = false;
 bool bWrap = false;
 // Only custom shapes obey the TextWordWrap option, normal text always 
wraps.
@@ -2844,6 +2862,7 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
XML_anchor, sVerticalAlignment,
XML_anchorCtr, bHorizontalCenter ? "1" : 
nullptr,
XML_vert, sWritingMode,
+   XML_upright, isUpright ? "1" : "0",
XML_rot, ((nTextPreRotateAngle + 
nTextRotateAngle) != 0) ? oox::drawingml::calcRotationValue( 
(nTextPreRotateAngle + nTextRotateAngle) * 100 ).getStr() : nullptr );
 if (bIsFontworkShape)
 {
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index f78c38ff91e9..076fd1124307 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -96,6 +96,17 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 }
 }
 
+if (bool bUpright = rAttribs.getBool(XML_upright, false))
+{
+uno::Sequence aGrabBag;
+xPropertySet->getPropertyValue("InteropGrabBag") >>= 
aGrabBag;
+sal_Int32 length = aGrabBag.getLength();
+aGrabBag.realloc(length + 1);
+aGrabBag[length].Name = "Upright";
+aGrabBag[length].Value <<= bUpright;
+xPropertySet->setPropertyValue("InteropGrabBag", 
uno::makeAny(aGrabBag));
+}
+
 if (xServiceInfo.is())
 {
 // Handle inset attributes for Writer textframes.
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx
new file mode 100644
index ..d7dc1978a067
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf123610_handle_upright.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index a7fa86d47a14..61ba601ed1c5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1190,6 +1190,16 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, "tdf133
 CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testBodyPrUpright, 
"tdf123610_handle_upright.docx")
+{
+// tdf#123610: Check grab-bag attribute upright to keep text upright 
regardless of shape rotation.
+
+xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+   

[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - oox/source sw/qa

2021-01-06 Thread Regényi Balázs (via logerrit)
 oox/source/vml/vmlshape.cxx  |4 +++
 sw/qa/extras/ooxmlexport/data/tdf97618_testVmlShapeTextWordWrap.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   13 
++
 3 files changed, 17 insertions(+)

New commits:
commit c3401667f5b09abde56211653bdbad2218da90fa
Author: Regényi Balázs 
AuthorDate: Sat Aug 29 09:11:46 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Jan 6 15:46:02 2021 +0100

tdf#97618 DOCX import: VML shape: fix missing square wrap

Co-authored-by: Szabolcs Tóth

Change-Id: Ib9db4b0270ed7d4b3d47406f2384276cafdd7249
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101632
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 0d773f0b07798a59f7cf31207813aaf6bc9bb922)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108869
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index a7a0c46d6204..4ac378e377fa 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -788,6 +788,10 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 eTextVerticalAdjust = drawing::TextVerticalAdjust_BOTTOM;
 PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, 
makeAny(eTextVerticalAdjust));
 
+// tdf#97618
+if(!maTypeModel.maWrapStyle.isEmpty())
+PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, 
makeAny(maTypeModel.maWrapStyle == "square"));
+
 PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight,
makeAny(maTypeModel.mbAutoHeight));
 
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf97618_testVmlShapeTextWordWrap.docx 
b/sw/qa/extras/ooxmlexport/data/tdf97618_testVmlShapeTextWordWrap.docx
new file mode 100644
index ..eb31a1244c01
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf97618_testVmlShapeTextWordWrap.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index e3f8e6cafc57..3a6d3e9db1bc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1183,6 +1183,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108505, 
"tdf108505.docx")
 getProperty(xText, "CharFontName"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testVmlShapeTextWordWrap, 
"tdf97618_testVmlShapeTextWordWrap.docx")
+{
+// tdf#97618 The text wraping of a shape was not handled in a canvas.
+// TODO: fix export too
+if (mbExported)
+return;
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+if (!pXmlDoc)
+return;
+// The bound rect of shape will be wider if wrap does not work (the wrong 
value is 3167).
+assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width", "2500");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits