[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - svx/qa svx/source

2021-10-21 Thread Regényi Balázs (via logerrit)
 svx/qa/unit/customshapes.cxx  |   24 +++---
 svx/source/customshapes/EnhancedCustomShape2d.cxx |3 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 404d12e9f71efbabf6cd8f5488d8dabf9f086af7
Author: Regényi Balázs 
AuthorDate: Sat Jan 16 13:48:44 2021 +0100
Commit: Tünde Tóth 
CommitDate: Thu Oct 21 10:53:53 2021 +0200

tdf#139549 DOCX import: document got modified at import time

Regression of bda05ba1736b74727872579b65b3fa14e3d8
"tdf#41466 DOCX import: fix VML v:shape/v:textbox".

Co-authored-by: Tünde Tóth

Change-Id: I8762aa8a710c3a37290e1db854b8cc86db6757b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109436
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 2ffdd37067926ddb841c6055205f267b96706945)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123967
Tested-by: Tünde Tóth 
Reviewed-by: Tünde Tóth 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 791588f1984d..dd1b79f4bc60 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -607,9 +607,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthV = aBoundRectV.Width;
 const sal_Int32 nLeftV = aBoundRectV.X;
 const sal_Int32 nTopV = aBoundRectV.Y;
-if (abs(nHeightV - 4149) > 5 || abs(nWidthV - 3819) > 5)
+if (abs(nHeightV - 8000) > 10 || abs(nWidthV - 8000) > 10)
 sErrors += "Flip vertical wrong size.";
-if (abs(nLeftV - 3155) > 5 || abs(nTopV - 3736) > 5)
+if (abs(nLeftV - 1000) > 10 || abs(nTopV - 2000) > 10)
 sErrors += " Flip vertical wrong position.";
 
 uno::Reference xShapeH(getShape(1));
@@ -621,9 +621,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthH = aBoundRectH.Width;
 const sal_Int32 nLeftH = aBoundRectH.X;
 const sal_Int32 nTopH = aBoundRectH.Y;
-if (abs(nHeightH - 4149) > 5 || abs(nWidthH - 3819) > 5)
+if (abs(nHeightH - 8000) > 10 || abs(nWidthH - 8000) > 10)
 sErrors += " Flip horizontal wrong size.";
-if (abs(nLeftH - 15026) > 5 || abs(nTopH - 4115) > 5)
+if (abs(nLeftH - 13000) > 10 || abs(nTopH - 2000) > 10)
 sErrors += " Flip horizontal wrong position.";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -686,13 +686,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_Asymmetric)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 10034) > 5)
+if (abs(nLeft - 9000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 12973) > 5)
+if (abs(nRight - 19000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 7892) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 14884) > 5)
+if (abs(nBottom - 18000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -719,13 +719,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_TextRotateAngle)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 5054) > 5)
+if (abs(nLeft - 2000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 6374) > 5)
+if (abs(nRight - 14000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 4516) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 8930) > 5)
+if (abs(nBottom - 9000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 556e440e491c..71f51ae7055e 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2866,9 +2866,10 @@ SdrObjectUniquePtr EnhancedCustomShape2d::CreatePathObj( 
bool bLineGeometryNeede
 SdrPathObj* pObj(rCandidate.first.get());
 const drawing::LineStyle 
eLineStyle(pObj->GetMergedItem(XATTR_LINESTYLE).GetValue());
 const drawing::FillStyle 
eFillStyle(pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue());
+const auto pText = pObj->getActiveText();
 
 // #i40600# if bLineGeometryNeededOnly is set, linestyle does not 
matter
-if(bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
+if(pText || bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
 vNewList.push_back(std::move(rCandidate));
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - svx/qa svx/source

2021-06-29 Thread Regényi Balázs (via logerrit)
 svx/qa/unit/customshapes.cxx  |   24 +++---
 svx/source/customshapes/EnhancedCustomShape2d.cxx |3 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 66cc4828d438655d9a1f2affbc594c4096d1acaf
Author: Regényi Balázs 
AuthorDate: Sat Jan 16 13:48:44 2021 +0100
Commit: László Németh 
CommitDate: Tue Jun 29 22:48:44 2021 +0200

tdf#139549 DOCX import: document got modified at import time

Regression of bda05ba1736b74727872579b65b3fa14e3d8
"tdf#41466 DOCX import: fix VML v:shape/v:textbox".

Co-authored-by: Tünde Tóth

Change-Id: I8762aa8a710c3a37290e1db854b8cc86db6757b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109436
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 2ffdd37067926ddb841c6055205f267b96706945)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117973
Tested-by: Jenkins

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 830c0074c757..b7b0788c4bba 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -610,9 +610,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthV = aBoundRectV.Width;
 const sal_Int32 nLeftV = aBoundRectV.X;
 const sal_Int32 nTopV = aBoundRectV.Y;
-if (abs(nHeightV - 4149) > 5 || abs(nWidthV - 3819) > 5)
+if (abs(nHeightV - 8000) > 10 || abs(nWidthV - 8000) > 10)
 sErrors += "Flip vertical wrong size.";
-if (abs(nLeftV - 3155) > 5 || abs(nTopV - 3736) > 5)
+if (abs(nLeftV - 1000) > 10 || abs(nTopV - 2000) > 10)
 sErrors += " Flip vertical wrong position.";
 
 uno::Reference xShapeH(getShape(1));
@@ -624,9 +624,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthH = aBoundRectH.Width;
 const sal_Int32 nLeftH = aBoundRectH.X;
 const sal_Int32 nTopH = aBoundRectH.Y;
-if (abs(nHeightH - 4149) > 5 || abs(nWidthH - 3819) > 5)
+if (abs(nHeightH - 8000) > 10 || abs(nWidthH - 8000) > 10)
 sErrors += " Flip horizontal wrong size.";
-if (abs(nLeftH - 15026) > 5 || abs(nTopH - 4115) > 5)
+if (abs(nLeftH - 13000) > 10 || abs(nTopH - 2000) > 10)
 sErrors += " Flip horizontal wrong position.";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -689,13 +689,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_Asymmetric)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 10034) > 5)
+if (abs(nLeft - 9000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 12973) > 5)
+if (abs(nRight - 19000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 7892) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 14884) > 5)
+if (abs(nBottom - 18000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -722,13 +722,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_TextRotateAngle)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 5054) > 5)
+if (abs(nLeft - 2000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 6374) > 5)
+if (abs(nRight - 14000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 4516) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 8930) > 5)
+if (abs(nBottom - 9000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 046f5a783c31..154f2df08c9e 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2864,9 +2864,10 @@ SdrObjectUniquePtr EnhancedCustomShape2d::CreatePathObj( 
bool bLineGeometryNeede
 SdrPathObj* pObj(rCandidate.first.get());
 const drawing::LineStyle 
eLineStyle(pObj->GetMergedItem(XATTR_LINESTYLE).GetValue());
 const drawing::FillStyle 
eFillStyle(pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue());
+const auto pText = pObj->getActiveText();
 
 // #i40600# if bLineGeometryNeededOnly is set, linestyle does not 
matter
-if(bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
+if(pText || bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
 vNewList.push_back(std::move(rCandidate));
 }
 
___
Li

[Libreoffice-commits] core.git: svx/qa svx/source

2021-06-28 Thread Regényi Balázs (via logerrit)
 svx/qa/unit/customshapes.cxx  |   24 +++---
 svx/source/customshapes/EnhancedCustomShape2d.cxx |3 +-
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit 2ffdd37067926ddb841c6055205f267b96706945
Author: Regényi Balázs 
AuthorDate: Sat Jan 16 13:48:44 2021 +0100
Commit: László Németh 
CommitDate: Mon Jun 28 09:35:18 2021 +0200

tdf#139549 DOCX import: document got modified at import time

Regression of bda05ba1736b74727872579b65b3fa14e3d8
"tdf#41466 DOCX import: fix VML v:shape/v:textbox".

Co-authored-by: Tünde Tóth

Change-Id: I8762aa8a710c3a37290e1db854b8cc86db6757b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109436
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 830c0074c757..b7b0788c4bba 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -610,9 +610,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthV = aBoundRectV.Width;
 const sal_Int32 nLeftV = aBoundRectV.X;
 const sal_Int32 nTopV = aBoundRectV.Y;
-if (abs(nHeightV - 4149) > 5 || abs(nWidthV - 3819) > 5)
+if (abs(nHeightV - 8000) > 10 || abs(nWidthV - 8000) > 10)
 sErrors += "Flip vertical wrong size.";
-if (abs(nLeftV - 3155) > 5 || abs(nTopV - 3736) > 5)
+if (abs(nLeftV - 1000) > 10 || abs(nTopV - 2000) > 10)
 sErrors += " Flip vertical wrong position.";
 
 uno::Reference xShapeH(getShape(1));
@@ -624,9 +624,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Mirror)
 const sal_Int32 nWidthH = aBoundRectH.Width;
 const sal_Int32 nLeftH = aBoundRectH.X;
 const sal_Int32 nTopH = aBoundRectH.Y;
-if (abs(nHeightH - 4149) > 5 || abs(nWidthH - 3819) > 5)
+if (abs(nHeightH - 8000) > 10 || abs(nWidthH - 8000) > 10)
 sErrors += " Flip horizontal wrong size.";
-if (abs(nLeftH - 15026) > 5 || abs(nTopH - 4115) > 5)
+if (abs(nLeftH - 13000) > 10 || abs(nTopH - 2000) > 10)
 sErrors += " Flip horizontal wrong position.";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -689,13 +689,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_Asymmetric)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 10034) > 5)
+if (abs(nLeft - 9000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 12973) > 5)
+if (abs(nRight - 19000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 7892) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 14884) > 5)
+if (abs(nBottom - 18000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
@@ -722,13 +722,13 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf127785_TextRotateAngle)
 const sal_Int32 nTop = aBoundRect.Y;
 const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1;
 const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1;
-if (abs(nLeft - 5054) > 5)
+if (abs(nLeft - 2000) > 10)
 sErrors += "wrong left";
-if (abs(nRight - 6374) > 5)
+if (abs(nRight - 14000) > 10)
 sErrors += " wrong right";
-if (abs(nTop - 4516) > 5)
+if (abs(nTop - 3000) > 10)
 sErrors += " wrong top";
-if (abs(nBottom - 8930) > 5)
+if (abs(nBottom - 9000) > 10)
 sErrors += " wrong bottom";
 
 CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx 
b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 046f5a783c31..154f2df08c9e 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -2864,9 +2864,10 @@ SdrObjectUniquePtr EnhancedCustomShape2d::CreatePathObj( 
bool bLineGeometryNeede
 SdrPathObj* pObj(rCandidate.first.get());
 const drawing::LineStyle 
eLineStyle(pObj->GetMergedItem(XATTR_LINESTYLE).GetValue());
 const drawing::FillStyle 
eFillStyle(pObj->GetMergedItem(XATTR_FILLSTYLE).GetValue());
+const auto pText = pObj->getActiveText();
 
 // #i40600# if bLineGeometryNeededOnly is set, linestyle does not 
matter
-if(bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
+if(pText || bLineGeometryNeededOnly || (drawing::LineStyle_NONE != 
eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
 vNewList.push_back(std::move(rCandidate));
 }
 
___
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/inc oox/source sc/qa

2021-02-25 Thread Regényi Balázs (via logerrit)
 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 == "vertOv

[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-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


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

2021-01-06 Thread Regényi Balázs (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt |   42 
++
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx  |   12 ++
 sw/source/filter/ww8/docxsdrexport.cxx  |6 -
 3 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit b3a16db723d60d8eca43589c0f57f882dee26eb0
Author: Regényi Balázs 
AuthorDate: Wed Aug 26 17:38:21 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Jan 6 15:18:19 2021 +0100

tdf#135047 DOCX export: fix spacing around objects

defined by frame style instead of direct formatting.

Co-authored-by: Szabolcs Tóth

Change-Id: I376c6ff09d15fe8e2db699b4cfc157ce08016cfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101416
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit fe72feef80a4336be9a57a8137839de1d52b2601)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108867
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt
new file mode 100644
index ..47dac15a5bba
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt
@@ -0,0 +1,42 @@
+
+http://openoffice.org/2010/draw"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+  
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+
+  
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgK
+   CgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/wAALCAACAAIBAREA/8QAFAAB
+   CP/EAB4QAAAEBwACBAUGFiU0Q1Nh/9oACAEB
+   AAA/AD/CzM0Sw0UpHYJ8BdZeD//Z
+  
+ 
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Vestibulum consequat mi quis pretium semper. Proin luctus orci ac neque 
venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus 
egestas. Donec blandit auctor arcu, nec pellentesque eros molestie eget. In 
consectetur aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non 
pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper 
vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est 
orci.
+   Integer sodales tincidunt tristique. Sed 
a metus posuere, adipiscing nunc et, viverra odio. Donec auctor molestie sem, 
sit amet tristique lectus hendrerit sed. Cras sodales nisl sed orci mattis 
iaculis. Nunc eget dolor accumsan, pharetra risus a, vestibulum mauris. Nunc 
vulputate lobortis mollis. Vivamus nec tellus faucibus, tempor magna nec, 
facilisis felis. Donec commodo enim a vehicula pellentesque. Nullam vehicula 
vestibulum est vel ultricies.
+   Aliquam velit massa, laoreet vel leo 
nec, volutpat facilisis eros. Donec consequat arcu ut diam tempor luctus. Cum 
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus 
mus. Praesent vitae lacus vel leo sodales pharetra a a nibh. Vestibulum ante 
ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam 
luctus tempus nibh, fringilla dictum augue consectetur eget. Curabitur at ante 
sit amet tortor pharetra molestie eu nec ante. Mauris tincidunt, nibh eu 
sollicitudin molestie, dolor sapien congue tortor, a pulvinar sapien turpis sed 
ante. Donec nec est elementum, euismod nulla in, mollis nunc.
+   
+  
+ 
+
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index afc2de810d5b..7a7b7d519016 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -257,6 +257,18 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter,
 CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testImageSpaceSettings, 
"tdf135047_ImageSpaceSettings.fodt")
+{
+// tdf#135047 The spaces of image were not saved.
+xmlDocUniquePtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distT", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distB", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distL", "90170");
+assertXPath

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

2021-01-06 Thread Regényi Balázs (via logerrit)
 sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx  |   19 
++
 sc/source/filter/oox/drawingfragment.cxx|8 ++--
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit f7413d0c1b5741adf97c40f755a069afc551578a
Author: Regényi Balázs 
AuthorDate: Wed Aug 19 15:32:54 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Jan 6 14:43:18 2021 +0100

tdf#135918 XLSX DrawingML shape import: fix needless displacement

Shape was displaced on rotation if it is placed next to the sheets
upper/left edges.

Co-authored-by: Szabolcs Tóth

Change-Id: I987e7b0d863b89cfb5d8154e2f0a017e21248ee1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101001
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 3e85b22769a4b02744a7006d7dc772973c0093f5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108865
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx 
b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx
new file mode 100644
index ..a5fcd1ce2fbd
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index a8229d26d158..16a38a862121 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -262,6 +262,7 @@ public:
 void testXLSDefColWidth();
 void testPreviewMissingObjLink();
 void testShapeRotationImport();
+void testShapeDisplacementOnRotationImport();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -412,6 +413,7 @@ public:
 CPPUNIT_TEST(testXLSDefColWidth);
 CPPUNIT_TEST(testPreviewMissingObjLink);
 CPPUNIT_TEST(testShapeRotationImport);
+CPPUNIT_TEST(testShapeDisplacementOnRotationImport);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4520,6 +4522,23 @@ void ScFiltersTest::testShapeRotationImport()
 }
 }
 
+void ScFiltersTest::testShapeDisplacementOnRotationImport()
+{
+// tdf#135918 shape is displaced on rotation if it is placed next to the 
sheets upper/left edges
+ScDocShellRef xDocSh = loadDoc("testShapeDisplacementOnRotationImport.", 
FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load 
testShapeDisplacementOnRotationImport.xlsx", xDocSh.is());
+
+uno::Reference xDoc(xDocSh->GetModel(), 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+uno::Reference xShape(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+uno::Reference xShapeProperties(xShape, 
uno::UNO_QUERY_THROW);
+uno::Any aRectProp = xShapeProperties->getPropertyValue("FrameRect");
+awt::Rectangle aRectangle = aRectProp.get();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRectangle.X);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRectangle.Y);
+}
+
 ScFiltersTest::ScFiltersTest()
   : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/filter/oox/drawingfragment.cxx 
b/sc/source/filter/oox/drawingfragment.cxx
index 396170be35e3..b726ea9479ad 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -295,9 +295,11 @@ void DrawingFragment::onEndElement()
 }
 
 // TODO: DrawingML implementation expects 32-bit 
coordinates for EMU rectangles (change that to EmuRectangle)
+// tdf#135918: Negative X,Y position has to be allowed to 
avoid shape displacement on rotation.
+// The negative values can exist because of previous lines 
where the anchor rectangle must be mirrored in some ranges.
 Rectangle aShapeRectEmu32(
-getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.X, 0, SAL_MAX_INT32 ),
-getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Y, 0, SAL_MAX_INT32 ),
+getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.X, SAL_MIN_INT32, SAL_MAX_INT32 ),
+getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Y, SAL_MIN_INT32, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Width, 0, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) );
 
@@ -314,7 +316,7 @@ void DrawingFragment::onEndElement()
 /*  Collect all shape positions in the WorksheetHelper base
 class. But first, scale EMUs to 1/100 mm. */
 Rectangle aShapeRectHmm(
-convertEmuToHmm(aShapeRectEmu32.X ), 
convertEmuToHmm(aShapeRectEmu32.Y ),
+

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

2021-01-06 Thread Regényi Balázs (via logerrit)
 sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt |  
284 ++
 sw/qa/core/layout/layout.cxx |   
15 
 sw/source/core/inc/frmtool.hxx   |
5 
 sw/source/core/layout/flowfrm.cxx|   
12 
 sw/source/core/layout/frmtool.cxx|
9 
 5 files changed, 317 insertions(+), 8 deletions(-)

New commits:
commit cfd02899cffda4d4a9d67e219c09ef39f1bbaa97
Author: Regényi Balázs 
AuthorDate: Sat Jul 11 21:29:33 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Jan 6 10:04:22 2021 +0100

tdf#134783 sw: fix contextual spacing position of shape

anchored to paragraph, i.e. when paragraph spacing removed
between same style paragraphs with option "Don't add
space between paragraphs of the same style".

Follow-up of commit 11059331718fb8faab483c75633b4e80d8028b7d
(SwFlowFrm: implement contextual spacing)

Co-authored-by: Szabolcs Tóth

Change-Id: Id128ad7cab3c7dde4333de3b11a5a3693d039243
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98584
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 713c6b1880ee06f8ff0aa869906058f247db6e3a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108733
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git 
a/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt 
b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
new file mode 100644
index ..aa5cc77126b9
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
@@ -0,0 +1,284 @@
+
+
+http://openoffice.org/2004/office"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns
 :css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:officeooo="http://openoffice.org/2009/office"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2020-07-14T15:50:45.95100PT1M19S1LibreOfficeDev/7.1.0.0.alpha0$Windows_X86_64
 
LibreOffice_project/e8ffd954ee590d1f382685ceae12a51387919fb8
+ 
+  
+   0
+   0
+   37837
+   23232
+   true
+   false
+   
+
+ view2
+ 10911
+ 6713
+ 0
+ 0
+ 37835
+ 23230
+ 0
+ 1
+ false
+ 100
+ false
+ false
+
+   
+  
+  
+   false
+   
+   
+   
+   1
+   true
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   
+   
+   true
+   false
+   false
+   0
+   true
+   false
+   true
+   false
+   false
+   0
+   false
+   true
+   false
+   false
+   false
+   false
+   high-resolution
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   true
+   false
+   
+   false
+   false
+   false
+   true
+   false
+   2065661
+   false
+   false
+   false
+   false
+   false
+   2065661
+   false
+   true
+   false
+   true
+   true
+   false
+   false
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   0
+   true
+   false
+   true
+   true
+   true
+   false
+   true
+   false
+   fals

[Libreoffice-commits] core.git: sw/source

2021-01-05 Thread Regényi Balázs (via logerrit)
 sw/source/core/doc/textboxhelper.cxx |   58 ++-
 1 file changed, 57 insertions(+), 1 deletion(-)

New commits:
commit 09cff148ed51e5d462b9d04634e9441caadde3ef
Author: Regényi Balázs 
AuthorDate: Tue Dec 8 12:10:03 2020 +0100
Commit: Balazs Varga 
CommitDate: Tue Jan 5 12:02:39 2021 +0100

cleanup: add warnings for unhandled cases for the SwTextBoxHelper

Change-Id: Idc62a8872cef89c5b3b45e9027718c1e61c5a910
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108076
Tested-by: Jenkins
Tested-by: Balazs Varga 
Reviewed-by: Balazs Varga 

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index cbf1384bd27c..a9859266e21f 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -442,7 +442,8 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
std::u16string_view rP
 uno::Reference xFrameParaProps(xCursor, 
uno::UNO_QUERY);
 
 // And simply map the property
-switch (rValue.get())
+const auto eValue = rValue.get();
+switch (eValue)
 {
 case drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER:
 xFrameParaProps->setPropertyValue(
@@ -460,6 +461,9 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
std::u16string_view rP
 
uno::makeAny(style::ParagraphAdjust::ParagraphAdjust_RIGHT)); //1
 break;
 default:
+SAL_WARN("sw.core",
+ "SwTextBoxHelper::syncProperty: unhandled 
TextHorizontalAdjust: "
+ << static_cast(eValue));
 break;
 }
 return;
@@ -510,6 +514,11 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
std::u16string_view rP
 case -270:
 nDirection = text::WritingMode2::BT_LR;
 break;
+default:
+SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: 
unhandled property value: "
+
"CustomShapeGeometry:TextPreRotateAngle: "
+<< nAngle);
+break;
 }
 
 if (nDirection)
@@ -539,6 +548,9 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
std::u16string_view rP
 else if (rValue >>= eMode2)
 syncProperty(pShape, RES_FRAMEDIR, 0, uno::makeAny(eMode2));
 }
+else
+SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: unhandled 
property: "
+<< static_cast(rPropertyName));
 }
 
 void SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, sal_uInt16 
nWID, sal_uInt8 nMemberID,
@@ -568,6 +580,10 @@ void SwTextBoxHelper::getProperty(SwFrameFormat const* 
pShape, sal_uInt16 nWID,
 case MID_CHAIN_NAME:
 rValue <<= pFormat->GetName();
 break;
+default:
+SAL_WARN("sw.core", "SwTextBoxHelper::getProperty: unhandled 
member-id: "
+<< static_cast(nMemberID));
+break;
 }
 }
 
@@ -604,6 +620,11 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
sal_uInt16 nWID, sal_u
 aPropertyName = UNO_NAME_HORI_ORIENT_POSITION;
 bAdjustX = true;
 break;
+default:
+SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: 
unhandled member-id: "
+<< 
static_cast(nMemberID)
+<< " (which-id: " << nWID << ")");
+break;
 }
 break;
 case RES_LR_SPACE:
@@ -616,6 +637,11 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
sal_uInt16 nWID, sal_u
 case MID_R_MARGIN:
 aPropertyName = UNO_NAME_RIGHT_MARGIN;
 break;
+default:
+SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: 
unhandled member-id: "
+<< 
static_cast(nMemberID)
+<< " (which-id: " << nWID << ")");
+break;
 }
 break;
 }
@@ -632,6 +658,11 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
sal_uInt16 nWID, sal_u
 aPropertyName = UNO_NAME_VERT_ORIENT_POSITION;
 bAdjustY = true;
 break;
+default:
+SAL_WARN("sw.core", "SwTextBoxHelper::syncProperty: 
unhandled member-id: "
+<< 
static_cast(nMemberID)
+<< " (which-id: " << nWID << ")");
+break;
 }
 break;
 case RES_FRM_SIZE:
@@ -688,6 +719,1

[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

2020-12-21 Thread Regényi Balázs (via logerrit)
 sw/source/filter/ww8/wrtw8nds.cxx |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit b5a02acda8396c108e21e72fc830cc41a0bc890c
Author: Regényi Balázs 
AuthorDate: Mon Dec 21 09:35:47 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Dec 21 21:58:39 2020 +0100

tdf#138986 Fix DOC export of LinkDisplayName

The LinkedDisplayName could be empty what caused an assert.

tdf#138986 regression from commit: bda05ba1736b74727872579b65b3fa14e3d8
(tdf#41466 DOCX import: fix VML v:shape/v:textbox)

Change-Id: I166a7e4c1defc201d0563a961b28ecb6c6be500c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108077
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit f80dcee922428fa564b4779b1f81ad087db937ae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108008

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index fc75ac5ff02a..77cdab41e879 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -149,6 +149,22 @@ static ww::eField lcl_getFieldId(const IFieldmark*const 
pFieldmark)
 return ww::eUNKNOWN;
 }
 
+static OUString
+lcl_getLinkChainName(const uno::Reference& rPropertySet,
+ const uno::Reference& 
rPropertySetInfo)
+{
+OUString sLinkChainName;
+if (rPropertySetInfo->hasPropertyByName("LinkDisplayName"))
+{
+rPropertySet->getPropertyValue("LinkDisplayName") >>= sLinkChainName;
+if (!sLinkChainName.isEmpty())
+return sLinkChainName;
+}
+if (rPropertySetInfo->hasPropertyByName("ChainName"))
+rPropertySet->getPropertyValue("ChainName") >>= sLinkChainName;
+return sLinkChainName;
+}
+
 MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport )
 : pOld( rExport.m_pChpIter ), m_rExport( rExport )
 {
@@ -637,7 +653,6 @@ bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos) const
 FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 {
 // collection point to first gather info about all of the potentially 
linked textboxes: to be analyzed later.
-OUString sLinkChainName;
 ww8::FrameIter linkedTextboxesIter = maFlyIter;
 while ( linkedTextboxesIter != maFlyFrames.end() )
 {
@@ -654,10 +669,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 {
 MSWordExportBase::LinkedTextboxInfo aLinkedTextboxInfo;
 
-if( xPropertySetInfo->hasPropertyByName("LinkDisplayName") )
-xPropertySet->getPropertyValue("LinkDisplayName") >>= 
sLinkChainName;
-else if( xPropertySetInfo->hasPropertyByName("ChainName") )
-xPropertySet->getPropertyValue("ChainName") >>= sLinkChainName;
+const OUString sLinkChainName = lcl_getLinkChainName(xPropertySet, 
xPropertySetInfo);
 
 if( xPropertySetInfo->hasPropertyByName("ChainNextName") )
 xPropertySet->getPropertyValue("ChainNextName") >>= 
aLinkedTextboxInfo.sNextChain;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2020-12-21 Thread Regényi Balázs (via logerrit)
 sw/source/filter/ww8/wrtw8nds.cxx |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit f80dcee922428fa564b4779b1f81ad087db937ae
Author: Regényi Balázs 
AuthorDate: Mon Dec 21 09:35:47 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Dec 21 17:05:32 2020 +0100

tdf#138986 Fix DOC export of LinkDisplayName

The LinkedDisplayName could be empty what caused an assert.

tdf#138986 regression from commit: bda05ba1736b74727872579b65b3fa14e3d8
(tdf#41466 DOCX import: fix VML v:shape/v:textbox)

Change-Id: I166a7e4c1defc201d0563a961b28ecb6c6be500c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108077
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index fc75ac5ff02a..77cdab41e879 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -149,6 +149,22 @@ static ww::eField lcl_getFieldId(const IFieldmark*const 
pFieldmark)
 return ww::eUNKNOWN;
 }
 
+static OUString
+lcl_getLinkChainName(const uno::Reference& rPropertySet,
+ const uno::Reference& 
rPropertySetInfo)
+{
+OUString sLinkChainName;
+if (rPropertySetInfo->hasPropertyByName("LinkDisplayName"))
+{
+rPropertySet->getPropertyValue("LinkDisplayName") >>= sLinkChainName;
+if (!sLinkChainName.isEmpty())
+return sLinkChainName;
+}
+if (rPropertySetInfo->hasPropertyByName("ChainName"))
+rPropertySet->getPropertyValue("ChainName") >>= sLinkChainName;
+return sLinkChainName;
+}
+
 MSWordAttrIter::MSWordAttrIter( MSWordExportBase& rExport )
 : pOld( rExport.m_pChpIter ), m_rExport( rExport )
 {
@@ -637,7 +653,6 @@ bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos) const
 FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 {
 // collection point to first gather info about all of the potentially 
linked textboxes: to be analyzed later.
-OUString sLinkChainName;
 ww8::FrameIter linkedTextboxesIter = maFlyIter;
 while ( linkedTextboxesIter != maFlyFrames.end() )
 {
@@ -654,10 +669,7 @@ FlyProcessingState SwWW8AttrIter::OutFlys(sal_Int32 nSwPos)
 {
 MSWordExportBase::LinkedTextboxInfo aLinkedTextboxInfo;
 
-if( xPropertySetInfo->hasPropertyByName("LinkDisplayName") )
-xPropertySet->getPropertyValue("LinkDisplayName") >>= 
sLinkChainName;
-else if( xPropertySetInfo->hasPropertyByName("ChainName") )
-xPropertySet->getPropertyValue("ChainName") >>= sLinkChainName;
+const OUString sLinkChainName = lcl_getLinkChainName(xPropertySet, 
xPropertySetInfo);
 
 if( xPropertySetInfo->hasPropertyByName("ChainNextName") )
 xPropertySet->getPropertyValue("ChainNextName") >>= 
aLinkedTextboxInfo.sNextChain;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - include/oox oox/qa oox/source sw/inc sw/qa sw/source

2020-12-10 Thread Regényi Balázs (via logerrit)
 include/oox/export/drawingml.hxx|4 
 include/oox/vml/vmlshape.hxx|   10 ++
 oox/qa/unit/vml.cxx |   19 ---
 oox/source/export/drawingml.cxx |   34 
++
 oox/source/export/vmlexport.cxx |   50 
--
 oox/source/vml/vmlshape.cxx |   32 
++
 oox/source/vml/vmlshapecontext.cxx  |   20 ++--
 sw/inc/textboxhelper.hxx|7 +
 sw/qa/extras/ooxmlexport/data/tdf41466_testVmlShapeWithTextbox.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx   |   24 
 sw/source/core/doc/textboxhelper.cxx|   23 
 sw/source/core/unocore/unodraw.cxx  |9 +
 sw/source/filter/ww8/docxattributeoutput.cxx|6 +
 sw/source/filter/ww8/docxattributeoutput.hxx|2 
 14 files changed, 207 insertions(+), 33 deletions(-)

New commits:
commit aefb6aaf6475b71668bab7e11ce51b0fdc34f299
Author: Regényi Balázs 
AuthorDate: Tue Dec 1 12:16:12 2020 +0100
Commit: László Németh 
CommitDate: Thu Dec 10 12:03:39 2020 +0100

tdf#41466 DOCX import: fix VML v:shape/v:textbox

VML v:shape/v:textbox element was imported only as
a text frame, losing (otherwise recognized) preset
shape geometry, i.e. replacing a callout bubble
(wedgeRectCallout) and other special shapes with a
plain rectangle.

Thanks to Attila Bakos for the initial help.

Change-Id: I03a608822ed54a20ed07406a08c3539e72958f5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105299
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit bda05ba1736b74727872579b65b3fa14e3d8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107486

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index a4ef6af0530f..0a42eb84f001 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -70,6 +70,7 @@ namespace style {
 namespace text {
 class XTextContent;
 class XTextRange;
+class XTextFrame;
 }
 namespace io {
 class XOutputStream;
@@ -125,6 +126,9 @@ public:
 virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
 /// Store the RelId of a graphic based on its checksum.
 virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId) 
= 0;
+///  Get textbox which belongs to the shape.
+virtual css::uno::Reference GetUnoTextFrame(
+css::uno::Reference xShape) = 0;
 protected:
 DMLTextExport() {}
 virtual ~DMLTextExport() {}
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 7703b311c757..0e50e5b6ee1f 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -216,6 +216,7 @@ struct ShapeModel
 OUString maSignatureLineSigningInstructions;
 bool mbSignatureLineShowSignDate;
 bool mbSignatureLineCanAddComment;
+bool mbInGroup;
 
 explicitShapeModel();
 ~ShapeModel();
@@ -275,6 +276,13 @@ protected:
 const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
 const css::awt::Rectangle& rShapeRect ) const = 0;
 
+/** Always called after implConvertAndInsert for the same task.*/
+virtual css::uno::Reference 
finalImplConvertAndInsert(
+const css::uno::Reference& rxShape) const
+{
+return rxShape;
+};
+
 /** Calculates the final shape rectangle according to the passed anchor,
 if present, otherwise according to the own anchor settings. */
 css::awt::Rectangle calcShapeRectangle(
@@ -304,6 +312,8 @@ protected:
 implConvertAndInsert(
 const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
 const css::awt::Rectangle& rShapeRect ) const 
override;
+virtual css::uno::Reference 
finalImplConvertAndInsert(
+const css::uno::Reference& rxShape) const 
override;
 /** Used by both RectangleShape and ComplexShape. */
 css::uno::ReferencecreateEmbeddedPictureObject(
 const css::uno::Reference< css::drawing::XShapes >& rxShapes,
diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index d43d2d5645ae..ec64a08c3fcf 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -55,25 +55,6 @@ void OoxVmlTest::load(const OUString& rFileName)
 mxComponent = loadFromDesktop(aURL);
 }
 
-CPPUNIT_TEST_FIXTURE(OoxVmlTest, testLayoutFlowAltAlone)
-{
-// mso-layout-flow-alt:bottom-to-top without a matching 
layout-flow:vertical.
-load("layout-flow-alt-alone.docx");
-
-uno::Refere

[Libreoffice-commits] core.git: include/oox oox/qa oox/source sw/inc sw/qa sw/source

2020-12-10 Thread Regényi Balázs (via logerrit)
 include/oox/export/drawingml.hxx|4 
 include/oox/vml/vmlshape.hxx|   10 ++
 oox/qa/unit/vml.cxx |   19 ---
 oox/source/export/drawingml.cxx |   34 
++
 oox/source/export/vmlexport.cxx |   50 
--
 oox/source/vml/vmlshape.cxx |   32 
++
 oox/source/vml/vmlshapecontext.cxx  |   20 ++--
 sw/inc/textboxhelper.hxx|7 +
 sw/qa/extras/ooxmlexport/data/tdf41466_testVmlShapeWithTextbox.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx   |   24 
 sw/source/core/doc/textboxhelper.cxx|   23 
 sw/source/core/unocore/unodraw.cxx  |9 +
 sw/source/filter/ww8/docxattributeoutput.cxx|6 +
 sw/source/filter/ww8/docxattributeoutput.hxx|2 
 14 files changed, 207 insertions(+), 33 deletions(-)

New commits:
commit bda05ba1736b74727872579b65b3fa14e3d8
Author: Regényi Balázs 
AuthorDate: Tue Dec 1 12:16:12 2020 +0100
Commit: László Németh 
CommitDate: Thu Dec 10 10:27:33 2020 +0100

tdf#41466 DOCX import: fix VML v:shape/v:textbox

VML v:shape/v:textbox element was imported only as
a text frame, losing (otherwise recognized) preset
shape geometry, i.e. replacing a callout bubble
(wedgeRectCallout) and other special shapes with a
plain rectangle.

Thanks to Attila Bakos for the initial help.

Change-Id: I03a608822ed54a20ed07406a08c3539e72958f5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105299
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 31eeb727760f..9f87e54c1361 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -70,6 +70,7 @@ namespace style {
 namespace text {
 class XTextContent;
 class XTextRange;
+class XTextFrame;
 }
 namespace io {
 class XOutputStream;
@@ -125,6 +126,9 @@ public:
 virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
 /// Store the RelId of a graphic based on its checksum.
 virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId) 
= 0;
+///  Get textbox which belongs to the shape.
+virtual css::uno::Reference GetUnoTextFrame(
+css::uno::Reference xShape) = 0;
 protected:
 DMLTextExport() {}
 virtual ~DMLTextExport() {}
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 7703b311c757..0e50e5b6ee1f 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -216,6 +216,7 @@ struct ShapeModel
 OUString maSignatureLineSigningInstructions;
 bool mbSignatureLineShowSignDate;
 bool mbSignatureLineCanAddComment;
+bool mbInGroup;
 
 explicitShapeModel();
 ~ShapeModel();
@@ -275,6 +276,13 @@ protected:
 const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
 const css::awt::Rectangle& rShapeRect ) const = 0;
 
+/** Always called after implConvertAndInsert for the same task.*/
+virtual css::uno::Reference 
finalImplConvertAndInsert(
+const css::uno::Reference& rxShape) const
+{
+return rxShape;
+};
+
 /** Calculates the final shape rectangle according to the passed anchor,
 if present, otherwise according to the own anchor settings. */
 css::awt::Rectangle calcShapeRectangle(
@@ -304,6 +312,8 @@ protected:
 implConvertAndInsert(
 const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
 const css::awt::Rectangle& rShapeRect ) const 
override;
+virtual css::uno::Reference 
finalImplConvertAndInsert(
+const css::uno::Reference& rxShape) const 
override;
 /** Used by both RectangleShape and ComplexShape. */
 css::uno::ReferencecreateEmbeddedPictureObject(
 const css::uno::Reference< css::drawing::XShapes >& rxShapes,
diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index d43d2d5645ae..ec64a08c3fcf 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -55,25 +55,6 @@ void OoxVmlTest::load(const OUString& rFileName)
 mxComponent = loadFromDesktop(aURL);
 }
 
-CPPUNIT_TEST_FIXTURE(OoxVmlTest, testLayoutFlowAltAlone)
-{
-// mso-layout-flow-alt:bottom-to-top without a matching 
layout-flow:vertical.
-load("layout-flow-alt-alone.docx");
-
-uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
-uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0)

[Libreoffice-commits] core.git: oox/source sw/qa

2020-10-29 Thread Regényi Balázs (via logerrit)
 oox/source/vml/vmlshape.cxx  |   34 
++
 sw/qa/extras/ooxmlexport/data/tdf137765_testVmlLineShapeRotated.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   16 

 3 files changed, 37 insertions(+), 13 deletions(-)

New commits:
commit 7774d01891df6787058677dee4bc449cd5841c59
Author: Regényi Balázs 
AuthorDate: Mon Oct 26 11:52:29 2020 +0100
Commit: László Németh 
CommitDate: Thu Oct 29 15:18:22 2020 +0100

tdf#137765 DOCX VML shape import: fix rotation handling

Change-Id: I78c89d4f795a67ff44ae9cef9daf44bf9f1d5c8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104807
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 43b54a658db6..a83cb6b2c76c 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -679,7 +679,8 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 awt::Rectangle aShapeRect(rShapeRect);
 std::optional oRotation;
 bool bFlipX = false, bFlipY = false;
-if (!maTypeModel.maRotation.isEmpty())
+// tdf#137765: skip this rotation for line shapes
+if (!maTypeModel.maRotation.isEmpty() && maService != 
"com.sun.star.drawing.LineShape")
 oRotation = ConversionHelper::decodeRotation(maTypeModel.maRotation);
 if (!maTypeModel.maFlip.isEmpty())
 {
@@ -1035,6 +1036,22 @@ namespace
 }
 }
 }
+
+void handleRotation(const ShapeTypeModel& rTypeModel, Reference& 
rxShape)
+{
+if (!rTypeModel.maRotation.isEmpty())
+{
+if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape))
+{
+// -1 is required because the direction of MSO rotation is the 
opposite of ours
+// 100 is required because in this part of the code the angle 
is in a hundredth of
+// degrees.
+auto nAngle = -1 * 100.0 * rTypeModel.maRotation.toDouble();
+double nHRad = nAngle * F_PI18000;
+pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, 
sin(nHRad), cos(nHRad));
+}
+}
+}
 }
 
 LineShape::LineShape(Drawing& rDrawing)
@@ -1045,6 +1062,8 @@ LineShape::LineShape(Drawing& rDrawing)
 Reference LineShape::implConvertAndInsert(const Reference& 
rxShapes, const awt::Rectangle& rShapeRect) const
 {
 Reference xShape = SimpleShape::implConvertAndInsert(rxShapes, 
rShapeRect);
+// tdf#137765
+handleRotation(maTypeModel, xShape);
 // tdf#97517 tdf#137678
 // The MirroredX and MirroredY properties (in the CustomShapeGeometry 
property) are not
 // supported for the LineShape by UNO, so we have to make the mirroring 
here.
@@ -1174,18 +1193,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 
 // tdf#105875 handle rotation
 // Note: must rotate before flip!
-if (!maTypeModel.maRotation.isEmpty())
-{
-if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
-{
-// -1 is required because the direction of MSO rotation is the 
opposite of ours
-// 100 is required because in this part of the code the angle is 
in a hundredth of
-// degrees.
-auto nAngle = -1 * 100.0 * maTypeModel.maRotation.toDouble();
-double nHRad = nAngle * F_PI18000;
-pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, 
sin(nHRad), cos(nHRad));
-}
-}
+handleRotation(maTypeModel, xShape);
 
 // Handle horizontal and vertical flip.
 handleMirroring(maTypeModel, xShape);
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf137765_testVmlLineShapeRotated.docx 
b/sw/qa/extras/ooxmlexport/data/tdf137765_testVmlLineShapeRotated.docx
new file mode 100644
index ..d411d7cda6fe
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf137765_testVmlLineShapeRotated.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index d38b5cfcd605..d7d76898c86a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1313,6 +1313,22 @@ DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredY, 
"tdf137678_testVmlLineShapeM
 CPPUNIT_ASSERT(sStyle.indexOf("flip:y") > 0);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testVmlLineShapeRotated, 
"tdf137765_testVmlLineShapeRotated.docx")
+{
+// tdf#137765 The "rotation" (in style attribute) was not handled 
correctly for VML line shapes.
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+// it was 1.55pt,279.5pt
+assertXPath(pXmlDoc,
+
"/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
+"from",
+"-9pt,296.75pt");
+// it was 25.5pt,317.8pt
+assertXPath(pXmlDoc,
+
"/w:

[Libreoffice-commits] core.git: oox/source sw/qa

2020-10-27 Thread Regényi Balázs (via logerrit)
 oox/source/vml/vmlshape.cxx|   53 
+-
 sw/qa/extras/ooxmlexport/data/tdf137678_testVmlLineShapeMirroredY.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |   12 
++
 3 files changed, 39 insertions(+), 26 deletions(-)

New commits:
commit ca83804ffcd0d6f81fa7c32be990c4ceeb4a60b7
Author: Regényi Balázs 
AuthorDate: Thu Oct 22 16:12:11 2020 +0200
Commit: László Németh 
CommitDate: Tue Oct 27 14:05:55 2020 +0100

tdf#137678 DOCX VML shape import: fix missing horizontal mirroring

The MirroredY property is set (in the CustomShapeGeometry property), but
it is not supported for the LineShape by UNO, so we have to make the
mirroring during importing.

Change-Id: Iaa7e3a352598ad12c5e0d40b4fcd43fd197c4df9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104662
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 54f1fcec5ae6..43b54a658db6 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1013,6 +1013,28 @@ namespace
 aPoint2.setY(aPoint2.getY() + 1);
 pShape->NbcMirror(aCenter, aPoint2);
 }
+
+void doMirrorY(SdrObject* pShape)
+{
+Point aCenter(pShape->GetSnapRect().Center());
+Point aPoint2(aCenter);
+aPoint2.setX(aPoint2.getX() + 1);
+pShape->NbcMirror(aCenter, aPoint2);
+}
+
+void handleMirroring(const ShapeTypeModel& rTypeModel, Reference& 
rxShape)
+{
+if (!rTypeModel.maFlip.isEmpty())
+{
+if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape))
+{
+if (rTypeModel.maFlip.startsWith("x"))
+doMirrorX(pShape);
+if (rTypeModel.maFlip.endsWith("y"))
+doMirrorY(pShape);
+}
+}
+}
 }
 
 LineShape::LineShape(Drawing& rDrawing)
@@ -1023,17 +1045,10 @@ LineShape::LineShape(Drawing& rDrawing)
 Reference LineShape::implConvertAndInsert(const Reference& 
rxShapes, const awt::Rectangle& rShapeRect) const
 {
 Reference xShape = SimpleShape::implConvertAndInsert(rxShapes, 
rShapeRect);
-// Handle vertical flip.
-// tdf#97517 The MirroredX property (in the CustomShapeGeometry property) 
is not supported for
-// the LineShape by UNO, so we have to make the mirroring here
-if (!maTypeModel.maFlip.isEmpty())
-{
-if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
-{
-if (maTypeModel.maFlip.startsWith("x"))
-doMirrorX(pShape);
-}
-}
+// tdf#97517 tdf#137678
+// The MirroredX and MirroredY properties (in the CustomShapeGeometry 
property) are not
+// supported for the LineShape by UNO, so we have to make the mirroring 
here.
+handleMirroring(maTypeModel, xShape);
 return xShape;
 }
 
@@ -1173,21 +1188,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 }
 
 // Handle horizontal and vertical flip.
-if (!maTypeModel.maFlip.isEmpty())
-{
-if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
-{
-if (maTypeModel.maFlip.startsWith("x"))
-doMirrorX(pShape);
-if (maTypeModel.maFlip.endsWith("y"))
-{
-Point aCenter(pShape->GetSnapRect().Center());
-Point aPoint2(aCenter);
-aPoint2.setX(aPoint2.getX() + 1);
-pShape->NbcMirror(aCenter, aPoint2);
-}
-}
-}
+handleMirroring(maTypeModel, xShape);
 
 return xShape;
 }
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf137678_testVmlLineShapeMirroredY.docx 
b/sw/qa/extras/ooxmlexport/data/tdf137678_testVmlLineShapeMirroredY.docx
new file mode 100644
index ..1559358b562b
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf137678_testVmlLineShapeMirroredY.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 8fa7391abcc7..ba955f016cce 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1299,6 +1299,18 @@ DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX, 
"tdf97517_testVmlLineShapeMi
 CPPUNIT_ASSERT(sStyle.indexOf("flip:x") > 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredY, 
"tdf137678_testVmlLineShapeMirroredY.docx")
+{
+// tdf#137678 The "flip:y" was not handled for VML line shapes.
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+OUString sStyle = getXPath(pXmlDoc,
+
"/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:line",
+"style");
+CPPUNIT_ASSERT(sStyle.indexOf("flip:y") > 0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 e

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2020-10-26 Thread Regényi Balázs (via logerrit)
 include/oox/vml/vmlshape.hxx  |5 +
 oox/source/vml/vmlshape.cxx   |   35 
--
 sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   15 

 4 files changed, 49 insertions(+), 6 deletions(-)

New commits:
commit ed943c6afeb33b9fee0ef530df7db592aa152a73
Author: Regényi Balázs 
AuthorDate: Thu Oct 22 13:36:25 2020 +0200
Commit: László Németh 
CommitDate: Mon Oct 26 18:22:18 2020 +0100

tdf#97517 DOCX VML shape import: fix missing vertical mirroring

The MirroredX property is set (in the CustomShapeGeometry property), but
it is not supported for the LineShape by UNO, so we have to make the
mirroring during importing.

Change-Id: I65a1f9a115a003c056ae31f4bc217206a0e6dcd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104656
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 119f711a4538..7703b311c757 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -360,6 +360,11 @@ class LineShape final : public SimpleShape
 {
 public:
 explicitLineShape( Drawing& rDrawing );
+virtual css::uno::Reference< css::drawing::XShape >
+implConvertAndInsert(
+const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
+const css::awt::Rectangle& rShapeRect ) const 
override;
+
 
 private:
 /** Returns the absolute shape rectangle. */
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d70a9563e106..54f1fcec5ae6 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1004,11 +1004,39 @@ Reference< XShape > 
PolyLineShape::implConvertAndInsert( const Reference< XShape
 return xShape;
 }
 
+namespace
+{
+void doMirrorX(SdrObject* pShape)
+{
+Point aCenter(pShape->GetSnapRect().Center());
+Point aPoint2(aCenter);
+aPoint2.setY(aPoint2.getY() + 1);
+pShape->NbcMirror(aCenter, aPoint2);
+}
+}
+
 LineShape::LineShape(Drawing& rDrawing)
 : SimpleShape(rDrawing, "com.sun.star.drawing.LineShape")
 {
 }
 
+Reference LineShape::implConvertAndInsert(const Reference& 
rxShapes, const awt::Rectangle& rShapeRect) const
+{
+Reference xShape = SimpleShape::implConvertAndInsert(rxShapes, 
rShapeRect);
+// Handle vertical flip.
+// tdf#97517 The MirroredX property (in the CustomShapeGeometry property) 
is not supported for
+// the LineShape by UNO, so we have to make the mirroring here
+if (!maTypeModel.maFlip.isEmpty())
+{
+if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
+{
+if (maTypeModel.maFlip.startsWith("x"))
+doMirrorX(pShape);
+}
+}
+return xShape;
+}
+
 awt::Rectangle LineShape::getAbsRectangle() const
 {
 const GraphicHelper& rGraphicHelper = 
mrDrawing.getFilter().getGraphicHelper();
@@ -1150,12 +1178,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
 {
 if (maTypeModel.maFlip.startsWith("x"))
-{
-Point aCenter(pShape->GetSnapRect().Center());
-Point aPoint2(aCenter);
-aPoint2.setY(aPoint2.getY() + 1);
-pShape->NbcMirror(aCenter, aPoint2);
-}
+doMirrorX(pShape);
 if (maTypeModel.maFlip.endsWith("y"))
 {
 Point aCenter(pShape->GetSnapRect().Center());
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx 
b/sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx
new file mode 100644
index ..75e9d8573bb3
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf97517_testVmlLineShapeMirroredX.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 3ac228db6cca..8fa7391abcc7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -40,6 +41,8 @@
 #include 
 #include 
 
+using namespace com::sun::star;
+
 char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
 
 class Test : public SwModelTestBase
@@ -1284,6 +1287,18 @@ DECLARE_OOXMLEXPORT_TEST(testVmlShapeTextWordWrap, 
"tdf97618_testVmlShapeTextWor
 assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "width", "2500");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testVmlLineShapeMirroredX, 
"tdf97517_testVmlLineShapeMirroredX.docx")
+{
+// tdf#97517 The "flip:x" was not handled for VML line shapes.
+xmlDocUniquePtr pXmlDoc =

[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' - sw/qa sw/source

2020-10-14 Thread Regényi Balázs (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt |   42 
++
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx  |   12 ++
 sw/source/filter/ww8/docxsdrexport.cxx  |6 -
 3 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit 91332b9fe9aed0320617d9edbb48a1a14f8d
Author: Regényi Balázs 
AuthorDate: Wed Aug 26 17:38:21 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Oct 14 17:59:54 2020 +0200

tdf#135047 DOCX export: fix spacing around objects

defined by frame style instead of direct formatting.

Co-authored-by: Szabolcs Tóth

Change-Id: I376c6ff09d15fe8e2db699b4cfc157ce08016cfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101416
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit fe72feef80a4336be9a57a8137839de1d52b2601)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104295
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt
new file mode 100644
index ..47dac15a5bba
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt
@@ -0,0 +1,42 @@
+
+http://openoffice.org/2010/draw"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+  
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+
+  
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgK
+   CgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/wAALCAACAAIBAREA/8QAFAAB
+   CP/EAB4QAAAEBwACBAUGFiU0Q1Nh/9oACAEB
+   AAA/AD/CzM0Sw0UpHYJ8BdZeD//Z
+  
+ 
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Vestibulum consequat mi quis pretium semper. Proin luctus orci ac neque 
venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus 
egestas. Donec blandit auctor arcu, nec pellentesque eros molestie eget. In 
consectetur aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non 
pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper 
vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est 
orci.
+   Integer sodales tincidunt tristique. Sed 
a metus posuere, adipiscing nunc et, viverra odio. Donec auctor molestie sem, 
sit amet tristique lectus hendrerit sed. Cras sodales nisl sed orci mattis 
iaculis. Nunc eget dolor accumsan, pharetra risus a, vestibulum mauris. Nunc 
vulputate lobortis mollis. Vivamus nec tellus faucibus, tempor magna nec, 
facilisis felis. Donec commodo enim a vehicula pellentesque. Nullam vehicula 
vestibulum est vel ultricies.
+   Aliquam velit massa, laoreet vel leo 
nec, volutpat facilisis eros. Donec consequat arcu ut diam tempor luctus. Cum 
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus 
mus. Praesent vitae lacus vel leo sodales pharetra a a nibh. Vestibulum ante 
ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam 
luctus tempus nibh, fringilla dictum augue consectetur eget. Curabitur at ante 
sit amet tortor pharetra molestie eu nec ante. Mauris tincidunt, nibh eu 
sollicitudin molestie, dolor sapien congue tortor, a pulvinar sapien turpis sed 
ante. Donec nec est elementum, euismod nulla in, mollis nunc.
+   
+  
+ 
+
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 6831c1ae634f..de2c3bb84568 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -491,6 +491,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134649_pageBreak, 
"tdf134649_pageBreak.fodt")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testImageSpaceSettings, 
"tdf135047_ImageSpaceSettings.fodt")
+{
+// tdf#135047 The spaces of image were not saved.
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distT", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distB", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distL", "90170");
+assertXPath(pXmlDoc, 
"/w:document

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

2020-10-14 Thread Regényi Balázs (via logerrit)
 sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx  |   19 
++
 sc/source/filter/oox/drawingfragment.cxx|8 ++--
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 19bbd01b671877812928ba013d4828c213d2f68e
Author: Regényi Balázs 
AuthorDate: Wed Aug 19 15:32:54 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Wed Oct 14 12:27:22 2020 +0200

tdf#135918 XLSX DrawingML shape import: fix needless displacement

Shape was displaced on rotation if it is placed next to the sheets
upper/left edges.

Co-authored-by: Szabolcs Tóth

Change-Id: I987e7b0d863b89cfb5d8154e2f0a017e21248ee1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101001
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 3e85b22769a4b02744a7006d7dc772973c0093f5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104292
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx 
b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx
new file mode 100644
index ..a5fcd1ce2fbd
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 99840eceaaae..149dbeb2b808 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -253,6 +253,7 @@ public:
 void testXLSDefColWidth();
 void testPreviewMissingObjLink();
 void testShapeRotationImport();
+void testShapeDisplacementOnRotationImport();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -396,6 +397,7 @@ public:
 CPPUNIT_TEST(testXLSDefColWidth);
 CPPUNIT_TEST(testPreviewMissingObjLink);
 CPPUNIT_TEST(testShapeRotationImport);
+CPPUNIT_TEST(testShapeDisplacementOnRotationImport);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4393,6 +4395,23 @@ void ScFiltersTest::testShapeRotationImport()
 }
 }
 
+void ScFiltersTest::testShapeDisplacementOnRotationImport()
+{
+// tdf#135918 shape is displaced on rotation if it is placed next to the 
sheets upper/left edges
+ScDocShellRef xDocSh = loadDoc("testShapeDisplacementOnRotationImport.", 
FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load 
testShapeDisplacementOnRotationImport.xlsx", xDocSh.is());
+
+uno::Reference xDoc(xDocSh->GetModel(), 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+uno::Reference xShape(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+uno::Reference xShapeProperties(xShape, 
uno::UNO_QUERY_THROW);
+uno::Any aRectProp = xShapeProperties->getPropertyValue("FrameRect");
+awt::Rectangle aRectangle = aRectProp.get();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRectangle.X);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRectangle.Y);
+}
+
 ScFiltersTest::ScFiltersTest()
   : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/filter/oox/drawingfragment.cxx 
b/sc/source/filter/oox/drawingfragment.cxx
index 716c46d1f974..3ec32dcd0e42 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -294,9 +294,11 @@ void DrawingFragment::onEndElement()
 }
 
 // TODO: DrawingML implementation expects 32-bit 
coordinates for EMU rectangles (change that to EmuRectangle)
+// tdf#135918: Negative X,Y position has to be allowed to 
avoid shape displacement on rotation.
+// The negative values can exist because of previous lines 
where the anchor rectangle must be mirrored in some ranges.
 Rectangle aShapeRectEmu32(
-getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.X, 0, SAL_MAX_INT32 ),
-getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Y, 0, SAL_MAX_INT32 ),
+getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.X, SAL_MIN_INT32, SAL_MAX_INT32 ),
+getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Y, SAL_MIN_INT32, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Width, 0, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) );
 
@@ -313,7 +315,7 @@ void DrawingFragment::onEndElement()
 /*  Collect all shape positions in the WorksheetHelper base
 class. But first, scale EMUs to 1/100 mm. */
 Rectangle aShapeRectHmm(
-convertEmuToHmm(aShapeRectEmu32.X ), 
convertEmuToHmm(aShapeRectEmu32.Y ),
+   

[Libreoffice-commits] core.git: include/oox oox/source sw/qa

2020-10-13 Thread Regényi Balázs (via logerrit)
 include/oox/export/drawingml.hxx |4 
 oox/source/export/drawingml.cxx  |   47 
+-
 oox/source/export/shapes.cxx |4 
 sw/qa/extras/ooxmlexport/data/tdf101122_noFillForCustomShape.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   16 +++
 5 files changed, 67 insertions(+), 4 deletions(-)

New commits:
commit 9310e47e2ce71348a16e5412131946348833f4b2
Author: Regényi Balázs 
AuthorDate: Mon Oct 12 09:58:35 2020 +0200
Commit: László Németh 
CommitDate: Tue Oct 13 15:19:57 2020 +0200

tdf#101122 DOCX custom shape export: remove bad fill

of (simplified export) of not filled custom shapes by
adding missing fill="none" to a:path.

Note: in OpenDocument, unfilled shape path is defined
by draw:enhanced-path command "F", see section 19.145
in ODF v1.2.

Co-authored-by: Szabolcs Tóth

Change-Id: I0be2aada3deb06828216e0441c91c389a673f87c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104205
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 11bf303e92ff..a4ef6af0530f 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -171,6 +171,7 @@ protected:
 
 void WriteGlowEffect(const css::uno::Reference& 
rXPropSet);
 void WriteSoftEdgeEffect(const 
css::uno::Reference& rXPropSet);
+bool HasEnhancedCustomShapeSegmentCommand(const 
css::uno::Reference& rXShape, const sal_Int16 nCommand);
 
 public:
 DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFB, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = 
nullptr )
@@ -275,7 +276,8 @@ public:
 static sal_Int32 GetCustomGeometryPointValue(
 const css::drawing::EnhancedCustomShapeParameter& rParam,
 const SdrObjCustomShape& rSdrObjCustomShape);
-void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, const bool 
bClosed );
+void WritePolyPolygon(const css::uno::Reference& 
rXShape,
+  const tools::PolyPolygon& rPolyPolygon, const bool 
bClosed);
 void WriteFill( const css::uno::Reference< css::beans::XPropertySet >& 
xPropSet );
 void WriteShapeStyle( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteShapeEffects( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c19b030ad642..8b7c4add1f78 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3582,7 +3582,8 @@ sal_Int32 DrawingML::GetCustomGeometryPointValue(
 return nValue;
 }
 
-void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon, 
const bool bClosed )
+void DrawingML::WritePolyPolygon(const 
css::uno::Reference& rXShape,
+ const tools::PolyPolygon& rPolyPolygon, const 
bool bClosed)
 {
 // In case of Writer, the parent element is , and there the
 //  element is not optional.
@@ -3599,9 +3600,15 @@ void DrawingML::WritePolyPolygon( const 
tools::PolyPolygon& rPolyPolygon, const
 
 const tools::Rectangle aRect( rPolyPolygon.GetBoundRect() );
 
+// tdf#101122
+std::optional sFill;
+if (HasEnhancedCustomShapeSegmentCommand(rXShape, 
css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL))
+sFill = "none"; // for possible values see ST_PathFillMode in OOXML 
standard
+
 // Put all polygons of rPolyPolygon in the same path element
 // to subtract the overlapped areas.
 mpFS->startElementNS( XML_a, XML_path,
+XML_fill, sFill,
 XML_w, OString::number(aRect.GetWidth()),
 XML_h, OString::number(aRect.GetHeight()) );
 
@@ -4191,6 +4198,44 @@ void DrawingML::WriteSoftEdgeEffect(const 
css::uno::Reference& rXShape, const sal_Int16 
nCommand)
+{
+try
+{
+uno::Reference xPropSet(rXShape, 
uno::UNO_QUERY_THROW);
+if (!GetProperty(xPropSet, "CustomShapeGeometry"))
+return false;
+Sequence aCustomShapeGeometryProps;
+mAny >>= aCustomShapeGeometryProps;
+for (const beans::PropertyValue& rGeomProp : 
std::as_const(aCustomShapeGeometryProps))
+{
+if (rGeomProp.Name == "Path")
+{
+uno::Sequence aPathProps;
+rGeomProp.Value >>= aPathProps;
+for (const beans::PropertyValue& rPathProp : 
std::as_const(aPathProps))
+{
+if (rPathProp.Name == "Segments")
+{
+uno::Sequence 
aSegments;
+rPathProp.Value >>= aSegments;
+for (const auto& rSegment : std::as_const(aSegments))
+{
+ 

[Libreoffice-commits] core.git: oox/source sw/qa

2020-10-09 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 7b2f0094f86266c64972d3e505a28b2d4e5caef6
Author: Regényi Balázs 
AuthorDate: Tue Oct 6 15:52:18 2020 +0200
Commit: László Németh 
CommitDate: Fri Oct 9 10:31:20 2020 +0200

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 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 215d56595ebc..00a44d3fccfa 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1309,19 +1309,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, GetShapeName(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 );
+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, GetShapeName(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);
@@ -1336,7 +1346,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 200d34033ede..ec359b119b58 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1152,6 +1152,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 'libreoffice-7-0' - oox/source sw/qa

2020-10-07 Thread Regényi Balázs (via logerrit)
 oox/source/vml/vmlshape.cxx   |   26 
---
 sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|   34 
++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |4 -
 4 files changed, 51 insertions(+), 13 deletions(-)

New commits:
commit 767ec919f09e5ed69149ed27bd46a6bb67556863
Author: Regényi Balázs 
AuthorDate: Wed Sep 30 15:19:36 2020 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 7 10:14:26 2020 +0200

tdf#105875 DOCX VML shape import: fix missing rotation

Also to avoid bad resizing of the rotated
shape, remove obsolete(?) code part from
commit 0423a6741fc08a35b123556f9b10219d090ee42a
(Import bezier curves from .docx.).

Co-authored-by: Szabolcs Toth

Change-Id: I77266ba65e558cf9e6dd0e1c37fad85abd038819
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103693
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 3b6de95a0d59cf5942af5ecf4a402c224b76f8a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103976
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d52e8e97fe1d..a7a0c46d6204 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1108,6 +1108,21 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
 }
 
+// tdf#105875 handle rotation
+// Note: must rotate before flip!
+if (!maTypeModel.maRotation.isEmpty())
+{
+if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
+{
+// -1 is required because the direction of MSO rotation is the 
opposite of ours
+// 100 is required because in this part of the code the angle is 
in a hundredth of
+// degrees.
+auto nAngle = -1 * 100.0 * maTypeModel.maRotation.toDouble();
+double nHRad = nAngle * F_PI18000;
+pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, 
sin(nHRad), cos(nHRad));
+}
+}
+
 // Handle horizontal and vertical flip.
 if (!maTypeModel.maFlip.isEmpty())
 {
@@ -1130,17 +1145,6 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 }
 }
 
-// Hacky way of ensuring the shape is correctly sized/positioned
-try
-{
-// E.g. SwXFrame::setPosition() unconditionally throws
-xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) );
-xShape->setPosition( awt::Point( rShapeRect.X, rShapeRect.Y ) );
-}
-catch (const ::css::uno::Exception&)
-{
-// TODO: try some other way to ensure size/position
-}
 return xShape;
 }
 
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx 
b/sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx
new file mode 100644
index ..e6512e075c21
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 8921cc0fdda9..f209ed442175 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1325,6 +1325,40 @@ DECLARE_OOXMLEXPORT_TEST(testTdf77236_MissingSolidFill, 
"tdf77236_MissingSolidFi
 assertXPath(pXmlDoc, 
"//mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf105875_VmlShapeRotationWithFlip, 
"tdf105875_VmlShapeRotationWithFlip.docx")
+{
+// tdf#105875: check whether the rotation of the VML bezier shape is ok 
(with flip too)
+// TODO: fix export too
+if (mbExported)
+return;
+
+{
+uno::Reference xPropertySet(getShape(1), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
xPropertySet->getPropertyValue("RotateAngle").get());
+}
+
+{
+uno::Reference xPropertySet(getShape(2), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(220 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+{
+uno::Reference xPropertySet(getShape(3), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(320 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+{
+uno::Reference xPropertySet(getShape(4), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(140 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+{
+uno::Reference xPropertySet(getShape(5), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(40 * 100), 
xPropertySet->getPropertyValue

[Libreoffice-commits] core.git: oox/source sw/qa

2020-10-06 Thread Regényi Balázs (via logerrit)
 oox/source/vml/vmlshape.cxx   |   26 
---
 sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|   34 
++
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |4 -
 4 files changed, 51 insertions(+), 13 deletions(-)

New commits:
commit 3b6de95a0d59cf5942af5ecf4a402c224b76f8a3
Author: Regényi Balázs 
AuthorDate: Wed Sep 30 15:19:36 2020 +0200
Commit: László Németh 
CommitDate: Tue Oct 6 11:22:17 2020 +0200

tdf#105875 DOCX VML shape import: fix missing rotation

Also to avoid bad resizing of the rotated
shape, remove obsolete(?) code part from
commit 0423a6741fc08a35b123556f9b10219d090ee42a
(Import bezier curves from .docx.).

Co-authored-by: Szabolcs Toth

Change-Id: I77266ba65e558cf9e6dd0e1c37fad85abd038819
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103693
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 6cd5aff9110d..d70a9563e106 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1129,6 +1129,21 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
 }
 
+// tdf#105875 handle rotation
+// Note: must rotate before flip!
+if (!maTypeModel.maRotation.isEmpty())
+{
+if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
+{
+// -1 is required because the direction of MSO rotation is the 
opposite of ours
+// 100 is required because in this part of the code the angle is 
in a hundredth of
+// degrees.
+auto nAngle = -1 * 100.0 * maTypeModel.maRotation.toDouble();
+double nHRad = nAngle * F_PI18000;
+pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, 
sin(nHRad), cos(nHRad));
+}
+}
+
 // Handle horizontal and vertical flip.
 if (!maTypeModel.maFlip.isEmpty())
 {
@@ -1151,17 +1166,6 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 }
 }
 
-// Hacky way of ensuring the shape is correctly sized/positioned
-try
-{
-// E.g. SwXFrame::setPosition() unconditionally throws
-xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) );
-xShape->setPosition( awt::Point( rShapeRect.X, rShapeRect.Y ) );
-}
-catch (const ::css::uno::Exception&)
-{
-// TODO: try some other way to ensure size/position
-}
 return xShape;
 }
 
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx 
b/sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx
new file mode 100644
index ..e6512e075c21
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf105875_VmlShapeRotationWithFlip.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 4f77681d2eaf..27a651d2dde7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1347,6 +1347,40 @@ DECLARE_OOXMLEXPORT_TEST(testTdf77236_MissingSolidFill, 
"tdf77236_MissingSolidFi
 assertXPath(pXmlDoc, 
"//mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf105875_VmlShapeRotationWithFlip, 
"tdf105875_VmlShapeRotationWithFlip.docx")
+{
+// tdf#105875: check whether the rotation of the VML bezier shape is ok 
(with flip too)
+// TODO: fix export too
+if (mbExported)
+return;
+
+{
+uno::Reference xPropertySet(getShape(1), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
xPropertySet->getPropertyValue("RotateAngle").get());
+}
+
+{
+uno::Reference xPropertySet(getShape(2), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(220 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+{
+uno::Reference xPropertySet(getShape(3), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(320 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+{
+uno::Reference xPropertySet(getShape(4), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(140 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+{
+uno::Reference xPropertySet(getShape(5), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_DOUBLES_EQUAL(sal_Int32(40 * 100), 
xPropertySet->getPropertyValue("RotateAngle").get(), 1);
+}
+
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extr

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

2020-09-29 Thread Regényi Balázs (via logerrit)
 oox/source/export/drawingml.cxx   |   28 +---
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |2 +-
 2 files changed, 2 insertions(+), 28 deletions(-)

New commits:
commit d67809efc6b372f5c8ddfa88551fcc89efe48cdc
Author: Regényi Balázs 
AuthorDate: Wed Sep 16 14:48:33 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 29 16:36:16 2020 +0200

tdf#124013 XLSX shape export: fix missing solidFill

of the inside of the shape (resulting for example,
invisible shapes).

See also commit 83c30743eaf44d8eded4a73e3ac2585b5bdbaffc
(tdf#77236 DOCX shape export: fix missing solidFill).

Co-authored-by: Szabolcs Toth

Change-Id: I4efde86f82e22e1aa49b89dc13557ef5f238ba83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102871
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103616
Tested-by: Jenkins

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8a45e22d3fc3..9e803aa6f38c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -438,36 +438,10 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 // the shape had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations, nAlpha );
 }
-else if ( aStyleProperties.hasElements() )
-{
-sal_uInt32 nThemeColor = 0;
-sal_Int32 nThemeAlpha = MAX_PERCENT;
-for( const auto& rStyleProp : std::as_const(aStyleProperties) )
-{
-if( rStyleProp.Name == "Color" )
-{
-rStyleProp.Value >>= nThemeColor;
-}
-else if(rStyleProp.Name == "Transformations" )
-{
-Sequence< PropertyValue > aStyleTransformations;
-rStyleProp.Value >>= aStyleTransformations;
-auto pProp = std::find_if(std::cbegin(aStyleTransformations), 
std::cend(aStyleTransformations),
-[](const PropertyValue& rProp) { return rProp.Name == 
"alpha"; });
-if (pProp != std::cend(aStyleTransformations))
-pProp->Value >>= nThemeAlpha;
-}
-}
-if ( nFillColor != nThemeColor || nAlpha != nThemeAlpha )
-// the shape contains a theme but it wasn't being used
-WriteSolidFill( ::Color(nFillColor & 0xff), nAlpha );
-
-// in case the shape used the style color and the user didn't change 
it,
-// we must not write a  tag.
-}
 else
 {
 // the shape had a custom color and the user didn't change it
+// tdf#124013
 WriteSolidFill( ::Color(nFillColor & 0xff), nAlpha );
 }
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index d52a867045bd..d3099505aa12 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -790,7 +790,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, 
"shape-theme-preservation.d
 // check shape style hasn't been overwritten
 assertXPath(pXmlDocument,
 
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill",
-0);
+1);
 assertXPath(pXmlDocument,
 
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
 1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-09-29 Thread Regényi Balázs (via logerrit)
 oox/source/export/drawingml.cxx  |8 
 sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx   |9 +
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx|2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit ecb06c0c5af4563d2feae5a927ab23542f63001b
Author: Regényi Balázs 
AuthorDate: Mon Sep 7 19:54:19 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Sep 29 16:35:36 2020 +0200

tdf#77236 DOCX shape export: fix missing solidFill

(resulting for example, invisible shapes).

Co-authored-by: Szabolcs Tóth

Change-Id: I328514022f4a594c374d5a97db39d1cf3a954e02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102195
Tested-by: László Németh 
Reviewed-by: László Németh 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103615
Tested-by: Jenkins

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 67c089b73cf5..8a45e22d3fc3 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -908,14 +908,6 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 // the line had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations );
 }
-else if( aStyleProperties.hasElements() )
-{
-if( nColor != nStyleColor )
-// the line style defines some color but it wasn't being used
-WriteSolidFill( nColor );
-// in case the shape used the style color and the user didn't 
change it,
-// we must not write a  tag.
-}
 else
 {
 WriteSolidFill( nColor, nColorAlpha );
diff --git a/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx 
b/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx
new file mode 100644
index ..2bb2c097838d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 13d6f679bbae..8921cc0fdda9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1316,6 +1316,15 @@ DECLARE_OOXMLEXPORT_TEST( testTdf107359, 
"tdf107359-char-pitch.docx" )
 CPPUNIT_ASSERT_EQUAL( sal_Int32(convertTwipToMm100(24 * 20)), nBaseWidth );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf77236_MissingSolidFill, 
"tdf77236_MissingSolidFill.docx")
+{
+// tdf#77236: solidFill of VML shape was not exported if the colors of 
line and style were the same
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"//mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 7702b935f3fe..d52a867045bd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -793,7 +793,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, 
"shape-theme-preservation.d
 0);
 assertXPath(pXmlDocument,
 
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
-0);
+1);
 
 // check direct theme assignments have been preserved
 assertXPath(pXmlDocument,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/inc oox/source sc/qa

2020-09-29 Thread Regényi Balázs (via logerrit)
 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 79737c8b0d84d4967c5f1c41b740a8a52db8b551
Author: Regényi Balázs 
AuthorDate: Tue Sep 22 17:12:59 2020 +0200
Commit: László Németh 
CommitDate: Tue Sep 29 12:26:25 2020 +0200

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 

diff --git a/oox/inc/drawingml/textbodyproperties.hxx 
b/oox/inc/drawingml/textbodyproperties.hxx
index 26e34ac6a5f7..8a51c2bb906e 100644
--- a/oox/inc/drawingml/textbodyproperties.hxx
+++ b/oox/inc/drawingml/textbodyproperties.hxx
@@ -46,6 +46,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 ddc5a96b8018..5af4d51cbfd4 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1429,6 +1429,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 d3add310097f..6a6d9e90ef63 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 8ea8035ea39a..0612fe56ed43 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2955,18 +2955,31 @@ void DrawingML::WriteText(const Reference& 
rXIface, bool bBodyPr, bo
 }
 
 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 == "vertOverflow")
+{
+OUString sValue;
+aProp.Value >>= sValue;
+  

[Libreoffice-commits] core.git: oox/source sw/qa

2020-09-29 Thread Regényi Balázs (via logerrit)
 oox/source/shape/WpsContext.cxx   |5 +
 sw/qa/extras/ooxmlexport/data/tdf80526_word_wrap.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx|   10 ++
 3 files changed, 15 insertions(+)

New commits:
commit 61291a63c0f9a57064300e7afc8222b4ae4e155a
Author: Regényi Balázs 
AuthorDate: Mon Sep 21 15:20:25 2020 +0200
Commit: László Németh 
CommitDate: Tue Sep 29 12:25:07 2020 +0200

tdf#80526 DOCX: import word-wrap textbox setting

See option "Word wrap text in shape" in Format->Text Box
and Shape->Text Attributes... of the selected textbox.

Co-authored-by: Szabolcs Toth

Change-Id: I7f2ca392089043c4bec20b943aa8c1975de72e5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103109
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 076fd1124307..cb47692d4c95 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -160,6 +160,11 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 xTextBoxPropertySet->setPropertyValue("CharColor", 
xCharColor);
 }
 }
+
+auto nWrappingType = rAttribs.getToken(XML_wrap, XML_square);
+xPropertySet->setPropertyValue("TextWordWrap",
+   uno::makeAny(nWrappingType == 
XML_square));
+
 return this;
 }
 break;
diff --git a/sw/qa/extras/ooxmlexport/data/tdf80526_word_wrap.docx 
b/sw/qa/extras/ooxmlexport/data/tdf80526_word_wrap.docx
new file mode 100644
index ..abf5ee5ed2c8
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf80526_word_wrap.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 682343c782af..f1934775b1c1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -1086,6 +1086,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131420, 
"tdf131420.docx")
 assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:pPr/w:pBdr[2]");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf80526_word_wrap, "tdf80526_word_wrap.docx")
+{
+// tdf#80526: check whether the "wrap" property has been set
+// TODO: fix export too
+if (mbExported)
+return;
+uno::Reference xShape = getShape(1);
+CPPUNIT_ASSERT_EQUAL(false, getProperty(xShape, "TextWordWrap"));
+}
+
 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: include/oox oox/source sw/qa

2020-09-23 Thread Regényi Balázs (via logerrit)
 include/oox/export/drawingml.hxx  |2 +
 oox/source/drawingml/shape.cxx|3 +
 oox/source/export/drawingml.cxx   |   57 +-
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |7 ++-
 4 files changed, 58 insertions(+), 11 deletions(-)

New commits:
commit ce405819f36496398e5ca389f12eafb3cfdc64ae
Author: Regényi Balázs 
AuthorDate: Tue Sep 15 11:38:18 2020 +0200
Commit: László Németh 
CommitDate: Wed Sep 23 12:06:16 2020 +0200

tdf#136566 XLSX export: fix lost scheme based line colors

by converting scheme color identifiers to colors temporarily.

Because we haven't exported theme XML yet, we could not import
shapes of these exported documents correctly, resulting missing
lines.

Co-authored-by: Szabolcs Toth

Change-Id: I4f3d19cb8a9a851fb07a97f798195011e420d441
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102722
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2760d2fe64a0..11bf303e92ff 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -188,6 +188,7 @@ public:
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
+void WriteColor( const ::Color nColor, const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
@@ -195,6 +196,7 @@ public:
 
 void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteSolidFill( const OUString& sSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
+void WriteSolidFill( const ::Color nColor, const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet );
 void WriteGradientFill( const css::uno::Reference< 
css::beans::XPropertySet >& rXPropSet );
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 90d9e5379dde..02b89312d200 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1279,6 +1279,9 @@ Reference< XShape > const & Shape::createAndInsert(
 if( !aLineProperties.maLineFill.maFillColor.isPlaceHolder() && 
!sLnColorFillScheme.isEmpty() )
 {
 
aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillSchemeClr", 
sLnColorFillScheme));
+auto aResolvedSchemeClr = 
aLineProperties.maLineFill.maFillColor;
+aResolvedSchemeClr.clearTransformations();
+
aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillResolvedSchemeClr",
 aResolvedSchemeClr.getColor(rGraphicHelper, nFillPhClr)));
 
aProperties.push_back(comphelper::makePropertyValue("SpPrLnSolidFillSchemeClrTransformations",
 aLineProperties.maLineFill.maFillColor.getTransformations()));
 }
 
putPropertiesToGrabBag(comphelper::containerToSequence(aProperties));
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 87e80e4ce12a..8d3cbd23a6a7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -273,25 +273,35 @@ bool DrawingML::GetPropertyAndState( const Reference< 
XPropertySet >& rXProperty
 return false;
 }
 
-void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha )
+namespace
+{
+/// Gets hexa value of color on string format.
+OString getColorStr(const ::Color nColor)
 {
 // Transparency is a separate element.
-OString sColor = OString::number(  sal_uInt32(nColor) & 0x00FF, 16 );
-if( sColor.getLength() < 6 )
+OString sColor = OString::number(sal_uInt32(nColor) & 0x00FF, 16);
+if (sColor.getLength() < 6)
 {
-OStringBuffer sBuf( "0" );
+OStringBuffer sBuf("0");
 int remains = 5 - sColor.getLength();
 
-while( remains > 0 )
+while (remains > 0)
 {
-sBuf.append( "0" );
+sBuf.append("0");
 remains--;
 }
 
-sBuf.append( sColor );
+sBuf.append(sColor);
 
 sColor = sBuf.getStr();
 }
+return sColor;
+}
+}
+
+void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha )
+{
+const auto sColor = getColorStr(nColor);
 

[Libreoffice-commits] core.git: oox/source sw/qa

2020-09-18 Thread Regényi Balázs (via logerrit)
 oox/source/export/drawingml.cxx   |   28 +---
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |2 +-
 2 files changed, 2 insertions(+), 28 deletions(-)

New commits:
commit c1376ad6f52d04c1c29e73bc5b312744c74f8bdd
Author: Regényi Balázs 
AuthorDate: Wed Sep 16 14:48:33 2020 +0200
Commit: László Németh 
CommitDate: Fri Sep 18 15:22:15 2020 +0200

tdf#124013 XLSX shape export: fix missing solidFill

of the inside of the shape (resulting for example,
invisible shapes).

See also commit 83c30743eaf44d8eded4a73e3ac2585b5bdbaffc
(tdf#77236 DOCX shape export: fix missing solidFill).

Co-authored-by: Szabolcs Toth

Change-Id: I4efde86f82e22e1aa49b89dc13557ef5f238ba83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102871
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 17352ddb152a..c02cfac613a8 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -441,36 +441,10 @@ void DrawingML::WriteSolidFill( const Reference< 
XPropertySet >& rXPropSet )
 // the shape had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations, nAlpha );
 }
-else if ( aStyleProperties.hasElements() )
-{
-sal_uInt32 nThemeColor = 0;
-sal_Int32 nThemeAlpha = MAX_PERCENT;
-for( const auto& rStyleProp : std::as_const(aStyleProperties) )
-{
-if( rStyleProp.Name == "Color" )
-{
-rStyleProp.Value >>= nThemeColor;
-}
-else if(rStyleProp.Name == "Transformations" )
-{
-Sequence< PropertyValue > aStyleTransformations;
-rStyleProp.Value >>= aStyleTransformations;
-auto pProp = std::find_if(std::cbegin(aStyleTransformations), 
std::cend(aStyleTransformations),
-[](const PropertyValue& rProp) { return rProp.Name == 
"alpha"; });
-if (pProp != std::cend(aStyleTransformations))
-pProp->Value >>= nThemeAlpha;
-}
-}
-if ( nFillColor != nThemeColor || nAlpha != nThemeAlpha )
-// the shape contains a theme but it wasn't being used
-WriteSolidFill( ::Color(nFillColor & 0xff), nAlpha );
-
-// in case the shape used the style color and the user didn't change 
it,
-// we must not write a  tag.
-}
 else
 {
 // the shape had a custom color and the user didn't change it
+// tdf#124013
 WriteSolidFill( ::Color(nFillColor & 0xff), nAlpha );
 }
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index eafdf88ea788..e5bc49ddd189 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -780,7 +780,7 @@ 
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeThemePreservation, "shape-theme-pre
 // check shape style hasn't been overwritten
 assertXPath(pXmlDocument,
 
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:solidFill",
-0);
+1);
 assertXPath(pXmlDocument,
 
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
 1);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source

2020-09-16 Thread Regényi Balázs (via logerrit)
 oox/source/export/drawingml.cxx |   11 ---
 1 file changed, 11 deletions(-)

New commits:
commit 366dcf137287216ee9966f0430ddb12e48e2665d
Author: Regényi Balázs 
AuthorDate: Mon Sep 14 13:47:03 2020 +0200
Commit: László Németh 
CommitDate: Wed Sep 16 15:21:20 2020 +0200

clean-up of commit 83c30743eaf44d8eded4a73e3ac2585b5bdbaffc

Change-Id: Ic49b9337e6accea6c9045f1da377eafcb683a1c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102721
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 605e85ffa087..2669018d3906 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -926,17 +926,6 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 // the line had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations );
 }
-// tdf#77236: I do not understand why this condition is required.
-// The original docx document of bug tdf#77236 includes the native 
colors in both places,
-// so, I think, we can export this color too (not only schema ones).
-//else if( aStyleProperties.hasElements() )
-//{
-//if( nColor != nStyleColor )
-//// the line style defines some color but it wasn't being used
-//WriteSolidFill( nColor );
-//// in case the shape used the style color and the user didn't 
change it,
-//// we must not write a  tag.
-//}
 else
 {
 WriteSolidFill( nColor, nColorAlpha );
___
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' - sw/qa sw/source

2020-09-15 Thread Regényi Balázs (via logerrit)
 sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt |  
284 ++
 sw/qa/core/layout/layout.cxx |   
15 
 sw/source/core/inc/frmtool.hxx   |
5 
 sw/source/core/layout/flowfrm.cxx|   
12 
 sw/source/core/layout/frmtool.cxx|
9 
 5 files changed, 317 insertions(+), 8 deletions(-)

New commits:
commit abd60664236bf57e032f438e1603453b24a2bbda
Author: Regényi Balázs 
AuthorDate: Sat Jul 11 21:29:33 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Sep 15 15:34:26 2020 +0200

tdf#134783 sw: fix contextual spacing position of shape

anchored to paragraph, i.e. when paragraph spacing removed
between same style paragraphs with option "Don't add
space between paragraphs of the same style".

Follow-up of commit 11059331718fb8faab483c75633b4e80d8028b7d
(SwFlowFrm: implement contextual spacing)

Co-authored-by: Szabolcs Tóth

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

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

diff --git 
a/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt 
b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
new file mode 100644
index ..aa5cc77126b9
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
@@ -0,0 +1,284 @@
+
+
+http://openoffice.org/2004/office"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns
 :css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:officeooo="http://openoffice.org/2009/office"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2020-07-14T15:50:45.95100PT1M19S1LibreOfficeDev/7.1.0.0.alpha0$Windows_X86_64
 
LibreOffice_project/e8ffd954ee590d1f382685ceae12a51387919fb8
+ 
+  
+   0
+   0
+   37837
+   23232
+   true
+   false
+   
+
+ view2
+ 10911
+ 6713
+ 0
+ 0
+ 37835
+ 23230
+ 0
+ 1
+ false
+ 100
+ false
+ false
+
+   
+  
+  
+   false
+   
+   
+   
+   1
+   true
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   
+   
+   true
+   false
+   false
+   0
+   true
+   false
+   true
+   false
+   false
+   0
+   false
+   true
+   false
+   false
+   false
+   false
+   high-resolution
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   true
+   false
+   
+   false
+   false
+   false
+   true
+   false
+   2065661
+   false
+   false
+   false
+   false
+   false
+   2065661
+   false
+   true
+   false
+   true
+   true
+   false
+   false
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   0
+   true
+   false
+   true
+   true
+   true
+   false
+   true
+   false
+ 

[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: oox/source sw/qa

2020-09-11 Thread Regényi Balázs (via logerrit)
 oox/source/export/drawingml.cxx  |   19 ++-
 sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx   |9 +
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx|2 -
 4 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 83c30743eaf44d8eded4a73e3ac2585b5bdbaffc
Author: Regényi Balázs 
AuthorDate: Mon Sep 7 19:54:19 2020 +0200
Commit: László Németh 
CommitDate: Fri Sep 11 15:36:15 2020 +0200

tdf#77236 DOCX shape export: fix missing solidFill

(resulting for example, invisible shapes).

Co-authored-by: Szabolcs Tóth

Change-Id: I328514022f4a594c374d5a97db39d1cf3a954e02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102195
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 06bbfea85d61..605e85ffa087 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -926,14 +926,17 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 // the line had a scheme color and the user didn't change it
 WriteSolidFill( sColorFillScheme, aTransformations );
 }
-else if( aStyleProperties.hasElements() )
-{
-if( nColor != nStyleColor )
-// the line style defines some color but it wasn't being used
-WriteSolidFill( nColor );
-// in case the shape used the style color and the user didn't 
change it,
-// we must not write a  tag.
-}
+// tdf#77236: I do not understand why this condition is required.
+// The original docx document of bug tdf#77236 includes the native 
colors in both places,
+// so, I think, we can export this color too (not only schema ones).
+//else if( aStyleProperties.hasElements() )
+//{
+//if( nColor != nStyleColor )
+//// the line style defines some color but it wasn't being used
+//WriteSolidFill( nColor );
+//// in case the shape used the style color and the user didn't 
change it,
+//// we must not write a  tag.
+//}
 else
 {
 WriteSolidFill( nColor, nColorAlpha );
diff --git a/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx 
b/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx
new file mode 100644
index ..2bb2c097838d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index da998b01bb5f..4f77681d2eaf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1338,6 +1338,15 @@ DECLARE_OOXMLEXPORT_TEST( testTdf107359, 
"tdf107359-char-pitch.docx" )
 CPPUNIT_ASSERT_EQUAL( sal_Int32(convertTwipToMm100(24 * 20)), nBaseWidth );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf77236_MissingSolidFill, 
"tdf77236_MissingSolidFill.docx")
+{
+// tdf#77236: solidFill of VML shape was not exported if the colors of 
line and style were the same
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"//mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index d1091c949bb6..eafdf88ea788 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -783,7 +783,7 @@ 
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeThemePreservation, "shape-theme-pre
 0);
 assertXPath(pXmlDocument,
 
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
-0);
+1);
 
 // check direct theme assignments have been preserved
 assertXPath(pXmlDocument,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sw/qa

2020-08-31 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 0d773f0b07798a59f7cf31207813aaf6bc9bb922
Author: Regényi Balázs 
AuthorDate: Sat Aug 29 09:11:46 2020 +0200
Commit: László Németh 
CommitDate: Mon Aug 31 16:04:01 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 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 362f02c7cabf..85ad112bcfae 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -791,6 +791,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 e68dde7499e7..30a27a22e1ce 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1264,6 +1264,19 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginNoHeader,
 assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "2551");
 }
 
+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


[Libreoffice-commits] core.git: sw/qa sw/source

2020-08-28 Thread Regényi Balázs (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt |   42 
++
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx  |   12 ++
 sw/source/filter/ww8/docxsdrexport.cxx  |6 -
 3 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit fe72feef80a4336be9a57a8137839de1d52b2601
Author: Regényi Balázs 
AuthorDate: Wed Aug 26 17:38:21 2020 +0200
Commit: László Németh 
CommitDate: Fri Aug 28 12:44:41 2020 +0200

tdf#135047 DOCX export: fix spacing around objects

defined by frame style instead of direct formatting.

Co-authored-by: Szabolcs Tóth

Change-Id: I376c6ff09d15fe8e2db699b4cfc157ce08016cfa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101416
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt 
b/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt
new file mode 100644
index ..47dac15a5bba
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf135047_ImageSpaceSettings.fodt
@@ -0,0 +1,42 @@
+
+http://openoffice.org/2010/draw"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+   
+
+   
+   
+  
+  
+   
+  
+  
+  
+   
+  
+ 
+ 
+  
+   
+  
+  
+   
+  
+ 
+ 
+  
+
+  
/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgK
+   CgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/wAALCAACAAIBAREA/8QAFAAB
+   CP/EAB4QAAAEBwACBAUGFiU0Q1Nh/9oACAEB
+   AAA/AD/CzM0Sw0UpHYJ8BdZeD//Z
+  
+ 
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Vestibulum consequat mi quis pretium semper. Proin luctus orci ac neque 
venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus 
egestas. Donec blandit auctor arcu, nec pellentesque eros molestie eget. In 
consectetur aliquam hendrerit. Sed cursus mauris vitae ligula pellentesque, non 
pellentesque urna aliquet. Fusce placerat mauris enim, nec rutrum purus semper 
vel. Praesent tincidunt neque eu pellentesque pharetra. Fusce pellentesque est 
orci.
+   Integer sodales tincidunt tristique. Sed 
a metus posuere, adipiscing nunc et, viverra odio. Donec auctor molestie sem, 
sit amet tristique lectus hendrerit sed. Cras sodales nisl sed orci mattis 
iaculis. Nunc eget dolor accumsan, pharetra risus a, vestibulum mauris. Nunc 
vulputate lobortis mollis. Vivamus nec tellus faucibus, tempor magna nec, 
facilisis felis. Donec commodo enim a vehicula pellentesque. Nullam vehicula 
vestibulum est vel ultricies.
+   Aliquam velit massa, laoreet vel leo 
nec, volutpat facilisis eros. Donec consequat arcu ut diam tempor luctus. Cum 
sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus 
mus. Praesent vitae lacus vel leo sodales pharetra a a nibh. Vestibulum ante 
ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam 
luctus tempus nibh, fringilla dictum augue consectetur eget. Curabitur at ante 
sit amet tortor pharetra molestie eu nec ante. Mauris tincidunt, nibh eu 
sollicitudin molestie, dolor sapien congue tortor, a pulvinar sapien turpis sed 
ante. Donec nec est elementum, euismod nulla in, mollis nunc.
+   
+  
+ 
+
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 7c23e44f5fd5..601a9cc742ce 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -488,6 +488,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf133702, 
"tdf133702.docx")
 assertXPath(pXmlDocument, "/w:document/w:body/w:p[1]/w:pPr/w:framePr");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testImageSpaceSettings, 
"tdf135047_ImageSpaceSettings.fodt")
+{
+// tdf#135047 The spaces of image were not saved.
+xmlDocUniquePtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distT", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distB", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distL", "90170");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor", "distR", "90170");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw

[Libreoffice-commits] core.git: sc/qa sc/source

2020-08-24 Thread Regényi Balázs (via logerrit)
 sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx |binary
 sc/qa/unit/subsequent_filters-test.cxx  |   19 
++
 sc/source/filter/oox/drawingfragment.cxx|8 ++--
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 3e85b22769a4b02744a7006d7dc772973c0093f5
Author: Regényi Balázs 
AuthorDate: Wed Aug 19 15:32:54 2020 +0200
Commit: László Németh 
CommitDate: Mon Aug 24 11:02:47 2020 +0200

tdf#135918 XLSX DrawingML shape import: fix needless displacement

Shape was displaced on rotation if it is placed next to the sheets
upper/left edges.

Co-authored-by: Szabolcs Tóth

Change-Id: I987e7b0d863b89cfb5d8154e2f0a017e21248ee1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101001
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx 
b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx
new file mode 100644
index ..a5fcd1ce2fbd
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/testShapeDisplacementOnRotationImport.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index c602ec875beb..01f2db7f7d9d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -272,6 +272,7 @@ public:
 void testXLSDefColWidth();
 void testPreviewMissingObjLink();
 void testShapeRotationImport();
+void testShapeDisplacementOnRotationImport();
 
 CPPUNIT_TEST_SUITE(ScFiltersTest);
 CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -434,6 +435,7 @@ public:
 CPPUNIT_TEST(testXLSDefColWidth);
 CPPUNIT_TEST(testPreviewMissingObjLink);
 CPPUNIT_TEST(testShapeRotationImport);
+CPPUNIT_TEST(testShapeDisplacementOnRotationImport);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4739,6 +4741,23 @@ void ScFiltersTest::testShapeRotationImport()
 }
 }
 
+void ScFiltersTest::testShapeDisplacementOnRotationImport()
+{
+// tdf#135918 shape is displaced on rotation if it is placed next to the 
sheets upper/left edges
+ScDocShellRef xDocSh = loadDoc("testShapeDisplacementOnRotationImport.", 
FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load 
testShapeDisplacementOnRotationImport.xlsx", xDocSh.is());
+
+uno::Reference xDoc(xDocSh->GetModel(), 
uno::UNO_QUERY_THROW);
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+uno::Reference xShape(xPage->getByIndex(0), 
uno::UNO_QUERY_THROW);
+
+uno::Reference xShapeProperties(xShape, 
uno::UNO_QUERY_THROW);
+uno::Any aRectProp = xShapeProperties->getPropertyValue("FrameRect");
+awt::Rectangle aRectangle = aRectProp.get();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aRectangle.X);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aRectangle.Y);
+}
+
 ScFiltersTest::ScFiltersTest()
   : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/filter/oox/drawingfragment.cxx 
b/sc/source/filter/oox/drawingfragment.cxx
index 83b3a7446f5e..1f1f38b25c28 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -295,9 +295,11 @@ void DrawingFragment::onEndElement()
 }
 
 // TODO: DrawingML implementation expects 32-bit 
coordinates for EMU rectangles (change that to EmuRectangle)
+// tdf#135918: Negative X,Y position has to be allowed to 
avoid shape displacement on rotation.
+// The negative values can exist because of previous lines 
where the anchor rectangle must be mirrored in some ranges.
 Rectangle aShapeRectEmu32(
-getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.X, 0, SAL_MAX_INT32 ),
-getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Y, 0, SAL_MAX_INT32 ),
+getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.X, SAL_MIN_INT32, SAL_MAX_INT32 ),
+getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Y, SAL_MIN_INT32, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Width, 0, SAL_MAX_INT32 ),
 getLimitedValue< sal_Int32, sal_Int64 >( 
aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) );
 
@@ -314,7 +316,7 @@ void DrawingFragment::onEndElement()
 /*  Collect all shape positions in the WorksheetHelper base
 class. But first, scale EMUs to 1/100 mm. */
 Rectangle aShapeRectHmm(
-convertEmuToHmm(aShapeRectEmu32.X ), 
convertEmuToHmm(aShapeRectEmu32.Y ),
+convertEmuToHmm(aShapeRectEmu32.X > 0 ? 
aShapeRectEmu32.X : 0), convertEmuToHmm(aShapeRectEmu32.Y > 0 ? 
aShapeRectEmu32.Y : 0),
 convertEmuToHmm(aShapeRectE

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

2020-07-28 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  
 |   23 ++
 sw/source/core/layout/anchoreddrawobject.cxx   
 |   36 +-
 writerfilter/source/dmapper/GraphicImport.cxx  
 |2 
 4 files changed, 59 insertions(+), 2 deletions(-)

New commits:
commit 43c0569af438b7fcb2bfa52cfe84b498b0e61f67
Author: Regényi Balázs 
AuthorDate: Wed Jun 10 14:27:32 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Jul 28 09:07:42 2020 +0200

tdf#133863 tdf#133864 DOCX shape import: width relative to inside

and outside margins.

See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).
commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386
(tdf#133070 DOCX import: fix shape height relative to bottom page margin)
commit 330ed8120e9881656716d70d87b9f49f861f0bfa
(tdf#133670 DOCX import: fix shape width relative to right margin)
commit 7380905abc0833d9e4c4fe731d76174db8a8724c
(tdf#132976 DOCX import: fix shape width relative to left margin)

Co-authored-by: Szabolcs Tóth

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97627
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit d63321d949563759ee2ada96fdc2e0f8728941b2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98832
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit dc3137f9a5a2abdbb627a1a26392d71e26bcc283)

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

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
new file mode 100644
index ..453320f388f1
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index bd5c8605d454..9b28c96820cc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1144,6 +1144,29 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testR
 CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, 
"tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx")
+{
+// TODO: Fix export.
+if (mbExported)
+return;
+
+// tdf#133863 tdf#133864 The sizes of the width of these shapes depend on 
the sizes of the inside and outside margins.
+// The open book: outside --text-- inside | inside --text-- outside
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// Outside
+sal_Int32 nAnchoredWidth = getXPath(pXmlDoc, 
"(//SwAnchoredDrawObject)[1]/bounds", "width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
+// Inside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth);
+// Inside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth);
+// Outside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[4]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index 4b9b119b7d0f..d68dfcf1af92 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -612,6 +612,26 @@ SwRect SwAnchoredDrawObject::GetObjRect() const
 return GetDrawObj()->GetSnapRect();
 }
 
+namespace
+{
+// Imagine an open book, inside margin is the one that is at the inner 
side of the pages, at the center of the book,
+// outside margin is at the two opposite edges of the book.
+// outside --text-- inside | inside --text-- outside
+// With mirrored margins, when relating the size of an object from the 
inside margin for example, on the
+// first page we calculate the new size of the object using the size of 
the right margin,
+// on second page the left margin, third page right margin, etc.
+long getInsideOutsideRelativeWidth(bool isOutside, const SwPageFrame* 
const pPageFrame)
+{
+// Alternating between the only two possible case

[Libreoffice-commits] core.git: sw/qa sw/source

2020-07-17 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
 |   18 +--
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
 |   18 +--
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  
 |   32 ++
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  
 |   11 --
 sw/source/filter/ww8/docxsdrexport.cxx 
 |   51 --
 6 files changed, 70 insertions(+), 60 deletions(-)

New commits:
commit fa84e889b8cabdd7c174b640883c692b8d514ae7
Author: Regényi Balázs 
AuthorDate: Wed Jul 15 16:02:16 2020 +0200
Commit: László Németh 
CommitDate: Fri Jul 17 17:05:31 2020 +0200

tdf#134299 DOCX shape export: fix relative size of shapes

relative to left/right/inside/outside/top/bottom page margins.

This fixes bugs: tdf#134300, tdf#134828, tdf#134830, tdf#134834
and tdf#134835.

Follow-up of commits:

d9bee5677edc857d7d119197a85c22b9410ed876
(tdf#133670 DOCX import: fix shape width relative to right margin)
abc818e5f2fb2884f1041e9626115e69cde766d5
(tdf#132976 DOCX import: fix shape width relative to left margin)
1a391f6ed056c95b9d7b5f18988ab8650723ffc5
(tdf#123324 DOCX import: fix shape height relative to top page margin)
d94ebb64e18839b430760dba525a885b10ae8093
(tdf#133863 tdf#133864 DOCX shape import: width relative to inside)
9693e9aac005b1406e0cdb1655efe45554a90f86
(tdf#133070 DOCX import: fix shape height relative to bottom page margin)

Co-authored-by: Szabolcs Tóth

Change-Id: I42cd7693c80cc62f71560e9ab0f226b51aff6bb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98850
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
index 453320f388f1..216434db3c06 100644
Binary files 
a/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 and 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index becf005b10e6..3e919588d498 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1195,25 +1195,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108505, 
"tdf108505.docx")
 DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginHasHeader,
  
"tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx")
 {
-// TODO: fix export too
-if (mbExported)
-return;
 // tdf#123324 The height was set relative to page print area top,
 // but this was handled relative to page height.
 // Note: page print area top = margin + header height.
 // In this case the header exists.
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-const sal_Int32 nAnchoredHeight
-= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
-CPPUNIT_ASSERT_EQUAL(static_cast(2551), nAnchoredHeight);
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "2551");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginNoHeader,
  
"tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx")
 {
-// TODO: fix export too
-if (mbExported)
-return;
 // tdf#123324 The height was set relative from top margin, but this was 
handled relative from page height.
 // Note: the MSO Word margin = LO margin + LO header height.
 // In this case the header does not exist, so MSO Word margin and LO 
Writer margin are the same.
@@ -1223,9 +1217,9 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginNoHeader,
 // Note: page print area top = margin + header height.
 // In this case the header does not exist, so OpenDocument and OOXML 
margins are the same.
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-const sal_Int32 nAnchoredHeight
-= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
-CPPUNIT_ASSERT_EQUAL(static_cast(2551), nAnchoredHeight);
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "height", "2551");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index c987501901f5..f5f4b1657007 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -161,17 +161,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134

[Libreoffice-commits] core.git: sw/qa sw/source

2020-07-17 Thread Regényi Balázs (via logerrit)
 sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt |  
284 ++
 sw/qa/core/layout/layout.cxx |   
15 
 sw/source/core/inc/frmtool.hxx   |
5 
 sw/source/core/layout/flowfrm.cxx|   
12 
 sw/source/core/layout/frmtool.cxx|
9 
 5 files changed, 317 insertions(+), 8 deletions(-)

New commits:
commit 713c6b1880ee06f8ff0aa869906058f247db6e3a
Author: Regényi Balázs 
AuthorDate: Sat Jul 11 21:29:33 2020 +0200
Commit: László Németh 
CommitDate: Fri Jul 17 16:38:38 2020 +0200

tdf#134783 sw: fix contextual spacing position of shape

anchored to paragraph, i.e. when paragraph spacing removed
between same style paragraphs with option "Don't add
space between paragraphs of the same style".

Follow-up of commit 11059331718fb8faab483c75633b4e80d8028b7d
(SwFlowFrm: implement contextual spacing)

Co-authored-by: Szabolcs Tóth

Change-Id: Id128ad7cab3c7dde4333de3b11a5a3693d039243
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98584
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git 
a/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt 
b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
new file mode 100644
index ..aa5cc77126b9
--- /dev/null
+++ b/sw/qa/core/layout/data/tdf134783_testAnchorPositionBasedOnParagraph.fodt
@@ -0,0 +1,284 @@
+
+
+http://openoffice.org/2004/office"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns
 :css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:officeooo="http://openoffice.org/2009/office"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2020-07-14T15:50:45.95100PT1M19S1LibreOfficeDev/7.1.0.0.alpha0$Windows_X86_64
 
LibreOffice_project/e8ffd954ee590d1f382685ceae12a51387919fb8
+ 
+  
+   0
+   0
+   37837
+   23232
+   true
+   false
+   
+
+ view2
+ 10911
+ 6713
+ 0
+ 0
+ 37835
+ 23230
+ 0
+ 1
+ false
+ 100
+ false
+ false
+
+   
+  
+  
+   false
+   
+   
+   
+   1
+   true
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   
+   
+   true
+   false
+   false
+   0
+   true
+   false
+   true
+   false
+   false
+   0
+   false
+   true
+   false
+   false
+   false
+   false
+   high-resolution
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   true
+   false
+   
+   false
+   false
+   false
+   true
+   false
+   2065661
+   false
+   false
+   false
+   false
+   false
+   2065661
+   false
+   true
+   false
+   true
+   true
+   false
+   false
+   false
+   true
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   0
+   true
+   false
+   true
+   true
+   true
+   false
+   true
+   false
+   false
+   true
+   false
+   false
+   true
+   
+   false
+   true
+  
+ 
+ 
+  
+   http://openoffice.org/2004/office"; 
xmlns:xlink="http://www.w3.org/1999/xlink"/>
+  
+ 
+ 
+  
+  
+  
+  
+  
+  

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

2020-07-16 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  
 |   23 ++
 sw/source/core/layout/anchoreddrawobject.cxx   
 |   36 +-
 writerfilter/source/dmapper/GraphicImport.cxx  
 |2 
 4 files changed, 59 insertions(+), 2 deletions(-)

New commits:
commit dc3137f9a5a2abdbb627a1a26392d71e26bcc283
Author: Regényi Balázs 
AuthorDate: Wed Jun 10 14:27:32 2020 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Jul 16 16:15:03 2020 +0200

tdf#133863 tdf#133864 DOCX shape import: width relative to inside

and outside margins.

See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).
commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386
(tdf#133070 DOCX import: fix shape height relative to bottom page margin)
commit 330ed8120e9881656716d70d87b9f49f861f0bfa
(tdf#133670 DOCX import: fix shape width relative to right margin)
commit 7380905abc0833d9e4c4fe731d76174db8a8724c
(tdf#132976 DOCX import: fix shape width relative to left margin)

Co-authored-by: Szabolcs Tóth

Change-Id: If81b7c80732141be1491ca82770cf6eee99f5656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97627
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit d63321d949563759ee2ada96fdc2e0f8728941b2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98832
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
new file mode 100644
index ..453320f388f1
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 80ca3e83b8fe..a7fa86d47a14 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1167,6 +1167,29 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testR
 CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, 
"tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx")
+{
+// TODO: Fix export.
+if (mbExported)
+return;
+
+// tdf#133863 tdf#133864 The sizes of the width of these shapes depend on 
the sizes of the inside and outside margins.
+// The open book: outside --text-- inside | inside --text-- outside
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Outside
+sal_Int32 nAnchoredWidth = getXPath(pXmlDoc, 
"(//SwAnchoredDrawObject)[1]/bounds", "width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
+// Inside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth);
+// Inside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth);
+// Outside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[4]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index 9b4bce8e44ef..1af32ed2fa80 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -620,6 +620,26 @@ SwRect SwAnchoredDrawObject::GetObjRect() const
 return GetDrawObj()->GetSnapRect();
 }
 
+namespace
+{
+// Imagine an open book, inside margin is the one that is at the inner 
side of the pages, at the center of the book,
+// outside margin is at the two opposite edges of the book.
+// outside --text-- inside | inside --text-- outside
+// With mirrored margins, when relating the size of an object from the 
inside margin for example, on the
+// first page we calculate the new size of the object using the size of 
the right margin,
+// on second page the left margin, third page right margin, etc.
+long getInsideOutsideRelativeWidth(bool isOutside, const SwPageFrame* 
const pPageFrame)
+{
+// Alternating between the only two possible cases: inside and outside.
+// Inside = false, Outside = true.
+auto nPageNum = pPageFrame->GetPhyPageNum();
+if (nPageNum % 2 == (isOutside ? 0 : 1))
+ret

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

2020-07-16 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
 |binary
 
sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
|   32 ++
 sw/source/core/inc/pagefrm.hxx 
|3 
 sw/source/core/layout/anchoreddrawobject.cxx   
|   17 -
 sw/source/core/layout/pagechg.cxx  
|   12 +++
 writerfilter/source/dmapper/GraphicImport.cxx  
|7 ++
 7 files changed, 67 insertions(+), 4 deletions(-)

New commits:
commit 86fc133348e88b84fe659258409de84c0a975941
Author: Regényi Balázs 
AuthorDate: Wed Jun 3 18:15:28 2020 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 16 13:47:20 2020 +0200

tdf#133070 DOCX import: fix shape height relative to bottom page margin

using UNO API RelativeHeightRelation and the associated
lo-ext attribute for OpenDocument export.

See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).

Co-authored-by: Szabolcs Tóth

Change-Id: I31db99fac5ad24971fa427671198b47906e9c057
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95451
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98831
Reviewed-by: Xisco Fauli 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
new file mode 100644
index ..2625a9a56a04
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
 differ
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
new file mode 100644
index ..155e74857479
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 948bca6d74ac..a1f8971772c1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -52,6 +52,38 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, 
"//page[1]/body/txt[1]/Text[3]", "nWidth").toInt32());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,
+ 
"tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx")
+{
+// TODO: fix export too
+if (mbExported)
+return;
+// tdf#133070 The height was set relative to page print area bottom,
+// but this was handled relative to page height.
+// Note: page print area bottom = margin + footer height.
+// In this case the footer exists.
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredHeight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter,
+ 
"tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx")
+{
+// TODO: fix export too
+if (mbExported)
+return;
+// tdf#133070 The height was set relative to page print area bottom,
+// but this was handled relative to page height.
+// Note: page print area bottom = margin + footer height.
+// In this case the footer does not exist, so OpenDocument and OOXML 
margins are the same.
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredHeight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 81949f58e1b4..3c7f29f52ad0 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -21,6 +21,7 @@
 
 #include 
 #include "ftnboss.hxx"
+#include "hffrm.hxx"
 
 #include 
 
@@ -328,6 +329,8 @@ public:
 /// Is bottom-of-page-frame - bottom-of-text-frame difference valid in 
case whitespace is hidden?
 /// If false is returned, then the caller should handle negative 
differenc

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

2020-07-14 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 b48bb4de31f0db1ffa86031ab38f8afa4183c136
Author: Regényi Balázs 
AuthorDate: Thu Jun 25 15:15:46 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Jul 14 16:55:00 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

Change-Id: Idd84dea040f9607d0d498e591601a8648a605a2e
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)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97807
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 607db7a33ae7..8a49546c94bd 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2901,9 +2901,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 791d32e26435..9d3ce8cd9292 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1242,6 +1242,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
+xmlDocUniquePtr 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: oox/source sw/qa

2020-07-03 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 cab956c480eb4f619580285c7b9a15b9e6d9b780
Author: Regényi Balázs 
AuthorDate: Thu Jun 25 15:15:46 2020 +0200
Commit: László Németh 
CommitDate: Fri Jul 3 13:33:16 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

Change-Id: Idd84dea040f9607d0d498e591601a8648a605a2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97127
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a5a44cc3e7fe..4adf7a9406b5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2901,9 +2901,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 db5add6d8014..e89522670483 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1269,6 +1269,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
+xmlDocUniquePtr 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: sw/qa sw/source writerfilter/source

2020-07-02 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx
 |binary
 
sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx
  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
 |   36 ++
 sw/source/core/inc/pagefrm.hxx 
 |1 
 sw/source/core/layout/anchoreddrawobject.cxx   
 |9 ++
 sw/source/core/layout/pagechg.cxx  
 |   12 +++
 writerfilter/source/dmapper/GraphicImport.cxx  
 |7 +
 7 files changed, 65 insertions(+)

New commits:
commit a85c2504c002dff069c129ab244cb2ba5820943d
Author: Regényi Balázs 
AuthorDate: Mon Jun 22 10:28:15 2020 +0200
Commit: László Németh 
CommitDate: Thu Jul 2 12:32:33 2020 +0200

tdf#123324 DOCX import: fix shape height relative to top page margin

using UNO API RelativeHeightRelation and the associated
lo-ext attribute for OpenDocument export.

See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).

Co-authored-by: Szabolcs Tóth

Change-Id: Ibaba4b3762de5a70506dacd85a818b8972b18144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96869
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx
new file mode 100644
index ..b978eec993c7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx
 differ
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx
new file mode 100644
index ..70c2793cbf96
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 167c05111a51..3ca1a456182f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1163,6 +1163,42 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108505, 
"tdf108505.docx")
 getProperty(xText, "CharFontName"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginHasHeader,
+ 
"tdf123324_testRelativeAnchorHeightFromTopMarginHasHeader.docx")
+{
+// TODO: fix export too
+if (mbExported)
+return;
+// tdf#123324 The height was set relative to page print area top,
+// but this was handled relative to page height.
+// Note: page print area top = margin + header height.
+// In this case the header exists.
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredHeight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2551), nAnchoredHeight);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromTopMarginNoHeader,
+ 
"tdf123324_testRelativeAnchorHeightFromTopMarginNoHeader.docx")
+{
+// TODO: fix export too
+if (mbExported)
+return;
+// tdf#123324 The height was set relative from top margin, but this was 
handled relative from page height.
+// Note: the MSO Word margin = LO margin + LO header height.
+// In this case the header does not exist, so MSO Word margin and LO 
Writer margin are the same.
+
+// tdf#123324 The height was set relative to page print area top,
+// but this was handled relative to page height.
+// Note: page print area top = margin + header height.
+// In this case the header does not exist, so OpenDocument and OOXML 
margins are the same.
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredHeight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2551), nAnchoredHeight);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 3c7f29f52ad0..a9f642c1f03e 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -330,6 +330,7 @@ public:
 /// If false is returned, then the caller should handle negative 
difference as (at least) zero difference instead.
 bool CheckPageHeightValidForHideWhitespace(SwTwips nDiff);
 
+const SwHeaderFrame* GetHeaderFrame() const;
 const SwFooterFrame* GetFooterFrame() const;
 };
 
d

[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2020-07-01 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  
 |   23 ++
 sw/source/core/layout/anchoreddrawobject.cxx   
 |   36 +-
 writerfilter/source/dmapper/GraphicImport.cxx  
 |2 
 4 files changed, 59 insertions(+), 2 deletions(-)

New commits:
commit d63321d949563759ee2ada96fdc2e0f8728941b2
Author: Regényi Balázs 
AuthorDate: Wed Jun 10 14:27:32 2020 +0200
Commit: László Németh 
CommitDate: Wed Jul 1 18:33:59 2020 +0200

tdf#133863 tdf#133864 DOCX shape import: width relative to inside

and outside margins.

See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).
commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386
(tdf#133070 DOCX import: fix shape height relative to bottom page margin)
commit 330ed8120e9881656716d70d87b9f49f861f0bfa
(tdf#133670 DOCX import: fix shape width relative to right margin)
commit 7380905abc0833d9e4c4fe731d76174db8a8724c
(tdf#132976 DOCX import: fix shape width relative to left margin)

Co-authored-by: Szabolcs Tóth

Change-Id: If81b7c80732141be1491ca82770cf6eee99f5656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97627
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
new file mode 100644
index ..453320f388f1
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 4c6428321792..ea7a3643954b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1169,6 +1169,29 @@ 
DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, "tdf132976_testR
 CPPUNIT_ASSERT_EQUAL(static_cast(1133), nAnchoredWidth);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromInsideOutsideMargin, 
"tdf133861_RelativeAnchorWidthFromInsideOutsideMargin.docx")
+{
+// TODO: Fix export.
+if (mbExported)
+return;
+
+// tdf#133863 tdf#133864 The sizes of the width of these shapes depend on 
the sizes of the inside and outside margins.
+// The open book: outside --text-- inside | inside --text-- outside
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Outside
+sal_Int32 nAnchoredWidth = getXPath(pXmlDoc, 
"(//SwAnchoredDrawObject)[1]/bounds", "width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
+// Inside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[2]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth);
+// Inside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[3]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1440), nAnchoredWidth);
+// Outside
+nAnchoredWidth = getXPath(pXmlDoc, "(//SwAnchoredDrawObject)[4]/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2552), nAnchoredWidth);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index 9b4bce8e44ef..1af32ed2fa80 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -620,6 +620,26 @@ SwRect SwAnchoredDrawObject::GetObjRect() const
 return GetDrawObj()->GetSnapRect();
 }
 
+namespace
+{
+// Imagine an open book, inside margin is the one that is at the inner 
side of the pages, at the center of the book,
+// outside margin is at the two opposite edges of the book.
+// outside --text-- inside | inside --text-- outside
+// With mirrored margins, when relating the size of an object from the 
inside margin for example, on the
+// first page we calculate the new size of the object using the size of 
the right margin,
+// on second page the left margin, third page right margin, etc.
+long getInsideOutsideRelativeWidth(bool isOutside, const SwPageFrame* 
const pPageFrame)
+{
+// Alternating between the only two possible cases: inside and outside.
+// Inside = false, Outside = true.
+auto nPageNum = pPageFrame->GetPhyPageNum();
+if (nPageNum % 2 == (isOutside ? 0 : 1))
+return pPageFrame->GetRightMargin();
+else
+return pPageFrame->GetLeftMargin();
+}
+}
+
 // --> #i70122#
 SwRect SwAnchoredDrawObject::GetObjBoundRect() const
 {
@@ -640,10 +660,22 @@ SwRect 

[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2020-07-01 Thread Regényi Balázs (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
 |binary
 
sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
|   32 ++
 sw/source/core/inc/pagefrm.hxx 
|3 
 sw/source/core/layout/anchoreddrawobject.cxx   
|   17 -
 sw/source/core/layout/pagechg.cxx  
|   12 +++
 writerfilter/source/dmapper/GraphicImport.cxx  
|7 ++
 7 files changed, 67 insertions(+), 4 deletions(-)

New commits:
commit b46f4bc9760267ac5e45d43b77b5d2721ee4c386
Author: Regényi Balázs 
AuthorDate: Wed Jun 3 18:15:28 2020 +0200
Commit: László Németh 
CommitDate: Wed Jul 1 10:15:44 2020 +0200

tdf#133070 DOCX import: fix shape height relative to bottom page margin

using UNO API RelativeHeightRelation and the associated
lo-ext attribute for OpenDocument export.

See commit 43d7f4e3640c5e370fd1204739c2b0c7eb5f40e4
(offapi: document the 4 new properties which are no longer read-only).

Co-authored-by: Szabolcs Tóth

Change-Id: I31db99fac5ad24971fa427671198b47906e9c057
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95451
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
new file mode 100644
index ..2625a9a56a04
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx
 differ
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
new file mode 100644
index ..155e74857479
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 92c5423a2b25..240447bf35c0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -52,6 +52,38 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(720), getXPath(pDump, 
"//page[1]/body/txt[1]/Text[3]", "nWidth").toInt32());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginHasFooter,
+ 
"tdf133070_testRelativeAnchorHeightFromBottomMarginHasFooter.docx")
+{
+// TODO: fix export too
+if (mbExported)
+return;
+// tdf#133070 The height was set relative to page print area bottom,
+// but this was handled relative to page height.
+// Note: page print area bottom = margin + footer height.
+// In this case the footer exists.
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredHeight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorHeightFromBottomMarginNoFooter,
+ 
"tdf133070_testRelativeAnchorHeightFromBottomMarginNoFooter.docx")
+{
+// TODO: fix export too
+if (mbExported)
+return;
+// tdf#133070 The height was set relative to page print area bottom,
+// but this was handled relative to page height.
+// Note: page print area bottom = margin + footer height.
+// In this case the footer does not exist, so OpenDocument and OOXML 
margins are the same.
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredHeight
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"height").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1147), nAnchoredHeight);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 81949f58e1b4..3c7f29f52ad0 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -21,6 +21,7 @@
 
 #include 
 #include "ftnboss.hxx"
+#include "hffrm.hxx"
 
 #include 
 
@@ -328,6 +329,8 @@ public:
 /// Is bottom-of-page-frame - bottom-of-text-frame difference valid in 
case whitespace is hidden?
 /// If false is returned, then the caller should handle negative 
difference as (at least) zero difference instead.
 bool CheckPageHeightValidForHideWhitespace(SwTwips nDiff);
+
+const SwFooterFrame* GetFooterFrame() const;
 };
 
 i

[Libreoffice-commits] core.git: oox/source sw/qa

2020-05-20 Thread Regényi Balázs (via logerrit)
 oox/source/drawingml/shape.cxx |1 +
 oox/source/export/drawingml.cxx|8 +++-
 sw/qa/extras/ooxmlexport/data/tdf126363_LineWidthRounding.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |   10 
++
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit c28d6b99599eaeb923804547c3ac849b6feec044
Author: Regényi Balázs 
AuthorDate: Mon May 11 16:16:59 2020 +0200
Commit: László Németh 
CommitDate: Wed May 20 17:01:05 2020 +0200

tdf#126363 DOCX shape round-trip: keep original line width

to avoid of rounding error of EMU -> 1/100 mm -> EMU
conversions, which messed up recognition of preset
line widths in MSO.

Co-authored-by: Szabolcs Tóth

Change-Id: Ide0e393e667848683f00f9ba7a73ff8a45a908b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94043
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 202e2927e80c..cd7c289e9efa 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1251,6 +1251,7 @@ Reference< XShape > const & Shape::createAndInsert(
 
 // Store original fill and line colors of the shape and the theme 
color name to InteropGrabBag
 std::vector aProperties;
+
aProperties.push_back(comphelper::makePropertyValue("EmuLineWidth", 
aLineProperties.moLineWidth.get(0)));
 
aProperties.push_back(comphelper::makePropertyValue("OriginalSolidFillClr", 
aShapeProps.getProperty(PROP_FillColor)));
 
aProperties.push_back(comphelper::makePropertyValue("OriginalLnSolidFillClr", 
aShapeProps.getProperty(PROP_LineColor)));
 OUString sColorFillScheme = 
aFillProperties.maFillColor.getSchemeName();
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c925819dd9f8..2d44aec64465 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -748,6 +748,7 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 mAny >>= aLineStyle;
 
 sal_uInt32 nLineWidth = 0;
+sal_uInt32 nEmuLineWidth = 0;
 ::Color nColor;
 sal_Int32 nColorAlpha = MAX_PERCENT;
 bool bColorSet = false;
@@ -784,6 +785,8 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 rProp.Value >>= aStyleProperties;
 else if( rProp.Name == "SpPrLnSolidFillSchemeClrTransformations" )
 rProp.Value >>= aTransformations;
+else if( rProp.Name == "EmuLineWidth" )
+rProp.Value >>= nEmuLineWidth;
 }
 for (const auto& rStyleProp : std::as_const(aStyleProperties))
 {
@@ -864,10 +867,13 @@ void DrawingML::WriteOutline( const 
Reference& rXPropSet, Referenc
 break;
 }
 
+// if the line-width was not modified after importing then the original 
EMU value will be exported to avoid unexpected conversion (rounding) error
+if (nEmuLineWidth == 0 || 
static_cast(oox::drawingml::convertEmuToHmm(nEmuLineWidth)) != 
nLineWidth)
+nEmuLineWidth = oox::drawingml::convertHmmToEmu(nLineWidth);
 mpFS->startElementNS( XML_a, XML_ln,
   XML_cap, cap,
   XML_w, nLineWidth == 0 || (nLineWidth > 1 && 
nStyleLineWidth != nLineWidth) ?
-  
OString::number(oox::drawingml::convertHmmToEmu(nLineWidth)).getStr() : nullptr 
);
+  OString::number(nEmuLineWidth).getStr() : 
nullptr );
 
 if( bColorSet )
 {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf126363_LineWidthRounding.docx 
b/sw/qa/extras/ooxmlexport/data/tdf126363_LineWidthRounding.docx
new file mode 100644
index ..180383ec6842
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf126363_LineWidthRounding.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index a591a3caa8fe..dd6544eb3173 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -971,6 +971,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131539, 
"tdf131539.odt")
 CPPUNIT_ASSERT(aXmlVal.indexOf("margin-left:139.95")>-1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testLineWidthRounding, 
"tdf126363_LineWidthRounding.docx")
+{
+// tdf#126363: check if line with stays the same after export
+xmlDocUniquePtr pXml = parseExport("word/document.xml");
+if (!pXml)
+return;
+// this was 57240 (it differs from the original 57150, losing the preset 
line width)
+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", "57150");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
__

[Libreoffice-commits] core.git: oox/source sw/qa

2020-04-29 Thread Regényi Balázs (via logerrit)
 oox/source/drawingml/textcharacterpropertiescontext.cxx  |
7 +
 sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx 
|binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|   
14 ++
 3 files changed, 21 insertions(+)

New commits:
commit d0124728059088cd72cb173e33df89d785ae2ab5
Author: Regényi Balázs 
AuthorDate: Tue Apr 28 09:18:24 2020 +0200
Commit: László Németh 
CommitDate: Wed Apr 29 16:20:37 2020 +0200

tdf#132491 DOCX DrawingML shape import: fix missing underline color

The import of underline color was unhandled.
Co-Author: Szabolcs Toth

Change-Id: I47dce90966c7130ca67941ee47b0e4b2ba7eb972
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93108
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx 
b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index 8c6eb4aee22a..8fecb8bd2735 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -201,6 +201,13 @@ ContextHandlerRef 
TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
 mrTextCharacterProperties.moUnderline = XML_dash;
 else if (attrib == "none")
 mrTextCharacterProperties.moUnderline = XML_none;
+auto colorAttrib = rAttribs.getIntegerHex(W_TOKEN(color));
+if (colorAttrib.has())
+{
+oox::drawingml::Color theColor;
+theColor.setSrgbClr(colorAttrib.get());
+mrTextCharacterProperties.maUnderlineColor = theColor;
+}
 break;
 }
 case W_TOKEN( spacing ):
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx
new file mode 100644
index ..aa5528b31093
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index e73e7dcfddab..a6352c767335 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1198,6 +1198,20 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, 
"tdf123351_UnderlineGroupS
 
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u",
 "val", "single");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, 
"tdf132491_UnderlineColorGroupedShapes.docx")
+{
+// tdf#132491 : Check if correct color is used for underline.
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u",
 "color", "FF");
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u",
 "color", "00B050");
+assertXPathNoAttribute(pXmlDocument, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+
"/a:graphic/a:graphicData/wpg:wgp/wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u",
 "color");
+}
+
 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: oox/source sw/qa

2020-04-17 Thread Regényi Balázs (via logerrit)
 oox/source/drawingml/textcharacterpropertiescontext.cxx   |3 ++
 sw/qa/extras/ooxmlexport/data/tdf131922_LanguageInGroupShape.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx|   13 
++
 3 files changed, 16 insertions(+)

New commits:
commit 01752af18d623676c4ebc7a8a4a47f69dfb79057
Author: Regényi Balázs 
AuthorDate: Tue Apr 7 10:01:15 2020 +0200
Commit: László Németh 
CommitDate: Fri Apr 17 13:50:54 2020 +0200

tdf#131922 DOCX DrawingML shape import: fix lang-id

The language identifier of text of grouped shapes wasn't imported.

Co-Author: Szabolcs Tóth

Change-Id: Ic71ea1bdf3aed27ad813cfa33659921060c0ec0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91801
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx 
b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index 4533a96e1cca..7658d41031f0 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -262,6 +262,9 @@ ContextHandlerRef 
TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
 mrTextCharacterProperties.moBaseline = -25000;
 break;
 }
+case W_TOKEN(lang):
+mrTextCharacterProperties.moLang = 
rAttribs.getString(W_TOKEN(val), OUString());
+break;
 case OOX_TOKEN(w14, glow):
 case OOX_TOKEN(w14, shadow):
 case OOX_TOKEN(w14, reflection):
diff --git a/sw/qa/extras/ooxmlexport/data/tdf131922_LanguageInGroupShape.docx 
b/sw/qa/extras/ooxmlexport/data/tdf131922_LanguageInGroupShape.docx
new file mode 100644
index ..afd5ec57aedc
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf131922_LanguageInGroupShape.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index a8588a0ddf68..19582a7990eb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -989,6 +989,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf122594, "tdf122594.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(3), nCheck);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testLanguageInGroupShape, 
"tdf131922_LanguageInGroupShape.docx")
+{
+// tdf#131922: Check if good language is used in shape group texts
+xmlDocPtr pXml = parseExport("word/document.xml");
+if (!pXml)
+return;
+assertXPath(pXml,
+
"/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/"
+"a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:lang",
+"val", "de-DE");
+}
+
 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: oox/source sw/qa

2020-04-09 Thread Regényi Balázs (via logerrit)
 oox/source/drawingml/textcharacterpropertiescontext.cxx  |6 +-
 sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   28 
--
 3 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit 3bf68bfa4a6376857ed65e768722607ee7287dfa
Author: Regényi Balázs 
AuthorDate: Tue Apr 7 09:12:07 2020 +0200
Commit: László Németh 
CommitDate: Thu Apr 9 09:52:13 2020 +0200

tdf#131776 DOCX grouped shape import: fix regression for strikeouts

Because of previous commit we applied strikeout
on shape text if its attribute "val" was false.

Regression from commit 143e6641cea7a06faeec8b3b65aa09b153a6490f
(tdf#131776 DOCX DrawingML shape import: fix missing strikeout).

Co-Author: Szabolcs Toth

Change-Id: Iff2331cc183be59aee66a7f6f0ad65af89b13093
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91796
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx 
b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index cd98b9564825..4533a96e1cca 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -211,10 +211,12 @@ ContextHandlerRef 
TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
 case W_TOKEN( bCs ):
 break;
 case W_TOKEN( strike ):
-mrTextCharacterProperties.moStrikeout = XML_sngStrike;
+if (rAttribs.getBool(W_TOKEN(val), true))
+mrTextCharacterProperties.moStrikeout = XML_sngStrike;
 break;
 case W_TOKEN( dstrike ):
-mrTextCharacterProperties.moStrikeout = XML_dblStrike;
+if (rAttribs.getBool(W_TOKEN(val), true))
+mrTextCharacterProperties.moStrikeout = XML_dblStrike;
 break;
 case W_TOKEN( color ):
 if (rAttribs.getInteger(W_TOKEN(val)).has())
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx 
b/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx
index b464f35e2f7e..3fd4ab1f5f59 100644
Binary files 
a/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index e88b902aee0a..ba54c33e115a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -780,17 +780,37 @@ DECLARE_OOXMLEXPORT_TEST(testStrikeoutGroupShapeText, 
"tdf131776_StrikeoutGroupS
 if (!pXml)
 return;
 
-// double strike
+// double strike (dstrike)
+//   no "val" attribute
 assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
 "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
 assertXPathNoAttribute(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
 "wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
+//   "val" attribute is true, this is used in this test file. However, LO 
is going to export this element without the "val" attribute
+//   because if the element appears, but without an attribute its "val" 
true by default.
+assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
+assertXPathNoAttribute(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
+//   "val" attribute is false (this was missing, resulting the regression)
+assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val", 
"false");
 
-// simple strike
+// simple strike (strike)
+//   no "val" attribute
 assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
-"wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
+"wps:wsp[4]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
 assertXPathNoAttribute(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
-"wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
+"wps:wsp[4]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
+//   "val" attribute is

[Libreoffice-commits] core.git: oox/source sw/qa

2020-04-03 Thread Regényi Balázs (via logerrit)
 oox/source/drawingml/textcharacterpropertiescontext.cxx  |6 +++
 sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   20 
++
 3 files changed, 26 insertions(+)

New commits:
commit 143e6641cea7a06faeec8b3b65aa09b153a6490f
Author: Regényi Balázs 
AuthorDate: Thu Apr 2 10:56:08 2020 +0200
Commit: László Németh 
CommitDate: Fri Apr 3 14:34:48 2020 +0200

tdf#131776 DOCX DrawingML shape import: fix missing strikeout

The absence of simple and double strikeouts is fixed.
Co-Author: Szabolcs Toth
Co-Author: Tibor Nagy

Change-Id: I5d7eef660f87c67855bce9847ad8e07d074183e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91555
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx 
b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index b7bb876044cf..cd98b9564825 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -210,6 +210,12 @@ ContextHandlerRef 
TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
 break;
 case W_TOKEN( bCs ):
 break;
+case W_TOKEN( strike ):
+mrTextCharacterProperties.moStrikeout = XML_sngStrike;
+break;
+case W_TOKEN( dstrike ):
+mrTextCharacterProperties.moStrikeout = XML_dblStrike;
+break;
 case W_TOKEN( color ):
 if (rAttribs.getInteger(W_TOKEN(val)).has())
 {
diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx 
b/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx
new file mode 100644
index ..b464f35e2f7e
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf131776_StrikeoutGroupShapeText.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index cff728463f28..fafe1cfe2b02 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -759,6 +759,26 @@ DECLARE_OOXMLEXPORT_TEST(testHyphenationAuto, 
"hyphenation.odt")
 assertXPath(pXmlStyles, 
"/w:styles/w:docDefaults/w:pPrDefault/w:pPr/w:suppressAutoHyphens", "val", 
"true");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testStrikeoutGroupShapeText, 
"tdf131776_StrikeoutGroupShapeText.docx")
+{
+// tdf#131776: Check if strikeout is used in shape group texts
+xmlDocPtr pXml = parseExport("word/document.xml");
+if (!pXml)
+return;
+
+// double strike
+assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike");
+assertXPathNoAttribute(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:dstrike", "val");
+
+// simple strike
+assertXPath(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike");
+assertXPathNoAttribute(pXml, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/"
+"wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:strike", "val");
+}
+
 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