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

2020-07-22 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfimport/data/picture-in-textframe.rtf |   29 +++
 sw/qa/extras/rtfimport/rtfimport.cxx |   16 ++
 writerfilter/source/rtftok/rtfsdrimport.cxx  |5 +++
 3 files changed, 50 insertions(+)

New commits:
commit 5ccf0dac637345bab3d3a4e37ea6707c6d9bd0a6
Author: Miklos Vajna 
AuthorDate: Mon Jul 20 21:22:14 2020 +0200
Commit: Michael Stahl 
CommitDate: Wed Jul 22 11:19:56 2020 +0200

tdf#134400 RTF import: fix unexpected inner properties for 
picture-in-textframe

Regression from commit 4ab658b56f5c6ff0082d38d8ace1924d11e30e96 (RTF
import: implement support for tables inside text frames, 2013-06-16),
the problem was that both the outer "textbox" and the inner "picture
frame" object had a shapeType property, and the properties were stored
in a vector. So by the time RTFSdrImport::initShape() looked up the
shape type for the inner shape, it thought it's not a picture frame,
leading to data loss.

(cherry picked from commit 5a083be34456e91427d0f2e2fea172f49f4502db)

Change-Id: I4a536789371619d1d54afa8c8d41c7d273b0d21b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99118
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99167
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf 
b/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf
new file mode 100644
index ..ec0a07690bdf
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/picture-in-textframe.rtf
@@ -0,0 +1,29 @@
+{\rtf1
+\paperw10080\paperh12960\margl1066\margr1066\margt1642\margb1066
+\pard\plain
+{\shp
+{\*\shpinst\shpleft31\shptop105\shpright4108\shpbottom3887\shpfhdr0\shpwr2\shpwrk3\shpfblwtxt0
+{\sp
+{\sn shapeType}
+{\sv 202}
+}
+{\shptxt \pard\plain
+before
+{\*\shppict
+{\pict
+{\*\picprop\shplid1025
+{\sp
+{\sn shapeType}
+{\sv 75}
+}
+}
+\picscalex23\picscaley24\piccropl0\piccropr0\piccropt0\piccropb0\picw30372\pich22437\picwgoal17219\pichgoal12720\pngblip
+47494638396110001000d5ffffc0c0c0555f00aafcfcfcf6f6f6eaeaeae6e6e6e4e4e4e3e3e3c2c2c2c1c1c1bcbcbcb5b5b5b3b3b3b0b0b0adadada5a5a5a2a2a2a1a1a19f9f9f9494948a8a8a888686867b7b7b6c6c6c5c5c5c4e4e4e4b4b4b4747474646463d3d3d3c3c3c2e2e2e2525251b1b1b1818181010100909090606060303030021f9040102002c1000100684408170482c0a06c8a4728924389f506833b281302a8e6b164b18103024c52111504cca67332102e0042e9a40d9319f8300a343c1200f54e47f7e2a1e0b0a7d0d728a010d838400261a7c0d94947784252700127e9d159f6c8411140019080ea7a9a85f842122281612b1b3b25d6b1f29291d0fbbbdbc5d5e51c34e4cc64a46c94341003b
+}
+}
+after\par
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index d2c2d4d24c8f..42c0108c020f 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -933,6 +933,22 @@ CPPUNIT_TEST_FIXTURE(Test, testOleInline)
  getProperty(getShape(1), 
"AnchorType"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testPictureInTextframe)
+{
+load(mpTestDocumentPath, "picture-in-textframe.rtf");
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xTextDocument->getDrawPage();
+uno::Reference xInnerShape(xDrawPage->getByIndex(1), 
uno::UNO_QUERY);
+text::TextContentAnchorType eAnchorType = 
text::TextContentAnchorType_AT_PARAGRAPH;
+xInnerShape->getPropertyValue("AnchorType") >>= eAnchorType;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 4
+// i.e. the properties of the inner shape (including its anchor type and 
bitmap fill) were lost
+// on import.
+CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, 
eAnchorType);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf128611)
 {
 load(mpTestDocumentPath, "tdf128611.rtf");
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 85f61129b1f3..ddd2337a9945 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -1129,6 +1129,11 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool 
bClose, ShapeOrPict const shap
 m_rImport.Mapper().endShape();
 }
 }
+
+// If the shape has an inner shape, the inner object's properties should 
not be influenced by
+// the outer one.
+rShape.getProperties().clear();
+
 m_xShape = xShape;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-07-09 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf83309.docx  |binary
 writerfilter/source/dmapper/NumberingManager.cxx |2 ++
 2 files changed, 2 insertions(+)

New commits:
commit 989cdd0a5b2efa83ff0b4ca8bc2adb0b64bde1bb
Author: Vasily Melenchuk 
AuthorDate: Thu Jun 25 11:42:02 2020 +0300
Commit: Xisco Fauli 
CommitDate: Thu Jul 9 16:48:20 2020 +0200

tdf#134260: docx import: allow default value for list tab position

It looks like previously used as a testcase document is just
a specific case with default values. All other readers (incl.
Office 365) displaying that doc with default tab at zero position.

Change-Id: I50fe00c7f87b6d790fbe6e2f32a306ac59060c72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97089
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 7221994b9b29659d3290e95eee92b1a3f80c2b7e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98331
Reviewed-by: Xisco Fauli 
(cherry picked from commit 54b6a6a5c95ed51ce0cd709d9fd3e477ced5ce8f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98332
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf83309.docx 
b/sw/qa/extras/ooxmlexport/data/tdf83309.docx
index 8dfddb6ed201..e8f59bc81969 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf83309.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf83309.docx differ
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index b197e4db80c2..3ea0e2e59da1 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -221,6 +221,8 @@ uno::Sequence 
ListLevel::GetLevelProperties(bool bDefaults
 
 if (m_nTabstop.has_value())
 
aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION, 
*m_nTabstop));
+else if (bDefaults)
+
aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION,
 0));
 
 //TODO: handling of nFLegal?
 //TODO: nFNoRestart lower levels do not restart when higher levels are 
incremented, like:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-11 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf132754.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   16 
 writerfilter/source/dmapper/NumberingManager.cxx |4 +++-
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 10abc94f9b3b223747f9dffd8d43f277343c8e1c
Author: Vasily Melenchuk 
AuthorDate: Sun May 10 00:43:59 2020 +0300
Commit: Thorsten Behrens 
CommitDate: Thu Jun 11 11:27:31 2020 +0200

tdf#132754: DOCX import: changed default list start nubmer

Default value for list numbering startAt is zero. If it is not
proveded numbering starts from this value.

Change-Id: I2cf7be9063e7bfb8b72d6ba77fcd9507e33bb848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93899
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit f8211e84a5239de25fe6dc45a4bb6b6f8673a1ee)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96048

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132754.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132754.docx
new file mode 100644
index ..baec54f5e0d7
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132754.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index f410c889375d..ca870b54e06b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -351,6 +351,22 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128889, 
"tdf128889.fodt")
 assertXPath(pXml, "/w:document/w:body/w:p[1]/w:r[2]/w:br", "type", "page");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132754, "tdf132754.docx")
+{
+{
+uno::Reference xPara(getParagraph(1), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("0.0.0."), getProperty(xPara, 
"ListLabelString"));
+}
+{
+uno::Reference xPara(getParagraph(2), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("0.0.1."), getProperty(xPara, 
"ListLabelString"));
+}
+{
+uno::Reference xPara(getParagraph(3), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("0.0.2."), getProperty(xPara, 
"ListLabelString"));
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf129353, "tdf129353.docx")
 {
 CPPUNIT_ASSERT_EQUAL(8, getParagraphs());
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 322c99200230..a00e780ad240 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -187,8 +187,10 @@ uno::Sequence 
ListLevel::GetLevelProperties(bool bDefaults
 {
 std::vector aNumberingProperties;
 
-if( m_nIStartAt >= 0)
+if (m_nIStartAt >= 0)
 
aNumberingProperties.push_back(lcl_makePropVal(PROP_START_WITH, 
m_nIStartAt) );
+else if (bDefaults)
+
aNumberingProperties.push_back(lcl_makePropVal(PROP_START_WITH, 0));
 
 sal_Int16 nNumberFormat = ConversionHelper::ConvertNumberingType(m_nNFC);
 if( m_nNFC >= 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-28 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf78352.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |9 +
 writerfilter/source/dmapper/DomainMapper.cxx |2 ++
 3 files changed, 11 insertions(+)

New commits:
commit fd6a96606d13a18e65af518668e4432af9e54c1a
Author: Vasily Melenchuk 
AuthorDate: Wed May 20 11:48:47 2020 +0300
Commit: Thorsten Behrens 
CommitDate: Thu May 28 14:13:50 2020 +0200

tdf#78352: docx import: allow tab at left indent for list

Looks like first tab stop for list bullets is at left paragraph
boundry. Luckely there is a compatibility option for this.

Change-Id: Iea4bd2b51912746dbd4722ff61eeb2e9293cab31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94559
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94971

diff --git a/sw/qa/extras/ooxmlexport/data/tdf78352.docx 
b/sw/qa/extras/ooxmlexport/data/tdf78352.docx
new file mode 100644
index ..6f85f2e2ab6a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf78352.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c59bc16709df..f410c889375d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -139,6 +139,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130610, 
"tdf130610_bold_in_2_styles.ott")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf78352, "tdf78352.docx")
+{
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+// Ensure that width of first tab is close to zero (previous value was 
~1000 twips)
+int nWidth = 
parseDump("/root/page/body/txt[1]/Text[@nType='PortionType::TabLeft']", 
"nWidth").toInt32();
+CPPUNIT_ASSERT_LESS(150, nWidth);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
 {
 // tdf#120315 cells of the second column weren't vertically merged
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 938cc59be726..fa18bd9326d0 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -126,6 +126,8 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 // Don't load the default style definitions to avoid weird mix
 m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", 
uno::makeAny(true));
 
+m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", 
uno::makeAny(true));
+
 // Initialize RDF metadata, to be able to add statements during the import.
 try
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-15 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf132514.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx|   10 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |3 --
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   17 +++
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |3 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|2 -
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|   10 
 writerfilter/source/dmapper/PropertyMap.hxx  |9 +++
 8 files changed, 41 insertions(+), 13 deletions(-)

New commits:
commit 6b812999c944e50ac7a9ac8245800f4cf99421ce
Author: László Németh 
AuthorDate: Mon May 4 13:42:14 2020 +0200
Commit: Miklos Vajna 
CommitDate: Fri May 15 12:11:03 2020 +0200

tdf#132514 DOCX import: fix lost table style with footer

Table paragraphs collected for table style processing
were mixed when both body text and footer contain tables,
i.e. clearing paragraph vector at processing the first table
resulted missing paragraph vector and table style processing
for the other one. (Note: only missing bottom paragraph margin
and line spacing were the problems here, not all table style
based paragraph settings, as in branch 'master'.)

Now tables in footer, also nested tables collect their
paragraphs in separated table paragraph vectors.

Regression from commit 6c5da2cd7af5c2d90e4d8e9635ba8c9989c87923
(tdf#119054 DOCX: fix not table style based bottom margin).

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

(cherry picked from commit 81ce88aa80f8e7cde4fdc5b211e9500a3599643c)

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
writerfilter/source/dmapper/DomainMapperTableHandler.cxx
writerfilter/source/dmapper/DomainMapperTableManager.cxx
writerfilter/source/dmapper/DomainMapper_Impl.cxx
writerfilter/source/dmapper/PropertyMap.hxx

Change-Id: Ib8568d8379cfb7da869120cdc7fe12895252d661
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93525
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132514.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132514.docx
new file mode 100644
index ..d32f84104e26
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132514.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index d460679b50ba..a459e8a57f27 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -480,6 +480,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119054, "tdf119054.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "line", 
"240");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf132514, "tdf132514.docx")
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+// Keep table style setting, when the footer also contain a table
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "before", 
"0");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "after", 
"0");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx")
 {
 /*
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index a0b214a76555..5a0ee4eb8b16 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1026,7 +1026,7 @@ void 
DomainMapperTableHandler::ApplyParaProperty(css::beans::PropertyValues aTab
 if (pTableProp != aTableProperties.end())
 {
 uno::Any aValue = pTableProp->Value;
-for (const auto& rParaProp : m_rDMapper_Impl.m_aParagraphsToEndTable)
+for (const auto& rParaProp : 
*m_rDMapper_Impl.getTableManager().getCurrentParagraphs())
 {
 // there is no direct paragraph formatting
 if (!rParaProp.m_pPropertyMap->isSet(eId))
@@ -1224,7 +1224,6 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 m_aCellProperties.clear();
 m_aRowProperties.clear();
 m_bHadFootOrEndnote = false;
-m_rDMapper_Impl.m_aParagraphsToEndTable.clear();
 
 #ifdef DBG_UTIL
 TagLogger::getInstance().endElement();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index f4d025739915..618ca603efe6 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -57,6 +57,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
 m_bPushCurrentWidth(false),
 

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

2020-04-28 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf115719.docx  |binary
 sw/qa/extras/ooxmlexport/data/tdf115719b.docx |binary
 sw/qa/extras/ooxmlimport/data/tdf115719b.docx |binary
 writerfilter/source/dmapper/PropertyMap.cxx   |   22 ++
 4 files changed, 22 insertions(+)

New commits:
commit 5a9e5b3d297094fc014f37d0d3843be82b2f4706
Author: Miklos Vajna 
AuthorDate: Mon Apr 20 21:04:30 2020 +0200
Commit: Xisco Faulí 
CommitDate: Tue Apr 28 11:42:36 2020 +0200

tdf#131446 DOCX import: restrict IncreasedAnchoredObjectSpacing further

Regression from commit 8b73bafbc18acb4dd8911d2f2de8158d98eb6144
(tdf#115719 DOCX import: increase paragraph spacing for anchored
objects, 2018-02-14), this is another case where the workaround for the
Word layout bug is not needed.

tdf115719.docx and tdf115719b.docx are tweaked to have  for 1 shape, as the original bugdoc has it. This allows
us to render both the tdf#115719 and tdf#131446 bug documents the same
way as Word does.

(cherry picked from commit 249428202be04ab9a2271a9cd48922523fa03bc4)

Change-Id: I0c3f197c3360882cd64f8dcf286c6051dc11d674
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92978
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719.docx 
b/sw/qa/extras/ooxmlexport/data/tdf115719.docx
index 4eda09a98fa2..99806d4dc860 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf115719.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf115719.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719b.docx 
b/sw/qa/extras/ooxmlexport/data/tdf115719b.docx
index a632e3df0e7a..f3e3925c8869 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf115719b.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf115719b.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx 
b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx
index 4cb13228443a..7d91108bc0bd 100644
Binary files a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx and 
b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx differ
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index d83d2bd831dd..fbc471415b4c 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1233,6 +1233,28 @@ void 
SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
 if (rAnchor.m_aAnchoredObjects.size() < 4)
 continue;
 
+// Ignore this paragraph if none of the objects are wrapped in the 
background.
+sal_Int32 nOpaqueCount = 0;
+for (const auto& rAnchored : rAnchor.m_aAnchoredObjects)
+{
+uno::Reference 
xShape(rAnchored.m_xAnchoredObject, uno::UNO_QUERY);
+if (!xShape.is())
+{
+continue;
+}
+
+bool bOpaque = true;
+xShape->getPropertyValue("Opaque") >>= bOpaque;
+if (!bOpaque)
+{
+++nOpaqueCount;
+}
+}
+if (nOpaqueCount < 1)
+{
+continue;
+}
+
 // Analyze the anchored objects of this paragraph, now that we know the
 // page width.
 sal_Int32 nShapesWidth = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-20 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf132185.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |9 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |9 -
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit cef38a8363efbd973f566f7595f0b6cfc41fdc2b
Author: Mike Kaganski 
AuthorDate: Sun Apr 19 19:54:59 2020 +0300
Commit: Mike Kaganski 
CommitDate: Mon Apr 20 11:39:15 2020 +0200

tdf#132185: field command does not necessarily end with space

Change-Id: I5a5e54fb42e20855b75af7ab523465a032ab46e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92504
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92444
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf132185.docx 
b/sw/qa/extras/ooxmlexport/data/tdf132185.docx
new file mode 100644
index ..955de5097945
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132185.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index d20d8a90938f..9d89184cde74 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -736,6 +736,15 @@ DECLARE_OOXMLEXPORT_TEST(testDropDownFieldEntryLimit, 
"tdf126792.odt" )
 CPPUNIT_ASSERT_EQUAL(sal_Int32(25), vListEntries.getLength());
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf132185, "tdf132185.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
+// Since the default (without xml:space attribute) is to ignore leading 
and trailing spaces,
+// " PAGE \\* roman " will get imported as "PAGE \\* roman". This is also 
valid, and must be
+// treated accordingly. "roman" was ignored before the fix, exporting only 
" PAGE ".
+assertXPathContent(pXmlDoc, "/w:ftr/w:p/w:r[2]/w:instrText", " PAGE \\* 
roman ");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 13f1ce4ad6a2..a04af3c1c8aa 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2902,7 +2902,14 @@ static sal_Int16 lcl_ParseNumberingType( const OUString& 
rCommand )
 sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
 
 //  The command looks like: " PAGE \* Arabic "
-OUString sNumber = msfilter::util::findQuotedText(rCommand, "\\* ", ' ');
+// tdf#132185: but may as well be "PAGE \* Arabic"
+OUString sNumber;
+constexpr OUStringLiteral rSeparator("\\* ");
+if (sal_Int32 nStartIndex = rCommand.indexOf(rSeparator); nStartIndex >= 0)
+{
+nStartIndex += rSeparator.getLength();
+sNumber = rCommand.getToken(0, ' ', nStartIndex);
+}
 
 if( !sNumber.isEmpty() )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-14 Thread László Németh (via logerrit)
 sw/qa/core/data/ooxml/pass/tdf123001.docx |binary
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   20 
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 5213c70a2d6cfd08750145e5b8152180ef7b5faa
Author: László Németh 
AuthorDate: Thu Apr 9 17:20:18 2020 +0200
Commit: Xisco Faulí 
CommitDate: Tue Apr 14 20:12:39 2020 +0200

tdf#132001 DOCX import: fix crash: redline in floating table

Copying redlines to frame text was failed in tables inside
frames. Skip these redlines temporarily.

Regression from commit e8bae67b3dbcc90ace8264b6b1aefaf0ce459aba
(tdf#125894: DOCX: import tracked changes in frames).

Change-Id: I4f3ca2e95fb2e7637f8cf8dca1088a7727bcf98d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91985
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 1350832be533ce6627607b1aaabd2b3565e6e7b3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92015
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/core/data/ooxml/pass/tdf123001.docx 
b/sw/qa/core/data/ooxml/pass/tdf123001.docx
new file mode 100644
index ..e94a66208e0d
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/tdf123001.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8e13daa08efb..13f1ce4ad6a2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6264,10 +6264,19 @@ void DomainMapper_Impl::ExecuteFrameConversion()
 uno::Reference< text::XTextRange > xRange;
 aFramedRedlines[i] >>= xRange;
 uno::Reference xRangeCursor = 
GetTopTextAppend()->createTextCursorByRange( xRange );
-sal_Int32 nLen = xRange->getString().getLength();
-redLen.push_back(nLen);
-xRangeCursor->gotoRange(m_xFrameStartRange, true);
-redPos.push_back(xRangeCursor->getString().getLength() - nLen);
+if (xRangeCursor.is())
+{
+sal_Int32 nLen = xRange->getString().getLength();
+redLen.push_back(nLen);
+xRangeCursor->gotoRange(m_xFrameStartRange, true);
+redPos.push_back(xRangeCursor->getString().getLength() - 
nLen);
+}
+else
+{
+// failed createTextCursorByRange(), for example, table 
inside the frame
+redLen.push_back(-1);
+redPos.push_back(-1);
+}
 }
 
 const uno::Reference< text::XTextContent >& xTextContent = 
xTextAppendAndConvert->convertToTextFrame(
@@ -6280,6 +6289,9 @@ void DomainMapper_Impl::ExecuteFrameConversion()
 {
 OUString sType;
 beans::PropertyValues aRedlineProperties( 3 );
+// skip failed createTextCursorByRange()
+if (redPos[i/3] == -1)
+continue;
 aFramedRedlines[i+1] >>= sType;
 aFramedRedlines[i+2] >>= aRedlineProperties;
 uno::Reference< text::XTextFrame > xFrame( xTextContent, 
uno::UNO_QUERY_THROW );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-08 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf131594.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |7 +++
 writerfilter/source/dmapper/DomainMapper.cxx |   25 +++--
 3 files changed, 22 insertions(+), 10 deletions(-)

New commits:
commit de5a0023695584a4c2c5a2729284186d43fc7d82
Author: Xisco Fauli 
AuthorDate: Thu Mar 26 15:50:59 2020 +0100
Commit: Michael Stahl 
CommitDate: Wed Apr 8 11:32:37 2020 +0200

tdf#131594: switch line numbering off if w:countBy="0"

See https://bugs.documentfoundation.org/show_bug.cgi?id=131594#c0
for more info

Change-Id: Ic57826eb5a440e83cea1d9bde5e9144727e3b6df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91141
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 910197b8cf9b653c1b39b35b73424a36b7c1d1ae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91512
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf131594.docx 
b/sw/qa/extras/ooxmlexport/data/tdf131594.docx
new file mode 100644
index ..009c6d56bd85
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131594.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 91817f2f2220..47db568932bd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -682,6 +682,13 @@ DECLARE_OOXMLEXPORT_TEST(testImageCommentAtChar, 
"image-comment-at-char.docx")
  getProperty(getRun(xPara, 5), 
"TextPortionType"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131594, "tdf131594.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+// lnNumType should not be exported if w:countBy="0"
+assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:lnNumType", 0);
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121663, "tdf121663.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 70cd838d59b5..938cc59be726 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1996,19 +1996,24 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 {
 uno::Reference< text::XLineNumberingProperties > 
xLineNumberingProperties( m_pImpl->GetTextDocument(), uno::UNO_QUERY_THROW );
 uno::Reference< beans::XPropertySet > xLineNumberingPropSet = 
xLineNumberingProperties->getLineNumberingProperties();
-xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_IS_ON ), uno::makeAny(true) );
-if( aSettings.nInterval )
-xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_INTERVAL ), uno::makeAny(static_cast(aSettings.nInterval)) );
-if( aSettings.nDistance != -1 )
-xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) );
+if( aSettings.nInterval == 0 )
+xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_IS_ON ), uno::makeAny(false) );
 else
 {
-// set Auto value (0.5 cm)
-xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_DISTANCE ), uno::makeAny(static_cast(500)) );
-if( pSectionContext )
-pSectionContext->SetdxaLnn( static_cast(283) );
+xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_IS_ON ), uno::makeAny(true) );
+if( aSettings.nInterval )
+xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_INTERVAL ), uno::makeAny(static_cast(aSettings.nInterval)) );
+if( aSettings.nDistance != -1 )
+xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) );
+else
+{
+// set Auto value (0.5 cm)
+xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_DISTANCE ), uno::makeAny(static_cast(500)) );
+if( pSectionContext )
+pSectionContext->SetdxaLnn( 
static_cast(283) );
+}
+xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) );
 }
-xLineNumberingPropSet->setPropertyValue(getPropertyName( 
PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) );
 }
 catch( const uno::Exception& )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-04 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf123873.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   10 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 ++
 3 files changed, 12 insertions(+)

New commits:
commit 612a8bd9cfda531b6c610118f7c3b22fef047e83
Author: Bakos Attila 
AuthorDate: Thu Feb 6 12:01:17 2020 +0100
Commit: Samuel Mehrbrodt 
CommitDate: Wed Mar 4 10:55:32 2020 +0100

tdf#123873 DOCX IMPORT: fix unhandled textwrap for objects

The OLE objects (in this case charts) had bad wrap option setting
and this lead to misplaced objects. Now this parameter is set
according to the file.

Change-Id: I506be91b6801f0ffc3942e514f81119d895fdcb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88091
Tested-by: Jenkins
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit affe9c8384475fc85027703332bc0f1b36eaa0a6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89908
Reviewed-by: Samuel Mehrbrodt 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf123873.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123873.docx
new file mode 100644
index ..b1de7f71f75a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123873.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 2365be2a5984..5c1bdc0582b9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -43,6 +43,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, 
"tdf128207.docx")
 assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123873, "tdf123873.docx")
+{
+//OLE Object were overlapped due to missing wrap import
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(p_XmlDoc);
+assertXPath(
+p_XmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom");
+}
+
+
 DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx")
 {
 //the line shape has anchor in the first cell however it has to
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fc189d7dcf9d..8e13daa08efb 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6142,6 +6142,8 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 xEmbeddedProps->setPropertyValue("VertOrient", 
xShapeProps->getPropertyValue("VertOrient"));
 xEmbeddedProps->setPropertyValue("VertOrientPosition", 
xShapeProps->getPropertyValue("VertOrientPosition"));
 xEmbeddedProps->setPropertyValue("VertOrientRelation", 
xShapeProps->getPropertyValue("VertOrientRelation"));
+//tdf123873 fix missing textwrap import
+xEmbeddedProps->setPropertyValue("TextWrap", 
xShapeProps->getPropertyValue("TextWrap"));
 }
 }
 //insert it into the document at the current cursor position
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-21 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx|   11 +++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   12 +++-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 541f5b508e7d356803eac2bdce4278649ee76203
Author: Szabolcs Toth 
AuthorDate: Thu Feb 20 10:54:19 2020 +0100
Commit: Xisco Faulí 
CommitDate: Fri Feb 21 18:01:59 2020 +0100

tdf#130799 DOCX import: fix missing inside vertical borders

caused by incomplete handling of tables with 1-column
rows with merged cells.

Have to check the rows below current to see if they contain
also one cell, therefore form a column, or more than one cell,
in which case do not remove vertical borders.

Regression from commit: 8a2eb40abbd52d960dd21308157186be0ca9dd3d
(tdf#129442 DOCX import: fix right border of 1-column tables).

Change-Id: If9ca7ccd42255e78c61b6271e19262ab5cc8e439
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89081
Tested-by: László Németh 
Reviewed-by: László Németh 
(cherry picked from commit 111db716c23f9f8450eda58c13dd2423770fd15e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89134
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index c85b8a7f932f..71628cb81e93 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1071,6 +1071,17 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, 
"tdf95495.docx")
 assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:ilvl 
[@w:val = '1']", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx")
+{
+// tdf#130799: Inside vertical borders of a table should not be missing.
+
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+// Left and right borders.
+assertXPathChildren(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 83cf9277b3e9..a0b214a76555 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -836,7 +836,17 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 // Do not apply vertical borders to a one column table.
 else if (m_aCellProperties.size() > 1 && 
aRowOfCellsIterator->size() <= 1)
 {
-rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
+bool isOneCol = true;
+for (size_t i = nRow; i < m_aCellProperties.size(); i++)
+{
+if (m_aCellProperties[i].size() > 1)
+{
+isOneCol = false;
+break;
+}
+}
+if (isOneCol)
+rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
 }
 // Do not apply horizontal borders to a one row table.
 else if (m_aCellProperties.size() == 1 && 
aRowOfCellsIterator->size() > 1)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-21 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf95495.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx   |   10 +
 writerfilter/source/dmapper/StyleSheetTable.cxx |   44 ++--
 3 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit 7c339186b4b41ce9a591cb8fb14ec3120567
Author: Szabolcs Toth 
AuthorDate: Fri Jan 24 10:40:01 2020 +0100
Commit: Xisco Faulí 
CommitDate: Fri Feb 21 17:15:55 2020 +0100

tdf#95495 DOCX import: fix inherited list level of custom styles

in DOCX export of MSO 2003, 2007 and 2010, where ilvl and outlinelvl
settings are missing, based on the settings of the parent styles.

Change-Id: I01d239db505d46a89d7f3b9118ef0b55697bc7fc
CO-Author: Balázs Nádasdy (NISZ)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87328
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/+/89216
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf95495.docx 
b/sw/qa/extras/ooxmlexport/data/tdf95495.docx
new file mode 100644
index ..21f534b11223
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf95495.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index a87a0b2919f3..c85b8a7f932f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1061,6 +1061,16 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, 
"tdf129452_BottomBorders.docx")
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testNumberingLevels, "tdf95495.docx")
+{
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+
+// tdf#95495: set list level of the custom style based on the setting of 
the parent style
+assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:numPr/w:ilvl 
[@w:val = '1']", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 08881a93a9fe..e4f970dbcd0e 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -892,6 +892,12 @@ uno::Sequence< OUString > PropValVector::getNames()
 return comphelper::containerToSequence(aRet);
 }
 
+static bool lcl_IsOutLineStyle(const OUString& sPrefix, const OUString& 
sStyleName)
+{
+OUString sSuffix;
+return sStyleName.getLength() == (sPrefix.getLength() + 2) && 
sStyleName.startsWith(sPrefix + " ", ) && sSuffix.toInt32() > 0;
+}
+
 void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
 {
 try
@@ -1049,13 +1055,39 @@ void StyleSheetTable::ApplyStyleSheets( const 
FontTablePtr& rFontTable )
 }
 
 // Set the outline levels
-const StyleSheetPropertyMap* pStyleSheetProperties = 
dynamic_cast(pEntry ? pEntry->pProperties.get() : 
nullptr);
+StyleSheetPropertyMap* pStyleSheetProperties = 
dynamic_cast(pEntry ? pEntry->pProperties.get() : 
nullptr);
+
 if ( pStyleSheetProperties )
 {
 beans::PropertyValue aLvlVal( getPropertyName( 
PROP_OUTLINE_LEVEL ), 0,
 uno::makeAny( sal_Int16( 
pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ),
 beans::PropertyState_DIRECT_VALUE );
 aPropValues.push_back(aLvlVal);
+
+// tdf#95495 missing list level settings in custom 
styles in old DOCX: apply settings of the parent style
+if (pStyleSheetProperties->GetListLevel() == -1 && 
pStyleSheetProperties->GetOutlineLevel() == -1)
+{
+const beans::PropertyValues aPropGrabBag = 
pEntry->GetInteropGrabBagSeq();
+for (const auto& rVal : aPropGrabBag)
+{
+if (rVal.Name == "customStyle" && 
rVal.Value == true)
+{
+OUString sBaseId = 
pEntry->sBaseStyleIdentifier;
+for (const auto& aSheetProps : 
m_pImpl->m_aStyleSheetEntries)
+{
+if (aSheetProps->sStyleIdentifierD 
== sBaseId)
+{
+StyleSheetPropertyMap* 
aStyleSheetProps
+= 

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

2020-02-10 Thread Jan-Marek Glogowski (via logerrit)
 sw/qa/extras/ooxmlimport/data/tdf129912.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |   36 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |1 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 
 4 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit a4567fb085ae313f514d2001b9e52499c9887a56
Author: Jan-Marek Glogowski 
AuthorDate: Tue Feb 4 14:29:46 2020 +0100
Commit: Miklos Vajna 
CommitDate: Mon Feb 10 12:23:58 2020 +0100

tdf#129912 correctly stop unstyled footnote parsing

The bug document somehow manages to generated a footnote, which
never terminates the format loop in SwTextFrame::Format_.

It contains an unstyled footnote, which I wasn't able to reproduce
to create in Word. So I manually edited the XML of the included
unit test document, which I used to develop the original patch,
and which reproduces the broken parsing behaviour.

This patch correctly stops the parsing of the custom footnote
reference, if the text run containing the footnote reference is
finished, which also fixes loading the bug document.

The unit test checks various footnote variants, which represent
different problems I found when developing the custom footnote
parsing in commit a991ad93dcd6807d0eacd11a50c2ae43a2cfb882
("tdf#121441 improve DOCX footnote import") and now also includes
an unstyled one.

It also contains a (still?) broken footnote test, with a complex
differing footnote.

Change-Id: I748955285d76b6f3122d1da5d8823068f3d7633f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87981
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 7d886eec953efa593708db9560d0e69ac12c99cf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87993
Tested-by: Xisco Faulí 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf129912.docx 
b/sw/qa/extras/ooxmlimport/data/tdf129912.docx
new file mode 100644
index ..d87255ffd61d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129912.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 29a1e4e0dcf0..82a18d353b0c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -25,6 +25,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -541,6 +543,40 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129659, "tdf129659.docx")
 // don't crash on footnote with page break
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129912, "tdf129912.docx")
+{
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+
+// Goto*FootnoteAnchor iterates the footnotes in a ring, so we need the 
amount of footnotes to stop the loop
+sal_Int32 nCount = pWrtShell->GetDoc()->GetFootnoteIdxs().size();
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5), nCount);
+
+// the expected footnote labels
+// TODO: the 5th label is actually wrong (missing the "PR" after the 
symbol part), but the "b" is there?!
+const sal_Unicode pLabel5[] = { u'\xF0D1', u'\xF031', u'\xF032', u'\x0062' 
};
+const OUString sFootnoteLabels[] = {
+OUString(u'\xF0A7'), "1", "2", OUString(u'\xF020'), { pLabel5, 
SAL_N_ELEMENTS(pLabel5) }
+};
+CPPUNIT_ASSERT_EQUAL(sal_Int32(SAL_N_ELEMENTS(sFootnoteLabels)), nCount);
+
+pWrtShell->GotoPrevFootnoteAnchor();
+nCount--;
+while (nCount >= 0)
+{
+SwFormatFootnote aFootnoteNote;
+CPPUNIT_ASSERT(pWrtShell->GetCurFootnote());
+OUString sNumStr = aFootnoteNote.GetNumStr();
+if (sNumStr.isEmpty())
+sNumStr = OUString::number(aFootnoteNote.GetNumber());
+CPPUNIT_ASSERT_EQUAL(sFootnoteLabels[nCount], sNumStr);
+pWrtShell->GotoPrevFootnoteAnchor();
+nCount--;
+}
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 4ea227cd8e0e..61136bd30a56 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -958,7 +958,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 break;
 case NS_ooxml::LN_CT_FtnEdnRef_id:
 // footnote or endnote reference id - not needed
-m_pImpl->StartCustomFootnote(m_pImpl->GetTopContext());
 break;
 case NS_ooxml::LN_CT_Color_themeColor:
 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, 
"themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
diff --git 

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

2020-02-07 Thread László Németh (via logerrit)
 sw/qa/core/data/ooxml/pass/tdf108272.docx|binary
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   10 +-
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |6 +++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   11 ++-
 4 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit bd704b167a07054335601aa86c636d7db84e982a
Author: László Németh 
AuthorDate: Mon Feb 3 13:54:57 2020 +0100
Commit: Xisco Faulí 
CommitDate: Fri Feb 7 17:57:07 2020 +0100

tdf#108272 DOCX table-only header: fix SAX parser error

Floating tables in table-only headers are imported
as non-floating ones after a SAX parser error. Now
we import them as non-floating ones from the beginning
to avoid of the parser error.

Change-Id: I0a816a7af642f402a25ed53d9766b1e8b82db789
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87874
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit 213d6390a2cc59d174173f4359c161625a9c4bdc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88097
Reviewed-by: Miklos Vajna 
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/core/data/ooxml/pass/tdf108272.docx 
b/sw/qa/core/data/ooxml/pass/tdf108272.docx
new file mode 100644
index ..8ee707c5ba8f
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/tdf108272.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index f4d025739915..5315e947ceae 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -51,7 +51,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
 m_nGridAfter(0),
 m_nHeaderRepeat(0),
 m_nTableWidth(0),
-m_bIsInShape(false),
+m_bIsUnfloatTable(false),
 m_aTmpPosition(),
 m_aTmpTableProperties(),
 m_bPushCurrentWidth(false),
@@ -339,8 +339,8 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 case NS_ooxml::LN_CT_TblPrBase_tblpPr:
 {
 writerfilter::Reference::Pointer_t pProperties 
= rSprm.getProps();
-// Ignore  in shape text, those tables should be 
always non-floating ones.
-if (!m_bIsInShape && pProperties.get())
+// Ignore  in shape text or in table-only 
header, those tables should be always non-floating ones.
+if (!m_bIsUnfloatTable && pProperties.get())
 {
 TablePositionHandlerPtr pHandler = 
m_aTmpPosition.back();
 if ( !pHandler )
@@ -430,9 +430,9 @@ TablePositionHandler* 
DomainMapperTableManager::getCurrentTableRealPosition()
 return nullptr;
 }
 
-void DomainMapperTableManager::setIsInShape(bool bIsInShape)
+void DomainMapperTableManager::setIsUnfloatTable(bool bIsUnfloatTable)
 {
-m_bIsInShape = bIsInShape;
+m_bIsUnfloatTable = bIsUnfloatTable;
 }
 
 void DomainMapperTableManager::startLevel( )
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index 219986870ef3..d58d5e29095e 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -46,8 +46,8 @@ class DomainMapperTableManager : public TableManager
 sal_uInt32  m_nGridAfter; ///< number of grid columns in the parent 
table's table grid which shall be left after the last cell in the table row
 sal_Int32   m_nHeaderRepeat; //counter of repeated headers - if == -1 
then the repeating stops
 sal_Int32   m_nTableWidth; //might be set directly or has to be 
calculated from the column positions
-/// Are we in a shape (text append stack is not empty) or in the body 
document?
-bool m_bIsInShape;
+/// Unfloat tables in a shape/table-only header (text append stack is not 
empty)
+bool m_bIsUnfloatTable;
 OUString m_sTableStyleName;
 /// Grab-bag of table look attributes for preserving.
 comphelper::SequenceAsHashMap m_aTableLook;
@@ -131,7 +131,7 @@ public:
 
 using TableManager::isInCell;
 
-void setIsInShape(bool bIsInShape);
+void setIsUnfloatTable(bool bIsUnfloatTable);
 
 };
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe6283616c1e..58aa43b82712 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1843,6 +1843,11 @@ void DomainMapper_Impl::appendTextPortion( const 
OUString& rString, const Proper
 
 if (m_aTextAppendStack.empty())
 return;
+
+// not a table-only header, don't avoid of floating tables
+if (m_eInHeaderFooterImport == HeaderFooterImportState::header && 
!IsInShape() && hasTableManager() && 

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

2020-01-30 Thread Jan-Marek Glogowski (via logerrit)
 sw/qa/extras/ooxmlimport/data/tdf129659.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|5 +
 writerfilter/source/dmapper/DomainMapper.cxx |   15 +++
 3 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit a0db764766dffe868ba3075901326ed6410ea037
Author: Jan-Marek Glogowski 
AuthorDate: Mon Jan 20 22:49:31 2020 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Thu Jan 30 16:55:34 2020 +0100

tdf#129659 DOCX check global footnote context

Since tdf#121441 we parse custom footnotes to get at least the
DOCX footnote text, even if we can't represent the formating. This
might push additional contexts to the parser stack. Therefore it's
now not sufficient to check the current context for a footnote,
but one has to check the global parser for a footnote context.

The actual bug is the unsupported footnote page break, which was
not correctly ignored and added a paragraph context to the stack,
resulting in the async substream input and output stack size.

Change-Id: I143254e7df37a619cb4efb542b58d3eff3afffa7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87114
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit b87af9775167002d36a3bc16cb308ea7895d7ea0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87742
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf129659.docx 
b/sw/qa/extras/ooxmlimport/data/tdf129659.docx
new file mode 100644
index ..38bd040d59bd
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129659.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 636e0337ad81..29a1e4e0dcf0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -536,6 +536,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf130214, "tdf130214.docx")
 // Currently this file imports with errors because of tdf#126435; it must 
not segfault on load
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129659, "tdf129659.docx")
+{
+// don't crash on footnote with page break
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f7f24546def8..4ea227cd8e0e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3174,8 +3174,7 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, 
size_t len)
 }
 }
 
-PropertyMapPtr pContext = m_pImpl->GetTopContext();
-if (pContext && !pContext->GetFootnote().is())
+if (!m_pImpl->GetFootnoteContext())
 {
 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, 
uno::makeAny(style::BreakType_PAGE_BEFORE));
@@ -3184,7 +3183,8 @@ void DomainMapper::lcl_text(const sal_uInt8 * data_, 
size_t len)
 m_pImpl->clearDeferredBreaks();
 }
 
-if( pContext->GetFootnote().is() && m_pImpl->IsInCustomFootnote() )
+PropertyMapPtr pContext = m_pImpl->GetTopContext();
+if (pContext && pContext->GetFootnote().is() && 
m_pImpl->IsInCustomFootnote())
 {
 pContext->GetFootnote()->setLabel(sText);
 //otherwise ignore sText
@@ -3410,7 +3410,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 const bool bSingleParagraph = 
m_pImpl->GetIsFirstParagraphInSection() && 
m_pImpl->GetIsLastParagraphInSection();
 const bool bSingleParagraphAfterRedline = 
m_pImpl->GetIsFirstParagraphInSection(true) && 
m_pImpl->GetIsLastParagraphInSection();
 PropertyMapPtr pContext = 
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
-if (pContext && !pContext->GetFootnote().is())
+if (!m_pImpl->GetFootnoteContext())
 {
 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 {
@@ -3470,9 +3470,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 }
 else
 {
-
-PropertyMapPtr pContext = m_pImpl->GetTopContext();
-if ( pContext && !pContext->GetFootnote().is() )
+if (!m_pImpl->GetFootnoteContext())
 {
 if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 {
@@ -3501,7 +3499,8 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 m_pImpl->clearDeferredBreaks();
 }
 
-if( pContext && pContext->GetFootnote().is() )
+PropertyMapPtr pContext = m_pImpl->GetTopContext();
+if (pContext && pContext->GetFootnote().is() && 
m_pImpl->IsInCustomFootnote())
 {
 pContext->GetFootnote()->setLabel( 

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

2020-01-28 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/ooxmlimport/data/tdf130214.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |5 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 ++
 3 files changed, 11 insertions(+)

New commits:
commit a232c0a72b195975c1c77e7e70ab844cd6d3f65f
Author: Mike Kaganski 
AuthorDate: Tue Jan 28 13:22:56 2020 +0300
Commit: Xisco Faulí 
CommitDate: Tue Jan 28 23:43:09 2020 +0100

tdf#130214: workaround invalid state resulting from error on import

Obviously the real error is somewhere else, which results in tdf#126435,
and produces unexpected state with missing text append context on stack.
This is just a hack to avoid crash.

Change-Id: I420ac3b74f5efb9688dc764ac2ad0dcc974ba0e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87595
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 
(cherry picked from commit eca00082c78fddf79f247057227404738be8806c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87634
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf130214.docx 
b/sw/qa/extras/ooxmlimport/data/tdf130214.docx
new file mode 100644
index ..4344e1c6e44e
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf130214.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index d75a8c0dc4fe..636e0337ad81 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -531,6 +531,11 @@ DECLARE_OOXMLIMPORT_TEST(testTdf103345, 
"numbering-circle.docx")
 }
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf130214, "tdf130214.docx")
+{
+// Currently this file imports with errors because of tdf#126435; it must 
not segfault on load
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4206b41ddaed..8128c800e834 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4426,6 +4426,12 @@ void DomainMapper_Impl::handleBibliography
 (const FieldContextPtr& pContext,
 const OUString & sTOCServiceName)
 {
+if (m_aTextAppendStack.empty())
+{
+// tdf#130214: a workaround to avoid crash on import errors
+SAL_WARN("writerfilter.dmapper", "no text append stack");
+return;
+}
 // Create section before setting m_bStartTOC and m_bStartBibliography: 
finishing paragraph
 // inside StartIndexSectionChecked could do the wrong thing otherwise
 const auto xTOC = StartIndexSectionChecked(sTOCServiceName);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-20 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  |   13 +
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx   |   17 ++---
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 63518134fc0a148dcce75bebaba43dc5ae761da8
Author: Szabolcs Toth 
AuthorDate: Mon Dec 30 10:09:34 2019 +0100
Commit: Xisco Faulí 
CommitDate: Mon Jan 20 09:18:57 2020 +0100

tdf#129452 DOCX import: fix bottom border of merged column

Bottom border of a vertically merged column of a table was missing
if the inside borders were turned off and the merge included the
last cell of the column. This happened because the first cell
(topmost) in a set of vertically merged cells determines the borders
of the new merged cell, and the turned off inside borders were at
the bottom in this case.

Change-Id: I3d3defad18a1315117a554a36ad599eb46daffe9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85988
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 0f4dd820ee433932d9d9237b676292d31c4ba913)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86430
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx
new file mode 100644
index ..0e8ddd6d3833
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 4511509e69cd..55ac7efb2718 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1048,6 +1048,19 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorder, 
"tdf129450_BottomBorder.docx")
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx")
+{
+// tdf#129452: Do not omit bottom borders when a column in a table is 
vertically merged and
+// the inside borders are turned off.
+
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 0);
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index b3bd18de4931..820408638a8d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -98,7 +98,7 @@ static void lcl_mergeBorder( PropertyIds nId, const 
PropertyMapPtr& pOrig, const
 }
 
 static void lcl_computeCellBorders( const PropertyMapPtr& pTableBorders, const 
PropertyMapPtr& pCellProps,
-sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow )
+sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow, bool 
bMergedVertically )
 {
 boost::optional pVerticalVal = 
pCellProps->getProperty(META_PROP_VERTICAL_BORDER);
 boost::optional pHorizontalVal = 
pCellProps->getProperty(META_PROP_HORIZONTAL_BORDER);
@@ -157,10 +157,13 @@ static void lcl_computeCellBorders( const PropertyMapPtr& 
pTableBorders, const P
 if ( nRow == 0 )
 {
 lcl_mergeBorder( PROP_TOP_BORDER, pTableBorders, pCellProps );
-if ( pHorizontalVal )
+if ( pHorizontalVal && !bMergedVertically )
 pCellProps->Insert( PROP_BOTTOM_BORDER, aHorizProp, false );
 }
 
+if ( bMergedVertically )
+lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps );
+
 if ( bIsEndRow )
 {
 lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps );
@@ -841,7 +844,15 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
 }
 
-lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, 
nCell, nRow, bIsEndCol, bIsEndRow );
+// tdf#129452 Checking if current cell is vertically merged 
with all the other cells below to the bottom.
+// This must be done in order to apply the bottom border of 
the table to the first cell in a vertical merge.
+bool bMergedVertically = 
bool(m_aCellProperties[nRow][nCell]->getProperty(PROP_VERTICAL_MERGE));
+
+for (size_t i = nRow + 1; bMergedVertically && i < 
m_aCellProperties.size(); i++)
+if ( 

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

2020-01-19 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129888dml.docx   |binary
 sw/qa/extras/ooxmlexport/data/tdf129888vml.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   28 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 -
 writerfilter/source/dmapper/GraphicImport.cxx |2 -
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |   24 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |1 
 7 files changed, 54 insertions(+), 16 deletions(-)

New commits:
commit 47bc0ff1ad0f07b07a75f55d3bb898e113a415b2
Author: Bakos Attila 
AuthorDate: Thu Jan 16 13:45:47 2020 +0100
Commit: László Németh 
CommitDate: Mon Jan 20 08:35:11 2020 +0100

tdf#129888 DOCX shape import: handle o:allowincell

(VML) and layoutInCell (DrawingML) attributes to fix
regressions caused by commit 10f29d8bf05d44ca8bc11d34d1294ec17f8ac0f1
(tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables).

Position of shapes anchored to tables is calculated from
the cell margin only if the previous attributes allow that.

Change-Id: Ifcfcb7f4959aea522dd45dff00cefd1bb9f4edda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86922
Tested-by: Jenkins
Reviewed-by: László Németh 
Signed-off-by: xisco 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86980
Reviewed-by: Attila Bakos 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx
new file mode 100644
index ..1f6b03034fda
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129888dml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx
new file mode 100644
index ..ee7c60f8a8dc
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf129888vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 516d65d9bcb8..bb9e3932320f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -42,6 +42,34 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, 
"tdf128207.docx")
 assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx")
+{
+//the line shape has anchor in the first cell however it has to
+//be positioned to an another cell. To reach this we must handle
+//the o:allowincell attribute of the shape, and its position has
+//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;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888vml The line shape has bad place!",
+ text::RelOrientation::PAGE_FRAME, nValue);
+}
+
+DECLARE_OOXMLIMPORT_TEST(testTdf129888dml, "tdf129888dml.docx")
+{
+//the shape has anchor in the first cell however it has to
+//be positioned to the right side of the page. To reach this we must handle
+//the layoutInCell attribute of the shape, and its position has
+//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;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf129888dml The shape has bad place!",
+ text::RelOrientation::PAGE_FRAME, nValue);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 3fd2e98fe018..f7f24546def8 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3046,21 +3046,6 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 m_pImpl->PushPendingShape(xShape);
 
 m_pImpl->SetIsFirstParagraphInShape(true);
-
-//tdf#87569: Fix table layout with correcting anchoring
-//If anchored object is in table, Word calculates its position from cell 
border
-//instead of page (what is set in the sample document)
-if (m_pImpl->m_nTableDepth > 0) //if we had a table
-{
-uno::Reference xShapePropSet(xShape, 
uno::UNO_QUERY);
-sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the 
current setting
-xShapePropSet->getPropertyValue("HoriOrientRelation") >>= 
nCurrentHorOriRel;
-//and the correction:
-if (nCurrentHorOriRel == text::RelOrientation::PAGE_FRAME)
-xShapePropSet->setPropertyValue("HoriOrientRelation",
- 

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

2020-01-13 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf128207.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|8 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 
 writerfilter/source/dmapper/GraphicImport.cxx |5 +
 writerfilter/source/dmapper/GraphicImport.hxx |2 ++
 5 files changed, 19 insertions(+)

New commits:
commit 4fcc04d134644a3013df7f331fe36072b96adb9f
Author: Bakos Attila 
AuthorDate: Fri Jan 10 10:49:14 2020 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 13 12:27:47 2020 +0100

tdf#128207: DOCX import: fix chart positioning

Embedded graphic objects had got 0 values for vertical and horizontal
positioning before, resulting overlapping, hidden charts,
but now they are positioned according to the values in the document.

Change-Id: Ia5403ac65ff7192d61072e8a9d8a7f80c7178b9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86521
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit d9c535ead688e9f156dbcf43948df08a69e218be)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86536
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128207.docx 
b/sw/qa/extras/ooxmlexport/data/tdf128207.docx
new file mode 100644
index ..c234ec8bc10f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf128207.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 062831503404..516d65d9bcb8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -34,6 +34,14 @@ protected:
 }
 };
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128207, "tdf128207.docx")
+{
+//There was the charts on each other, because their horizontal and 
vertical position was 0!
+xmlDocPtr p_XmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(p_XmlDoc);
+assertXPathContent(p_XmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/w:drawing/wp:anchor/wp:positionH/wp:posOffset",
 "4445");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
 {
 //the original tdf87569 sample has vml shapes...
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f60d188c4c01..0f79bb73334e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6101,6 +6101,10 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 
 // Update the shape properties if it is embedded object.
 if(m_xEmbedded.is()){
+if (m_pGraphicImport->GetXShapeObject())
+m_pGraphicImport->GetXShapeObject()->setPosition(
+m_pGraphicImport->GetGraphicObjectPosition());
+
 uno::Reference xShape = 
m_pGraphicImport->GetXShapeObject();
 UpdateEmbeddedShapeProps(xShape);
 if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index da2b9ce04ef4..df4ae45f7671 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -424,6 +424,11 @@ GraphicImport::~GraphicImport()
 {
 }
 
+com::sun::star::awt::Point GraphicImport::GetGraphicObjectPosition()
+{
+return (com::sun::star::awt::Point(m_pImpl->nLeftPosition, 
m_pImpl->nTopPosition));
+}
+
 void GraphicImport::handleWrapTextValue(sal_uInt32 nVal)
 {
 switch (nVal)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx 
b/writerfilter/source/dmapper/GraphicImport.hxx
index d83f41cb161d..7807e48ede00 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -99,6 +99,8 @@ public:
 bool IsGraphic() const;
 sal_Int32 GetLeftMarginOrig() const;
 
+com::sun::star::awt::Point GetGraphicObjectPosition();
+
  private:
 // Properties
 virtual void lcl_attribute(Id Name, Value & val) override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-08 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129353.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   29 +++
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |   29 +++
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   16 -
 sw/qa/extras/rtfimport/rtfimport.cxx  |2 
 writerfilter/source/dmapper/DomainMapper.cxx  |   11 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |  180 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |5 
 8 files changed, 191 insertions(+), 81 deletions(-)

New commits:
commit e76fcb8f169acac3d81bdaf9b126cc4c98e2eb8e
Author: Mike Kaganski 
AuthorDate: Fri Dec 13 09:36:39 2019 +0300
Commit: Andras Timar 
CommitDate: Thu Jan 9 08:19:01 2020 +0100

tdf#129353, tdf#129402: fix node creation on index import

ToC, bibliography, and index sections import code changed to closely
follow what Word does, make sure that pre-rendered entries don't get
imported as standalone paragraphs outside of the index sections, and
paragraph count is accurate (no missing or added paragraphs as much
as possible).

In Word, an index may start and end in the middle of a paragraph:



Some text before index





 TOC ...





First pre-rendered index entry


...


Last pre-rendered index entry





Some text after index



However, normally it looks like either no runs precedig index, or no
runs of pre-rendered contents will be present. When no Std elements
are used, the typical situation is that there's a normal paragraph
(possibly with some user text), which ends with index start marker,
without any pre-rendered contents in the same paragraph; and all pre-
rendered contents goes in following paragraphs. Such index normally
ends with index end marker in the *first* run of a paragraph, which
then might have normal text runs.

When Stds are used, then no leading/trailing out-of-index runs in
paragraphs with marks are usually present; and in this case, when
paragraphs with index marks don't contain pre-rendered entries, they
still are treated as part of the index.

In Writer, indexes are node sections (and so cannot be inline with
other paragraph contents). When there was some paragraph content
already before the start-of-index mark, the paragraph is assumed
to end before the index; in this case, when current  element
ends, importer decides if a separate starting paragraph is needed
or not, depending on if there was some runs after the mark. When
there was no text runs before the starting mark, then the paragraph
is treated as leading paragraph of the index. This allows to not
miss empty paragraphs before index; and not have two paragraphs
where there was one in Word. Only in cases when user had manually
typed text both in and outside of the index in the same paragraph
in Word, we would have the paragraph split into two in Writer.

For end marks, the behaviour depends on whether it's inside Std.
When inside, the ending paragraph starting with index end mark is
considered part of the index. For out-of-Std case, it's considered
normal paragraph (and measures are taken to make sure it's not
dropped even if empty, because sometimes such paragraphs don't
have other content, and have section settings, which is usually
treated by Writer as "drop this paragraph" sign).

A special problem is multi-column index. It's wrapped into a
continuous section by Word; and in Writer, we also wrap it into
a section. It would be possibly useful to detect somehow if this
section is part of index definition, and in this case, drop the
section and put its properties into the Writer's index section.
That would avoid an explicit section in the imported document.
This is TODO, for someone who figures how to detect reliably if
the section belongs to index definition. See comment in
DomainMapper_Impl::appendTextSectionAfter. By the way, current
export code is wrong, producing an index that is single-column
in Word; this change doesn't touch that.

Several existing tests needed to be fixed, which used to test
wrong results.

Reviewed-on: https://gerrit.libreoffice.org/85089
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 5cdb14345842c07eb1a466897753da910e9488f8)

Change-Id: I9597c8ab13f31ded9abcc24054d3478d3e3a3b40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85289
Tested-by: Jenkins
Reviewed-by: Andras 

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

2020-01-08 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf123262_textFootnoteSeparators.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx   |   18 
++
 writerfilter/source/dmapper/DomainMapper.cxx|   28 
+++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |   14 
-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx   |   18 
--
 5 files changed, 52 insertions(+), 26 deletions(-)

New commits:
commit 1bbff471cdcfcd4a9ceb6ff6fed7006fbc3f6e1c
Author: Justin Luth 
AuthorDate: Fri Nov 29 22:10:27 2019 +0300
Commit: Michael Stahl 
CommitDate: Wed Jan 8 17:41:52 2020 +0100

tdf#123262 writerfilter: completely ignore footnote separators

... except for processing enough to observe the separator exists.

For each footnote reference, the entire footnote.xml file is
parsed every time. The text in the "separator" footnote was
being added to every footnote.  The normal case where this is just
a single paragraph was already handled, but this patch generalizes
everything to handle cases of actual text or multiple paragraphs.

Not every footnote has a type, so we can't depend on that to turn
ignoringText ON/OFF. Every footnote has an ID, but theoretically
the ID could be processed before or after the type, and it has
no idea which type it is. Finally, the skipped text has no idea
how many times/paragaphs it needs to skip. So a three-way
control was needed to handle on/used/off. As a safeguard, finishing
the footnote.xml parse (PopFootOrEndnote) ensures that
ignoring won't be left on in the unlikely case that
the separator is the last footnote.

Change-Id: Ia30ca8d3a36417a4691e3b2e1c978720be017030
Reviewed-on: https://gerrit.libreoffice.org/82172
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit acb9d901009d026cb48e6a8b94e6200f05110504)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85734
Reviewed-by: Michael Stahl 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf123262_textFootnoteSeparators.docx 
b/sw/qa/extras/ooxmlexport/data/tdf123262_textFootnoteSeparators.docx
new file mode 100644
index ..ceccb767e27e
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf123262_textFootnoteSeparators.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 14ba1cde9683..2560cf89a506 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -523,6 +523,24 @@ DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Paragraph starts with W(87), not tab(9)", 
u'W', sFootnotePara[0] );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf123262_textFootnoteSeparators, 
"tdf123262_textFootnoteSeparators.docx")
+{
+//Everything easily fits on one page
+CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 1, getPages() );
+
+uno::Reference xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xFootnotes = 
xFootnotesSupplier->getFootnotes();
+uno::Reference xFootnoteText(xFootnotes->getByIndex(0), 
uno::UNO_QUERY);
+
+// The text in the separator footnote should not be added to the footnotes
+OUString sText = " Microsoft Office.";
+CPPUNIT_ASSERT_EQUAL(sText, xFootnoteText->getString());
+
+// Ensure that paragraph markers are not lost.
+xFootnoteText.set(xFootnotes->getByIndex(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in second footnote", 
2, getParagraphs(xFootnoteText) );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo79668,"fdo79668.docx")
 {
 // fdo#79668: Document was Crashing on DebugUtil build while Saving
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 5417b6a05e0b..87b7fdbcbecc 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1078,9 +1078,20 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 }
 break;
 case NS_ooxml::LN_CT_FtnEdn_type:
-// This is the "separator" footnote, ignore its linebreak.
+// This is the "separator" footnote, ignore its linebreaks/text.
 if (static_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_FtnEdn_separator)
-m_pImpl->SeenFootOrEndnoteSeparator();
+m_pImpl->SetSkipFootnoteState( SkipFootnoteSeparator::ON );
+else
+m_pImpl->SetSkipFootnoteState( SkipFootnoteSeparator::OFF );
+break;
+case NS_ooxml::LN_CT_FtnEdn_id:
+{
+SkipFootnoteSeparator eSkip = m_pImpl->GetSkipFootnoteState();
+if ( eSkip == SkipFootnoteSeparator::ON )
+m_pImpl->SetSkipFootnoteState( SkipFootnoteSeparator::SKIPPING 
);
+

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

2020-01-08 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |   12 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx  |5 +
 3 files changed, 17 insertions(+)

New commits:
commit e4b8fc7563087e82a659f6b697a986b53e51876c
Author: Szabolcs Toth 
AuthorDate: Tue Dec 17 16:06:30 2019 +0100
Commit: Xisco Faulí 
CommitDate: Wed Jan 8 14:43:54 2020 +0100

tdf#129450 DOCX import: fix bottom border of 1-row tables

Bottom border was missing in a 1-row table with disabled
inside borders. This happened because LO applied the empty
horizontal borders to the bottom border of the table.

Change-Id: I40140bf63297189edad13088f98fc5f869969c2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85303
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 6b1bd2699b0bdad6dc42db741dea0717cf7c1d36)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86397
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx
new file mode 100644
index ..df00bfe04421
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf129450_BottomBorder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 8e7a7149292e..4511509e69cd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1036,6 +1036,18 @@ DECLARE_OOXMLEXPORT_TEST(testRightBorder, 
"tdf129442_RightBorder.docx")
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 
'nil']", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testBottomBorder, "tdf129450_BottomBorder.docx")
+{
+// tdf#129450: Missing bottom border in one row table.
+
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+
+// If there is no bottom border, it is shown in tcBorders.
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 21472dc0eddf..b3bd18de4931 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -835,6 +835,11 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 {
 rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
 }
+// Do not apply horizontal borders to a one row table.
+else if (m_aCellProperties.size() == 1 && 
aRowOfCellsIterator->size() > 1)
+{
+rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
+}
 
 lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, 
nCell, nRow, bIsEndCol, bIsEndRow );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-08 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/rtfexport/data/tdf129513.rtf  |4 
 sw/qa/extras/rtfexport/rtfexport5.cxx  |   11 +++
 writerfilter/source/rtftok/rtfdispatchflag.cxx |1 -
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit a3fa368f1a50463e1540619834df31f48cba6a7d
Author: Mike Kaganski 
AuthorDate: Fri Dec 20 16:07:00 2019 +0300
Commit: Xisco Faulí 
CommitDate: Wed Jan 8 11:50:18 2020 +0100

tdf#129513: drop incorrect and redundant erasure of paragraph sprm

It was introduced in commit 2499397cb39330dabeb8b7b3e0d7eb6213a0d8f4
"avoid sending duplicated paragraph flags", and supposedly was meant
to avoid having duplicating sprms in the collected properties, when
new properties were pushed back at that time. Using specific sprm id
was likely a mistake (nParam should have been used instead).

Now the new sprm is added using RTFSprms::set with eOverwrite having
default value of RTFOverwrite::YES, which takes care to avoid dupes,
so the call to erase is redundant.

This reverts commit 2499397cb39330dabeb8b7b3e0d7eb6213a0d8f4.

Change-Id: Ied19f6feb41bd17ef317812d4d295ca0542a5843
Reviewed-on: https://gerrit.libreoffice.org/85602
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 989043b0644354b92fd17e4194897c2eb0935031)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85742
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/rtfexport/data/tdf129513.rtf 
b/sw/qa/extras/rtfexport/data/tdf129513.rtf
new file mode 100644
index ..cc39953491d9
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf129513.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+\trowd\cellx2000\pard\intbl\pagebb
+In table
+\cell\row\pard\par }
\ No newline at end of file
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx 
b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 640cff9bec39..75678fb6971b 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -1164,6 +1164,17 @@ DECLARE_RTFEXPORT_TEST(testTdf128320, "tdf128320.odt")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nPos);
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf129513, "tdf129513.rtf")
+{
+// \pagebb after \intbl must not reset the "in table" flag
+CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+// Make sure the first paragraph is imported in table
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getCellNames().getLength());
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("In table"), xCell->getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 0c39866cd8df..894716b2897c 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -431,7 +431,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 if (nParam >= 0)
 {
 auto pValue = new RTFValue(1);
-m_aStates.top().getParagraphSprms().erase(NS_ooxml::LN_inTbl);
 m_aStates.top().getParagraphSprms().set(nParam, pValue);
 return RTFError::OK;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-01-08 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx|   11 +++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 +
 3 files changed, 16 insertions(+)

New commits:
commit 327de796b8a44028b2d49387a977663c88f59956
Author: Szabolcs Toth 
AuthorDate: Tue Dec 17 14:54:39 2019 +0100
Commit: Xisco Faulí 
CommitDate: Wed Jan 8 10:12:58 2020 +0100

tdf#129442 DOCX import: fix right border of 1-column tables

Right border was missing in a 1-column table with disabled
inside borders. This happened because LO applied the empty
vertical borders to the right border of the table.

Change-Id: Ib190689bf5059bfd7dbf07b07808cd761015f37e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85301
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 8a2eb40abbd52d960dd21308157186be0ca9dd3d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86261
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx
new file mode 100644
index ..57ad24b61435
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 251ef426c58f..8e7a7149292e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1024,6 +1024,17 @@ DECLARE_OOXMLEXPORT_TEST(testInsideBorders, 
"tdf129242_InsideBorders.docx")
 assertXPathChildren(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx")
+{
+// tdf#129442: Right border of a one column table was missing.
+
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+
+// If the right border is missing like in the bug, then there is a 
 tag in tcBorders.
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 
'nil']", 0);
+}
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 0f675839e176..21472dc0eddf 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -830,6 +830,11 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
 rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
 }
+// Do not apply vertical borders to a one column table.
+else if (m_aCellProperties.size() > 1 && 
aRowOfCellsIterator->size() <= 1)
+{
+rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
+}
 
 lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, 
nCell, nRow, bIsEndCol, bIsEndRow );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-20 Thread Bakos Attila (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx |binary
 sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   20 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |   15 +
 writerfilter/source/dmapper/GraphicImport.cxx |9 
 5 files changed, 44 insertions(+)

New commits:
commit b83d394a16a9a93b314f20ea8fb2ccbb99d9d07f
Author: Bakos Attila 
AuthorDate: Sat Dec 14 12:36:13 2019 +0100
Commit: László Németh 
CommitDate: Fri Dec 20 17:59:14 2019 +0100

tdf#87569 tdf#109411 DOCX import: fix shape anchor in tables

Import "relative from page" horizontal setting of
VML and DrawingML shapes as "relative from column"
in tables, just as MSO handles it.

Change-Id: If71f2e52bbba324a98651e701feaeb99acfefc48
Reviewed-on: https://gerrit.libreoffice.org/85141
Tested-by: Jenkins
Reviewed-by: László Németh 
Reviewed-on: https://gerrit.libreoffice.org/85572

diff --git a/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx
new file mode 100644
index ..7f00a46e2cc6
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf87569_drawingml.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx 
b/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx
new file mode 100644
index ..0223ad71d4e2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf87569_vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 1c4d89028fbd..2271aa413dd6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -31,6 +32,25 @@ protected:
 }
 };
 
+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;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_vml: The Shape is not in the 
table!",
+ text::RelOrientation::FRAME, nValue);
+}
+
+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;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tdf87569_drawingml: The Shape is not in the 
table!",
+ text::RelOrientation::FRAME, nValue);
+}
 
 DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
 {
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 16d42193ac6a..5417b6a05e0b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3035,6 +3035,21 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 m_pImpl->PushPendingShape(xShape);
 
 m_pImpl->SetIsFirstParagraphInShape(true);
+
+//tdf#87569: Fix table layout with correcting anchoring
+//If anchored object is in table, Word calculates its position from cell 
border
+//instead of page (what is set in the sample document)
+if (m_pImpl->m_nTableDepth > 0) //if we had a table
+{
+uno::Reference xShapePropSet(xShape, 
uno::UNO_QUERY);
+sal_Int16 nCurrentHorOriRel; //A temp variable for storaging the 
current setting
+xShapePropSet->getPropertyValue("HoriOrientRelation") >>= 
nCurrentHorOriRel;
+//and the correction:
+if (nCurrentHorOriRel == text::RelOrientation::PAGE_FRAME)
+xShapePropSet->setPropertyValue("HoriOrientRelation",
+
uno::makeAny(text::RelOrientation::FRAME));
+}
+
 }
 
 void DomainMapper::lcl_endShape( )
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 33275d9f0d55..da2b9ce04ef4 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -860,6 +860,15 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 if (nRotation)
 xShapeProps->setPropertyValue("RotateAngle", 
uno::makeAny(nRotation));
 }
+
+//tdf#109411 If anchored object is in table, Word 
calculates its position from cell border
+//instead of page (what is set in the sample document)
+if (m_pImpl->rDomainMapper.IsInTable() &&
+

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

2019-12-17 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx  |   13 +
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx   |2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 39e138902d05fbb00fda8003908c851d2f3ecb00
Author: Szabolcs Toth 
AuthorDate: Sat Dec 7 08:57:32 2019 +0100
Commit: Xisco Faulí 
CommitDate: Tue Dec 17 11:29:49 2019 +0100

tdf#129242 Regression fixed for one cell table borders

Had to check an additional criteria before removing
inside borders.

Change-Id: I0828d973bd331e65ebabc1fe2e2f25f1bcaf58b0
Reviewed-on: https://gerrit.libreoffice.org/84676
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit dff3ae42d94fdf97c856c4a4d1e66234604927f4)
Reviewed-on: https://gerrit.libreoffice.org/85199
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx 
b/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx
new file mode 100644
index ..58045c971c82
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf129242_InsideBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index c78ecb5aff38..251ef426c58f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1012,6 +1012,19 @@ DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, 
"tdf124399_SingleCellTableB
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testInsideBorders, "tdf129242_InsideBorders.docx")
+{
+// tdf#129242: Don't remove inside borders if the table has more than one 
cells.
+
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+
+// If this is not 0, then inside borders are removed.
+assertXPathChildren(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:tcBorders", 0);
+}
+
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index d6be09fbd4e4..b8923e734bee 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -824,7 +824,7 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 #endif
 
 // Do not apply horizontal and vertical borders to a one cell 
table.
-if (m_aCellProperties.size() <= 1)
+if (m_aCellProperties.size() <= 1 && 
aRowOfCellsIterator->size() <= 1)
 {
 rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
 rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-12-16 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf115719b.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|   12 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   14 --
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |   15 +++
 writerfilter/source/dmapper/GraphicImport.cxx |7 +++
 writerfilter/source/dmapper/GraphicImport.hxx |1 +
 writerfilter/source/dmapper/PropertyMap.cxx   |   13 +++--
 7 files changed, 50 insertions(+), 12 deletions(-)

New commits:
commit 14b69981a3fe36e082852cb561251eb4fc43f6c5
Author: Miklos Vajna 
AuthorDate: Fri Dec 6 16:54:07 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Dec 16 13:36:18 2019 +0100

Related: tdf#115719 DOCX import: fix increased spacing vs left-aligned 
objects

Commit 8b73bafbc18acb4dd8911d2f2de8158d98eb6144 (tdf#115719 DOCX import:
increase paragraph spacing for anchored objects, 2018-02-14) added an
import-time tweak for a problem that has been confirmed to be a Word
layout bug in the meantime (and the tweak makes Writer behave the same
way if the document has been created by an affected Word version for
layout compatiblity).

Later, commit 4883da6fd25e4645a3b30cb58212a2f666dae75a (Related:
tdf#124600 DOCX import: ignore left wrap on left-aligned shapes,
2018-02-14) fixed left spacing of anchored objects aligned to the left,
to be in sync with what the DOC import does.

This broke the previous fix in case the shapes are left-aligned.

Fix the problem by tracking what is the in-file-format and logical left
margin, so the final doc model has the value necessary for correct
horizontal positioning and the importer has the value that's necessary
for correct vertical positioning.

(cherry picked from commit 814cb2433da6bd608e935fa5531d2a2b92867985)

Change-Id: I8f16cbe7bad40e243111c902bdc1ab0e8141d6b9
Reviewed-on: https://gerrit.libreoffice.org/85207
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719b.docx 
b/sw/qa/extras/ooxmlexport/data/tdf115719b.docx
new file mode 100644
index ..a632e3df0e7a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf115719b.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 72e2104d935a..d4aa8d886626 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -291,6 +291,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf115719b, "tdf115719b.docx")
+{
+// This is similar to testTdf115719, but here the left textbox is not 
aligned "from left, by
+// 0cm" but simply aligned to left, which is a different codepath.
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 1
+// i.e. the the textboxes did not appear on the 2nd page, but everything 
was on a single page.
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf123243, "tdf123243.docx")
 {
 // Without the accompanying fix in place, this test would have failed with 
'Expected: 1; Actual:
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2ee8968467bf..d88776c63f46 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1679,7 +1679,7 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 // Remember what objects are anchored to this 
paragraph.
 // That list is only used for Word compat purposes, and
 // it is only relevant for body text.
-AnchoredObjectInfo aInfo;
+AnchoredObjectsInfo aInfo;
 aInfo.m_xParagraph = xTextRange;
 aInfo.m_aAnchoredObjects = 
rAppendContext.m_aAnchoredObjects;
 m_aAnchoredObjectAnchors.push_back(aInfo);
@@ -6083,8 +6083,18 @@ void  DomainMapper_Impl::ImportGraphic(const 
writerfilter::Reference< Properties
 appendTextContent( xTextContent, uno::Sequence< beans::PropertyValue 
>() );
 
 if (eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR && 
!m_aTextAppendStack.empty())
+{
 // Remember this object is anchored to the current paragraph.
-
m_aTextAppendStack.top().m_aAnchoredObjects.push_back(xTextContent);
+AnchoredObjectInfo aInfo;
+aInfo.m_xAnchoredObject = xTextContent;
+if (m_pGraphicImport)
+{
+// We still have the graphic import around, remember the 
original margin, so later
+// 

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

2019-12-08 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |4 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   28 +++--
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |3 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   12 ++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|3 
 writerfilter/source/dmapper/TableManager.cxx |   48 ++--
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|   83 ---
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx|5 
 writerfilter/source/ooxml/factoryimpl_ns.py  |3 
 writerfilter/source/ooxml/model.xml  |   19 ---
 10 files changed, 76 insertions(+), 132 deletions(-)

New commits:
commit 25240856843444f1dac489f73ad058fad1b1d456
Author: László Németh 
AuthorDate: Thu Dec 5 09:47:18 2019 +0100
Commit: László Németh 
CommitDate: Mon Dec 9 08:25:43 2019 +0100

fdo#38414 tdf#44986: DOCX table import: handle gridBefore/After

without serious regressions, ie. losing the import of complex
forms with multiple or nested tables.

Complete the fix for tdf#116194 (DOCX import: fix missing
tables with w:gridBefore) with handling gridAfter on
DomainMapper level.

This consists of also rejections (except their unit tests) of

commit cf33af732ed0d3d553bb74636e3b14c55d44c153
(handle w:gridBefore by faking cells (fdo#38414)) and

commit 1d1748d143ab4270a2ca1b5117852b1b1bb4c526 (Related:
tdf#44986 DOCX import: handle w:gridAfter by faking cells)

Change-Id: I31fa1de03bcdf42424fa5507fb5a3e06aa47107d
Reviewed-on: https://gerrit.libreoffice.org/84517
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit b2c6d2d961a6113d0f111fab45ae12a40d389a23)
Reviewed-on: https://gerrit.libreoffice.org/84724

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2a682a847337..1fd030ae4426 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -935,6 +935,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf44986, "tdf44986.docx")
 // Check the first row of the table, it should have two cells (one 
separator).
 // This was 0: the first row had no separators, so it had only one cell, 
which was too wide.
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< 
uno::Sequence >(xTableRows->getByIndex(0), 
"TableColumnSeparators").getLength());
+// Check content of cells, including the newly added gridAfter cell
+CPPUNIT_ASSERT_EQUAL(OUString("A1"), 
uno::Reference(xTable->getCellByName("A1"), 
uno::UNO_QUERY_THROW)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("A2"), 
uno::Reference(xTable->getCellByName("A2"), 
uno::UNO_QUERY_THROW)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(""), 
uno::Reference(xTable->getCellByName("B1"), 
uno::UNO_QUERY_THROW)->getString());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf106953, "tdf106953.docx")
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index f4d025739915..b7d5a7b35e8e 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -48,7 +48,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
 m_nCell(),
 m_nGridSpan(1),
 m_aGridBefore(),
-m_nGridAfter(0),
+m_aGridAfter(),
 m_nHeaderRepeat(0),
 m_nTableWidth(0),
 m_bIsInShape(false),
@@ -357,7 +357,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 m_aGridBefore.back( ) = nIntValue;
 break;
 case NS_ooxml::LN_CT_TrPrBase_gridAfter:
-m_nGridAfter = nIntValue;
+m_aGridAfter.back() = nIntValue;
 break;
 case NS_ooxml::LN_CT_TblPrBase_tblCaption:
 // To-Do: Not yet preserved
@@ -399,6 +399,11 @@ sal_uInt32 DomainMapperTableManager::getCurrentGridBefore( 
)
 return m_aGridBefore.back( );
 }
 
+sal_uInt32 DomainMapperTableManager::getCurrentGridAfter( )
+{
+return m_aGridAfter.back( );
+}
+
 bool DomainMapperTableManager::hasCurrentSpans() const
 {
 return !m_aGridSpans.empty();
@@ -462,6 +467,7 @@ void DomainMapperTableManager::startLevel( )
 m_aTmpTableProperties.push_back( pTmpProperties );
 m_nCell.push_back( 0 );
 m_aGridBefore.push_back( 0 );
+m_aGridAfter.push_back( 0 );
 m_nTableWidth = 0;
 m_nLayoutType = 0;
 
@@ -492,6 +498,7 @@ void DomainMapperTableManager::endLevel( )
 
 m_nCell.pop_back( );
 m_aGridBefore.pop_back( );
+m_aGridAfter.pop_back( );
 m_nTableWidth = 0;
 m_nLayoutType = 0;
 
@@ -548,6 +555,7 @@ void DomainMapperTableManager::endOfRowAction()
 IntVectorPtr pTmpCellWidths = m_aCellWidths.back();
 sal_uInt32 nTmpCell = m_nCell.back();
 sal_uInt32 nTmpGridBefore 

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

2019-12-08 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf116194.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx   |9 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   37 ++-
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |3 -
 writerfilter/source/dmapper/TableData.hxx|   11 +++-
 writerfilter/source/dmapper/TableManager.cxx |   20 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx|4 +
 writerfilter/source/ooxml/model.xml  |5 +-
 8 files changed, 74 insertions(+), 15 deletions(-)

New commits:
commit 70274f86cdc1c023ffdd0130c262c1479262d76b
Author: László Németh 
AuthorDate: Mon Dec 2 19:02:43 2019 +0100
Commit: László Németh 
CommitDate: Sun Dec 8 22:29:54 2019 +0100

tdf#116194 DOCX import: fix missing tables with w:gridBefore

Regression from the commit cf33af732ed0d3d553bb74636e3b14c55d44c153
"handle w:gridBefore by faking cells (fdo#38414)"

This patch replaces the previous fix with a better solution,
fixing tdf#38414 on the proposed DomainMapper level. (Note:
to reject the old fix completely, its follow-up commit w:gridAfter
will be handled in a similar way.)

Now the related regressions, tdf#111679, tdf#120512 and the complex
forms of tdf#116194, tdf120256 and tdf#122608 are fixed, too.

Change-Id: Id25f5fb4d9021c87ee8c82782b2038e6fb255673
Reviewed-on: https://gerrit.libreoffice.org/84263
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit da1f71edfc72928b07a569b98e2766a8a7de9d2a)
Reviewed-on: https://gerrit.libreoffice.org/84711
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116194.docx 
b/sw/qa/extras/ooxmlexport/data/tdf116194.docx
new file mode 100644
index ..feec3ee9870f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116194.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 8d084d3afbad..2940f264429c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -587,6 +587,15 @@ DECLARE_OOXMLEXPORT_TEST(testGridBefore, "gridbefore.docx")
 CPPUNIT_ASSERT( leftA3.toInt32() > leftB2.toInt32());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116194, "tdf116194.docx")
+{
+// The problem was that the importer lost consecutive tables with 
w:gridBefore
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, "/w:document/w:body/w:tbl", 2);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testMsoBrightnessContrast, 
"msobrightnesscontrast.docx")
 {
 uno::Reference textDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 3a3b713723ee..f4d025739915 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -47,7 +47,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
 m_nRow(0),
 m_nCell(),
 m_nGridSpan(1),
-m_nGridBefore(0),
+m_aGridBefore(),
 m_nGridAfter(0),
 m_nHeaderRepeat(0),
 m_nTableWidth(0),
@@ -354,7 +354,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
 }
 break;
 case NS_ooxml::LN_CT_TrPrBase_gridBefore:
-m_nGridBefore = nIntValue;
+m_aGridBefore.back( ) = nIntValue;
 break;
 case NS_ooxml::LN_CT_TrPrBase_gridAfter:
 m_nGridAfter = nIntValue;
@@ -394,6 +394,11 @@ DomainMapperTableManager::IntVectorPtr const & 
DomainMapperTableManager::getCurr
 return m_aTableGrid.back( );
 }
 
+sal_uInt32 DomainMapperTableManager::getCurrentGridBefore( )
+{
+return m_aGridBefore.back( );
+}
+
 bool DomainMapperTableManager::hasCurrentSpans() const
 {
 return !m_aGridSpans.empty();
@@ -456,6 +461,7 @@ void DomainMapperTableManager::startLevel( )
 m_aTmpPosition.push_back( pTmpPosition );
 m_aTmpTableProperties.push_back( pTmpProperties );
 m_nCell.push_back( 0 );
+m_aGridBefore.push_back( 0 );
 m_nTableWidth = 0;
 m_nLayoutType = 0;
 
@@ -485,6 +491,7 @@ void DomainMapperTableManager::endLevel( )
 m_aCellWidths.back()->push_back(*oCurrentWidth);
 
 m_nCell.pop_back( );
+m_aGridBefore.pop_back( );
 m_nTableWidth = 0;
 m_nLayoutType = 0;
 
@@ -540,6 +547,7 @@ void DomainMapperTableManager::endOfRowAction()
 IntVectorPtr pTmpGridSpans = m_aGridSpans.back();
 IntVectorPtr pTmpCellWidths = m_aCellWidths.back();
 sal_uInt32 nTmpCell = m_nCell.back();
+sal_uInt32 nTmpGridBefore = m_aGridBefore.back();
 
 // endLevel and startLevel are taking care of the non finished row
 // to carry it over to the next table
@@ -552,10 

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

2019-12-06 Thread Jan-Marek Glogowski (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   18 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 +++
 2 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 4412689b1358b5cc932f905417f23e2a3cbb494b
Author: Jan-Marek Glogowski 
AuthorDate: Fri Nov 1 10:39:47 2019 +0100
Commit: Michael Stahl 
CommitDate: Fri Dec 6 14:50:22 2019 +0100

tdf#120546 fix DOCX overriding numrule format

... at least in the view.

This "fixes" the import side of the exported OOXML document with
multiple overridden numrule character format. This prevents the
change of the shared numrule, which results in all bullets being
formatted like the last overridden numrule.

What is missing is a consistent way to edit the override, as the
override is currently just stored in an internal attribute, the
"ListAutoFormat" property.

Fixing editing for good will be a larger work, as "ListAutoFormat"
must be reflected in the GUI and must have a higher priority then
the numrule format. Currently positioning the curser in front of
the number or bullet entry lets one change the numrule format,
which is applied to all bullets of the same rule.

This special DOCX override mode is enabled by the import filter
setting DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
to true. This should also change the edit mode, so that a change
of the entry doesn't modify the rule, but the override and this
must also be reflected in the GUI character settings.

Change-Id: I057f7a354bc3c413b114eec772e06c7063029699
Reviewed-on: https://gerrit.libreoffice.org/81878
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 
(cherry picked from commit 6ed12ab2d0742f86ce25defec3c776562dbfad9a)
Reviewed-on: https://gerrit.libreoffice.org/84624
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cb252c87ded9..2a682a847337 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -356,9 +356,23 @@ DECLARE_OOXMLEXPORT_TEST(testPositionAndRotation, 
"position-and-rotation.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testNumberingFont, "numbering-font.docx")
 {
+// check that the original numrule font name is still Calibri
 uno::Reference 
xStyle(getStyles("CharacterStyles")->getByName("ListLabel 1"), uno::UNO_QUERY);
-// This was Calibri, i.e. custom font of the numbering itself ("1.\t") was 
lost on import.
-CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty(xStyle, 
"CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Calibri"), getProperty(xStyle, 
"CharFontName"));
+
+uno::Reference xPara = getParagraph(2);
+uno::Reference properties(xPara, uno::UNO_QUERY);
+uno::Any aValue = properties->getPropertyValue("ListAutoFormat");
+CPPUNIT_ASSERT(aValue.hasValue());
+uno::Sequence aListAutoFormat;
+CPPUNIT_ASSERT(aValue >>= aListAutoFormat);
+auto it = std::find_if(std::cbegin(aListAutoFormat), 
std::cend(aListAutoFormat),
+[](const css::beans::NamedValue& val) { return val.Name == 
"CharFontName"; });
+CPPUNIT_ASSERT(it != std::cend(aListAutoFormat));
+OUString sOverrideFontName;
+CPPUNIT_ASSERT(it->Value >>= sOverrideFontName);
+// but the overridden font name is Verdana
+CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), sOverrideFontName);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf106541_noinheritChapterNumbering, 
"tdf106541_noinheritChapterNumbering.odt")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe66d4ddadb9..0633d195eb46 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6432,6 +6432,9 @@ uno::Reference 
DomainMapper_Impl::GetCurrentNumberingCharSt
 xLevels = GetCurrentNumberingRules();
 if (!xLevels.is())
 {
+if (IsOOXMLImport())
+return xRet;
+
 PropertyMapPtr pContext = m_pTopContext;
 if (IsRTFImport() && !IsOpenField())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-12-05 Thread László Németh (via logerrit)
 sw/qa/extras/rtfexport/data/tdf128428_dntblnsbdb.rtf |   31 +++
 sw/qa/extras/rtfexport/rtfexport3.cxx|6 +++
 writerfilter/source/rtftok/rtfdispatchflag.cxx   |5 +++
 3 files changed, 42 insertions(+)

New commits:
commit 37ce55f7970de7bfba1d4fc9128cc5198e030f88
Author: László Németh 
AuthorDate: Wed Dec 4 10:45:16 2019 +0100
Commit: László Németh 
CommitDate: Thu Dec 5 10:23:30 2019 +0100

tdf#128428 RTF: switch off longer space at \dntblnsbdb

The Word 6.0 (Japanese) compatibility option
\dntblnsbdb switches off the balancing of SBCS/DBCS
characters, including the longer space sequences.

Note: using \dntblnsbdb, it will be possible to
set normal (short) space sequences in RTF export, too,
to avoid broken document layout during RTF round-trip.

Fix regression from commit 24b04db5a63b57a74e58a7616091437ad68548ac
(tdf#123703 RTF import: fix length of space character sequence).

Change-Id: I5ade9e0a2db0bde204d1debe831058045fd8f586
Reviewed-on: https://gerrit.libreoffice.org/84397
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit cd7241e3d2892c2a115265f842f464d017d7c7e1)
Reviewed-on: https://gerrit.libreoffice.org/84414
Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/data/tdf128428_dntblnsbdb.rtf 
b/sw/qa/extras/rtfexport/data/tdf128428_dntblnsbdb.rtf
new file mode 100644
index ..13a231725683
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf128428_dntblnsbdb.rtf
@@ -0,0 +1,31 @@
+{\rtf1\mac\ansicpg1\uc1 
\deff0\deflang1033\deflangfe1033{\upr{\fonttbl{\f0\fnil\fcharset256\fprq2{\*\panose
 00020206030504050203}Times New Roman;}{\f3\fnil\fcharset2\fprq2{\*\panose 
00020005}Symbol;}^M{\f4\fnil\fcharset256\fprq2{\*\panose 
00020005}Times;}}{\*\ud{\fonttbl{\f0\fnil\fcharset256\fprq2{\*\panose
 00020206030504050203}Times New Roman;}{\f3\fnil\fcharset2\fprq2{\*\panose 
00020005}Symbol;}{\f4\fnil\fcharset256\fprq2{\*\panose 
00020005}Times;{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \f4\lang1033\cgrid \snext0 Normal;}{\*\cs10
  \additive Default Paragraph 
Font;}}{\*\listtable{\list\listtemplateid984073\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\chbrdr\brdrnone\brdrcf1
 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname 
;}\listid1}}{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}{\info{\title
 Viikkoaikataulu S 2001  SibA / Musiikkiteknologian osasto  1}{\author 
CM}{\operator Kalev 
Tiits}{\creatim\yr2003\mo9\dy2\hr15\min6}{\revtim\yr2003\mo9\dy2\hr15\min6}{\printim\yr2003\mo8\dy7\hr15\min14}{\version2}{\edmins0}{\nofpages2}{\nofwords40}{\nofchars233}{\*\company
 Sibelius 
Academy}{\nofcharsws286}{\vern16553}}\paperw16838\paperh11899\margl1440\margr1440\margt1800\margb1800
 
\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dghspace180\dgvspace180\dghorigin1701\dgvorigin1984\dghshow0\dgvshow0\jexpand\viewki
 nd1\viewscale100\pgbrdrhead\pgbrdrfoot\nolnhtadjtbl \fet0\sectd 
\lndscpsxn\linex0\headery709\footery709\colsx709\endnhere\sectdefaultcl 
{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta 
.}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta 
.}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta 
.}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta 
)}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
)}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
)}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
)}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta 
)}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}
+word   
   word2\par
+word   
   word2\par
+word   
   word2\par
+word   
   word2\par
+word 

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

2019-12-02 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/rtfimport/data/tdf128611.rtf   |   29 
 sw/qa/extras/rtfimport/rtfimport.cxx|   19 ++
 writerfilter/source/rtftok/rtfsdrimport.cxx |   19 ++
 3 files changed, 67 insertions(+)

New commits:
commit 5ce09e923a5419acb6700cea055f9d350e8f0e51
Author: Miklos Vajna 
AuthorDate: Wed Nov 27 17:14:13 2019 +0100
Commit: Miklos Vajna 
CommitDate: Mon Dec 2 14:49:47 2019 +0100

Related: tdf#128611 RTF import: handle vertical flip of line shapes

UI uses SdrEditView::MirrorMarkedObjVertical() to flip a line shape
vertically, handle it similarly at import time as well.

Also note that this flips in-place, while the naive '*= -1' for the
height would have an incorrect vertical position.

(cherry picked from commit f9f421b7beaf117968c0dbfd84a2dad3dc85136a)

Change-Id: I42b7feb5f799b99337ddec734dcf98dd1d553755
Reviewed-on: https://gerrit.libreoffice.org/84209
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfimport/data/tdf128611.rtf 
b/sw/qa/extras/rtfimport/data/tdf128611.rtf
new file mode 100644
index ..207252cd8d26
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf128611.rtf
@@ -0,0 +1,29 @@
+{\rtf1
+\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1417
+\pard\plain
+{\shp
+{\*\shpinst\shpleft-5\shptop248\shpright8933\shpbottom1838\shpfhdr0\shpbxmargin\shpbxignore\shpbymargin\shpbyignore\shpwr0\shpwrk0\shpfblwtxt0\shpz0\shplid1028
+{\sp
+{\sn shapeType}
+{\sv 20}
+}
+{\sp
+{\sn fFlipH}
+{\sv 0}
+}
+{\sp
+{\sn fFlipV}
+{\sv 1}
+}
+{\sp
+{\sn posrelh}
+{\sv 3}
+}
+}
+{\shprslt
+{\*\do\dobxmargin\dobymargin\dodhgt8192
+\dpline\dpptx8938\dppty0\dpptx0\dppty1590\dpx-5\dpy9248\dpxsize8938\dpysize1590\dplinew15\dplinecor0\dplinecog0\dplinecob0}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index ce693e11f717..a88dddf2f086 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -903,6 +903,25 @@ CPPUNIT_TEST_FIXTURE(Test, testOleInline)
  getProperty(getShape(1), 
"AnchorType"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf128611)
+{
+load(mpTestDocumentPath, "tdf128611.rtf");
+auto aPolyPolySequence
+= getProperty>>(getShape(1), 
"PolyPolygon");
+CPPUNIT_ASSERT(aPolyPolySequence.hasElements());
+uno::Sequence& rPolygon = aPolyPolySequence[0];
+CPPUNIT_ASSERT_GREATER(static_cast(1), rPolygon.size());
+sal_Int32 nY1 = rPolygon[0].Y;
+sal_Int32 nY2 = rPolygon[1].Y;
+
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 6242
+// - Actual  : 3438
+// i.e. the vertical flip was missing, and the y1 > y2 assert failed, 
because the line pointed
+// from top left to bottom right, not bottom left to top right.
+CPPUNIT_ASSERT_GREATER(nY2, nY1);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFdo80742)
 {
 load(mpTestDocumentPath, "fdo80742.rtf");
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 2545b93c552c..85f61129b1f3 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -45,6 +45,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
 #include 
 #include "rtfdocumentimpl.hxx"
 
@@ -1046,6 +1049,22 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool 
bClose, ShapeOrPict const shap
 "CustomShapeGeometry",
 
uno::makeAny(aCustomShapeGeometry.getAsConstPropertyValueList()));
 }
+else if (SdrObject* pObject = GetSdrObjectFromXShape(xShape))
+{
+Point aRef1 = pObject->GetSnapRect().Center();
+Point aRef2(aRef1);
+if (obFlipH == true)
+{
+// Horizontal mirror means a vertical reference line.
+aRef2.AdjustY(1);
+}
+if (obFlipV == true)
+{
+// Vertical mirror means a horizontal reference line.
+aRef2.AdjustX(1);
+}
+pObject->Mirror(aRef1, aRef2);
+}
 }
 
 if (rShape.getHoriOrientRelation() != 0)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-27 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx   |   11 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |   12 ++--
 writerfilter/source/dmapper/TableManager.hxx |2 ++
 3 files changed, 19 insertions(+), 6 deletions(-)

New commits:
commit 835f0e940a600cfac0ac41efb8a4e6015a122dd7
Author: László Németh 
AuthorDate: Tue Nov 26 16:42:15 2019 +0100
Commit: Xisco Faulí 
CommitDate: Wed Nov 27 12:05:31 2019 +0100

tdf#76586 fix table width of auto-width nested tables

when they have (sometimes incorrect) fixed cell widths.

Change-Id: I98bf37bfce72b84eed14e354520e4741ae2ddada
Reviewed-on: https://gerrit.libreoffice.org/83787
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 001e11c8f4a52a2eb308562bdee8516efb77b96b)
Reviewed-on: https://gerrit.libreoffice.org/83851
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index b9efb409a456..8d084d3afbad 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -374,10 +374,13 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testFdo73389,"fdo73389.docx")
 {
-uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
-uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
-// This was 9340, i.e. the width of the inner table was too large.
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2842), 
getProperty(xTables->getByIndex(0), "Width"));
+// The width of the inner table was too large. The first fix still 
converted
+// the "auto" table width to a fixed one. The recent fix uses variable 
width.
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","type","pct");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","w","5000");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx")
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx 
b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index e29637583631..3a3b713723ee 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -644,8 +644,16 @@ void DomainMapperTableManager::endOfRowAction()
 {
 if(nTableWidth > 100 || nTableWidth <= 0)
 {
-pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH, 
m_nTableWidth);
-pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH_TYPE, 
text::SizeType::FIX);
+if(getTableDepth() > 1 && !m_bTableSizeTypeInserted)
+{
+pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH, 
sal_Int32(100));
+
pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH_TYPE, 
text::SizeType::VARIABLE);
+}
+else
+{
+pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH, 
m_nTableWidth);
+
pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH_TYPE, 
text::SizeType::FIX);
+}
 }
 }
 uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( 
) - 1 );
diff --git a/writerfilter/source/dmapper/TableManager.hxx 
b/writerfilter/source/dmapper/TableManager.hxx
index 6c7a9ea1e21e..47947ee724ee 100644
--- a/writerfilter/source/dmapper/TableManager.hxx
+++ b/writerfilter/source/dmapper/TableManager.hxx
@@ -328,6 +328,8 @@ protected:
  */
 sal_uInt32 getTableDepthDifference() const { return mnTableDepthNew - 
mnTableDepth; }
 
+sal_uInt32 getTableDepth() const { return mnTableDepthNew; }
+
 /**
Action to be carried out at the end of the last paragraph of a
cell.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-21 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf119054.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx|   12 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   45 ---
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx |3 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   22 +++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|   11 +++
 6 files changed, 71 insertions(+), 22 deletions(-)

New commits:
commit 6c5da2cd7af5c2d90e4d8e9635ba8c9989c87923
Author: László Németh 
AuthorDate: Fri Nov 15 15:44:55 2019 +0100
Commit: László Németh 
CommitDate: Thu Nov 21 17:34:57 2019 +0100

tdf#119054 DOCX: fix not table style based bottom margin

in table cells, ie. using paragraph styles with bottom
margin setting or direct paragraph formatting of bottom
margin. Both of them overwrite the table style based
bottom margin.

Change-Id: I527b16c24fe47df8412291089ff86fadd3f9430b
Reviewed-on: https://gerrit.libreoffice.org/82800
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 6100909c84550036932d031f4d2f652e158a1a0a)
Reviewed-on: https://gerrit.libreoffice.org/83154
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf119054.docx 
b/sw/qa/extras/ooxmlexport/data/tdf119054.docx
new file mode 100644
index ..9c3657c24a97
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf119054.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 9e0859f028e7..d460679b50ba 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -468,6 +468,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf128752, "tdf128752.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after", 
"0");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf119054, "tdf119054.docx")
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+// Don't overwrite before and after spacing of Heading2 by table style
+assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before");
+assertXPathNoAttribute(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after");
+// Use table style based single line spacing instead of the docDefaults' 
254
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "line", 
"240");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx")
 {
 /*
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 10eb60471126..d6be09fbd4e4 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -809,6 +809,9 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 // Remove properties from style/row that aren't allowed in 
cells
 pAllCellProps->Erase( PROP_HEADER_ROW_COUNT );
 pAllCellProps->Erase( PROP_TBL_HEADER );
+// Remove paragraph properties from style/row that paragraph 
style can overwrite
+pAllCellProps->Erase( PROP_PARA_BOTTOM_MARGIN );
+pAllCellProps->Erase( PROP_PARA_LINE_SPACING );
 
 // Then add the cell properties
 pAllCellProps->InsertProps(*aCellIterator);
@@ -981,6 +984,36 @@ css::uno::Sequence 
DomainMapperTableHandler::endTabl
 return aRowProperties;
 }
 
+// table style has got bigger precedence than docDefault style,
+// but lower precedence than the paragraph styles and direct paragraph 
formatting
+void DomainMapperTableHandler::ApplyParaProperty(css::beans::PropertyValues 
aTableProperties, PropertyIds eId)
+{
+OUString sPropertyName = getPropertyName(eId);
+auto pTableProp = std::find_if(aTableProperties.begin(), 
aTableProperties.end(),
+[&](const beans::PropertyValue& rProp) { return rProp.Name == 
sPropertyName; });
+if (pTableProp != aTableProperties.end())
+{
+uno::Any aValue = pTableProp->Value;
+for (const auto& rParaProp : m_rDMapper_Impl.m_aParagraphsToEndTable)
+{
+// there is no direct paragraph formatting
+if (!rParaProp.m_pPropertyMap->isSet(eId))
+{
+OUString sParaStyleName;
+rParaProp.m_rPropertySet->getPropertyValue("ParaStyleName") 
>>= sParaStyleName;
+StyleSheetEntryPtr pEntry = 
m_rDMapper_Impl.GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(sParaStyleName);
+uno::Any aMargin = 
m_rDMapper_Impl.GetPropertyFromStyleSheet(eId, pEntry, true, true);
+uno::Any aMarginDocDefault = 
m_rDMapper_Impl.GetPropertyFromStyleSheet(eId, 

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

2019-11-20 Thread Szabolcs Toth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx   |   11 
++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx|7 
++
 3 files changed, 18 insertions(+)

New commits:
commit 6aca6d4ba87fec450065b205eff09654ae420d01
Author: Szabolcs Toth 
AuthorDate: Thu Nov 14 13:32:00 2019 +0100
Commit: Xisco Faulí 
CommitDate: Wed Nov 20 23:50:51 2019 +0100

tdf#124399 DOCX import: don't apply inside borders to 1-cell tables

Extra cell borders appeared on the bottom, top, left or right
of the 1-cell tables when only the "inside borders" option was selected.
The extra borders were the ones that would normally have appeared as
inside borders if there were more than one cells in the table.

Change-Id: I05d5f2a5a0168989f220d20a95b6dacf5152f9f7
Reviewed-on: https://gerrit.libreoffice.org/82675
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit 8a59f18b6eb22c43ec10cdc29ba5a13d5feba4f0)
Reviewed-on: https://gerrit.libreoffice.org/83303
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git 
a/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx 
b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx
new file mode 100755
index ..edb93b76e1df
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index ec87951cdeec..c78ecb5aff38 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1001,6 +1001,17 @@ 
DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.
 assertXPathContent(pXmlDoc, 
"//w:tbl/w:tr/w:tc[2]/w:p/m:oMath/m:sSubSup/m:e/m:r/m:t", u"\u03C3");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, 
"tdf124399_SingleCellTableBorders.docx")
+{
+// tdf#124399: Extra borders on single cell tables fixed.
+
+xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+if (!pXmlDocument)
+return;
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top[@w:val = 
'nil']", 1);
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 
'nil']", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index d80f4b36518d..10eb60471126 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -820,6 +820,13 @@ CellPropertyValuesSeq_t 
DomainMapperTableHandler::endTableGetCellProperties(Tabl
 TagLogger::getInstance().attribute("row", nRow);
 #endif
 
+// Do not apply horizontal and vertical borders to a one cell 
table.
+if (m_aCellProperties.size() <= 1)
+{
+rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
+rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
+}
+
 lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, 
nCell, nRow, bIsEndCol, bIsEndRow );
 
 //now set the default left+right border distance TODO: there's 
an sprm containing the default distance!
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-18 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf128752.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx|9 +
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |5 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   13 +++--
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|5 -
 5 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 28444a2cf7ac637a0161733121c59de82bc7e4db
Author: László Németh 
AuthorDate: Fri Nov 15 10:37:42 2019 +0100
Commit: László Németh 
CommitDate: Mon Nov 18 15:06:40 2019 +0100

tdf#128752 DOCX: fix partial direct paragraph spacing in tables

When direct formatting of a table paragraph set only top margin,
but not the bottom margin, also there was no paragraph style setting
for the bottom margin, the paragraph was imported using docDefault
bottom spacing instead of the table style bottom spacing.

Change-Id: Ib7f5f80dd2485a0fd4ab8e0645b7d730a7ec3c5c
Reviewed-on: https://gerrit.libreoffice.org/82771
Tested-by: Jenkins
Reviewed-by: László Németh 
(cherry picked from commit d8f3f8ecd9e6304f3a98ab03fae6bc545893f782)
Reviewed-on: https://gerrit.libreoffice.org/82789

diff --git a/sw/qa/extras/ooxmlexport/data/tdf128752.docx 
b/sw/qa/extras/ooxmlexport/data/tdf128752.docx
new file mode 100644
index ..0e49291414d7
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf128752.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index bd80a537e12a..9e0859f028e7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -459,6 +459,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf127814, "tdf127814.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "before", "0");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf128752, "tdf128752.docx")
+{
+// Paragraph bottom margin was 200, docDefault instead of table style 
setting
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after", 
"0");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx")
 {
 /*
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index be87c2c3785f..efbaf3a0ffc3 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1099,6 +1099,10 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 uno::Reference xCellRange(xTable, 
uno::UNO_QUERY);
 uno::Any aBottomMargin = pTableProp->Value;
 sal_Int32 nRows = aCellProperties.getLength();
+
+for (const auto& rParaProp : 
m_rDMapper_Impl.m_aPendingParaProp )
+rParaProp->setPropertyValue("ParaBottomMargin", 
aBottomMargin );
+
 for (sal_Int32 nRow = 0; nRow < nRows; ++nRow)
 {
 const uno::Sequence< beans::PropertyValues > 
aCurrentRow = aCellProperties[nRow];
@@ -1184,6 +1188,7 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 m_aCellProperties.clear();
 m_aRowProperties.clear();
 m_bHadFootOrEndnote = false;
+m_rDMapper_Impl.m_aPendingParaProp.clear();
 
 #ifdef DBG_UTIL
 TagLogger::getInstance().endElement();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0ba1c83673d1..52a0418abd92 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -792,9 +792,9 @@ OUString DomainMapper_Impl::GetDefaultParaStyleName()
 return m_sDefaultParaStyleName;
 }
 
-uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, 
StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara)
+uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId, 
StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, const 
bool bStyles)
 {
-while(pEntry.get( ) )
+while( bStyles && pEntry.get( ) )
 {
 if(pEntry->pProperties)
 {
@@ -1722,7 +1722,16 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap, con
 {
 uno::Any aMargin = 
GetPropertyFromParaStyleSheet(PROP_PARA_BOTTOM_MARGIN);
 if ( aMargin != uno::Any() )
+{
 
xParaProps->setPropertyValue("ParaBottomMargin", aMargin);
+
+// table style has got bigger precedence than 
docDefault style
+