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

2020-10-15 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 846118c0be78e29752826a47cd09b3033dbd075f
Author: Regényi Balázs 
AuthorDate: Sat Aug 29 09:11:46 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Thu Oct 15 11:20:50 2020 +0200

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/+/104304
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index c26d512ecd23..d4ac133718dd 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -790,6 +790,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 de2c3bb84568..29a3a3b54b5b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -503,6 +503,19 @@ DECLARE_OOXMLEXPORT_TEST(testImageSpaceSettings, 
"tdf135047_ImageSpaceSettings.f
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distR", "90170");
 }
 
+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;
+xmlDocPtr 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


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

2020-09-13 Thread Regényi Balázs (via logerrit)
 oox/source/export/drawingml.cxx|7 +
 sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  |   12 
++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 162d7d3ba448f5b53d4ca8b70b22a298e8ea2166
Author: Regényi Balázs 
AuthorDate: Thu Jun 25 15:15:46 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Sun Sep 13 21:46:27 2020 +0200

tdf#112312 DOCX legacy shape export: keep fixed size

Classical/legacy shapes lost their fixed size when exporting them with the
option "Resize shape to fit text" because they do not have the ability to
resize to content.

Co-authored-by: Szabolcs Tóth

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97127
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit cab956c480eb4f619580285c7b9a15b9e6d9b780)

Change-Id: Idd84dea040f9607d0d498e591601a8648a605a2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102569
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9ef07ec5ef5d..b80b33134566 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2831,9 +2831,14 @@ void DrawingML::WriteText( const Reference< XInterface 
>& rXIface, const OUStrin
 
 if (GetDocumentType() == DOCUMENT_DOCX || GetDocumentType() == 
DOCUMENT_XLSX)
 {
+// tdf#112312: only custom shapes obey the TextAutoGrowHeight 
option
 bool bTextAutoGrowHeight = false;
-if (GetProperty(rXPropSet, "TextAutoGrowHeight"))
+uno::Reference xShape(rXIface, uno::UNO_QUERY);
+auto pSdrObjCustomShape = xShape.is() ? 
dynamic_cast(GetSdrObjectFromXShape(xShape)) : nullptr;
+if (pSdrObjCustomShape && GetProperty(rXPropSet, 
"TextAutoGrowHeight"))
+{
 mAny >>= bTextAutoGrowHeight;
+}
 mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit 
: XML_noAutofit));
 }
 if (GetDocumentType() == DOCUMENT_PPTX)
diff --git a/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt 
b/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt
new file mode 100644
index ..b5ccb356203e
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf112312_AutoFitForLegacyShapes.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c9833e045f0a..ea46e10deac7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1244,6 +1244,18 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, "tdf133670_test
 CPPUNIT_ASSERT_EQUAL(static_cast(2408), nAnchoredWidth);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testAutoFitForLegacyShapes, 
"tdf112312_AutoFitForLegacyShapes.odt")
+{
+// tdf#112312: check if noAutoFit is used instead of spAutoFit even if the 
TextAutoGrowHeight is set
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr/a:noAutofit");
+assertXPathNoAttribute(pXmlDocument, 
"/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:bodyPr", "a:spAutofit");
+}
+
 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-6-4' - oox/source sw/qa

2020-07-27 Thread Szabolcs Toth (via logerrit)
 oox/source/export/drawingml.cxx   |2 +-
 sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |   12 
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 1dc3fa541159e746b81561bb6a6170dcd968704d
Author: Szabolcs Toth 
AuthorDate: Mon May 11 15:56:27 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Mon Jul 27 20:03:26 2020 +0200

tdf#92526 DrawingML shape export: fix 0 line width

0 line width is the thinnest possible line width,
but without its explicit export (a:ln w="0"), shape
outline was imported with 0.75 pt line width by MSO.

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

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93968
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 96319d662dca12616eb52c601a2d5b5adca3ae57)

Change-Id: I40f7aefe6358bebe9a3853fe3e7d6faa170bc34c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99533
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 468c89ad7b7e..9ef07ec5ef5d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -874,7 +874,7 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 
 mpFS->startElementNS( XML_a, XML_ln,
   XML_cap, cap,
-  XML_w, nLineWidth > 1 && nStyleLineWidth != 
nLineWidth ?
+  XML_w, nLineWidth == 0 || (nLineWidth > 1 && 
nStyleLineWidth != nLineWidth) ?
   
OString::number(oox::drawingml::convertHmmToEmu(nLineWidth)).getStr() : nullptr 
);
 
 if( bColorSet )
diff --git a/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt 
b/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt
new file mode 100644
index ..fffd9b9b2037
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf92526_ShapeLineWidth.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 7e9bcb639012..089154675288 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1118,6 +1118,18 @@ DECLARE_OOXMLEXPORT_TEST(testArrowMarker, 
"tdf123346_ArrowMarker.docx")
 "/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:tailEnd", "type", 
"arrow");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, "tdf92526_ShapeLineWidth.odt")
+{
+// tdf#92526: Make sure that line with stays 0.
+xmlDocPtr pXml = parseExport("word/document.xml");
+if (!pXml)
+return;
+
+// "w" attribute was not exported.
+assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing"
+"/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0");
+}
+
 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-6-4' - oox/source sw/qa

2020-06-12 Thread Tibor Nagy (via logerrit)
 oox/source/vml/vmlshape.cxx  |   14 ++
 sw/qa/extras/ooxmlexport/data/tdf123622.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   13 +
 3 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 459c7d4190461123057ca05af15d7199d40ed258
Author: Tibor Nagy 
AuthorDate: Fri May 8 10:32:09 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Jun 12 09:46:49 2020 +0200

tdf#123622 DOCX VML import: fix relative horizontal alignment

Margin (left, right, inner, outer) alignments of VML shapes
weren't handled.

Co-authored-by: Attila Bakos (NISZ)

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93723
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 52442a4c0192cbedafe7b77459dd2c3d1cf3614b)

Change-Id: I5f8ece64707a2d699b71d6151887db05ac39c4f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96138
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e1c857f5528e..c26d512ecd23 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -643,10 +643,16 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, 
const ShapeTypeModel& rType
 
 if ( rTypeModel.maPositionHorizontalRelative == "page" )
 rPropSet.setAnyProperty(PROP_HoriOrientRelation, 
makeAny(text::RelOrientation::PAGE_FRAME));
-else if ( rTypeModel.maPositionVerticalRelative == "margin" )
-rPropSet.setProperty(PROP_VertOrientRelation, 
text::RelOrientation::PAGE_PRINT_AREA);
-else if ( rTypeModel.maPositionVerticalRelative == "text" )
-rPropSet.setProperty(PROP_VertOrientRelation, 
text::RelOrientation::FRAME);
+else if ( rTypeModel.maPositionHorizontalRelative == "margin" )
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PAGE_PRINT_AREA);
+else if (rTypeModel.maPositionHorizontalRelative == "right-margin-area" ||
+ rTypeModel.maPositionHorizontalRelative == "inner-margin-area")
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PAGE_RIGHT);
+else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" ||
+ rTypeModel.maPositionHorizontalRelative == "outer-margin-area")
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PAGE_LEFT);
+else if ( rTypeModel.maPositionHorizontalRelative == "text" )
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::FRAME);
 
 if ( rTypeModel.maPositionVertical == "center" )
 rPropSet.setAnyProperty(PROP_VertOrient, 
makeAny(text::VertOrientation::CENTER));
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123622.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123622.docx
new file mode 100644
index ..54ef0cbd7670
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123622.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 8d347be29038..cf01b3231e37 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -35,6 +35,19 @@ protected:
 }
 };
 
+DECLARE_OOXMLIMPORT_TEST(testTdf123622, "tdf123622.docx")
+{
+uno::Reference 
XPropsRight(getShape(1),uno::UNO_QUERY);
+sal_Int16 nRelativePosR = 0;
+XPropsRight->getPropertyValue("HoriOrientRelation")>>=nRelativePosR;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape inside the margin", sal_Int16(4), 
nRelativePosR);
+
+uno::Reference XPropsLeft(getShape(2), 
uno::UNO_QUERY);
+sal_Int16 nRelativePosL = 0;
+XPropsLeft->getPropertyValue("HoriOrientRelation") >>= nRelativePosL;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape inside the margin", sal_Int16(3), 
nRelativePosL);
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf78749, "tdf78749.docx")
 {
 //Shape lost the background image before, now check if it still has...
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits