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

2019-05-10 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf124594.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx|   10 
 sw/source/filter/ww8/docxsdrexport.cxx|   26 +
 writerfilter/source/dmapper/GraphicImport.cxx |   32 ++
 4 files changed, 55 insertions(+), 13 deletions(-)

New commits:
commit da5f9c68a253f28e9c0149e61b5662191a658af2
Author: Miklos Vajna 
AuthorDate: Mon May 6 21:33:59 2019 +0200
Commit: Michael Stahl 
CommitDate: Fri May 10 12:47:44 2019 +0200

tdf#124594 DOCX filter: don't extend margins from effects for rotated shapes

Regression from commit a5a836d8c43dc9cebbbf8af39bf0142de603a7c6 (DOCX
filter: effect extent should be part of the margin, 2014-12-04), the
problem was that extending margins as-is based on the effect extent
values only work correctly in case of non-rotated shapes.

For example, with 90 degree clockwise rotation the top effect extent
should extend the right margin, etc. Fix the bug by limiting this
extension to the non-rotated scenario.

Test the behavior at a layout level, so in case later the effect extent
feature is implemented, it won't be necessary to adjust the test.

(cherry picked from commit 65420c21194a28aeead0238838028b734b663d87)

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

Change-Id: I97271bbb7c079951980b436cb8d8e5e54eeead55
Reviewed-on: https://gerrit.libreoffice.org/71893
Tested-by: Jenkins
Tested-by: Xisco FaulĂ­ 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124594.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124594.docx
new file mode 100644
index ..27abe1841982
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124594.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index b8e6324b97ce..e610254b3b83 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -70,6 +70,16 @@ DECLARE_OOXMLEXPORT_TEST(testFrameSizeExport, 
"floating-tables-anchor.docx")
 assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tblPr/w:tblW", "w", 
"4000");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf124594, "tdf124594.docx")
+{
+xmlDocPtr pDump = parseLayoutDump();
+// Without the accompanying fix in place, this test would have failed, as 
the portion text was
+// only "Er horte leise Schritte hinter", which means the 1st line of the 
2nd paragraph was
+// split into two by a Special portion, i.e. the top margin of the shape 
was too large.
+assertXPath(pDump, "/root/page/body/txt[2]/Text[1]", "Portion",
+"Er horte leise Schritte hinter sich. Das bedeutete nichts 
Gutes. Wer wurde ihm ");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTextInput, "textinput.odt")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index b8372d5e13c1..2979914ae8ff 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -344,6 +344,7 @@ void DocxSdrExport::startDMLAnchorInline(const 
SwFrameFormat* pFrameFormat, cons
 awt::Point aPos(pFrameFormat->GetHoriOrient().GetPos(),
 pFrameFormat->GetVertOrient().GetPos());
 const SdrObject* pObj = pFrameFormat->FindRealSdrObject();
+long nRotation = 0;
 if (pObj != nullptr)
 {
 // SdrObjects know their layer, consider that instead of the frame 
format.
@@ -354,21 +355,28 @@ void DocxSdrExport::startDMLAnchorInline(const 
SwFrameFormat* pFrameFormat, cons
 ->getIDocumentDrawModelAccess()
 .GetInvisibleHellId();
 
-lclMovePositionWithRotation(aPos, rSize, pObj->GetRotateAngle());
+nRotation = pObj->GetRotateAngle();
+lclMovePositionWithRotation(aPos, rSize, nRotation);
 }
 attrList->add(XML_behindDoc, bOpaque ? "0" : "1");
+// Extend distance with the effect extent if the shape is not rotated, 
which is the opposite
+// of the mapping done at import time.
 // The type of dist* attributes is unsigned, so make sure no negative 
value is written.
-sal_Int64 nDistT
-= std::max(static_cast(0), 
TwipsToEMU(aULSpaceItem.GetUpper()) - nTopExt);
+sal_Int64 nTopExtDist = nRotation ? 0 : nTopExt;
+sal_Int64 nDistT = std::max(static_cast(0),
+TwipsToEMU(aULSpaceItem.GetUpper()) - 
nTopExtDist);
 attrList->add(XML_distT, OString::number(nDistT).getStr());
-sal_Int64 nDistB
-= std::max(static_cast(0), 
TwipsToEMU(aULSpaceItem.GetLower()) - nBottomExt);
+sal_Int64 nBottomExtDist = nRotation ? 0 : nBottomExt;
+sal_Int64 nDistB = 

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

2019-02-11 Thread Libreoffice Gerrit user
 dev/null |binary
 sw/qa/extras/layout/data/tdf122878.docx  |binary
 sw/qa/extras/layout/layout.cxx   |   14 +++---
 sw/source/core/text/txtfly.cxx   |1 -
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |3 +--
 5 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit 7ed962571df02d1d7b286e7af534fadd717a8003
Author: Patrick Jaap 
AuthorDate: Wed Jan 23 10:01:36 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 11 18:08:41 2019 +0100

tdf#122878: enable wrap for flys in footer

This patch removes the check for a footer node,
intoduced by
23f698ecee033612ac3a9f5cfd7674b08bb3ccd1
preserving the behaviour for the connected bug reports
i13832 and i24135.

Without this check, the wraping becomes enabled for footer
objects, too.

With this enhencement, the commits
7df33caac85ac90c26e97dedbc201f46dc9e4cb4
d3db6ff43a531ecf1afc858a0a8832353d091644
are directly affected and therefore the unit test is edited.

Change-Id: I093add9e251ac97859a66cb8b8563010ef734c2d
Reviewed-on: https://gerrit.libreoffice.org/67069
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 8e3afdb5989d571410350f1d43fcf26492a4eaff)
Reviewed-on: https://gerrit.libreoffice.org/67671

diff --git a/sw/qa/extras/layout/data/tdf116989.docx 
b/sw/qa/extras/layout/data/tdf116989.docx
deleted file mode 100644
index 498b60dbf345..
Binary files a/sw/qa/extras/layout/data/tdf116989.docx and /dev/null differ
diff --git a/sw/qa/extras/layout/data/tdf122878.docx 
b/sw/qa/extras/layout/data/tdf122878.docx
new file mode 100644
index ..f42e92ea2641
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf122878.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 3b470ff8c2a6..8c132693e68b 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -64,7 +64,7 @@ public:
 void testTdf120287();
 void testTdf120287b();
 void testTdf120287c();
-void testTdf116989();
+void testTdf122878();
 void testTdf115094();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
@@ -102,7 +102,7 @@ public:
 CPPUNIT_TEST(testTdf120287);
 CPPUNIT_TEST(testTdf120287b);
 CPPUNIT_TEST(testTdf120287c);
-CPPUNIT_TEST(testTdf116989);
+CPPUNIT_TEST(testTdf122878);
 CPPUNIT_TEST(testTdf115094);
 CPPUNIT_TEST_SUITE_END();
 
@@ -2652,17 +2652,17 @@ void SwLayoutWriter::testTdf120287c()
 assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 3);
 }
 
-void SwLayoutWriter::testTdf116989()
+void SwLayoutWriter::testTdf122878()
 {
-createDoc("tdf116989.docx");
+createDoc("tdf122878.docx");
 xmlDocPtr pXmlDoc = parseLayoutDump();
 // FIXME: the XPath should be adjusted when the proper floating table 
would be imported
 const sal_Int32 nTblTop
-= getXPath(pXmlDoc, "/root/page[1]/footer/tab/infos/bounds", 
"top").toInt32();
+= getXPath(pXmlDoc, 
"/root/page[1]/footer/txt/anchored/fly/tab/infos/bounds", "top")
+  .toInt32();
 const sal_Int32 nFirstPageParaCount
 = getXPathContent(pXmlDoc, "count(/root/page[1]/body/txt)").toInt32();
-// FIXME: should be exactly 30, when proper floating tables in footers are 
supported
-CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(30), nFirstPageParaCount);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(30), nFirstPageParaCount);
 for (sal_Int32 i = 1; i <= nFirstPageParaCount; ++i)
 {
 const OString xPath = "/root/page[1]/body/txt[" + OString::number(i) + 
"]/infos/bounds";
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 31f04c376233..e16cd878ce75 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -803,7 +803,6 @@ bool SwTextFly::GetTop( const SwAnchoredObject* 
_pAnchoredObj,
// #i13832#, #i24135# wrap around objects in page header
( !pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) 
&&
  nullptr != ( pHeader = pTmp->FindFooterOrHeader() ) &&
- !pHeader->IsFooterFrame() &&
  m_pCurrFrame->IsInDocBody(
 {
 if( pHeader || RndStdIds::FLY_AT_FLY == rNewA.GetAnchorId() )
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 04fd361b7e36..01c7f59fc314 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1176,8 +1176,7 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH_TYPE, 
nTableWidthType);
 if