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

2020-07-28 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx|4 ++--
 sw/qa/extras/ooxmlimport/data/tdf127778.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   12 
 sw/source/filter/ww8/docxattributeoutput.cxx |   11 +++
 sw/source/filter/ww8/wrtw8sty.cxx|   12 
 sw/source/filter/ww8/wrtww8.hxx  |1 +
 writerfilter/source/dmapper/PropertyMap.cxx  |9 -
 7 files changed, 38 insertions(+), 11 deletions(-)

New commits:
commit 72ea1f784ff455bf90966cfdd6336a516efc8ea3
Author: Miklos Vajna 
AuthorDate: Mon May 11 21:08:35 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Tue Jul 28 11:43:07 2020 +0200

tdf#127778 DOCX import: fix unexpected heading on non-first page ...

... when the first page has a heading

Regression from commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX
import: first page header should always set default headers as well,
2014-11-21), the problem is around how to split a first + follow page
style on import, and then do the opposite on export.

This is described using a single section in OOXML, but Writer has 2 page
styles for this (unlike in case of the DOC filter). This means the
header margin has to be taken from one of these page styles. The above
commit tweaked the import, so the follow page style has the wanted
header margin, but this leads to incorrect layout.

Fix the problem by tweaking the export instead: it has random access to
the doc model, so it can take the header margin from the first page
style if needed, and then the import side can be reverted, leading to
correct layout.

Also remove some leftover debug code in test/, which was added in commit
5352d45dd4a04f8f02cf7f6ad4169126d3b3586a (convert AnimationImport to
fast-parser APIs, 2020-02-18).

(cherry picked from commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2)

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport6.cxx

Change-Id: I4bbf7271f3a437e8432399bd1e32e9d24190a501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94193
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
(cherry picked from commit a2b8ede5b45101c45291d1e1e96e7fa1ad47dd2b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99544
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index bcc9fed18e1c..012c60737cca 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -521,7 +521,7 @@ DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx")
 {
 // The problem was exporter was exporting vml data for shape in w:rPr 
element.
 // vml data should not come under w:rPr element.
-xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
 if (!pXmlDoc)
 return;
 CPPUNIT_ASSERT(getXPath(pXmlDoc, 
"/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", 
"stroked").match("f"));
@@ -531,7 +531,7 @@ DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx")
 {
 // The problem was exporter was exporting v:imagedata data for shape in 
w:pict as v:fill w element.
 
-xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
 if (!pXmlDoc)
 return;
 CPPUNIT_ASSERT(getXPath(pXmlDoc, 
"/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", 
"detectmouseclick").match("t"));
diff --git a/sw/qa/extras/ooxmlimport/data/tdf127778.docx 
b/sw/qa/extras/ooxmlimport/data/tdf127778.docx
new file mode 100644
index ..a706d575763f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf127778.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 7688e1927acb..a14b97aec66a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -271,6 +271,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx")
  getProperty(xText, "CharColor"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf127778)
+{
+load(mpTestDocumentPath, "tdf127778.docx");
+xmlDocPtr pLayout = parseLayoutDump();
+// Without the accompanying fix in place, this test would have failed with:
+// equality assertion failed
+// - Expected: 0
+// - Actual  : 1
+// i.e. the 2nd page had an unexpected header.
+assertXPath(pLayout, "//page[2]/header", 0);
+}
+
 // related tdf#43017
 DECLARE_OOXMLIMPORT_TEST(testTdf124754, "tdf124754.docx")
 {
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0d8534386cf7..825189c8ccd6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@

[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: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source writerfilter/source

2020-07-27 Thread Szabolcs Toth (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx
 |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  
 |   13 ++
 sw/source/core/layout/anchoreddrawobject.cxx   
 |3 ++
 writerfilter/source/dmapper/GraphicImport.cxx  
 |8 ++
 4 files changed, 24 insertions(+)

New commits:
commit ff4740980c7a7fa5162da94c0d31d41e25f5d1e3
Author: Szabolcs Toth 
AuthorDate: Fri Jun 5 12:06:22 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Mon Jul 27 23:04:42 2020 +0200

tdf#133670 DOCX import: fix shape width relative to right margin

using UNO API RelativeWidthRelation 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: Balázs Regényi

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95582
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 330ed8120e9881656716d70d87b9f49f861f0bfa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97067
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit 718683ab1582849ea43797e404c6453ce2fbd424)

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

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx
new file mode 100644
index ..68f24370a31e
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf133670_testRelativeAnchorWidthFromRightMargin.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 93a65a57fc45..c9833e045f0a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1231,6 +1231,19 @@ DECLARE_OOXMLEXPORT_TEST(testDocxTablePosition, 
"floating-table-position.docx")
 assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", 
"4611");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromRightMargin, 
"tdf133670_testRelativeAnchorWidthFromRightMargin.docx")
+{
+// TODO: Fix export.
+if (mbExported)
+return;
+
+// tdf#133670 The width was set relative from right margin, but this was 
handled relative from page width.
+xmlDocPtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredWidth
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(2408), 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 95ad5bc155b4..4b9b119b7d0f 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -633,6 +633,9 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const
 // E.g.: (left margin = 8 && relative size = 150%) -> width of 
some shape = 12.
 else if (GetDrawObj()->GetRelativeWidthRelation() == 
text::RelOrientation::PAGE_LEFT)
 nWidth = GetPageFrame()->GetLeftMargin();
+// Same as the left margin above.
+else if (GetDrawObj()->GetRelativeWidthRelation() == 
text::RelOrientation::PAGE_RIGHT)
+nWidth = GetPageFrame()->GetRightMargin();
 else
 nWidth = GetPageFrame( )->GetBoundRect( 
GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth();
 nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth());
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 04b2b124aae6..062c00d5f58e 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -948,6 +948,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 
xPropertySet->setPropertyValue("RelativeWidthRelation", 
uno::makeAny(text::RelOrientation::PAGE_LEFT));
 }
 break;
+case NS_ooxml::LN_ST_SizeRelFromH_rightMargin:
+if (m_xShape.is())
+{
+// Same as the left margin above.
+uno::Reference 
xPropertySet(m_xShape, uno::UNO_QUERY);
+
xPropertySet->setPropertyValue("RelativeWidthRelation", 
uno::makeAny(text::RelOrientation::PAGE_RIGHT));
+}
+break;
 case NS_o

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

2020-07-27 Thread Szabolcs Toth (via logerrit)
 
sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx
 |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  
|   14 ++
 sw/source/core/layout/anchoreddrawobject.cxx   
|   13 ++---
 writerfilter/source/dmapper/GraphicImport.cxx  
|   10 +++
 4 files changed, 33 insertions(+), 4 deletions(-)

New commits:
commit 10b24292a37b69e9329b03fed2f10af4a91247e0
Author: Szabolcs Toth 
AuthorDate: Thu Jun 4 15:43:42 2020 +0200
Commit: Gabor Kelemen 
CommitDate: Mon Jul 27 22:34:02 2020 +0200

tdf#132976 DOCX import: fix shape width relative to left margin

using UNO API RelativeWidthRelation 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: Balázs Regényi

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95525
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 7380905abc0833d9e4c4fe731d76174db8a8724c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96998
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit 5451833f3af5582a8cab7e4b3da402f083f56908)

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

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx
 
b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx
new file mode 100644
index ..2f1c5560c17a
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf132976_testRelativeAnchorWidthFromLeftMargin.docx
 differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 089154675288..bd5c8605d454 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1130,6 +1130,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeLineWidth, 
"tdf92526_ShapeLineWidth.odt")
 "/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "0");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRelativeAnchorWidthFromLeftMargin, 
"tdf132976_testRelativeAnchorWidthFromLeftMargin.docx")
+{
+// TODO: Fix export.
+if (mbExported)
+return;
+
+// tdf#132976 The size of the width of this shape should come from the 
size of the left margin.
+// It was set to the size of the width of the entire page before.
+xmlDocPtr pXmlDoc = parseLayoutDump();
+const sal_Int32 nAnchoredWidth
+= getXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT_EQUAL(static_cast(1133), 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 079468fdf062..95ad5bc155b4 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -624,13 +624,18 @@ SwRect SwAnchoredDrawObject::GetObjBoundRect() const
 long nTargetWidth = aCurrObjRect.GetWidth( );
 if ( GetDrawObj( )->GetRelativeWidth( ) )
 {
-tools::Rectangle aPageRect;
+long nWidth = 0;
 if (GetDrawObj()->GetRelativeWidthRelation() == 
text::RelOrientation::FRAME)
 // Exclude margins.
-aPageRect = GetPageFrame()->getFramePrintArea().SVRect();
+nWidth = 
GetPageFrame()->getFramePrintArea().SVRect().GetWidth();
+// Here we handle the relative size of the width of some shape.
+// The size of the shape's width is going to be relative to the 
size of the left margin.
+// E.g.: (left margin = 8 && relative size = 150%) -> width of 
some shape = 12.
+else if (GetDrawObj()->GetRelativeWidthRelation() == 
text::RelOrientation::PAGE_LEFT)
+nWidth = GetPageFrame()->GetLeftMargin();
 else
-aPageRect = GetPageFrame( )->GetBoundRect( 
GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect();
-nTargetWidth = aPageRect.GetWidth( ) * (*GetDrawObj( 
)->GetRelativeWidth());
+nWidth = GetPageFrame( )->GetBoundRect( 
GetPageFrame()->getRootFrame()->GetCurrShell()->GetOut() ).SVRect().GetWidth();
+nTargetWidth = nWidth * (*GetDrawObj( )->GetRelativeWidth());
 }
 
 long nTargetHeight = aCurrObjRect.GetHeight( );
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 8afea80365fe..04b2b124aae6 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
++

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

2020-06-12 Thread Attila Bakos (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   28 ++---
 sw/source/core/doc/textboxhelper.cxx  |4 +
 sw/source/core/unocore/unotext.cxx|4 -
 sw/source/filter/ww8/docxsdrexport.cxx|   12 +
 writerfilter/source/dmapper/GraphicImport.cxx |   33 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   37 --
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |3 -
 7 files changed, 43 insertions(+), 78 deletions(-)

New commits:
commit 33a0d2f40cee7d1ea46af5bdcac2d0791646c064
Author: Attila Bakos 
AuthorDate: Thu Mar 19 14:40:36 2020 +0100
Commit: Gabor Kelemen 
CommitDate: Fri Jun 12 10:20:20 2020 +0200

tdf#119038 DOCX: fix FollowTextFlow handling

This fix also a clean-up for the following commits:

ad8857dab30e099a0cf6ec18d184a6c836b33317
(tdf#130120 DOCX: export o:allowincell)
14ad64270e4fbca3c24da6f55f260b1fb229556a
(tdf#129888 DOCX shape import: handle o:allowincell)
10f29d8bf05d44ca8bc11d34d1294ec17f8ac0f1
(tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables)

where these patches ignored the option "Follow text flow"
and there was no possibility to switch this setting on GUI.
Now this is handled on GUI as well by replacing the
grab-bag with UNO property "IsFollowingTextFlow".

The tdf#119038 bug also fixed.

Note: Unit tests for the commits mentioned above were
modified for testing the new property, so new tests were
not added.

Change-Id: Ie35c6e280f8b33d8535ca4cd9749f110f9d592ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90753
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 27d04f6dbf38aa28fb7215590d578c4567db5770)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96171
Tested-by: Gabor Kelemen 
Reviewed-by: Gabor Kelemen 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index cf01b3231e37..7f1e63d39cc7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -84,10 +84,10 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, 
"tdf129888vml.docx")
 //to be calculated from the page frame instead of the table:
 
 uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
-sal_Int16 nValue;
-xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+bool bValue;
+xShapeProperties->getPropertyValue("IsFollowingTextFlow") >>= bValue;
 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888vml The line shape has bad place!",
- text::RelOrientation::PAGE_FRAME, nValue);
+ false, bValue);
 }
 
 DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, "tdf129888dml.docx")
@@ -98,18 +98,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, 
"tdf129888dml.docx")
 //to be calculated from the page frame instead of the table:
 
 uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
-sal_Int16 nValue;
-xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+bool bValue;
+xShapeProperties->getPropertyValue("IsFollowingTextFlow") >>= bValue;
 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888dml The shape has bad place!",
- text::RelOrientation::PAGE_FRAME, nValue);
+false, bValue);
 }
 
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130120, "tdf130120.docx")
 {
-   //Text for exporting the allowincell attribute:
+//Text for exporting the allowincell attribute:
 xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
 assertXPath(p_XmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/"
-  "mc:Choice/w:drawing/wp:anchor","layoutInCell","0");
+"mc:Choice/w:drawing/wp:anchor", "layoutInCell", "0");
 }
 
 
@@ -117,20 +117,20 @@ DECLARE_OOXMLEXPORT_TEST(testTdf87569v, 
"tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
 uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
-sal_Int16 nValue;
-xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+bool bValue;
+xShapeProperties->getPropertyValue("IsFollowingTextFlow") >>= bValue;
 CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_vml: The Shape is not in the 
table!",
- text::RelOrientation::FRAME, nValue);
+ true, bValue);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx")
 {
 //if the original tdf87569 sample is upgraded it will have drawingml 
shapes...
 uno::Reference xShapeProperties(getShape(1), 
uno::UNO_QUERY);
-sal_Int16 nValue;
-xShapeProperties->getPropertyValue("HoriOrientRelation") >>= nValue;
+bool bValue;
+xShapeProperties->getPropertyValue("IsFollowingTextFlow") >>= bValue;

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

2020-06-11 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf130120.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|9 +++
 sw/source/filter/ww8/docxsdrexport.cxx|   23 --
 sw/source/filter/ww8/ww8graf.cxx  |1 
 writerfilter/source/dmapper/GraphicImport.cxx |   14 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   19 ++
 6 files changed, 62 insertions(+), 4 deletions(-)

New commits:
commit 24aff342ae648706b2f1ff0cdf1202e2d88067d9
Author: Bakos Attila 
AuthorDate: Tue Feb 11 11:43:48 2020 +0100
Commit: Gabor Kelemen 
CommitDate: Thu Jun 11 17:29:30 2020 +0200

tdf#130120 DOCX: export o:allowincell

Object anchors are set by allowincell/
LayoutInCell attributes in table cells.
Export it by grab bag method temporarily,
instead of using the suggested FollowTextFlow,
related also to the missing GUI support.

Follow-up of commit 14ad64270e4fbca3c24da6f55f260b1fb229556a
(tdf#129888 DOCX shape import: handle o:allowincell)

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf130120.docx 
b/sw/qa/extras/ooxmlexport/data/tdf130120.docx
new file mode 100644
index ..5ca2adc76d60
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130120.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 6561bbeb6cb8..8d347be29038 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -91,6 +91,15 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, 
"tdf129888dml.docx")
  text::RelOrientation::PAGE_FRAME, nValue);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130120, "tdf130120.docx")
+{
+   //Text for exporting the allowincell attribute:
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+assertXPath(p_XmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/mc:AlternateContent/"
+  "mc:Choice/w:drawing/wp:anchor","layoutInCell","0");
+}
+
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 7cacc4eb3173..1663ab98e30e 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -31,8 +31,9 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
+#include 
 
 using namespace com::sun::star;
 using namespace oox;
@@ -469,7 +470,25 @@ void DocxSdrExport::startDMLAnchorInline(const 
SwFrameFormat* pFrameFormat, cons
 attrList->add(XML_distR, OString::number(nDistR).getStr());
 attrList->add(XML_simplePos, "0");
 attrList->add(XML_locked, "0");
-attrList->add(XML_layoutInCell, "1");
+bool bLclInTabCell = true;
+if (pObj)
+{
+uno::Reference 
xShape((const_cast(pObj)->getUnoShape()),
+   uno::UNO_QUERY);
+uno::Sequence propList = 
lclGetProperty(xShape, "InteropGrabBag");
+if (propList.hasElements())
+{
+auto pLclProp = std::find_if(
+std::begin(propList), std::end(propList),
+[](const beans::PropertyValue& rProp) { return rProp.Name 
== "LayoutInCell"; });
+if (pLclProp && pLclProp != propList.end())
+pLclProp->Value >>= bLclInTabCell;
+}
+}
+if (bLclInTabCell)
+attrList->add(XML_layoutInCell, "1");
+else
+attrList->add(XML_layoutInCell, "0");
 bool bAllowOverlap = 
pFrameFormat->GetWrapInfluenceOnObjPos().GetAllowOverlap();
 attrList->add(XML_allowOverlap, bAllowOverlap ? "1" : "0");
 if (pObj != nullptr)
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a49d9dea7054..c622366bd954 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2703,7 +2703,6 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( long 
nGrafAnchorCp )
 SdrObject::Free(pObject);
 return nullptr;
 }
-
 const bool bLayoutInTableCell =
 m_nInTable && IsObjectLayoutInTableCell( pRecord->nLayoutInTableCell );
 
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index a2c19383c95d..174674ae46a0 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfi