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

2018-06-25 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf117843.docx  |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   12 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 6dcf475d5cda984ce0d1035e36267cedc3019e50
Author: Miklos Vajna 
Date:   Tue Jun 5 09:43:49 2018 +0200

tdf#117843 DOCX import: disable compat increased spacing in header/footer

It's only relevant for the body text.

(cherry picked from commit 09a37fe50f36ced755bc326fb6b4c1b6fdf61f86)

Reviewed-on: https://gerrit.libreoffice.org/55335
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit eb65a8c54f56abc8ba66f9cbc779cd20e4740933)

Change-Id: Id894604ed9b2c19400eeabbd2966f104d8b34aab
Reviewed-on: https://gerrit.libreoffice.org/56053
Tested-by: Jenkins
Reviewed-by: Aron Budea 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf117843.docx 
b/sw/qa/extras/ooxmlimport/data/tdf117843.docx
new file mode 100644
index ..501e85bfef96
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf117843.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 22bf0b01f752..e6f3a150b31f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1608,6 +1608,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx")
 CPPUNIT_ASSERT_EQUAL( OUString("4006"), aTop );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf117843, "tdf117843.docx")
+{
+uno::Reference xPageStyles = 
getStyles("PageStyles");
+uno::Reference 
xPageStyle(xPageStyles->getByName("Standard"), uno::UNO_QUERY);
+uno::Reference xHeaderText
+= getProperty>(xPageStyle, "HeaderText");
+// This was 4025, increased top paragraph margin was unexpected.
+CPPUNIT_ASSERT_EQUAL(
+static_cast(0),
+getProperty(getParagraphOfText(1, xHeaderText), 
"ParaTopMargin"));
+}
+
 // 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 b5ec69a98304..f65d2166cc01 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1258,9 +1258,11 @@ void DomainMapper_Impl::finishParagraph( const 
PropertyMapPtr& pPropertyMap )
 xTextRange = xTextAppend->finishParagraph( 
comphelper::containerToSequence(aProperties) );
 m_xPreviousParagraph.set(xTextRange, uno::UNO_QUERY);
 
-if (!rAppendContext.m_aAnchoredObjects.empty())
+if (!rAppendContext.m_aAnchoredObjects.empty() && 
!IsInHeaderFooter())
 {
 // 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;
 aInfo.m_xParagraph = xTextRange;
 aInfo.m_aAnchoredObjects = 
rAppendContext.m_aAnchoredObjects;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-11 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf117403.rtf|   15 ++
 sw/qa/extras/rtfimport/rtfimport.cxx |   14 ++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   35 +--
 3 files changed, 60 insertions(+), 4 deletions(-)

New commits:
commit 9223a8766e5a055f77e9cc7bccbfa718e6122e28
Author: Miklos Vajna 
Date:   Tue May 8 09:06:26 2018 +0200

tdf#117403 RTF import: fix lost cell border of merged cell

If two source cells have different border types, then Writer takes the
second, Word takes the first. So mimic the MSO behavior explicitly in
dmapper.

(cherry picked from commit 42b32321381126ad70700424b8970dbc45a843f5)

Change-Id: I25adc62e024a929216c7b05fec44e1f602f28285
Reviewed-on: https://gerrit.libreoffice.org/54089
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf117403.rtf 
b/sw/qa/extras/rtfimport/data/tdf117403.rtf
new file mode 100644
index ..243fe548c246
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf117403.rtf
@@ -0,0 +1,15 @@
+{\rtf\ansi\ansicpg1252\deff2
+{\fonttbl
+{\f0\fcharset238\froman Tms Rmn;}
+{\f1\fdecor Symbol;}
+{\f2\fcharset238\fswiss Helv;}
+{\f3\fcharset238\fmodern Courier New;}
+}
+\sectd
+\pgwsxn16837\pghsxn11905\marglsxn400\margrsxn400\margtsxn801\margbsxn801\lndscpsxn\plain\fs20\pard\qc
+\pard\pard
+\par
+\trowd\clmgf\clbrdrb\brdrs\brdrw1\cellx1764\clmrg\cellx2325
+\pard\intbl \qc \fs12 A1\cell
+\pard\intbl \cell
+\row \pard \par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index b3ca9eeedd25..565e26a49714 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1319,6 +1319,20 @@ DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf")
 }
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf117403, "tdf117403.rtf")
+{
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xCell.is());
+table::BorderLine2 aExpected(static_cast(COL_BLACK), 0, 4, 0,
+ table::BorderLineStyle::SOLID, 4);
+// This failed, border was not imported, OuterLineWidth was 0 instead of 4.
+CPPUNIT_ASSERT_BORDER_EQUAL(aExpected, 
getProperty(xCell, "BottomBorder"));
+}
+
 DECLARE_RTFIMPORT_TEST(testImportHeaderFooter, "tdf108055.rtf")
 {
 // The RTF import sometimes added Header and Footer multiple Times
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index e6f993e19387..1466787b8fb5 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1030,21 +1030,48 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 {
 if (!aMerges.empty())
 {
+static const std::vector aBorderNames
+= { "TopBorder", "LeftBorder", "BottomBorder", 
"RightBorder" };
+
 // Perform horizontal merges in reverse order, so the 
fact that merging changes the position of cells won't cause a problem for us.
 for 
(std::vector::reverse_iterator it = aMerges.rbegin(); 
it != aMerges.rend(); ++it)
 {
 uno::Reference 
xCellRange(xTable, uno::UNO_QUERY_THROW);
-uno::Reference 
xCell(xCellRange->getCellByPosition(it->m_nFirstCol, it->m_nFirstRow), 
uno::UNO_QUERY_THROW);
-OUString aFirst = 
xCell->getPropertyValue("CellName").get();
+uno::Reference xFirstCell(
+xCellRange->getCellByPosition(it->m_nFirstCol, 
it->m_nFirstRow),
+uno::UNO_QUERY_THROW);
+OUString aFirst
+= 
xFirstCell->getPropertyValue("CellName").get();
 // tdf#105852: Only try to merge if m_nLastCol is 
set (i.e. there were some merge continuation cells)
 if (it->m_nLastCol != -1)
 {
-
xCell.set(xCellRange->getCellByPosition(it->m_nLastCol, it->m_nLastRow), 
uno::UNO_QUERY_THROW);
-OUString aLast = 
xCell->getPropertyValue("CellName").get();
+// Save border properties of the first cell
+ 

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

2018-05-04 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf116801.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |   12 
 writerfilter/source/dmapper/StyleSheetTable.cxx |4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 2019109e20dc522dd3bd6a730bf639efc2c00309
Author: Miklos Vajna 
Date:   Wed May 2 22:04:08 2018 +0200

tdf#116801 DOCX import: char styles have no IsAutoUpdate property

See sw/source/core/unocore/unomapproperties.hxx:447,
UNO_NAME_IS_AUTO_UPDATE is part of the COMMON_PARA_STYLE_PROPERTIES
define. So it's not "list styles don't have this", but "only paragraph
styles have this".

(cherry picked from commit ebcf27d419e41a497242c98fcfec08a2088c0720)

Change-Id: I1c256b087cdc2e7e341f55d717ef8e678fc69fb4
Reviewed-on: https://gerrit.libreoffice.org/53773
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116801.docx 
b/sw/qa/extras/ooxmlexport/data/tdf116801.docx
new file mode 100644
index ..f904546cf38b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116801.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index bc7c15524778..7af6f0dc39e2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -218,6 +218,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116985, "tdf116985.docx")
 CPPUNIT_ASSERT(nWidth > 4000);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116801, "tdf116801.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+// This raised a lang::IndexOutOfBoundsException, table was missing from
+// the import result.
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("D1"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("D1"), xCell->getString());
+}
+
 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 55996991a84a..d192eaa5ab53 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1197,8 +1197,8 @@ void StyleSheetTable::ApplyStyleSheets( const 
FontTablePtr& rFontTable )
 xPropertySet->setPropertyValue("StyleInteropGrabBag", 
uno::makeAny(aGrabBag));
 }
 
-// List styles don't support automatic update.
-if (pEntry->bAutoRedefine && !bListStyle)
+// Only paragraph styles support automatic updates.
+if (pEntry->bAutoRedefine && bParaStyle)
 xPropertySet->setPropertyValue("IsAutoUpdate", 
uno::makeAny(true));
 }
 else if(pEntry->nStyleTypeCode == STYLE_TYPE_TABLE)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-04 Thread Mike Kaganski
 sw/qa/extras/rtfexport/data/tdf117268.rtf   |   35 ++
 sw/qa/extras/rtfexport/rtfexport3.cxx   |   38 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |7 
 3 files changed, 80 insertions(+)

New commits:
commit fe3ddff71af9298cc389ce05f6c1474bc0aeb715
Author: Mike Kaganski 
Date:   Thu May 3 15:09:40 2018 +0300

tdf#117268: treat erroneous \itap0 the same way as Word does

... so that if we are inside a table, it would not convert table
paragraphs into top-level paragraphs. (The in-the-wild documents
with this invalid input are, e.g., generated by Consultant+ legal
reference database).

Reviewed-on: https://gerrit.libreoffice.org/53790
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 247dabcb0b92a62b233ec0237deac84e6675325c)

Change-Id: I45eb9073a0651bc963badb84229ce5ae437f1a8c
Reviewed-on: https://gerrit.libreoffice.org/53813
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfexport/data/tdf117268.rtf 
b/sw/qa/extras/rtfexport/data/tdf117268.rtf
new file mode 100644
index ..608ea65637cc
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf117268.rtf
@@ -0,0 +1,35 @@
+{\rtf1
+{\trowd
+\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\cellx2000
+\pard
+Text 1
+\itap0
+\cell
+\row}
+\pard
+\par
+\itap0
+{\trowd
+\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\cellx2000
+\pard
+Text 2
+\itap0
+\cell
+\row}
+\itap0
+{\trowd
+\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\cellx2000
+\pard
+\itap2
+Text 3
+\nestcell
+\itap2
+{\nesttableprops\trowd
+\clbrdrl\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clbrdrt\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\cellx1000
+\nestrow}
+\itap0
+\cell
+\row}
+\itap0
+\par
+}
\ No newline at end of file
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index beaf63faf020..9f59e19a470a 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -76,6 +77,43 @@ DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf")
  getProperty(getParagraph(1), 
"ParaLeftMargin"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf117268, "tdf117268.rtf")
+{
+// Here we check that we correctly mimic Word's treatment of erroneous 
\itap0 inside tables.
+// Previously, the first table was import as text, and second top-level 
one only imported
+// last row with nested table (first row was also imported as text).
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY_THROW);
+
+// First (simple) table
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("Text 1"), xCell->getString());
+
+// Nested table
+xTable.set(xTables->getByIndex(1), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
+xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("Text 3"), xCell->getString());
+uno::Reference xNestedAnchor(xTable->getAnchor(), 
uno::UNO_QUERY_THROW);
+uno::Reference 
xAnchorCell(xNestedAnchor->getPropertyValue("Cell"),
+ uno::UNO_QUERY_THROW);
+
+// Outer table
+xTable.set(xTables->getByIndex(2), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
+xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("Text 2"), xCell->getString());
+xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY_THROW);
+uno::Reference xTextRangeCompare(xCell, 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), 
xTextRangeCompare->compareRegionStarts(xAnchorCell, xCell));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 489875e3e78c..6ae43f60248d 100644
--- 

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

2018-04-25 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf116976.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|7 +++
 writerfilter/source/dmapper/GraphicImport.cxx |   10 --
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 65f4c7b8725e8fe086889fca8c7c9b7e32fdd4d5
Author: Miklos Vajna 
Date:   Thu Apr 12 18:39:36 2018 +0200

tdf#116976 DOCX import: fix rel size of shape after bitmap

We have a queue of these odd relative sizes (which are not XML
attributes but text inside the XML element), if the bitmap doesn't pop
the queue, the following shape won't get its size.

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

Change-Id: I1602208c9509d8889bf0be254f3b25fb25fafca2
Reviewed-on: https://gerrit.libreoffice.org/52970
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116976.docx 
b/sw/qa/extras/ooxmlexport/data/tdf116976.docx
new file mode 100644
index ..70492a4af2f3
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116976.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 922f2fcb7192..4dbf3c1bd83f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -201,6 +201,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), nPgNumColour);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
+{
+// This was 0, reltive size of shape after bitmap was ignored.
+CPPUNIT_ASSERT_EQUAL(static_cast(40),
+ getProperty(getShape(1), "RelativeWidth"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index b6c11b58c603..6830e9db71b1 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1065,10 +1065,12 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
 break;
 case NS_ooxml::LN_CT_SizeRelH_pctWidth:
 case NS_ooxml::LN_CT_SizeRelV_pctHeight:
-if (m_xShape.is() && !m_pImpl->m_rPositivePercentages.empty())
+if (m_pImpl->m_rPositivePercentages.empty())
+break;
+
+if (m_xShape.is())
 {
 sal_Int16 nPositivePercentage = 
rtl::math::round(m_pImpl->m_rPositivePercentages.front().toDouble() / 
oox::drawingml::PER_PERCENT);
-m_pImpl->m_rPositivePercentages.pop();
 
 if (nPositivePercentage)
 {
@@ -1077,6 +1079,10 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
 xPropertySet->setPropertyValue(aProperty, 
uno::makeAny(nPositivePercentage));
 }
 }
+
+// Make sure the token is consumed even if xShape is an empty
+// reference.
+m_pImpl->m_rPositivePercentages.pop();
 break;
 case NS_ooxml::LN_EG_WrapType_wrapNone: // 90944; - doesn't contain 
attributes
 //depending on the behindDoc attribute text wraps through behind 
or in front of the object
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-10 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf116410.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|6 ++
 sw/qa/extras/ooxmlimport/data/tdf115719b.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |6 ++
 writerfilter/source/dmapper/PropertyMap.cxx   |4 
 5 files changed, 16 insertions(+)

New commits:
commit da01b17379fcb3cb89eddf718c922d1676aa482a
Author: Miklos Vajna 
Date:   Mon Mar 26 21:52:05 2018 +0200

tdf#116410 DOCX import: restrict increased object spacing to multiple shapes

This anchored object handling is just there to be bug-compatible with
Word, it's not needed for the case when there is a single shape in the
paragraph.

(cherry picked from commit 2c4d84e93901571ead79c85aa3894ef4e10bf5af)

Also:

Related: tdf#115719 DOCX import: fix ignore of increased anchored obj 
spacing

If there is only a single anchored object, then ignore only the current
paragraph, not all paragraphs of the section.

(cherry picked from commit 599ff05300599d4e4ce818092f18e76e738b921e)

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

Change-Id: I5e3dc4ba9a4a6f459ec6217e8974ebc2d7303bcc
Reviewed-on: https://gerrit.libreoffice.org/52022
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116410.docx 
b/sw/qa/extras/ooxmlexport/data/tdf116410.docx
new file mode 100644
index ..5352a233ed70
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116410.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 079e3513a4a1..922f2fcb7192 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -121,6 +121,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx")
+{
+// Opposite of the above, was 2 pages, should be 1 page.
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
 {
 // This was 2096, the horizontal positioning of the star shape affected the
diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx 
b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx
new file mode 100644
index ..551b9871fe60
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e3cdc19701ab..3af5a063c002 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -276,6 +276,12 @@ xray ThisComponent.StyleFamilies.PageStyles.Default.Width
 CPPUNIT_ASSERT( pos.X > width / 2 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf115719b, "tdf115719b.docx")
+{
+// This was 0, 4th (last) paragraph had no increased spacing.
+CPPUNIT_ASSERT(getProperty(getParagraph(4), "ParaTopMargin") > 
0);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testN766477, "n766477.docx")
 {
 /*
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 708b80a55c4f..af4133a7625e 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1148,6 +1148,10 @@ void 
SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
 std::vector& rAnchoredObjectAnchors = 
rDM_Impl.m_aAnchoredObjectAnchors;
 for (auto& rAnchor : rAnchoredObjectAnchors)
 {
+// Ignore this paragraph when there is a single shape only.
+if (rAnchor.m_aAnchoredObjects.size() < 2)
+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-0' - sw/qa writerfilter/source

2018-03-26 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf116269.rtf   |   22 +
 sw/qa/extras/rtfimport/rtfimport.cxx|8 +++
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |4 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |   30 
 writerfilter/source/rtftok/rtfdocumentimpl.hxx  |   13 +
 writerfilter/source/rtftok/rtfsprm.cxx  |   57 
 writerfilter/source/rtftok/rtfsprm.hxx  |2 
 7 files changed, 134 insertions(+), 2 deletions(-)

New commits:
commit 01d7bbdc13594965aad55269c1283716974ae743
Author: Miklos Vajna 
Date:   Mon Mar 19 21:38:43 2018 +0100

tdf#116269 RTF import: implement reverse deduplication for lists

This is the same mechanism that was added in commit
1be0a3fa9ebb22b607c54b47739d4467acfed259 (n#825305: writerfilter RTF
import: override style properties like Word, 2014-06-17), except that
here the reference is a list definition, not a paragraph style.

Also, this commit only implements the part that inserts explicit
defaults for not repeated properties, not the actual deduplication, as
that already works at a dmapper level.

(Saving the bugdoc as DOCX, it's visible in document.xml that DOCX marks
these defaults explicitly:



but RTF does not, so the right place to fix this is in the tokenizer.)

(cherry picked from commit 0f0a80123d970ef6f3f8269619813e5277fff4df)

Change-Id: Iec88d9bf1032d1d89194bd272500d6780c3c2224
Reviewed-on: https://gerrit.libreoffice.org/51690
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf116269.rtf 
b/sw/qa/extras/rtfimport/data/tdf116269.rtf
new file mode 100644
index ..39504c1ae9d5
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf116269.rtf
@@ -0,0 +1,22 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf360
+{\*\listtable
+{\list\listtemplateid1\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0
+{\*\levelmarker \{decimal\}.}
+{\leveltext\leveltemplateid1\'02\'00.;}
+{\levelnumbers\'01;}
+\fi-360\li720\lin720 }
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0
+{\*\levelmarker \{decimal\}.}
+{\leveltext\leveltemplateid2\'02\'01.;}
+{\levelnumbers\'01;}
+\fi-360\li1440\lin1440 }
+{\listname ;}
+\listid42}
+}
+{\*\listoverridetable
+{\listoverride\listid42\listoverridecount0\ls1}
+}
+\paperw11900\paperh16840\margl1417\margr1417\margb1701\margt1984
+\pard\ri-6\ls1\ilvl1 Gaming proposal
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 233cf1d5dc3b..254e203398e3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -662,6 +662,14 @@ DECLARE_RTFIMPORT_TEST(testFdo81033, "fdo81033.rtf")
 CPPUNIT_ASSERT_EQUAL(u'_', tabs[1].FillChar);
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf116269, "tdf116269.rtf")
+{
+// This was 2540, implicit 0 left margin was ignored on import (inherited
+// value from list definition is repeated if it's not 0).
+CPPUNIT_ASSERT_EQUAL(static_cast(0),
+ getProperty(getParagraph(1), 
"ParaLeftMargin"));
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf")
 {
 uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 7079962c69d1..489875e3e78c 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -663,12 +663,16 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
  pIntValue);
 else if (m_aStates.top().eDestination == 
Destination::LISTOVERRIDEENTRY)
 
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue);
+m_aStates.top().nCurrentListIndex = nParam;
 }
 break;
 case RTF_LS:
 {
 if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY)
+{
 
m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, 
pIntValue);
+m_aStates.top().nCurrentListOverrideIndex = nParam;
+}
 else
 {
 // Insert at the start, so properties inherited from the list
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0a5d3993ff43..b3bc922dd437 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -125,6 +125,15 @@ RTFValue::Pointer_t getNestedAttribute(RTFSprms& rSprms, 
Id 

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

2018-03-23 Thread Serge Krot
 sw/qa/extras/ooxmlimport/data/tdf113182.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 
 writerfilter/source/dmapper/DomainMapper.cxx |7 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 133821d1526800a93bb395a91f87dc77d29f0b8d
Author: Serge Krot 
Date:   Fri Mar 16 10:42:50 2018 +0100

tdf#113182: DOCX filter: new values of wrap property in text box

Added support of "none" and "through" values of the w:wrap
poroperty in the text box.

Change-Id: I83f0c9e8162e93bf457f228d49d3b426050d4dc6
Reviewed-on: https://gerrit.libreoffice.org/51396
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
(cherry picked from commit be02ce71f2ee694fa2609a7a630853c24acfbfff)
Reviewed-on: https://gerrit.libreoffice.org/51431
Reviewed-by: Serge Krot (CIB) 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf113182.docx 
b/sw/qa/extras/ooxmlimport/data/tdf113182.docx
new file mode 100755
index ..9f35ec3d4ebc
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113182.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index d879dab4495a..e3cdc19701ab 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1574,6 +1574,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx")
 
 }
 
+// DOCX: Textbox wrap differs in MSO and LO
+// Both should layout text regardless of existing text box
+// and as result only one page should be generated.
+DECLARE_OOXMLIMPORT_TEST(testTdf113182, "tdf113182.docx")
+{
+CPPUNIT_ASSERT_EQUAL(getPages(), 1);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
 {
 OUString aTop = 
parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 40134d148ac9..abfc8694535c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -866,11 +866,16 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 //should be either LN_Value_doc_ST_Wrap_notBeside or 
LN_Value_doc_ST_Wrap_around or LN_Value_doc_ST_Wrap_auto
 OSL_ENSURE( sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_around ||
 sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_notBeside ||
+sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_through ||
+sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_none ||
 sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_auto,
-"wrap not around, not_Beside or auto?");
+"wrap not around, not_Beside, through, none or 
auto?");
 if( sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_around ||
+sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_through ||
 sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_auto )
 pParaProperties->SetWrap ( 
text::WrapTextMode_DYNAMIC ) ;
+else if (sal::static_int_cast(nIntValue) == 
NS_ooxml::LN_Value_doc_ST_Wrap_none)
+pParaProperties->SetWrap ( 
text::WrapTextMode_THROUGH ) ;
 else
 pParaProperties->SetWrap ( text::WrapTextMode_NONE 
) ;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-20 Thread Mike Kaganski
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|   16 
 sw/qa/extras/rtfexport/rtfexport2.cxx|   16 ++--
 writerfilter/source/dmapper/ConversionHelper.cxx |9 +
 3 files changed, 23 insertions(+), 18 deletions(-)

New commits:
commit 88e22b92bce612f349f8aa38adf69a8806361da3
Author: Mike Kaganski 
Date:   Mon Mar 19 00:11:33 2018 +0300

tdf#116472: import "auto" border color as black

Since commit fe6da2feb57c3d5e355a36f6b8ac09b48412ff39, "auto" color is
supported in OOXML import.

Since ODF doesn't support "auto" color as border color, just convert
"auto" border color to black on import, like is done in GetLineIndex
in ww8par6.cxx.

Incidentally, this also fixes a problem in RTF import, where we used to
import black borders ("\red0\green0\blue0;" entries in color table) as
0x01 ("\red0\green0\blue1;") - see fixed tests in rtfexport2.cxx.

Change-Id: I4f5e720d215b51c8a43dc7c58f338741bd608efc
Reviewed-on: https://gerrit.libreoffice.org/51519
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
Reviewed-on: https://gerrit.libreoffice.org/51585
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 1fa183ca174a..11401fe20323 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -650,43 +650,43 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:val
 = 'single']",1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:sz
 = 4]", 1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:space
 = 0]", 1);
-assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color
 = 'auto']", 1);
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:top[@w:color
 = '00']", 1);
 
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:val
 = 'single']",1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:sz
 = 4]", 1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:space
 = 0]", 1);
-assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color
 = 'auto']", 1);
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:bottom[@w:color
 = '00']", 1);
 
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:val
 = 'single']",1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:sz
 = 4]", 1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:space
 = 0]", 1);
-assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color
 = 'auto']", 1);
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideH[@w:color
 = '00']", 1);
 
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:val
 = 'single']",1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:sz
 = 4]", 1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:space
 = 0]", 1);
-assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color
 = 'auto']", 1);
+assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblPr/w:tblBorders/w:insideV[@w:color
 = '00']", 1);
 
 //Table Cell Borders
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:val
 = 'single']",1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:sz
 = 4]", 1);
 assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:space
 = 0]", 1);
-assertXPath(pXmlDocument, 
"/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcBorders/w:top[@w:color
 = 'auto']", 1);
+assertXPath(pXmlDocument, 

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

2018-03-15 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf115861.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|7 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |6 ++
 writerfilter/source/dmapper/util.cxx  |   14 +-
 4 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 0edb7585c7bdf5f01dcf31f106477c959f107a84
Author: Miklos Vajna 
Date:   Mon Mar 5 22:09:39 2018 +0100

tdf#115861 DOCX import: avoid last-paragraph removal when discarding footer

Discarding header/footer is necessary when the document or section
settings request to ignore first or even headers/footers. In the bugdoc
case settings.xml didn't opt-in for different even/odd footers, but
there was an even footer to be ignored.

Handle this state at two more places, so we don't end up in a situation
where we ignore the footer but not its "remove last (empty) paragraph at
the end of the footer" action.

Also make the debug dumper for text ranges more robust to have a working
token dump when we try to get the string for a table.

(cherry picked from commit 49cf733effc56c09c5e2eb023120c2d3532b5b3d)

Change-Id: I6395f37aa40c42304e2c918d87dadecb21e9d378
Reviewed-on: https://gerrit.libreoffice.org/50884
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf115861.docx 
b/sw/qa/extras/ooxmlexport/data/tdf115861.docx
new file mode 100644
index ..f42a7bad2cfa
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf115861.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 0fd64733e700..35bf52ee25af 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -81,6 +81,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112694, "tdf112694.docx")
 CPPUNIT_ASSERT(!getProperty(aPageStyle, "HeaderIsOn"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf115861, "tdf115861.docx")
+{
+// Second item in the paragraph enumeration was a table, 2nd paragraph was
+// lost.
+CPPUNIT_ASSERT_EQUAL(OUString("(k)"), getParagraph(2)->getString());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.docx")
 {
 uno::Reference xTextField = getProperty< 
uno::Reference >(getRun(getParagraph(1), 2), "TextField");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 13f8c4313894..b5ec69a98304 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -388,6 +388,9 @@ void DomainMapper_Impl::AddDummyParaForTableInSection()
 
 void DomainMapper_Impl::RemoveLastParagraph( )
 {
+if (m_bDiscardHeaderFooter)
+return;
+
 if (m_aTextAppendStack.empty())
 return;
 uno::Reference< text::XTextAppend > xTextAppend = 
m_aTextAppendStack.top().xTextAppend;
@@ -1061,6 +1064,9 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( 
)
 
 void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
 {
+if (m_bDiscardHeaderFooter)
+return;
+
 #ifdef DEBUG_WRITERFILTER
 TagLogger::getInstance().startElement("finishParagraph");
 #endif
diff --git a/writerfilter/source/dmapper/util.cxx 
b/writerfilter/source/dmapper/util.cxx
index e721d6cecb9b..378e30b08a9d 100644
--- a/writerfilter/source/dmapper/util.cxx
+++ b/writerfilter/source/dmapper/util.cxx
@@ -34,7 +34,19 @@ std::string XTextRangeToString(uno::Reference< 
text::XTextRange > const & textRa
 #ifdef DEBUG_WRITERFILTER
 if (textRange.get())
 {
-OUString aOUStr = textRange->getString();
+OUString aOUStr;
+
+try
+{
+aOUStr = textRange->getString();
+}
+catch (const uno::Exception& rException)
+{
+result += "(exception: ";
+result += rException.Message.toUtf8().getStr();
+result += ")";
+}
+
 OString aOStr(aOUStr.getStr(), aOUStr.getLength(),  
RTL_TEXTENCODING_ASCII_US );
 
 result = aOStr.getStr();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-13 Thread Caolán McNamara
 sw/qa/core/data/rtf/fail/forcepoint-7.rtf|  517 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |7 
 writerfilter/source/dmapper/DomainMapperTableManager.hxx |1 
 3 files changed, 525 insertions(+)

New commits:
commit 874ce3384be2e11a7fd0ed02bf7d05e0ab5bea79
Author: Caolán McNamara 
Date:   Mon Mar 12 10:24:55 2018 +

forcepoint #24 back() on empty vector

Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: Idb6723b53a1ae8aaca80847bfe643bc4abaedd21
Reviewed-on: https://gerrit.libreoffice.org/51122
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/data/rtf/fail/forcepoint-7.rtf 
b/sw/qa/core/data/rtf/fail/forcepoint-7.rtf
new file mode 100755
index ..e5b227346108
--- /dev/null
+++ b/sw/qa/core/data/rtf/fail/forcepoint-7.rtf
@@ -0,0 +1,517 @@
+{\rtf1\�nsi\ansicpg1252\deflang3081\ftnbj\uc1\deff0
+{\fonttbl{\f0 \fswiss \fcharset1 Arial;}{\f1 \froman \fcharset2 Times New 
Roman;}{\f2 \froman \fcharset2 Symbol;}{\f3 \fswiss \fcharset0 Times New 
Roman;}{\f4 \fswiss \fcharset2 Symbol;}{\f5 \froman \fcharset0 Arial;}{\f6 
\fswiss \fcharset0 Lucida Sans;}{\f7 \fswiss \fcharset0 Arial;}{\f8 \fswiss 
\fcharset1 Wingdings;}}
+{\colortbl ;\red0\green0\blue0 ;\red255\green255\blue255 
;\red255\green255\blue128 ;\red0\green64\blue128 ;\red0\green0\blue255 
;\red0\green0\blue160 ;}
+{\stylesheet{\f0\fs20\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0
 Normal;}{\cs1\f0\fs24\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0 
Default Paragraph 
Font;}{\cs2\f6\fs16\b\protect\cf1\cb3\chcbpat3\expnd0\expndtw0\charscalex100\dn0
 
SSBookmark;}{\s3\snext0\outlinelevel0\f0\fs32\b\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel0
 Heading 
1;}{\s4\snext0\outlinelevel1\f0\fs24\b\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel1
 Heading 
2;}{\s5\snext0\outlinelevel2\f0\fs24\b\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel2
 Heading 3
+;}{\s6\snext0\outlinelevel3\f0\fs24\b\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel3
 Heading 
4;}{\s7\snext0\outlinelevel4\f0\fs24\b\i\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel4
 Heading 
5;}{\s8\snext0\outlinelevel5\f0\fs20\b\cf1\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel5
 Heading 
6;}{\s9\snext0\outlinelevel6\f0\fs24\cf4\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel6
 Heading 
7;}{\s10\snext0\outlinelevel7\f0\fs24\i\cf4\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel7
 Heading 8
+;}{\s11\snext0\outlinelevel8\f0\fs22\cf4\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0\outlinelevel8
 Heading 
9;}{\s12\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa0\sl0\shading0
 TOC 
1;}{\s13\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li180\ri0\sb0\sa0\sl0\shading0
 TOC 
2;}{\s14\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li360\ri0\sb0\sa0\sl0\shading0
 TOC 
3;}{\s15\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li540\ri0\sb0\sa0\sl0\shading0
 TOC 
4;}{\s16\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li720\ri0\sb0\sa0\sl0\shading0
 TOC 5
+;}{\s17\snext0\f0\fs24\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li900\ri0\sb0\sa0\sl0\shading0
 TOC 
6;}{\s18\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li1080\ri0\sb0\sa0\sl0\shading0
 TOC 
7;}{\s19\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li1260\ri0\sb0\sa0\sl0\shading0
 TOC 
8;}{\s20\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li1440\ri0\sb0\sa0\sl0\shading0
 TOC 
9;}{\s21\snext0\f0\fs32\b\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb240\sa60\sl0\shading0\qc
 
Title;}{\s22\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi-360\li360\ri0\sb0\sa0\sl0\shading0
 Numbered List
+;}{\s23\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi-360\li360\ri0\sb0\sa0\sl0\shading0
 Bulleted 
List;}{\s24\snext0\f0\fs20\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa120\sl0\shading0
 Body 
Text;}{\s25\snext0\f0\fs18\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa120\sl0\sl480\slmult1\shading0
 Body Text 
2;}{\s26\snext0\f0\fs16\cf0\cb2\chcbpat2\expnd0\expndtw0\charscalex100\dn0\fi0\li0\ri0\sb0\sa120\sl0\shading0
 Body Text 

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

2018-03-12 Thread Caolán McNamara
 sw/qa/core/data/rtf/fail/forcepoint-4.rtf | 1779 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 
 2 files changed, 1783 insertions(+), 1 deletion(-)

New commits:
commit 3686a3fc1b2eaee53b1ab32f33455b2b37aa8c6e
Author: Caolán McNamara 
Date:   Thu Mar 8 21:25:28 2018 +

forcepoint #21 pop on empty stack

Thanks to Antti Levomäki and Christian Jalio from Forcepoint.

Change-Id: I25b1c6361fb0a3ae6b01f2be870c9e1b49bf5b84
Reviewed-on: https://gerrit.libreoffice.org/51115
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/sw/qa/core/data/rtf/fail/forcepoint-4.rtf 
b/sw/qa/core/data/rtf/fail/forcepoint-4.rtf
new file mode 100755
index ..ccd04d451b10
--- /dev/null
+++ b/sw/qa/core/data/rtf/fail/forcepoint-4.rtf
@@ -0,0 +1,1779 @@
+{\rtf1\ansi \deff4\deflang1033{\fonttbl{\f0\froman\fcharset0\fprq2 Tms 
Rmn;}{\f1\froman\fcharset2\fprq2 Symbol;}{\f2\fswiss\fcharset0\fprq2 
Helv{\*\falt Arial};}{\f3\fmodern\fcharset0\fprq1 Courier;}
+{\f4\froman\fcharset0\fprq2 Times New Roman;}{\f5\fswiss\fcharset0\fprq2 
Arial;}{\f6\froman\fcharset0\fprq2 MS Serif;}{\f7\fswiss\fcharset0\fprq2 MS 
Sans Serif;}{\f8\froman\fcharset0\fprq2 Times;}{\f9\fswiss\fcharset0\fprq2 
Helvetica;}
+{\f10\fswiss\fcharset0\fprq2 System;}{\f11\fmodern\fcharset0\fprq1 Courier 
New;}{\f12\froman\fcharset0\fprq2 New York;}{\f13\fswiss\fcharset0\fprq2 
Geneva;}{\f14\fnil\fcharset2\fprq2 Marlett;}{\f15\fnil\fcharset2\fprq2 
Wingdings;}
+{\f16\fswiss\fcharset0\fprq2 Arial Narrow;}{\f17\fswiss\fcharset0\fprq2 Arial 
Black;}{\f18\froman\fcharset0\fprq2 Book Antiqua;}{\f19\froman\fcharset0\fprq2 
Bookman Old Style;}{\f20\froman\fcharset0\fprq2 Century Schoolbook;}
+{\f21\fnil\fcharset2\fprq2 Monotype Sorts;}{\f22\fswiss\fcharset0\fprq2 
Haettenschweiler;}{\f23\froman\fcharset0\fprq2 
Garamond;}{\f24\fmodern\fcharset2\fprq1 MS 
LineDraw;}{\f25\fswiss\fcharset0\fprq2 Helvetica-Narrow;}
+{\f26\froman\fcharset255\fprq2 Roman;}{\f27\fscript\fcharset255\fprq2 
Script;}{\f28\fmodern\fcharset255\fprq2 Modern;}{\f29\fswiss\fcharset0\fprq1 MS 
Dialog;}{\f30\froman\fcharset0\fprq2 Bookman{\*\falt Bookman Old Style};}
+{\f31\fnil\fcharset0\fprq0 Times New Roman Monotype{\*\falt Times New 
Roman};}{\f32\fnil\fcharset0\fprq0 Stone Sans{\*\falt Times New 
Roman};}{\f33\froman\fcharset0\fprq2 Palatino;}{\f34\fnil\fcharset0\fprq0 Arial 
Monotype;}}{\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
 \f4\fs20 \snext0 Normal;}{\s1\sb240\sa60\keepn\widctlpar{\*\pn 
\pnlvl1\pndec\pnprev1\pnstart1\pnsp144 {\pntxta .}}\b\f5\fs28\kerning28 
+\sbasedon0\snext0 heading 
1,H1;}{\s2\sb380\sa160\sl-320\slmult0\keepn\nowidctlpar\tqr\tx432\tx864{\*\pn 
\pnlvl2\pndec\pnprev1\pnstart1\pnsp144 }\b\f9\fs28\cf1 \sbasedon15\snext0 
heading 2,H2;}{\s3\sb280\sa140\sl-280\slmult0
+\keepn\nowidctlpar\tqr\tx432\tx864{\*\pn 
\pnlvl3\pndec\pnprev1\pnstart1\pnsp144 {\pntxtb .}}\b\f9\cf1\kerning28 
\sbasedon2\snext16 heading 3,H3;}{\s4\sb120\sa80\keep\keepn\widctlpar{\*\pn 
\pnlvl4\pndec\pnprev1\pnstart1\pnsp144 {\pntxtb .}}
+\b\i\f9\fs20\kerning28 \sbasedon0\snext16 heading 
4,H4;}{\s5\sb240\sa60\widctlpar{\*\pn \pnlvl5\pndec\pnprev1\pnstart1\pnsp144 
{\pntxtb .}}\f5\fs22 \sbasedon0\snext0 heading 
5,H5;}{\s6\sb240\sa60\widctlpar{\*\pn \pnlvl6\pndec\pnprev1\pnstart1\pnsp144 
+{\pntxtb .}}\i\f5\fs22 \sbasedon0\snext0 heading 
6,H6;}{\s7\sb240\sa60\widctlpar{\*\pn \pnlvl7\pndec\pnprev1\pnstart1\pnsp144 
{\pntxtb .}}\f5\fs20 \sbasedon0\snext0 heading 
7;}{\s8\sb240\sa60\widctlpar{\*\pn \pnlvl8\pndec\pnprev1\pnstart1\pnsp144 
+{\pntxtb .}}\i\f5\fs20 \sbasedon0\snext0 heading 
8;}{\s9\sb240\sa60\widctlpar{\*\pn \pnlvl9\pndec\pnprev1\pnstart1\pnsp144 
{\pntxtb .}}\i\f5\fs18 \sbasedon0\snext0 heading 9;}{\*\cs10 \additive Default 
Paragraph Font;}{\s15\li864\sb100\sl-260\slmult0
+\nowidctlpar \f8\fs20\cf1 \snext15 T1.Text1;}{\s16\sa120\widctlpar \f4\fs20 
\sbasedon0\snext16 Body 
Text;}{\s17\fi-288\li1655\sb100\sa100\sl-260\slmult0\keepn\nowidctlpar\tx1655 
\f8\fs20\cf1 \snext17 A.A+List;}{
+\s18\fi-288\li1655\sb100\sa100\sl-260\slmult0\nowidctlpar\tx1655\tx1958 
\f8\fs20\cf1 \snext18 
A.AList;}{\s19\li1655\sb100\sa100\sl-260\slmult0\keepn\nowidctlpar\tx1655 
\f31\fs20\cf1 \snext19 A.AList_nonum;}{\s20\qc\nowidctlpar \f8\fs4\cf1 \snext20 
+anchorhldr;}{\s21\fi-792\li2015\sb100\sa100\sl-260\slmult0\nowidctlpar\tx2015 
\f8\fs20\cf1 \snext21 
b1.Bul_list;}{\s22\fi-289\li1224\sb100\sa100\sl-260\slmult0\nowidctlpar\tx1224\tldot\tx3685
 \f8\fs20\cf1 \snext22 b1.Bullet1;}{

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

2018-02-28 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf115715.rtf  |   38 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   17 +++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   30 ---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 ++
 4 files changed, 79 insertions(+), 10 deletions(-)

New commits:
commit 7963353a816f22a66330923f90f500820784313a
Author: Miklos Vajna 
Date:   Mon Feb 26 21:17:59 2018 +0100

tdf#115715 RTF import: ignore zero para indents in styles without parents

The only reason the DOCX equivalent of the bugdoc was imported correctly
is that these default zero margins are simply missing from the DOCX
markup, suggesting Word ignores them. We now do the same, this way
the stripped down document's 3 paragraphs all have different margins as
expected.

(Also rework the testTdf112211_2 testcase to test the original problem
better: I verified that the layout is unchanged before/after this
patch.)

(cherry picked from commit 59363e639b67a8acbd6da240635de47921b2c955)

Change-Id: I88d56c27c19e070e983c3392f99bca96597cd56e
Reviewed-on: https://gerrit.libreoffice.org/50435
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf115715.rtf 
b/sw/qa/extras/rtfimport/data/tdf115715.rtf
new file mode 100644
index ..4f8311d8de11
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf115715.rtf
@@ -0,0 +1,38 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch0\stshfloch1\stshfhich1\stshfbi1\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs1025
+\noqfpromote
+{\stylesheet
+{\ql \rin0\lin0 \ltrch\fcs0 
\f1\fs24\cf1\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 
\sqformat \spriority0 Normal;}
+{\s55\ql \rin0\lin0 \afs26 \ltrch\fcs0 
\f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext55 
\slink22 Style 55;}
+{\s56\ql \fi-720\rin0\lin0 \afs26 \ltrch\fcs0 
\f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext56 
\slink24 Style 56;}
+}
+{\*\listtable
+{\list\listtemplateid-454920584
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+\af0\afs26\ltrch\fcs0
+\fs26\hres0\chhres0}
+{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'01.;}
+{\levelnumbers\'01;}
+\af0\afs26 \ltrch\fcs0 \fs26\hres0\chhres0}
+{\listname;}
+\listid1}
+}
+{\*\listoverridetable
+{\listoverride\listid1\listoverridecount0\ls1}
+}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440
+\pard\plain before
+\par
+\pard\plain\s56\fi-720\li1580
+\ls1\rin0\lin1580 \afs26 \ltrch\fcs0 
\f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052
+{\ltrch\fcs0
+\lang1033\langfe1033\langfenp1033 1}
+\par
+\pard\plain\s55\ql \li1580
+\ls1\ilvl1\rin0\lin1580 \afs26 \ltrch\fcs0 
\f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052
+{\ltrch\fcs0
+\lang1033\langfe1033\langfenp1033 a}
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 2ae659ae8351..233cf1d5dc3b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -179,6 +179,14 @@ DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
 }
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf115715, "tdf115715.rtf")
+{
+// This was 0, second paragraph was shifted to the right, it had the same
+// horizontal position as the 3rd paragraph.
+CPPUNIT_ASSERT_EQUAL(static_cast(-1270),
+ getProperty(getParagraph(2), 
"ParaFirstLineIndent"));
+}
+
 DECLARE_RTFIMPORT_TEST(testTdf115155, "tdf115155.rtf")
 {
 auto xLevels
@@ -348,11 +356,10 @@ DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf")
 
 DECLARE_RTFIMPORT_TEST(testTdf112211_2, "tdf112211-2.rtf")
 {
-uno::Reference xPropertyState(getParagraph(2), 
uno::UNO_QUERY);
-beans::PropertyState ePropertyState = 
xPropertyState->getPropertyState("ParaLeftMargin");
-// This was beans::PropertyState_DIRECT_VALUE -> direct formatting
-// prevented inheritance from numbering definition.
-CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE, ePropertyState);
+// Spacing between the bullet and the actual text was too large.
+// This is now around 269, large old value was 629.
+int nWidth = 
parseDump("/root/page/body/txt[2]/Text[@nType='POR_TABLEFT']", 
"nWidth").toInt32();
+CPPUNIT_ASSERT_LESS(300, nWidth);
 }
 
 DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf")
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index bfb40c83b8be..9c4c714baeb3 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx

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

2018-02-27 Thread Caolán McNamara
 sw/qa/core/data/rtf/pass/forcepoint-1.rtf|  193 +++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |6 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx  |2 
 3 files changed, 200 insertions(+), 1 deletion(-)

New commits:
commit efadc8becb2376e54839a7823560811063fb2f48
Author: Caolán McNamara 
Date:   Mon Feb 26 12:30:57 2018 +

forcepoint #10 pop empty stack

Change-Id: I96452a86187a6b03251614625445d1b18a5ee218
Reviewed-on: https://gerrit.libreoffice.org/50358
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/data/rtf/pass/forcepoint-1.rtf 
b/sw/qa/core/data/rtf/pass/forcepoint-1.rtf
new file mode 100755
index ..afee08d8d925
--- /dev/null
+++ b/sw/qa/core/data/rtf/pass/forcepoint-1.rtf
@@ -0,0 +1,193 @@
+{\rtf1\ansi\ansicpg1252\uc1 
\deff0\deflang3082\deflangfe3082{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 
02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 
020b0604020202020204}Arial;}
+{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier 
New;}{\f153\froman\fcharset238\fprq2 Times New Roman 
CE;}{\f154\froman\fcharset204\fprq2 Times New Roman 
Cyr;}{\f156\froman\fcharset161\fprq2 Times New Roman Greek;}
+{\f157\froman\fcharset162\fprq2 Times New Roman 
Tur;}{\f158\froman\fcharset177\fprq2 Times New Roman 
(Hebrew);}{\f159\froman\fcharset178\fprq2 Times New Roman 
(Arabic);}{\f160\froman\fcharset186\fprq2 Times New Roman Baltic;}
+{\f161\fswiss\fcharset238\fprq2 Arial CE;}{\f162\fswiss\fcharset204\fprq2 
Arial Cyr;}{\f164\fswiss\fcharset161\fprq2 Arial 
Greek;}{\f165\fswiss\fcharset162\fprq2 Arial 
Tur;}{\f166\fswiss\fcharset177\fprq2 Arial (Hebrew);}
+{\f167\fswiss\fcharset178\fprq2 Arial 
(Arabic);}{\f168\fswiss\fcharset186\fprq2 Arial 
Baltic;}{\f169\fmodern\fcharset238\fprq1 Courier New 
CE;}{\f170\fmodern\fcharset204\fprq1 Courier New 
Cyr;}{\f172\fmodern\fcharset161\fprq1 Courier New Greek;}
+{\f173\fmodern\fcharset162\fprq1 Courier New 
Tur;}{\f174\fmodern\fcharset177\fprq1 Courier New 
(Hebrew);}{\f175\fmodern\fcharset178\fprq1 Courier New 
(Arabic);}{\f176\fmodern\fcharset186\fprq1 Courier New 
Baltic;}}{\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{\ql
 \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 
\fs20\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext0 Normal;}{
+\s3\qj 
\li0\ri0\keepn\widctlpar\hyphpar0\aspalpha\aspnum\faauto\outlinelevel2\adjustright\rin0\lin0\itap0
 \b\fs24\lang3082\langfe1024\cgrid\langnp3082\langfenp1024 \sbasedon0 \snext0 
heading 3;}{\*\cs10 \additive Default Paragraph Font;}{
+\s15\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \sbasedon0 \snext15 
Lower Roman List;}{\s16\ql \li0\ri0\nowidctlpar\tx431\faauto\rin0\lin0\itap0 
+\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \sbasedon31 \snext0 
Numbered Heading 1;}{\s17\ql \li0\ri0\nowidctlpar\tx431\faauto\rin0\lin0\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \sbasedon32 \snext0 
Numbered Heading 2;}{
+\s18\ql \li0\ri0\nowidctlpar\tx431\faauto\rin0\lin0\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \sbasedon33 \snext0 
Numbered Heading 3;}{\s19\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 
+\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \sbasedon0 \snext19 
Endnote Text;}{\s20\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext20 Diamond List;}{
+\s21\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext21 Numbered 
List;}{\s22\ql \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 
+\fs20\lang3082\langfe3082\super\cgrid\langnp3082\langfenp3082 \snext22 Endnote 
Reference;}{\s23\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext23 Triangle 
List;}{
+\s24\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext24 Square 
List;}{\s25\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
+\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext25 Dashed 
List;}{\s26\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \sbasedon21 \snext26 
Upper Roman List;}{
+\s27\ql \fi-431\li720\ri0\nowidctlpar\faauto\rin0\lin720\itap0 
\fs24\lang3082\langfe3082\cgrid\langnp3082\langfenp3082 \snext27 Heart 
List;}{\s28\ql 

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

2018-02-26 Thread Miklos Vajna
 sw/qa/extras/ooxmlimport/data/tdf115883.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |6 ++
 writerfilter/source/dmapper/PropertyMap.cxx  |9 -
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit bd2e7b2a5bcb8f7838c7de828d0ecdd071ee4c64
Author: Miklos Vajna 
Date:   Thu Feb 22 12:28:06 2018 +0100

tdf#115883 DOCX import: catch RuntimeException from SwXFrame

getPropertyValue("Surround") for a non-inserted frame can throw, but
hasPropertyValue("Surround") still returns true. So fix the regression
by just catching the exception, assuming that in that case no increased
spacing is needed.

Change-Id: I49a78ce8d41b4e1cc7d23721d5dc70f7550c94af
Reviewed-on: https://gerrit.libreoffice.org/50175
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 5e1a50cc433a865da677faf7d502ba41858e45f6)
Reviewed-on: https://gerrit.libreoffice.org/50348
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf115883.docx 
b/sw/qa/extras/ooxmlimport/data/tdf115883.docx
new file mode 100644
index ..f90ac638d7a4
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115883.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 61ef9aeaeb63..d879dab4495a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -684,6 +684,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf105975formula, 
"tdf105975.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("25"), 
xEnumerationAccess->getPresentation(false).trim());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf115883, "tdf115883.docx")
+{
+// Import failed due to an unhandled exception when getting the Surround
+// property of a not yet inserted frame.
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf75573, "tdf75573_page1frame.docx")
 {
 // the problem was that the frame was discarded
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index db2f20980bb3..708b80a55c4f 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1219,7 +1219,14 @@ void SectionPropertyMap::CloseSectionGroup( 
DomainMapper_Impl& rDM_Impl )
 }
 rPendingFloatingTables.clear();
 
-HandleIncreasedAnchoredObjectSpacing(rDM_Impl);
+try
+{
+HandleIncreasedAnchoredObjectSpacing(rDM_Impl);
+}
+catch (const uno::Exception& rException)
+{
+SAL_WARN("writerfilter", "HandleIncreasedAnchoredObjectSpacing() 
failed: " << rException);
+}
 
 if ( m_nLnnMod )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-02-21 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf112694.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|8 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |4 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   11 ---
 writerfilter/source/dmapper/PropertyMap.cxx   |   10 ++
 5 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 055aae14063773bdac9ea43b3207f1d7d6ca6b4c
Author: Miklos Vajna 
Date:   Mon Feb 19 22:37:58 2018 +0100

tdf#112694 DOCX import: handle  when turning on follow style 
header

Commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page
header should always set default headers as well, 2014-11-21) turned on
header/footer of follow page styles of first page styles when the first
page style had the header/footer turned on, but failed to consider if
 is present or not. When it's not present, the first page
header/footer should be ignored.

An additional problem is that by the time
DomainMapper_Impl::PushPageHeaderFooter() is called,  is not
parsed yet, so we can't act accordingly.

Fix the problem by moving the check to
SectionPropertyMap::PrepareHeaderFooterProperties(), which runs at the
end of the section properties, where all required info is available,
there we can just check for m_bTitlePage.

This allows reverting the two changes to existing testcases in
CppunitTest_sw_ooxmlexport6 from the original commit as a side-effect.

(cherry picked from commit a16275a3647a2fba9913ed23e8329e45b02123b4)

Change-Id: Ic628adab99a4b148fcfd66ca39d0cf81eb7dd9f1
Reviewed-on: https://gerrit.libreoffice.org/50027
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf112694.docx 
b/sw/qa/extras/ooxmlexport/data/tdf112694.docx
new file mode 100644
index ..f629a388e3cb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf112694.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 91697a80f920..0fd64733e700 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -73,6 +73,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82065_Ind_start_strict, 
"tdf82065_Ind_start_stri
 CPPUNIT_ASSERT_EQUAL_MESSAGE("IndentAt defined", true, bFoundIndentAt);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf112694, "tdf112694.docx")
+{
+uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard");
+// Header was on when header for file was for explicit first pages only
+// (marked via ).
+CPPUNIT_ASSERT(!getProperty(aPageStyle, "HeaderIsOn"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.docx")
 {
 uno::Reference xTextField = getProperty< 
uno::Reference >(getRun(getParagraph(1), 2), "TextField");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 880d05aafbb6..dbed9fc22384 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -454,7 +454,7 @@ DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx")
 {
 // The problem was exporter was exporting vml data for shape in w:rPr 
element.
 // vml data should not come under w:rPr element.
-xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
 if (!pXmlDoc)
 return;
 CPPUNIT_ASSERT(getXPath(pXmlDoc, 
"/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", 
"stroked").match("f"));
@@ -464,7 +464,7 @@ DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx")
 {
 // The problem was exporter was exporting v:imagedata data for shape in 
w:pict as v:fill w element.
 
-xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
 if (!pXmlDoc)
 return;
 CPPUNIT_ASSERT(getXPath(pXmlDoc, 
"/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", 
"detectmouseclick").match("t"));
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index de2a959f019d..3791a7c44295 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1660,17 +1660,6 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 getPropertyName(ePropIsOn),
 uno::makeAny(true));
 
-if (bFirst)
-{
-OUString aFollowStyle = 
xPageStyle->getPropertyValue("FollowStyle").get();
-if (GetPageStyles()->hasByName(aFollowStyle))
-{
- 

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

2018-02-16 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf113258.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|9 +
 writerfilter/source/dmapper/DomainMapper.cxx  |   22 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |7 +++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 +++
 5 files changed, 41 insertions(+)

New commits:
commit 3779c742a52d8dde3fa7b74c2a8ca8bc7d071b4e
Author: Miklos Vajna 
Date:   Mon Feb 12 22:04:55 2018 +0100

tdf#113258 DOCX import: fix beforeAutospacing for shape first paragraph

Commit c761df1e42fd11acc5fc05b0baacd803c3788ca6 (tdf#84678 DOCX import:
fix handling of textbox margins, 2016-10-25) uncovered a previously
harder to notice problem that single-paragraph shapes have an incorrect
upper paragraph margin for the first paragraph. Now that the shape
margins are correct this problematic paragraph margin causes crop of the
shape text.

Fix the problem by adapting the DOCX import to the WW8 import's
SwWW8ImplReader::AppendTextNode() (the "If this is the first paragraph
in the document" part), where it seems the first paragraph is not only
the literally first paragraph in the document, but also the first
paragraph of shapes as well.

(cherry picked from commit f737c9386a605cb7d8c9dbc210c557f98f6cdc19)

Conflicts:
writerfilter/source/dmapper/DomainMapper.cxx

Change-Id: I9d99b9cfabae2c9a7c33eefefb5a9f008669e93d
Reviewed-on: https://gerrit.libreoffice.org/49626
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf113258.docx 
b/sw/qa/extras/ooxmlexport/data/tdf113258.docx
new file mode 100644
index ..d60a2ee6413c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf113258.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 98e207c81d81..91697a80f920 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -161,6 +161,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf114703, "tdf114703.docx")
 
comphelper::SequenceAsHashMap(xRules->getByIndex(0))["FirstLineIndent"].get());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf113258, "tdf113258.docx")
+{
+uno::Reference xShape(getShape(1), uno::UNO_QUERY);
+// This was 494, i.e. automatic spacing resulted in non-zero paragraph top
+// margin for the first paragraph in a shape.
+CPPUNIT_ASSERT_EQUAL(static_cast(0),
+ getProperty(xShape->getStart(), 
"ParaTopMargin"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 83698f4553de..5569f91a23de 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2170,7 +2170,27 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 StyleSheetTablePtr pStyleTable = m_pImpl->GetStyleSheetTable();
 const OUString sConvertedStyleName = pStyleTable->ConvertStyleName( 
sStringValue, true );
 if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != 
CONTEXT_SECTION)
+{
 m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, 
uno::makeAny( sConvertedStyleName ));
+
+if (m_pImpl->GetIsFirstParagraphInShape())
+{
+// First paragraph in shape: see if we need to disable
+// paragraph top margin from style.
+StyleSheetEntryPtr pEntry
+= 
m_pImpl->GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(
+sConvertedStyleName);
+if (pEntry)
+{
+boost::optional pParaAutoBefore
+= pEntry->pProperties->getProperty(
+PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING);
+if (pParaAutoBefore)
+m_pImpl->GetTopContext()->Insert(PROP_PARA_TOP_MARGIN,
+ 
uno::makeAny(static_cast(0)));
+}
+}
+}
 //apply numbering to paragraph if it was set at the style, but only if 
the paragraph itself
 //does not specify the numbering
 if( !rContext->isSet(PROP_NUMBERING_RULES) ) // !contains
@@ -3080,6 +3100,8 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 // No context? Then this image should not appear directly inside the
 // document, just save it for later usage.
 m_pImpl->PushPendingShape(xShape);
+
+m_pImpl->SetIsFirstParagraphInShape(true);
 }
 
 void 

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

2018-02-16 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf115719.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |7 +
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   30 --
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   17 +++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|   16 +++
 writerfilter/source/dmapper/PropertyMap.cxx  |   68 +++
 writerfilter/source/dmapper/PropertyMap.hxx  |4 
 writerfilter/source/dmapper/SettingsTable.cxx|   27 +
 writerfilter/source/dmapper/SettingsTable.hxx|2 
 9 files changed, 142 insertions(+), 29 deletions(-)

New commits:
commit 33317afcb1c070bd4ff19d312964d78f2105a87e
Author: Miklos Vajna 
Date:   Wed Feb 14 15:31:35 2018 +0100

tdf#115719 DOCX import: increase paragraph spacing for anchored objects

... like Word 2013 does, when the version string indicates that the new
layout is wanted.

An alternative to this change would be to add a new sw layout
compatibility flag and handle this at a layout level (somewhere in
SwAnchoredObject::GetObjRectWithSpaces()). The downside of that approach
is that once a layout flag is added, it's not preferred to tweak its
behavior, while doing the same at import time is not a problem.

Also it's better to have a flag for something which has clear behavior
in some spec / implementer notes, which is not the case for this
problem. (I've mailed dochelp@microsoft, no answer so far.)

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

Change-Id: Ibad28d27e4bcbe1991a3be1c686064e18e9ffa4d
Reviewed-on: https://gerrit.libreoffice.org/49802
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf115719.docx 
b/sw/qa/extras/ooxmlexport/data/tdf115719.docx
new file mode 100644
index ..9519a2a14524
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf115719.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 58e654159494..98e207c81d81 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -99,6 +99,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf67207_MERGEFIELD, 
"mailmerge.docx")
 
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.text.fieldmaster.DataBase.Name"), 
sValue);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
+{
+// This was a single page, instead of pushing the textboxes to the second
+// page.
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
 {
 // This was 2096, the horizontal positioning of the star shape affected the
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 2f254be9c67c..e6f993e19387 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -312,34 +312,6 @@ void 
lcl_DecrementHoriOrientPosition(std::vector& rFramePr
 }
 }
 
-sal_Int32 lcl_getWordCompatibilityMode( const css::uno::Sequence< 
css::beans::PropertyValue >& rCompatSettings )
-{
-for ( int i = 0; i < rCompatSettings.getLength(); ++i )
-{
-const css::beans::PropertyValue& rProp = rCompatSettings[i];
-if ( rProp.Name == "compatSetting" )
-{
-css::uno::Sequence< css::beans::PropertyValue > 
aCurrentCompatSettings;
-rProp.Value >>= aCurrentCompatSettings;
-
-OUString sName;
-OUString sUri;
-OUString sVal;
-
-aCurrentCompatSettings[0].Value >>= sName;
-aCurrentCompatSettings[1].Value >>= sUri;
-aCurrentCompatSettings[2].Value >>= sVal;
-
-if ( sName == "compatibilityMode" && sUri == 
"http://schemas.microsoft.com/office/word; )
-{
-return sVal.toInt32();
-}
-}
-}
-
-return -1; // Word compatibility mode not found
-}
-
 TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo & rInfo, 
std::vector& rFrameProperties)
 {
 // will receive the table style if any
@@ -574,7 +546,7 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 
 // tdf#106742: since MS Word 2013 (compatibilityMode >= 15), top-level 
tables are handled the same as nested tables;
 // this is also the default behavior in LO when DOCX doesn't define 
"compatibilityMode" option
-sal_Int32 nMode = lcl_getWordCompatibilityMode( 
m_rDMapper_Impl.GetSettingsTable()->GetCompatSettings() );
+sal_Int32 nMode = 

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

2018-02-09 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf115242.rtf |   40 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |8 
 writerfilter/source/dmapper/DomainMapper.cxx  |   24 +++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +-
 writerfilter/source/rtftok/rtfdispatchvalue.cxx   |8 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|5 +-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx|3 +
 writerfilter/source/rtftok/rtfsprm.cxx|   11 ++
 writerfilter/source/rtftok/rtfsprm.hxx|3 +
 9 files changed, 96 insertions(+), 11 deletions(-)

New commits:
commit ecff2a84e2766dd93bd028e065d9ea3d833b369b
Author: Miklos Vajna 
Date:   Mon Feb 5 16:02:19 2018 +0100

tdf#115242 RTF import: order numPr before other paragraph properties

So that paragraph properties inherited from numbering properties can be
properly overwritten with direct formatting, even when we have to take
style deduplication into account.

The OOXML tokenizer already did this,
writerfilter::dmapper::DomainMapper::sprmWithProps()'s
NS_ooxml::LN_CT_NumPr_numId depends on this, so adapt the RTF tokenizer
accordingly.

(cherry picked from commit 03cee02464f230a2efa67d131c137f32fe540052)

Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx

Change-Id: Iec6026d146f08a9d06266763d01ed626a2d1f3d1
Reviewed-on: https://gerrit.libreoffice.org/49355
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf115242.rtf 
b/sw/qa/extras/rtfimport/data/tdf115242.rtf
new file mode 100644
index ..f79a0ed9a642
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf115242.rtf
@@ -0,0 +1,40 @@
+{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch0\stshfloch1\stshfhich1\stshfbi1\deflang1033\deflangfe1033\themelang1033\themelangfe2052\themelangcs1025
+{\*\listtable
+{\list\listtemplateid-454920584
+{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0\afs26 \ltrch\fcs0 \fs26 }
+{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\'02\'01.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0\afs26 \ltrch\fcs0 \fs26 }
+{\listname ;}
+\listid1}
+}
+{\*\listoverridetable
+{\listoverride\listid1\listoverridecount0\ls1}
+}
+\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect
+\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\noxlattoyen
+\noultrlspc\dntblnsbdb\nospaceforul\horzdoc\dgmargin\dghspace120\dgvspace181\dghorigin1440\dgvorigin1440\dghshow2\dgvshow1
+\jcompress\viewkind1\viewscale100\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot5451531
+\newtblstyruls\nogrowautofit\viewbksp1\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal
 \nouicompat \fet0
+{\*\wgrffmtfilter 2450}
+\nofeaturethrottle1\ilfomacatclnup0
+\ltrpar \sectd 
\ltrsect\linex0\headery735\footery893\sectlinegrid360\sectdefaultcl\sectrsid1254981\sftnbj
+\pard\plain \ltrpar\s57\ql \fi-720\li1580\ri0\sl-421\slmult0\widctlpar
+\tx2264\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin1580\itap0\pararsid1254981
 \rtlch\fcs1 \af1\afs26\alang1025 \ltrch\fcs0 
\f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\lang1033\langfe1033\langfenp1033\insrsid10637256 This is \'931\'94}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid4026340
+\par
+{\listtext\pard\plain\ltrpar \s56 \rtlch\fcs1 \af0\afs26\alang1025 \ltrch\fcs0 
\f1\fs26\insrsid10637256 \hich\af1\dbch\af0\loch\f1 a.\tab}
+}
+\pard\plain \ltrpar\s56\ql \li1580\ri0\sl-421\slmult0\widctlpar
+\tx2293\wrapdefault\aspalpha\aspnum\faauto\ls1\ilvl1\adjustright\rin0\lin1580\itap0\pararsid10637256
 \rtlch\fcs1 \af1\afs26\alang1025 \ltrch\fcs0 
\f1\fs26\lang1033\langfe2052\cgrid\langnp1033\langfenp2052
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\lang1033\langfe1033\langfenp1033\insrsid10637256 This is \'93a\'94, \'93a\'94 
starts at the above \'93This\'94}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid4026340
+\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 030fccae1aab..2ae659ae8351 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1397,6 +1397,14 @@ DECLARE_RTFIMPORT_TEST(testTdf104016, "tdf104016.rtf")
   

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

2018-02-07 Thread Mike Kaganski
 sw/qa/extras/ooxmlimport/data/tdf114217.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |8 
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |4 +++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|6 --
 writerfilter/source/dmapper/PropertyMap.cxx  |5 +
 5 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit a34f87f8f97aa6aafd4098cffd214e8d2c3a0ba3
Author: Mike Kaganski 
Date:   Wed Feb 7 01:03:32 2018 +0300

tdf#114217: Consider relative width when importing floating table

Unit test included

Change-Id: I8e3338d7df431bd016caa4e06e684fbd189127c4
Reviewed-on: https://gerrit.libreoffice.org/49324
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 76d6fcd05c630a928dd3bd028d560792d9c904ca)
Reviewed-on: https://gerrit.libreoffice.org/49333
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf114217.docx 
b/sw/qa/extras/ooxmlimport/data/tdf114217.docx
new file mode 100644
index ..49f1ce164cbe
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf114217.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 449dae04ac59..61ef9aeaeb63 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1574,6 +1574,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
 CPPUNIT_ASSERT_EQUAL( OUString("1696"), aTop );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx")
+{
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDrawPage = 
xDrawPageSupplier->getDrawPage();
+// This was 1, multi-page table was imported as a floating one.
+CPPUNIT_ASSERT_EQUAL(static_cast(0), xDrawPage->getCount());
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index a6e6947d9491..2f254be9c67c 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1151,8 +1151,10 @@ void DomainMapperTableHandler::endTable(unsigned int 
nestedTableLevel, bool bTab
 // table is not in the body text.
 sal_Int32 nTableWidth = 0;
 m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, 
nTableWidth);
+sal_Int32 nTableWidthType = text::SizeType::FIX;
+m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH_TYPE, 
nTableWidthType);
 if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1 
&& !m_rDMapper_Impl.IsInHeaderFooter())
-m_rDMapper_Impl.m_aPendingFloatingTables.emplace_back(xStart, 
xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth);
+m_rDMapper_Impl.m_aPendingFloatingTables.emplace_back(xStart, 
xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth, 
nTableWidthType);
 else
 {
 // m_xText points to the body text, get the current xText from 
m_rDMapper_Impl, in case e.g. we would be in a header.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 589a79953f13..cf51e7fac46c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -356,17 +356,19 @@ struct FloatingTableInfo
 css::uno::Reference m_xEnd;
 css::uno::Sequence m_aFrameProperties;
 sal_Int32 m_nTableWidth;
+sal_Int32 m_nTableWidthType;
 /// Break type of the section that contains this table.
 sal_Int32 m_nBreakType = -1;
 
 FloatingTableInfo(css::uno::Reference const& xStart,
 css::uno::Reference const& xEnd,
 const css::uno::Sequence& 
aFrameProperties,
-sal_Int32 nTableWidth)
+sal_Int32 nTableWidth, sal_Int32 nTableWidthType)
 : m_xStart(xStart),
 m_xEnd(xEnd),
 m_aFrameProperties(aFrameProperties),
-m_nTableWidth(nTableWidth)
+m_nTableWidth(nTableWidth),
+m_nTableWidthType(nTableWidthType)
 {
 }
 css::uno::Any getPropertyValue(const OUString );
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index c416ba52ba69..b1ee1fd971a3 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1030,6 +1031,10 @@ bool 

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

2018-01-30 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf115155.rtf   |   30 
 sw/qa/extras/rtfimport/rtfimport.cxx|   10 
 writerfilter/source/dmapper/DomainMapper.cxx|1 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |   13 --
 4 files changed, 52 insertions(+), 2 deletions(-)

New commits:
commit 697359f63e392a73fe3c34635819706a93e5c6b1
Author: Miklos Vajna 
Date:   Mon Jan 29 22:01:54 2018 +0100

tdf#115155 RTF import: fix left indent handling inside list definition

This used to work in the past only because the left indent was also
imported as a direct paragraph formatting, but that is not the case
since left margin of lists is deduplicated during import after commit
c9dee880d88305312094b311abdae155e452bf14 (tdf#104016 RTF import:
deduplicate before text indent from numbering, 2017-12-05).

(cherry picked from commit 7655001a65a250ea7cd70f2efcc78037b5a9813f)

Change-Id: I1c9be30700c51ef97fb274e8781d6008db3121d8
Reviewed-on: https://gerrit.libreoffice.org/4
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf115155.rtf 
b/sw/qa/extras/rtfimport/data/tdf115155.rtf
new file mode 100644
index ..199a6df68485
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf115155.rtf
@@ -0,0 +1,30 @@
+{\rtf1
+{\stylesheet
+{Normal;}
+}
+{\*\listtable
+{\list\listtemplateid-1421309416\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0
+\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\leveltemplateid646248826\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li720 }
+{\listname ;}
+\listid2098404966}
+{\list\listtemplateid1569465126\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0
+\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\leveltemplateid-597686520\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li1440 }
+\listid298658175}
+}
+{\*\listoverridetable
+{\listoverride\listid2098404966\listoverridecount0\ls1}
+{\listoverride\listid298658175\listoverridecount0\ls2}
+}
+\pard \fi-360\li720\ri0\ls1
+outer\par
+\pard \fi-360\li1440\ri0\ls2
+inner\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index b71a21f901d8..030fccae1aab 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -179,6 +179,16 @@ DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
 }
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf115155, "tdf115155.rtf")
+{
+auto xLevels
+= 
getProperty(getParagraph(2), 
"NumberingRules");
+// 1st level
+comphelper::SequenceAsHashMap aMap(xLevels->getByIndex(0));
+// This was 1270: the left margin in the numbering rule was too small.
+CPPUNIT_ASSERT_EQUAL(static_cast(2540), 
aMap["IndentAt"].get());
+}
+
 DECLARE_RTFIMPORT_TEST(testTdf108951, "tdf108951.rtf")
 {
 // This test is import-only, as we assert the list ID, which is OK to
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 39368c29d812..8b2020e300ff 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1334,6 +1334,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 // So no situation where keeping indentation at this point 
would make sense -> erase.
 rContext->Erase(PROP_PARA_FIRST_LINE_INDENT);
 rContext->Erase(PROP_PARA_LEFT_MARGIN);
+rContext->Erase(PROP_PARA_RIGHT_MARGIN);
 }
 }
 else
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index daaf9a44b969..399be66da0a6 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1465,8 +1465,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
 }
 case RTF_LI:
 {
-putNestedAttribute(m_aStates.top().aParagraphSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
-   NS_ooxml::LN_CT_Ind_left, pIntValue);
+if (m_aStates.top().eDestination == Destination::LISTLEVEL)
+{
+if (m_aStates.top().bLevelNumbersValid)
+putNestedAttribute(m_aStates.top().aTableSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
+   NS_ooxml::LN_CT_Ind_left, pIntValue);
+}
+else
+{
+putNestedAttribute(m_aStates.top().aParagraphSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
+   NS_ooxml::LN_CT_Ind_left, 

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

2018-01-27 Thread Michael Stahl
 sw/qa/extras/rtfimport/data/tdf115153.rtf  |9 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   14 ++
 writerfilter/source/rtftok/rtfdispatchflag.cxx |   10 --
 3 files changed, 31 insertions(+), 2 deletions(-)

New commits:
commit 8932ada4d8841499aa809f6b29efc1402fe95c1e
Author: Michael Stahl 
Date:   Wed Jan 24 16:42:34 2018 +0100

tdf#115153 writerfilter: RTF import: fix vert orient of Word 6 shapes

The bugdoc is affected by the change of default vertical alignment;
apparently it's not even possible to set the vertical alignment of a
Word 6 drawing object (\do) so we have to set the Word default.

(regression from c79467ba954987f1d239c594c1e1b3af3f5515f6)

(cherry picked from commit dc16cc0492ba96007078cc285fee1a8d03f40d55)

tdf#115153 the missing test document
(cherry picked from commit b7f12d8fd7493a7201ae5fd97e80e0296538f136)

Change-Id: I4084a7a7e2a55f864cb569e04632e034d59eefdb
Reviewed-on: https://gerrit.libreoffice.org/48524
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/rtfimport/data/tdf115153.rtf 
b/sw/qa/extras/rtfimport/data/tdf115153.rtf
new file mode 100644
index ..b80487072e54
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf115153.rtf
@@ -0,0 +1,9 @@
+{\rtf\ansi\ansicpg1251
+{\info {\author Oracle Reports} }
+\paperw11340\paperh16840\margl0\margr0\margt460\margb1240
+
+
+{\do \dobxpage\dobypage \dpline \dplinew0 \dpptx0 \dppty728 \dpptx0 \dppty0 
\dpx1436 \dpy1208 \dpxsize0 \dpysize728
+}
+
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 49733991b16b..b71a21f901d8 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -705,6 +705,20 @@ DECLARE_RTFIMPORT_TEST(testGroupshapeRotation, 
"groupshape-rotation.rtf")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), 
getProperty(getShape(1), "RotateAngle"));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf115153, "tdf115153.rtf")
+{
+auto const xShape(getShape(1));
+CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::NONE, 
getProperty(xShape, "HoriOrient"));
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME,
+ getProperty(xShape, "HoriOrientRelation"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2533), getProperty(xShape, 
"HoriOrientPosition"));
+// VertOrient was wrong
+CPPUNIT_ASSERT_EQUAL(text::VertOrientation::NONE, 
getProperty(xShape, "VertOrient"));
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME,
+ getProperty(xShape, "VertOrientRelation"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2131), getProperty(xShape, 
"VertOrientPosition"));
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt")
 {
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 38c5f0e5a2a3..a50165506f81 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -965,12 +966,19 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 
getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"),
 uno::UNO_QUERY);
 uno::Reference 
xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
+
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape,
+uno::UNO_QUERY);
 if (xDrawSupplier.is())
 {
 uno::Reference 
xShapes(xDrawSupplier->getDrawPage(),
  uno::UNO_QUERY);
 if (xShapes.is() && nKeyword != RTF_DPTXBX)
+{
+// set default VertOrient before inserting
+
m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(
+"VertOrient", 
uno::makeAny(text::VertOrientation::NONE));
 xShapes->add(m_aStates.top().aDrawingObject.xShape);
+}
 }
 if (nType)
 {
@@ -978,8 +986,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
 xDefaulter->createCustomShapeDefaults(OUString::number(nType));
 }
-
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape,
-uno::UNO_QUERY);
 std::vector& rPendingProperties
 = m_aStates.top().aDrawingObject.aPendingProperties;
 

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

2018-01-23 Thread Patrick Jaap
 sw/qa/extras/ooxmlimport/data/tdf113946.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |7 ++
 writerfilter/source/dmapper/GraphicHelpers.cxx |   86 -
 3 files changed, 51 insertions(+), 42 deletions(-)

New commits:
commit ada232a67fbb3acf60b104a4916719dbdb891819
Author: Patrick Jaap 
Date:   Mon Jan 15 16:43:07 2018 +0100

tdf#113946 add 'topMargin' to GraphicHelpers import

The case '...topMargin' was not caught for setting a relative
vertical position in GraphicHelpers. The test file demands a '7' here,
which stands for 'PAGE_FRAME'. The '7' was overwritten in GraphicImport in 
case
'LN_CT_Anchor_positionV' by a call of 'resolve'.

For a better overview a switch is inserted here.

Change-Id: Ie98209fe445ecbba15c3dafe5980ca52421126f8
Reviewed-on: https://gerrit.libreoffice.org/47908
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/ooxmlimport/data/tdf113946.docx 
b/sw/qa/extras/ooxmlimport/data/tdf113946.docx
new file mode 100644
index ..060df76ecc2a
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf113946.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4d65beeb90c4..449dae04ac59 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1567,6 +1567,13 @@ DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx")
 CPPUNIT_ASSERT_EQUAL( OUString("30624"), aTop );
 
 }
+
+DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
+{
+OUString aTop = 
parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top");
+CPPUNIT_ASSERT_EQUAL( OUString("1696"), aTop );
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx 
b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 8108445d24fb..a7ce01868714 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -63,57 +63,59 @@ void PositionHandler::lcl_attribute( Id aName, Value& rVal )
 {
 case NS_ooxml::LN_CT_PosV_relativeFrom:
 {
-// TODO There are some other unhandled values
-static const Id pVertRelValues[] =
+switch ( nIntValue )
 {
-
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin,
-NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page,
-
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph,
-NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line
-};
+case 
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin:
+m_nRelation = text::RelOrientation::PAGE_PRINT_AREA;
+break;
 
-static const sal_Int16 pVertRelations[] =
-{
-text::RelOrientation::PAGE_PRINT_AREA,
-text::RelOrientation::PAGE_FRAME,
-text::RelOrientation::FRAME,
-text::RelOrientation::TEXT_LINE
-};
+case 
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page:
+case 
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_topMargin: // fallthrough 
intended
+m_nRelation =  text::RelOrientation::PAGE_FRAME;
+break;
 
-for ( int i = 0; i < 4; i++ )
-{
-if ( pVertRelValues[i] == sal_uInt32( nIntValue ) )
-m_nRelation = pVertRelations[i];
+case 
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph:
+m_nRelation = text::RelOrientation::FRAME;
+break;
+
+case 
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line:
+m_nRelation = text::RelOrientation::TEXT_LINE;
+break;
+
+// TODO There are some other unhandled values
 }
 }
 break;
+
 case NS_ooxml::LN_CT_PosH_relativeFrom:
 {
-// TODO There are some other unhandled values
-static const Id pHoriRelValues[] =
+switch ( nIntValue )
 {
-
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin,
-NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page,
-
NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_column,
-

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

2018-01-09 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf114703.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   12 +
 writerfilter/source/dmapper/NumberingManager.cxx |   28 +--
 writerfilter/source/dmapper/NumberingManager.hxx |8 +++---
 4 files changed, 32 insertions(+), 16 deletions(-)

New commits:
commit d9fcc98c2d7d072d1a99c7c8b59806715a393a4f
Author: Miklos Vajna 
Date:   Mon Jan 8 22:59:21 2018 +0100

tdf#114703 DOCX import: apply num defaults only to abstract nums

Numbering definitions have two levels: abstract ones and overrides. The
full definition is a merge of the two. Make sure that when defaults are
added to the numbering level properties, these are only added for
abstract ones, otherwise overriding e.g. the start value of a level will
also pull in other, unwanted default properties.

(cherry picked from commit a6ec829055ab0b9d223979ae5f90d158d5549db1)

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

Change-Id: If0273ebc6b49476df17b09d636489a3bfb717334
Reviewed-on: https://gerrit.libreoffice.org/47653
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf114703.docx 
b/sw/qa/extras/ooxmlexport/data/tdf114703.docx
new file mode 100644
index ..116b56a2b42f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf114703.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index a5f808f070b3..700c69b225c3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -136,6 +136,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113399, "tdf113399.doc")
 CPPUNIT_ASSERT_EQUAL(static_cast(0), nPaddingValue);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf114703, "tdf114703.docx")
+{
+uno::Reference xRules
+= getProperty(
+getStyles("NumberingStyles")->getByName("WWNum1"), 
"NumberingRules");
+// This was 0, level override "default" replaced the non-default value from
+// the abstract level.
+CPPUNIT_ASSERT_EQUAL(
+static_cast(-1000),
+
comphelper::SequenceAsHashMap(xRules->getByIndex(0))["FirstLineIndent"].get());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 809717e62659..273501e6ccc6 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -191,9 +191,9 @@ sal_Int16 ListLevel::GetParentNumbering( const OUString& 
sText, sal_Int16 nLevel
 return nParentNumbering;
 }
 
-uno::Sequence< beans::PropertyValue > ListLevel::GetProperties( )
+uno::Sequence ListLevel::GetProperties(bool bDefaults)
 {
-uno::Sequence< beans::PropertyValue > aLevelProps = GetLevelProperties( );
+uno::Sequence aLevelProps = 
GetLevelProperties(bDefaults);
 if ( m_pParaStyle.get( ) )
 AddParaProperties(  );
 return aLevelProps;
@@ -233,7 +233,7 @@ uno::Sequence< beans::PropertyValue > 
ListLevel::GetCharStyleProperties( )
 return comphelper::containerToSequence(rProperties);
 }
 
-uno::Sequence< beans::PropertyValue > ListLevel::GetLevelProperties( )
+uno::Sequence ListLevel::GetLevelProperties(bool 
bDefaults)
 {
 const sal_Int16 aWWToUnoAdjust[] =
 {
@@ -286,7 +286,8 @@ uno::Sequence< beans::PropertyValue > 
ListLevel::GetLevelProperties( )
 }
 }
 
-aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION, 
m_nTabstop));
+if (bDefaults || m_nTabstop != 0)
+
aNumberingProperties.push_back(lcl_makePropVal(PROP_LISTTAB_STOP_POSITION, 
m_nTabstop));
 
 //TODO: handling of nFLegal?
 //TODO: nFNoRestart lower levels do not restart when higher levels are 
incremented, like:
@@ -299,7 +300,8 @@ uno::Sequence< beans::PropertyValue > 
ListLevel::GetLevelProperties( )
 //TODO: sRGBXchNums; array of inherited numbers
 
 //  nXChFollow; following character 0 - tab, 1 - space, 2 - nothing
-aNumberingProperties.push_back(lcl_makePropVal(PROP_LEVEL_FOLLOW, 
m_nXChFollow));
+if (bDefaults || m_nXChFollow != SvxNumberFormat::LISTTAB)
+aNumberingProperties.push_back(lcl_makePropVal(PROP_LEVEL_FOLLOW, 
m_nXChFollow));
 
 PropertyIds const aReadIds[] =
 {
@@ -310,7 +312,7 @@ uno::Sequence< beans::PropertyValue > 
ListLevel::GetLevelProperties( )
 boost::optional aProp = getProperty(rReadId);
 if (aProp)
 aNumberingProperties.emplace_back( getPropertyName(aProp->first), 
0, aProp->second, beans::PropertyState_DIRECT_VALUE );
-else if (rReadId == PROP_FIRST_LINE_INDENT)
+else if (rReadId == PROP_FIRST_LINE_INDENT && bDefaults)
 // Writer default is -360 

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

2017-12-19 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf113547.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   11 +++
 writerfilter/source/dmapper/NumberingManager.cxx |   10 --
 writerfilter/source/dmapper/NumberingManager.hxx |3 +++
 4 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit feb043331207ae66e1ac6cce613ff052f96d4f02
Author: Miklos Vajna 
Date:   Mon Dec 18 22:29:04 2017 +0100

tdf#113547 DOCX import: fix handling of stub numbering overrides

Regression from commit c72a1a74b5b1064fc9cdf9994b11fce26d866e26
(Related: tdf#112211 DOCX import: fix handling of missing first ind in
, 2017-09-19), now that a numbering level can have default
properties, we need to differentiate between the case when the level has
real properties or it has only default properties.

Merging of properties is not necessary when the abstract numbering has
properties, but the "override" has default properties only.

(cherry picked from commit a0bf35f7c0eedbe04783285a4a7071e68baeb7fe)

Change-Id: Idbcbd0f66932514612e11fe82377f2b68ac9e403
Reviewed-on: https://gerrit.libreoffice.org/46777
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf113547.docx 
b/sw/qa/extras/ooxmlexport/data/tdf113547.docx
new file mode 100644
index ..7b35ad72ba44
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf113547.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 6aca7e81b2cd..e2af3250cb07 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -109,6 +109,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
 "HoriOrientPosition"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf113547, "tdf113547.docx")
+{
+uno::Reference xPropertySet(
+getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
+uno::Reference xLevels(
+xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
+comphelper::SequenceAsHashMap aProps(xLevels->getByIndex(0)); // 1st level
+// This was 0, first-line left margin of the numbering was lost.
+CPPUNIT_ASSERT_EQUAL(static_cast(-635), 
aProps["FirstLineIndent"].get());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 8754b489a9ec..809717e62659 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -119,6 +119,12 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
 default:
 OSL_FAIL( "this line should never be reached");
 }
+m_bHasValues = true;
+}
+
+bool ListLevel::HasValues() const
+{
+return m_bHasValues;
 }
 
 void ListLevel::SetParaStyle( const std::shared_ptr< StyleSheetEntry >& pStyle 
)
@@ -467,9 +473,9 @@ uno::Sequence< uno::Sequence< beans::PropertyValue > > 
ListDef::GetPropertyValue
 for ( sal_Int32 i = 0; i < nThisCount && i < nAbstractCount; i++ )
 {
 uno::Sequence< beans::PropertyValue > level = aThis[i];
-if ( level.hasElements() )
+if (level.hasElements() && GetLevel(i)->HasValues())
 {
-// If the element contains something, merge it
+// If the element contains something, merge it, but ignore stub 
overrides.
 lcl_mergeProperties( level, aAbstract[i] );
 }
 }
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx 
b/writerfilter/source/dmapper/NumberingManager.hxx
index 026164122e85..eabf4a0276c6 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -52,6 +52,7 @@ class ListLevel : public PropertyMap
 sal_Int32 m_nTabstop;
 std::shared_ptr< StyleSheetEntry >  m_pParaStyle;
 bool  m_outline;
+bool m_bHasValues = false;
 
 public:
 
@@ -80,6 +81,8 @@ public:
 const OUString& GetBulletChar( ) { return m_sBulletChar; };
 const std::shared_ptr< StyleSheetEntry >& GetParaStyle( ) { return 
m_pParaStyle; };
 bool isOutlineNumbering() const { return m_outline; }
+/// Determines if SetValue() was called at least once.
+bool HasValues() const;
 
 // UNO mapping functions
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-13 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf113183.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |   10 ++
 writerfilter/source/dmapper/GraphicHelpers.cxx |4 
 3 files changed, 14 insertions(+)

New commits:
commit 134898e42ac6c455d5df0c2de3842d1bd7309f5f
Author: Miklos Vajna 
Date:   Tue Dec 12 09:18:39 2017 +0100

tdf#113183 DOCX import: fix not independent text box alignments

The alternative would be to clear them in
writerfilter::dmapper::DomainMapper::getPositionOffset(), but that runs
before writerfilter::dmapper::PositionHandler::lcl_sprm(), so it would
be too early.

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

(cherry picked from commit 312cecf11c1ab8acef6ce08ccb90d5322836b08f)

Change-Id: I287b9a4025c4b1844ae467c48815b5d7ffe3f98e
Reviewed-on: https://gerrit.libreoffice.org/46322
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf113183.docx 
b/sw/qa/extras/ooxmlexport/data/tdf113183.docx
new file mode 100644
index ..197f483ba011
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf113183.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 116b3f05bb2b..6aca7e81b2cd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -99,6 +99,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf67207_MERGEFIELD, 
"mailmerge.docx")
 
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.text.fieldmaster.DataBase.Name"), 
sValue);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
+{
+// This was 2096, the horizontal positioning of the star shape affected the
+// positioning of the triangle one, so the triangle was outside the page
+// frame.
+CPPUNIT_ASSERT_EQUAL(static_cast(0),
+ getProperty(getShapeByName("triangle"),
+"HoriOrientPosition"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx 
b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 62579dbaa864..8108445d24fb 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -133,9 +133,11 @@ void PositionHandler::lcl_sprm(Sprm& rSprm)
 {
 case NS_ooxml::LN_CT_PosH_posOffset:
 m_nPosition = 
oox::drawingml::convertEmuToHmm(m_rPositionOffsets.first.toInt32());
+m_rPositionOffsets.first.clear();
 break;
 case NS_ooxml::LN_CT_PosV_posOffset:
 m_nPosition = 
oox::drawingml::convertEmuToHmm(m_rPositionOffsets.second.toInt32());
+m_rPositionOffsets.second.clear();
 break;
 case NS_ooxml::LN_CT_PosH_align:
 {
@@ -150,6 +152,7 @@ void PositionHandler::lcl_sprm(Sprm& rSprm)
 m_nOrient = text::HoriOrientation::INSIDE;
 else if (rAlign == "outside")
 m_nOrient = text::HoriOrientation::OUTSIDE;
+rAlign.clear();
 break;
 }
 case NS_ooxml::LN_CT_PosV_align:
@@ -165,6 +168,7 @@ void PositionHandler::lcl_sprm(Sprm& rSprm)
 m_nOrient = text::VertOrientation::NONE;
 else if (rAlign == "outside")
 m_nOrient = text::VertOrientation::NONE;
+rAlign.clear();
 break;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-12-06 Thread Miklos Vajna
 sw/qa/extras/rtfimport/data/tdf104016.rtf|   30 +++
 sw/qa/extras/rtfimport/rtfimport.cxx |9 
 writerfilter/source/dmapper/DomainMapper.cxx |1 
 3 files changed, 40 insertions(+)

New commits:
commit 61b7034824dead1635f9e9c6ec996297e10f6910
Author: Miklos Vajna 
Date:   Tue Dec 5 09:17:43 2017 +0100

tdf#104016 RTF import: deduplicate before text indent from numbering

We already deduplicated first line indentation since commit
3915bf2dc877d5f1140798e24933db0f21386a4a (tdf#95376 DOCX import: fix
incorrectly indented tab stops, 2016-01-26), the same is necessary for
before text indent.

(cherry picked from commit c9dee880d88305312094b311abdae155e452bf14)

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

diff --git a/sw/qa/extras/rtfimport/data/tdf104016.rtf 
b/sw/qa/extras/rtfimport/data/tdf104016.rtf
new file mode 100644
index ..4ae6e310572e
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf104016.rtf
@@ -0,0 +1,30 @@
+{\rtf1\ansi\ansicpg1252\deff0
+{\fonttbl
+{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;}
+{\f1\fnil\fcharset0\fprq0\fttruetype Arial;}
+{\f2\fnil\fcharset0\fprq0\fttruetype Symbol;}
+}
+{\*\listtable
+{\list\listtemplateid1018\listsimple
+{\listlevel\levelnfc23\levelstartat1\levelspace0\levelfollow0\fi-360\li720
+{\leveltext\'01\'b7 ;}
+{\levelnumbers;}
+\f2}
+\listid1017}
+}
+{\*\listoverridetable
+{\listoverride\listoverridecount0\listid1017\levelnfc23\levelstartat1\levelspace0\levelfollow0\fi-360\li720
+{\leveltext\'01\'b7 ;}
+{\levelnumbers;}
+\f2\ls1}
+}
+\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\facingp\titlepg
+\deftab720\viewkind1\paperw12240\paperh15840\margl1440\margr1440\widowctl
+\sectd\sbknone\colsx360\marglsxn1800\margrsxn1800\pgncont\ltrsect
+\pard\plain
+{\ltrpar\ql\fi-360\li720\s21\f0\fs24\lang1033
+\ls1\ilvl0\itap0\tx720
+{\f0\fs24\lang1033
+\ltrch hello}
+\par}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index fabf17d152e9..49733991b16b 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1364,6 +1364,15 @@ DECLARE_RTFIMPORT_TEST(testWatermark, "watermark.rtf")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), 
aActualSize.Height);
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf104016, "tdf104016.rtf")
+{
+uno::Reference xParagraph(getParagraph(1), 
uno::UNO_QUERY);
+// This was beans::PropertyState_DIRECT_VALUE, leading to lack of
+// interitance from numbering.
+CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DEFAULT_VALUE,
+ xParagraph->getPropertyState("ParaLeftMargin"));
+}
+
 // tests should only be added to rtfIMPORT *if* they fail round-tripping in 
rtfEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 3cddc0b946e2..39368c29d812 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1333,6 +1333,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 // 4) Direct paragraph formatting: that will came later.
 // So no situation where keeping indentation at this point 
would make sense -> erase.
 rContext->Erase(PROP_PARA_FIRST_LINE_INDENT);
+rContext->Erase(PROP_PARA_LEFT_MARGIN);
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits