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

2018-12-05 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|   13 +++
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |2 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |8 +-
 sw/source/filter/ww8/wrtw8nds.cxx |   95 ++
 sw/source/filter/ww8/wrtww8.hxx   |1 
 5 files changed, 114 insertions(+), 5 deletions(-)

New commits:
commit 1575b46276a44fe0566fec8910188a781589dd75
Author: Serge Krot 
AuthorDate: Thu Nov 22 10:05:47 2018 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Dec 5 16:56:43 2018 +0100

tdf#121561: sw: DOCX: add std/stdPr/stdContent around TOC

During export into DOCX from ODT we need to do it
because in this case the TOC title will be recognized
inside MS Word as part of the TOC.

Later we could add support of these keywords in LO import
in order to detect TOC title from DOCX input.

Added unit test for export.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index d7fd52d87b6d..3b005e198b87 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -131,6 +131,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121456_tabsOffset, 
"tdf121456_tabsOffset.odt")
 }
 }
 
+// tdf#121561: make sure w:sdt/w:sdtContent around TOC is written during 
ODT->DOCX conversion
+DECLARE_OOXMLEXPORT_TEST(testTdf121561_tocTitle, "tdf121456_tabsOffset.odt")
+{
+xmlDocPtr pXmlDoc = parseExport();
+if (!pXmlDoc)
+return;
+
+assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r/w:t", "Inhaltsverzeichnis");
+assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtContent/w:p/w:r/w:instrText", " TOC \\f \\o 
\"1-9\" \\h");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartGallery", "val", "Table 
of Contents");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartUnique", 1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf106174_rtlParaAlign, 
"tdf106174_rtlParaAlign.docx")
 {
 CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), 
getProperty(getParagraph(1), "ParaAdjust"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index be20dd24b246..bd662172ae0c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -693,7 +693,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77129, "fdo77129.docx")
return;
 
 // Data was lost from this paragraph.
-assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:t", 
"Abstract");
+assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[4]/w:r[1]/w:t", 
"Abstract");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testfdo79969_xlsm, "fdo79969_xlsm.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 277f8b71ce22..84b38fc0a26a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -143,7 +143,7 @@ DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx")
 
 // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
 // not to insert an empty paragraph before TOC.
-assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:instrText", " TOC \\z \\f \\o \"1-3\" \\u 
\\h");
+assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\z 
\\f \\o \"1-3\" \\u \\h");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
@@ -160,7 +160,7 @@ DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
 
 // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
 // not to insert an empty paragraph before TOC.
-assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:instrText", " TOC \\z \\o \"1-3\" \\u \\h");
+assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\z 
\\o \"1-3\" \\u \\h");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testPreserveZfield,"preserve_Z_field_TOC.docx")
@@ -190,7 +190,7 @@ DECLARE_OOXMLEXPORT_TEST(testFieldFlagB,"TOC_field_b.docx")
 
 // FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
 // not to insert an empty paragraph before TOC.
-assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:instrText", " TOC \\b \"bookmark111\" \\o 
\"1-9\" \\h");
+assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:sdt/w:sdtContent/w:p[1]/w:r[2]/w:instrText", " TOC \\b 
\"bookmark111\" \\o \"1-9\" \\h");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testPreserveXfieldTOC, "PreserveXfieldTOC.docx")
@@ -448,7 +448,7 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78654 , "fdo78654.docx")
 return;
 // In 

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

2018-12-04 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/data2/tdf105413.fodt |   38 +++
 sw/qa/extras/uiwriter/uiwriter2.cxx|   69 +
 sw/source/core/edit/edfcol.cxx |   16 ++
 3 files changed, 123 insertions(+)

New commits:
commit 1d65ffc5a37be21e0316019b1c96eb9a1c871ac0
Author: László Németh 
AuthorDate: Tue Dec 4 21:54:24 2018 +0100
Commit: László Németh 
CommitDate: Wed Dec 5 08:02:14 2018 +0100

tdf#105413 track changes: keep paragraph styles

applied in Show Changes mode, instead of losing them
after saving the document or hiding the changes. The bug
occured in paragraphs with directly preceding tracked deletions.

Change-Id: I9a5fd1b82cb7e99884d8807d0abee1fea59d5df3
Reviewed-on: https://gerrit.libreoffice.org/64518
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data2/tdf105413.fodt 
b/sw/qa/extras/uiwriter/data2/tdf105413.fodt
new file mode 100644
index ..f27ee904d82b
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf105413.fodt
@@ -0,0 +1,38 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+
+ 
+  
+   Ismeretlen szerző
+   2018-12-03T20:35:00
+  
+ 
+
+
+ 
+  
+   Ismeretlen szerző
+   2018-12-03T20:34:58
+  
+ 
+
+   
+   
+
+
+
+
+
+   
+   Par1Par2
+   
+   Format 
this...
+   Par3
+   
+  
+ 
+
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 0b5daf0f0fa5..0ab26ac25485 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -9,6 +9,8 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -38,6 +40,7 @@ public:
 void testTdf119571();
 void testTdf119019();
 void testTdf119824();
+void testTdf105413();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -48,12 +51,30 @@ public:
 CPPUNIT_TEST(testTdf119571);
 CPPUNIT_TEST(testTdf119019);
 CPPUNIT_TEST(testTdf119824);
+CPPUNIT_TEST(testTdf105413);
 CPPUNIT_TEST_SUITE_END();
 
 private:
 SwDoc* createDoc(const char* pName = nullptr);
 };
 
+static void lcl_dispatchCommand(const uno::Reference& 
xComponent,
+const OUString& rCommand,
+const uno::Sequence& 
rPropertyValues)
+{
+uno::Reference xController
+= uno::Reference(xComponent, 
uno::UNO_QUERY)->getCurrentController();
+CPPUNIT_ASSERT(xController.is());
+uno::Reference xFrame(xController->getFrame(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xFrame.is());
+
+uno::Reference xContext = 
::comphelper::getProcessComponentContext();
+uno::Reference 
xDispatchHelper(frame::DispatchHelper::create(xContext));
+CPPUNIT_ASSERT(xDispatchHelper.is());
+
+xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, 
rPropertyValues);
+}
+
 SwDoc* SwUiWriterTest2::createDoc(const char* pName)
 {
 if (!pName)
@@ -373,6 +394,54 @@ void SwUiWriterTest2::testTdf119824()
 CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(3), 6), "RedlineType"));
 }
 
+void 

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

2018-11-30 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   68 ++
 sw/source/core/doc/DocumentRedlineManager.cxx |   40 ++-
 2 files changed, 95 insertions(+), 13 deletions(-)

New commits:
commit 4b850b204fbbe13e3ed11434f262dfabe528241a
Author: László Németh 
AuthorDate: Thu Nov 29 11:10:38 2018 +0100
Commit: László Németh 
CommitDate: Fri Nov 30 12:26:06 2018 +0100

tdf#119824 fix undo/redo of overlapping redlines

Overlapping redlines (introduced by the
commit 9dbf817fe5c5253fba0831aefa17575ae0ba3af1
"handle scope of w:pPrChange and w:rPrChange properly"
for showing tracked DOCX paragraph formatting) resulted
losing of tracked deletion, ie. reappearing deleted
content using Redo (reported after fixing the broken
non-visible change tracking with overlapping redlines in
commit 694a6389e84d5b416cde6dde2d5eaa589a0a6493
"tdf#119019 DOCX track changes: fix invisible delete
and insert").

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

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 66ef3ede1721..f90b1846967d 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -36,6 +37,7 @@ public:
 void testTdf108687_tabstop();
 void testTdf119571();
 void testTdf119019();
+void testTdf119824();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testRedlineMoveInsertInDelete);
@@ -45,6 +47,7 @@ public:
 CPPUNIT_TEST(testTdf108687_tabstop);
 CPPUNIT_TEST(testTdf119571);
 CPPUNIT_TEST(testTdf119019);
+CPPUNIT_TEST(testTdf119824);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -273,6 +276,7 @@ void SwUiWriterTest2::testTdf119571()
 
 void SwUiWriterTest2::testTdf119019()
 {
+// check handling of overlapping redlines
 load(DATA_DIRECTORY, "tdf119019.docx");
 
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
@@ -304,6 +308,70 @@ void SwUiWriterTest2::testTdf119019()
 CPPUNIT_ASSERT(!hasProperty(getRun(getParagraph(2), 1), "RedlineType"));
 }
 
+void SwUiWriterTest2::testTdf119824()
+{
+// check handling of overlapping redlines with Redo
+SwDoc* pDoc = createDoc("tdf119019.docx");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Pellentesque habitant morbi tristique 
senectus "
+  "et netus et malesuada fames ac turpis 
egestas. "
+  "Proin pharetra nonummy pede. Mauris et 
orci."),
+ getParagraph(3)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(""), getRun(getParagraph(3), 
1)->getString());
+// third paragraph has got a tracked paragraph formatting at this point
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(3), 1), "RedlineType"));
+
+// and a tracked text deletion at the beginning of the paragraph
+CPPUNIT_ASSERT_EQUAL(OUString("Pellentesque habitant morbi tristique 
senectus "),
+ getRun(getParagraph(3), 3)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(""), getRun(getParagraph(3), 
2)->getString());
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(3), 2), "RedlineType"));
+
+// delete last word of the third paragraph to remove tracked paragraph 
formatting
+// of this paragraph to track and show word deletion correctly.
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Down(/*bSelect=*/false);
+pWrtShell->Down(/*bSelect=*/false);
+pWrtShell->Down(/*bSelect=*/false);
+pWrtShell->Down(/*bSelect=*/false);
+pWrtShell->EndPara(/*bSelect=*/false);
+pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 5, 
/*bBasicCall=*/false);
+rtl::Reference pTransfer = new SwTransferable(*pWrtShell);
+pTransfer->Cut();
+
+// check tracking of the new text deletion
+CPPUNIT_ASSERT_EQUAL(OUString("orci."), getRun(getParagraph(3), 
7)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(""), getRun(getParagraph(3), 
6)->getString());
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(3), 6), "RedlineType"));
+
+// make sure that the tracked paragraph formatting is removed (tracked 
deletion is in the second run)
+CPPUNIT_ASSERT_EQUAL(OUString("Pellentesque habitant morbi tristique 
senectus "),
+ getRun(getParagraph(3), 2)->getString());
+CPPUNIT_ASSERT_EQUAL(OUString(""), getRun(getParagraph(3), 
1)->getString());
+CPPUNIT_ASSERT(hasProperty(getRun(getParagraph(3), 1), "RedlineType"));
+
+// tdf#119824 check redo
+sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+rUndoManager.Undo();
+rUndoManager.Undo();
+rUndoManager.Redo();
+

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

2018-11-27 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/layout.cxx |2 +-
 sw/source/core/layout/paintfrm.cxx |   10 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit f006b6339e20af6a3fbd60d97d21590d4ebf5021
Author: László Németh 
AuthorDate: Fri Nov 23 21:55:54 2018 +0100
Commit: László Németh 
CommitDate: Tue Nov 27 14:44:59 2018 +0100

tdf#112195 Writer: page background covers whole page

as in ODT implementation of Google Docs, and as in DOCX
supporting basic requirements of creating digital and
professional print media. This patch fixes DOCX import
(tdf#121668) and it gives the required PDF export, too.

In the case of solid color, color gradient, hatching,
pattern and tiled bitmap (except stretched bitmap),
this patch removes the obsolete white border around
the text area, if the user modifies the page background.

Note: likely the white border was good for home printing
in former times, but now it forms only a serious
barrier for most users to create de facto design
standard whole page background formatting instead of
its unacceptable poor man's version.

Note 2: the OpenDocument standard refers XSL/CSS here,
and browsers adapt background settings to the body margin
area the same way, as Google Docs and fixed LibreOffice do.

More information:

tdf#112195 "(Whole-Page-Filling) - Allow page background to cover the
whole page (reloaded)"

tdf#33041 "Allow page background to cover the whole page, not only
within page borders/margins"

tdf#121668 "FILEOPEN DOCX Page Color created with Word disappears on the
margins"

ooo#9370 "Off-margin page background"
(https://bz.apache.org/ooo/show_bug.cgi?id=9370)

Change-Id: I7c6c96ceaf7102b38e3e5c1ed767db0ee63520ab
Reviewed-on: https://gerrit.libreoffice.org/63914
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 99bf4ba29c76..304f14b40398 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2370,7 +2370,7 @@ void SwLayoutWriter::testTableExtrusion1()
 xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
 CPPUNIT_ASSERT(pXmlDoc);
 sal_Int32 nRight = getXPath(pXmlDoc, "//sectrectclipregion", 
"right").toInt32();
-sal_Int32 nLeft = (nRight + getXPath(pXmlDoc, "(//rect)[1]", 
"right").toInt32()) / 2;
+sal_Int32 nLeft = static_cast(nRight * 0.95);
 
 // Expect table borders in right page margin.
 const OString sXPath = "//polyline/point[@x>" + OString::number(nLeft) + " 
and @x<"
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 1adf941b8e46..e920046b1016 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6179,7 +6179,15 @@ void SwFrame::PaintSwFrameBackground( const SwRect 
, const SwPageFrame *pP
 }
 else
 {
-::lcl_CalcBorderRect( aRect, this, rAttrs, false, gProp);
+if ( bPageFrame )
+{
+aRect = getFrameArea();
+}
+else
+{
+   ::lcl_CalcBorderRect( aRect, this, rAttrs, false, gProp);
+}
+
 if ( (IsTextFrame() || IsTabFrame()) && GetPrev() )
 {
 if ( GetPrev()->GetAttrSet()->GetBackground() == 
GetAttrSet()->GetBackground() &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-25 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx |   21 +++--
 sw/qa/extras/ww8export/ww8export3.cxx  |   22 --
 sw/source/filter/ww8/ww8par3.cxx   |   16 +++-
 3 files changed, 26 insertions(+), 33 deletions(-)

New commits:
commit d3144a09dc5e2c21ffa34e3527bb6c94cd9926e8
Author: Justin Luth 
AuthorDate: Sat Nov 24 14:39:50 2018 +0300
Commit: Justin Luth 
CommitDate: Mon Nov 26 06:11:52 2018 +0100

partial revert tdf79435 doc: round-trip legacy input formfields

Apparently import isn't always properly reading some of these
strings, so it is just garbage being round-tripped in some cases.
Let's just avoid that until such time as import might be fixed.

I couldn't readily identify the import problem. It even happens with
version eWW8 files and also TestBeltAndBraces() didn't seem to
prevent the problem.

These crashes are due to reading garbage:
/srv/crashtestdata/files/doc/ooo78311-1.doc
-DISTRICT_COURSE_OUTLINE_TEMPLATE.doc
/srv/crashtestdata/files/doc/kde79024-2.doc
-Ü2_Blanko.doc
/srv/crashtestdata/files/doc/ooo24395-1.doc
-stateapp-emp.doc
/srv/crashtestdata/files/doc/abi9921-1.doc
/srv/crashtestdata/files/doc/ooo59101-1.doc
-Hovedblankett.DOC
/srv/crashtestdata/files/doc/fdo48097-1.doc
-BR1010.doc

Change-Id: Iceaa53760867f06c73ab900c57f197dbc0fb8e65
Reviewed-on: https://gerrit.libreoffice.org/63938
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index ac7909edcc9b..547afcd1a399 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -733,18 +733,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf79435_legacyInputFields, 
"tdf79435_legacyInputFi
 uno::Reference 
xParameters(xFormField->getParameters());
 
 OUString sTmp;
-xParameters->getByName("EntryMacro") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
-xParameters->getByName("Help") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
-xParameters->getByName("ExitMacro") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+// Doc import problems, so disabling tests
+//xParameters->getByName("EntryMacro") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+//xParameters->getByName("Help") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
+//xParameters->getByName("ExitMacro") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
 xParameters->getByName("Hint") >>= sTmp;
 CPPUNIT_ASSERT_EQUAL(OUString("StatusHelp"), sTmp);
-xParameters->getByName("Content") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
-xParameters->getByName("Format") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
+//xParameters->getByName("Content") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
+//xParameters->getByName("Format") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
 
 sal_uInt16 nMaxLength = 0;
 xParameters->getByName("MaxLength") >>= nMaxLength;
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 14293e2ba5df..e85ec0efa18f 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -75,18 +75,20 @@ DECLARE_WW8EXPORT_TEST(testTdf79435_legacyInputFields, 
"tdf79435_legacyInputFiel
 uno::Reference 
xParameters(xFormField->getParameters());
 
 OUString sTmp;
-xParameters->getByName("EntryMacro") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
-xParameters->getByName("Help") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
-xParameters->getByName("ExitMacro") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+// Too often the string reader can fail during import - fix that first to 
prevent round-tripping garbage.
+// (for example BR-1010B.doc from tdf#48097)
+//xParameters->getByName("EntryMacro") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+//xParameters->getByName("Help") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
+//xParameters->getByName("ExitMacro") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
 xParameters->getByName("Description") >>= sTmp;
 CPPUNIT_ASSERT_EQUAL(OUString("StatusHelp"), sTmp);
-xParameters->getByName("Content") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
-xParameters->getByName("Format") >>= sTmp;
-CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
+//xParameters->getByName("Content") >>= sTmp;
+//CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
+//xParameters->getByName("Format") >>= sTmp;
+

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

2018-11-22 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf121597.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |   15 +
 sw/source/filter/ww8/ww8atr.cxx |   31 ++--
 3 files changed, 18 insertions(+), 28 deletions(-)

New commits:
commit d1ee27cf9b83ad9b69d1ee00e2e8969fb35446c9
Author: László Németh 
AuthorDate: Wed Nov 21 17:18:39 2018 +0100
Commit: László Németh 
CommitDate: Thu Nov 22 18:04:32 2018 +0100

tdf#121597 DOCX: don't export empty paragraphs at tracked deletion

of non-empty multiple paragraphs. Complete the fix for
"tdf#115521 DOCX export: keep empty paragraphs in tracked deletion"
in commit 2cdc870a7ee82d0faf35cdb5b2bf4e687cfd2b8d

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf121597.odt 
b/sw/qa/extras/ooxmlexport/data/tdf121597.odt
new file mode 100644
index ..760b46e76379
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121597.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 2728c75b51be..c7e6bac3a8ea 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -826,6 +826,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, 
"tdf58944-repeating-t
  
parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, 
"tdf121597.odt")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+// check paragraphs with removed paragraph mark
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:pPr/w:rPr/w:del");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:rPr/w:del");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:pPr/w:rPr/w:del");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:pPr/w:rPr/w:del");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[10]/w:pPr/w:rPr/w:del");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index d8411eed8796..b911ef83b6a7 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5505,37 +5505,12 @@ const SwRedlineData* 
AttributeOutputBase::GetParagraphMarkerRedline( const SwTex
 if ( pRedl->GetRedlineData().GetType() != aRedlineType )
 continue;
 
-const SwPosition* pCheckedEnd = pRedl->End();
-const SwPosition* pCheckedStt = pRedl->Start();
-sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
-sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
-sal_uLong uEndNodeIndex   = pCheckedEnd->nNode.GetIndex();
-sal_uLong uEndCharIndex   = pCheckedEnd->nContent.GetIndex();
+sal_uLong uStartNodeIndex = pRedl->Start()->nNode.GetIndex();
+sal_uLong uEndNodeIndex   = pRedl->End()->nNode.GetIndex();
 sal_uLong uNodeIndex = rNode.GetIndex();
 
 if( uStartNodeIndex <= uNodeIndex && uNodeIndex < uEndNodeIndex )
-{
-// Maybe add here a check that also the start & end of the redline 
is the entire paragraph
-if ( ( uStartNodeIndex < uEndNodeIndex ) &&
- // check start:
- // 1. start in the same node
- (( uStartNodeIndex == uNodeIndex &&
-uStartCharIndex == static_cast(rNode.Len()) ) ||
- // 2. or in a previous node
-uStartNodeIndex < uNodeIndex
- ) &&
- // check end:
- // 1. end in the same node
- (( uEndNodeIndex == (uNodeIndex + 1) &&
-uEndCharIndex == 0) ||
- // 2. or end in after that
-uEndNodeIndex > (uNodeIndex + 1)
- )
-   )
-{
-return &( pRedl->GetRedlineData() );
-}
-}
+return &( pRedl->GetRedlineData() );
 }
 return nullptr;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-21 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/data/tdf120711.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx |7 +++
 sw/source/core/doc/DocumentRedlineManager.cxx |2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 836cbf3680afd9198abf3a64be698f8fe256dd5a
Author: László Németh 
AuthorDate: Tue Nov 20 22:36:58 2018 +0100
Commit: László Németh 
CommitDate: Wed Nov 21 10:28:38 2018 +0100

tdf#120711 fix paragraph join with change tracking

a DOC import regression caused by "tdf#119571 change
tracking: show layout changes at paragraph join"
(commit 1bbbe57dfc0b43d6b5444798d77dcdf5e4e76e49)

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

diff --git a/sw/qa/extras/ww8export/data/tdf120711.doc 
b/sw/qa/extras/ww8export/data/tdf120711.doc
new file mode 100644
index ..90e7c05cec0a
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf120711.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index f732bf990c25..14293e2ba5df 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -158,6 +158,13 @@ DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, 
"tdf94009_zeroPgMargin.odt")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(defaultStyle, 
"TopMargin"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf120711_joinedParagraphWithChangeTracking, 
"tdf120711.doc")
+{
+sal_Int16   numFormat = getNumberingTypeOfParagraph(5);
+// last paragraph is not a list item
+CPPUNIT_ASSERT(style::NumberingType::CHAR_SPECIAL != numFormat);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 036e33e43853..4ce414043270 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1835,7 +1835,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 if (pDelNode != nullptr && pTextNode != nullptr && 
pDelNode != pTextNode)
 pTextNode->CopyCollFormat( *pDelNode );
 }
-else
+else if ( bCallDelete && nsRedlineType_t::REDLINE_DELETE == 
pNewRedl->GetType() )
 {
 // tdf#119571 update the style of the joined paragraph
 // after a partially deleted paragraph to show its correct 
style
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-20 Thread Libreoffice Gerrit user
 sw/qa/extras/odfexport/data/referencelanguage.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx  |2 +-
 sw/source/core/fields/reffld.cxx  |2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 542d17d9384cced62db6bcfa45a5f44316409edc
Author: László Németh 
AuthorDate: Tue Nov 20 09:44:43 2018 +0100
Commit: László Németh 
CommitDate: Tue Nov 20 18:18:41 2018 +0100

tdf#115319 fix Hungarian article before letter i

in words, for example “az Ipsum”, not “a Ipsum”.

This bug was reported by Gellért Gyuris.

Complete commit 1037e3759bf178b52d16c12a811717f94ab9950a
(tdf#115319 references with Hungarian articles)

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

diff --git a/sw/qa/extras/odfexport/data/referencelanguage.odt 
b/sw/qa/extras/odfexport/data/referencelanguage.odt
index dcdd626fe3cf..9614bb3e31bc 100644
Binary files a/sw/qa/extras/odfexport/data/referencelanguage.odt and 
b/sw/qa/extras/odfexport/data/referencelanguage.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 2ef4e2cd4400..0f60b411ede2 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1948,7 +1948,7 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, 
"referencelanguage.odt")
 {
 // Test loext:reference-language attribute of reference fields
 // (used from LibreOffice 6.1, and proposed for next ODF)
-const char* aFieldTexts[] = { "A 2", "Az 50-esek",
+const char* aFieldTexts[] = { "A 2", "Az Isten", "Az 50-esek",
 "A 2018-asok", "Az egyebek", "A fejezetek",
 reinterpret_cast(u8"Az „Őseinket...”"), "a 2",
 "Az v", "az 1", "Az e", "az 1",
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 0ba15e80664e..40793345af65 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -294,7 +294,7 @@ static void lcl_formatReferenceLanguage( OUString& rRefText,
 0x00E1, 0x00C1, 0x00E9, 0x00C9, 0x00ED, 0x00CD,
 0x00F3, 0x00D3, 0x00F6, 0x00D6, 0x0151, 0x0150,
 0x00FA, 0x00DA, 0x00FC, 0x00DC, 0x0171, 0x0170, 0 };
-static OUString sVowels = "aAeEoOuU" + OUString(sVowelsWithDiacritic);
+static OUString sVowels = "aAeEiIoOuU" + 
OUString(sVowelsWithDiacritic);
 
 // handle more than 1-letter long Roman numbers and
 // their possible combinations with letters:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-20 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |   11 +
 sw/source/filter/ww8/docxattributeoutput.cxx   |   19 -
 3 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit f2f2143316acb449baaf29dd5300a6acf8a5c632
Author: Serge Krot 
AuthorDate: Fri Nov 16 09:53:37 2018 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Nov 20 11:55:29 2018 +0100

tdf#121456: sw: DOCX: tabs export and TABS_RELATIVE_TO_INDENT prop

In DOCX, w:pos specifies the position of the current custom tab stop
with respect to the current page margins.
But in ODT, zero position could be page margins or paragraph indent
according to used settings DocumentSettingId::TABS_RELATIVE_TO_INDENT

Added new unit test.

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt 
b/sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt
new file mode 100755
index ..ff8d5400950b
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf121456_tabsOffset.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 40e9fb19c3ca..2728c75b51be 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -120,6 +120,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf63561_clearTabs2, 
"tdf63561_clearTabs2.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), getProperty< 
uno::Sequence >(getParagraph(4), "ParaTabStops").getLength());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf121456_tabsOffset, "tdf121456_tabsOffset.odt")
+{
+for (int i=2; i<8; i++)
+{
+uno::Sequence< style::TabStop > stops = getProperty< 
uno::Sequence >(getParagraph( i ), "ParaTabStops");
+CPPUNIT_ASSERT_EQUAL( sal_Int32(1), stops.getLength());
+CPPUNIT_ASSERT_EQUAL( css::style::TabAlign_RIGHT, stops[ 0 ].Alignment 
);
+CPPUNIT_ASSERT_EQUAL( sal_Int32(17000), stops[ 0 ].Position );
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf106174_rtlParaAlign, 
"tdf106174_rtlParaAlign.docx")
 {
 CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), 
getProperty(getParagraph(1), "ParaAdjust"));
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 241c1e1b..c576fec3ec09 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7707,7 +7707,7 @@ void DocxAttributeOutput::ParaWidows( const 
SvxWidowsItem& rWidows )
 }
 
 static void impl_WriteTabElement( FSHelperPtr const & pSerializer,
-  const SvxTabStop& rTab )
+  const SvxTabStop& rTab, long tabsOffset )
 {
 FastAttributeList *pTabElementAttrList = 
FastSerializerHelper::createAttrList();
 
@@ -7729,9 +7729,11 @@ static void impl_WriteTabElement( FSHelperPtr const & 
pSerializer,
 break;
 }
 
-// Because GetTabPos already includes indent, we don't need to add 
nCurrentLeft (CurrentLeft is indentation information)
-//pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::valueOf( 
rTab.GetTabPos() + nCurrentLeft ) );
-pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::number( 
rTab.GetTabPos()) );
+// Write position according to used offset of the whole paragraph.
+// In DOCX, w:pos specifies the position of the current custom tab stop 
with respect to the current page margins.
+// But in ODT, zero position could be page margins or paragraph indent 
according to used settings.
+// This is handled outside of this method and provided for us in 
tabsOffset parameter.
+pTabElementAttrList->add( FSNS( XML_w, XML_pos ), OString::number( 
rTab.GetTabPos() + tabsOffset ) );
 
 sal_Unicode cFillChar = rTab.GetFill();
 
@@ -7770,6 +7772,13 @@ void DocxAttributeOutput::ParaTabStop( const 
SvxTabStopItem& rTabStop )
 
 m_pSerializer->startElementNS( XML_w, XML_tabs, FSEND );
 
+// Get offset for tabs
+// In DOCX, w:pos specifies the position of the current custom tab stop 
with respect to the current page margins.
+// But in ODT, zero position could be page margins or paragraph indent 
according to used settings.
+long tabsOffset = 0;
+if 
(m_rExport.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT))
+tabsOffset = m_rExport.GetItem(RES_LR_SPACE).GetTextLeft();
+
 // clear unused inherited tabs - otherwise the style will add them back in
 sal_Int32 nCurrTab = 0;
 for ( sal_uInt16 i = 0; i < nInheritedTabCount; ++i )
@@ -7789,7 +7798,7 @@ void DocxAttributeOutput::ParaTabStop( const 
SvxTabStopItem& rTabStop )
 for 

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

2018-11-16 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf79435_legacyInputFields.doc |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx   |   59 +
 sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx  |binary
 sw/qa/extras/ww8export/ww8export.cxx |2 
 sw/qa/extras/ww8export/ww8export3.cxx|   53 
 sw/source/filter/ww8/docxattributeoutput.cxx |  109 -
 sw/source/filter/ww8/wrtww8.cxx  |  121 +--
 sw/source/filter/ww8/ww8par.hxx  |   12 -
 sw/source/filter/ww8/ww8par3.cxx |   36 ++-
 writerfilter/source/dmapper/FFDataHandler.cxx|   28 ++
 writerfilter/source/dmapper/FFDataHandler.hxx|   12 +
 writerfilter/source/dmapper/FormControlHelper.cxx|   43 +++
 12 files changed, 433 insertions(+), 42 deletions(-)

New commits:
commit 46c1a75b144a4c5fd1f4ab0113b87fe030bebd27
Author: Justin Luth 
AuthorDate: Sat Oct 20 19:18:02 2018 +0300
Commit: Miklos Vajna 
CommitDate: Fri Nov 16 15:41:42 2018 +0100

tdf79435 doc/docx: round-trip legacy input formfields

GrabBag the settings which LO doesn't implement
(which is all of them) so that the document
round-trips without losing the config settings.

Change-Id: I00de6c483af68073634430dd74fd445e981573ab
Reviewed-on: https://gerrit.libreoffice.org/62241
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf79435_legacyInputFields.doc 
b/sw/qa/extras/ooxmlexport/data/tdf79435_legacyInputFields.doc
new file mode 100644
index ..da7fade8091c
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf79435_legacyInputFields.doc differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 8a98742a0532..864d97178cb2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -723,6 +724,64 @@ DECLARE_OOXMLEXPORT_TEST(testObjectCrossReference, 
"object_cross_reference.odt")
 CPPUNIT_ASSERT_EQUAL(sal_uInt16(21), nIndex);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf79435_legacyInputFields, 
"tdf79435_legacyInputFields.doc")
+{
+//using .doc input file to verify cross-format compatability.
+uno::Reference xFormField;
+xFormField
+= 
getProperty>(getRun(getParagraph(5), 3), 
"Bookmark");
+uno::Reference 
xParameters(xFormField->getParameters());
+
+OUString sTmp;
+xParameters->getByName("EntryMacro") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+xParameters->getByName("Help") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("F1Help"), sTmp);
+xParameters->getByName("ExitMacro") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("test"), sTmp);
+xParameters->getByName("Hint") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("StatusHelp"), sTmp);
+xParameters->getByName("Content") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("Camelcase"), sTmp);
+xParameters->getByName("Format") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("TITLE CASE"), sTmp);
+
+sal_uInt16 nMaxLength = 0;
+xParameters->getByName("MaxLength") >>= nMaxLength;
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Max Length", sal_uInt16(10), nMaxLength);
+
+// too bad this is based on character runs - just found try trial and 
error.
+xFormField
+= 
getProperty>(getRun(getParagraph(6), 2), 
"Bookmark");
+xParameters.set(xFormField->getParameters());
+xParameters->getByName("Type") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("calculated"), sTmp);
+
+xFormField
+= 
getProperty>(getRun(getParagraph(7), 2), 
"Bookmark");
+xParameters.set(xFormField->getParameters());
+xParameters->getByName("Type") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("currentDate"), sTmp);
+
+xFormField
+= 
getProperty>(getRun(getParagraph(7), 6), 
"Bookmark");
+xParameters.set(xFormField->getParameters());
+xParameters->getByName("Type") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("currentTime"), sTmp);
+
+xFormField
+= 
getProperty>(getRun(getParagraph(8), 2), 
"Bookmark");
+xParameters.set(xFormField->getParameters());
+xParameters->getByName("Type") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("number"), sTmp);
+
+xFormField
+= 
getProperty>(getRun(getParagraph(8), 6), 
"Bookmark");
+xParameters.set(xFormField->getParameters());
+xParameters->getByName("Type") >>= sTmp;
+CPPUNIT_ASSERT_EQUAL(OUString("date"), sTmp);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, 
"tdf120224_textControlCrossRef.docx")
 {
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/qa/extras/ww8export/data/tdf79435_legacyInputFields.docx 

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

2018-11-15 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlexport/htmlexport.cxx|   28 
 sw/source/filter/html/htmlplug.cxx|4 +-
 sw/source/filter/html/htmlreqifreader.cxx |   51 +-
 sw/source/filter/html/htmlreqifreader.hxx |3 +
 4 files changed, 82 insertions(+), 4 deletions(-)

New commits:
commit e807d6158e5bb030e2f884571493f65b285875f8
Author: Miklos Vajna 
AuthorDate: Thu Nov 15 14:05:38 2018 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 15 19:29:46 2018 +0100

sw reqif-xhtml export: write graphic of OLE object at an RTF level as well

An embedded object have have its replacement graphic at 3 levels in
reqif-xhtml: PNG at HTML level, WMF at RTF level and as a stream in the
OLE2 storage. Some reqif readers depend on having the replacement
graphic at an RTF level, so write that variant, too.

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

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 81d851a7f831..5ae05a172078 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -23,6 +23,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 class HtmlExportTest : public SwModelTestBase, public HtmlTestTools
 {
@@ -564,6 +566,32 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, 
"reqif-ole2.xhtml")
 // Finally the export also failed as it tried to open the stream from the
 // document storage, but the embedded object already opened it, so an
 // exception of type com.sun.star.io.IOException was thrown.
+
+if (mbExported)
+{
+// Check that the replacement graphic is exported at RTF level.
+SvMemoryStream aStream;
+wrapFragment(aStream);
+xmlDocPtr pDoc = parseXmlStream();
+CPPUNIT_ASSERT(pDoc);
+// Get the path of the RTF data.
+OUString aOlePath = getXPath(
+pDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data");
+OUString aOleSuffix(".ole");
+CPPUNIT_ASSERT(aOlePath.endsWith(aOleSuffix));
+INetURLObject aUrl(maTempFile.GetURL());
+aUrl.setBase(aOlePath.copy(0, aOlePath.getLength() - 
aOleSuffix.getLength()));
+aUrl.setExtension("ole");
+OUString aOleUrl = 
aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+
+// Search for \result in the RTF data.
+SvFileStream aOleStream(aOleUrl, StreamMode::READ);
+CPPUNIT_ASSERT(aOleStream.IsOpen());
+OString aOleString(read_uInt8s_ToOString(aOleStream, 
aOleStream.TellEnd()));
+// Without the accompanying fix in place, this test would have failed,
+// replacement graphic was missing at RTF level.
+CPPUNIT_ASSERT(aOleString.indexOf(OOO_STRING_SVTOOLS_RTF_RESULT) != 
-1);
+}
 }
 
 DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2Odg, "reqif-ole-odg.xhtml")
diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index f067d18be3b3..f71e81b9a8cc 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1534,7 +1534,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, 
const SwFrameFormat& rFrame
 if (xStream.is())
 {
 std::unique_ptr 
pStream(utl::UcbStreamHelper::CreateStream(xStream));
-if (SwReqIfReader::WrapOleInRtf(*pStream, aOutStream))
+if (SwReqIfReader::WrapOleInRtf(*pStream, aOutStream, *pOLENd))
 {
 // Data always wrapped in RTF.
 aFileType = "text/rtf";
@@ -1553,7 +1553,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, 
const SwFrameFormat& rFrame
 aOLEExp.ExportOLEObject(rOLEObj.GetObject(), *pStorage);
 pStorage->Commit();
 aMemory.Seek(0);
-if (SwReqIfReader::WrapOleInRtf(aMemory, aOutStream))
+if (SwReqIfReader::WrapOleInRtf(aMemory, aOutStream, *pOLENd))
 {
 // Data always wrapped in RTF.
 aFileType = "text/rtf";
diff --git a/sw/source/filter/html/htmlreqifreader.cxx 
b/sw/source/filter/html/htmlreqifreader.cxx
index cdc443f42cee..fc2c11705b80 100644
--- a/sw/source/filter/html/htmlreqifreader.cxx
+++ b/sw/source/filter/html/htmlreqifreader.cxx
@@ -18,6 +18,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace
 {
@@ -132,6 +134,42 @@ OString InsertOLE1Header(SvStream& rOle2, SvStream& rOle1)
 
 return aClassName;
 }
+
+/// Writes rGraphic with size from rOLENode to rRtf as an RTF hexdump.
+void WrapOleGraphicInRtf(SvStream& rRtf, SwOLENode& rOLENode, const Graphic& 
rGraphic)
+{
+// Start result.
+rRtf.WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_RESULT);
+
+// Start pict.
+rRtf.WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_PICT);
+
+ 

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

2018-11-12 Thread Libreoffice Gerrit user
 sw/qa/extras/odfimport/data/tdf120677.fodt |   13 +
 sw/qa/extras/odfimport/odfimport.cxx   |5 +
 sw/source/core/text/guess.cxx  |   20 
 3 files changed, 30 insertions(+), 8 deletions(-)

New commits:
commit 4bb28ad217ea9d6511b6921dcd3d28328edcb4d6
Author: Mike Kaganski 
AuthorDate: Mon Nov 12 15:07:58 2018 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 12 20:02:46 2018 +0100

tdf#120677: restore treatment of blanks in SwTextGuess::Guess

Before commit 0be3db28a4db4d2c81a5cb2edd48711eec55b51b, all non-breakable
spaces were converted to plain spaces in SwTextSlot::SwTextSlot (see
pInf->SetText call there). The mentioned commit has changed that to allow
differentiating non-breakable spaces from other types of spaces (related
to the fix of tdf#115067). This broke following processing of the NBSPs
when they don't fit to line, causing infinite layout loop leading to OOM.

This allows to restore old behavior to not call the break iterator for
NBSP by explicitly checking for it.

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

diff --git a/sw/qa/extras/odfimport/data/tdf120677.fodt 
b/sw/qa/extras/odfimport/data/tdf120677.fodt
new file mode 100644
index ..b2006828fb10
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf120677.fodt
@@ -0,0 +1,13 @@
+
+
+
+ 
+  
+   
+ 
+  . 
+ 
+
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index bd31b56d3e76..160f72028f51 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -910,5 +910,10 @@ DECLARE_ODFIMPORT_TEST(testTdf116195, "tdf116195.odt")
 );
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf120677, "tdf120677.fodt")
+{
+// The document used to hang the layout, consuming memory until OOM
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 96f82ae8dd5e..f24fdef51094 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -40,7 +40,14 @@ using namespace ::com::sun::star::i18n;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::linguistic2;
 
-#define CH_FULL_BLANK 0x3000
+namespace{
+
+const sal_Unicode CH_FULL_BLANK = 0x3000;
+const sal_Unicode CH_NB_SPACE = 0xA0;
+
+bool IsBlank(sal_Unicode ch) { return ch == CH_BLANK || ch == CH_FULL_BLANK || 
ch == CH_NB_SPACE; }
+
+}
 
 // provides information for line break calculation
 // returns true if no line break has to be performed
@@ -243,7 +250,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 sal_Unicode cCutChar = nCutPos < TextFrameIndex(rInf.GetText().getLength())
 ? rInf.GetText()[sal_Int32(nCutPos)]
 : 0;
-if( CH_BLANK == cCutChar || CH_FULL_BLANK == cCutChar )
+if (IsBlank(cCutChar))
 {
 nBreakPos = nCutPos;
 TextFrameIndex nX = nBreakPos;
@@ -253,23 +260,20 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 // we step back until a non blank character has been found
 // or there is only one more character left
 while (nX && TextFrameIndex(rInf.GetText().getLength()) < 
nBreakPos &&
-   ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) ||
- CH_FULL_BLANK == cCutChar ) )
+   IsBlank(rInf.GetChar(--nX)))
 --nBreakPos;
 }
 else // #i20878#
 {
 while (nX && nBreakPos > rInf.GetLineStart() + TextFrameIndex(1) &&
-   ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) ||
- CH_FULL_BLANK == cCutChar ) )
+   IsBlank(rInf.GetChar(--nX)))
 --nBreakPos;
 }
 
 if( nBreakPos > rInf.GetIdx() )
 nPorLen = nBreakPos - rInf.GetIdx();
 while (++nCutPos < TextFrameIndex(rInf.GetText().getLength()) &&
-   ( CH_BLANK == ( cCutChar = rInf.GetChar( nCutPos ) ) ||
- CH_FULL_BLANK == cCutChar ) )
+   IsBlank(rInf.GetChar(nCutPos)))
 ; // nothing
 
 nBreakStart = nCutPos;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-11-06 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlimport/data/tdf115094.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx  |   20 
 sw/source/core/unocore/unotext.cxx |   18 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |2 +-
 4 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit 4d9dda3fd096b9bffba5a07243a86208affd893f
Author: Patrick Jaap 
AuthorDate: Fri Sep 21 11:53:19 2018 +0200
Commit: Miklos Vajna 
CommitDate: Tue Nov 6 14:26:45 2018 +0100

tdf#115094 part I: do not move graphic nodes

Do not move graphic nodes in SwXText::convertToTextFrame()
since it is not reasonable (they are anchored to something that
already moved) and hence it causes errors.

A static function checks wether the current node is a graphic.

A small change in writerfilter was done since a unit test failed:
The condition "m_nAnchorType != 0"  was removed since it is not
reasonable at this place.

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

diff --git a/sw/qa/extras/ooxmlimport/data/tdf115094.docx 
b/sw/qa/extras/ooxmlimport/data/tdf115094.docx
new file mode 100644
index ..38d84d88ed86
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115094.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 7f548f47e65d..6fe7784cd062 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -223,6 +223,26 @@ DECLARE_OOXMLIMPORT_TEST(testTdf119200, "tdf119200.docx")
 CPPUNIT_ASSERT_EQUAL(OUString(u" size 12{ func \u2287 } {}"), 
getFormula(getRun(xPara, 7)));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf115094, "tdf115094.docx")
+{
+// anchor of graphic has to be the text in the text frame
+// xray ThisComponent.DrawPage(1).Anchor.Text
+uno::Reference xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPageSupplier->getDrawPage(),
+  uno::UNO_QUERY);
+uno::Reference xShape(xDrawPage->getByIndex(1), 
uno::UNO_QUERY);
+uno::Reference xText1(xShape->getAnchor()->getText(), 
uno::UNO_QUERY);
+
+// xray ThisComponent.TextTables(0).getCellByName("A1")
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+uno::Reference xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xText2(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(xText1.get(), xText2.get());
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index dbf00411ece5..e27630e16445 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1487,6 +1487,20 @@ SwXText::appendTextContent(
 return insertTextContentWithProperties(xTextContent, 
rCharacterAndParagraphProperties, xInsertPosition);
 }
 
+// determine wether SwFrameFormat is a graphic node
+static bool isGraphicNode(const SwFrameFormat* pFrameFormat)
+{
+// safety
+if( !pFrameFormat->GetContent().GetContentIdx() )
+{
+return false;
+}
+auto index = *pFrameFormat->GetContent().GetContentIdx();
+// consider the next node -> there is the graphic stored
+index++;
+return index.GetNode().IsGrfNode();
+}
+
 // move previously appended paragraphs into a text frames
 // to support import filters
 uno::Reference< text::XTextContent > SAL_CALL
@@ -1632,13 +1646,15 @@ SwXText::convertToTextFrame(
 
 // see if there are frames already anchored to this node
 // we have to work with the SdrObjects, as unique name is not guaranteed 
in their frame format
+// tdf#115094: do nothing if we have a graphic node
 std::set aAnchoredObjectsByPtr;
 std::set aAnchoredObjectsByName;
 for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrameFormats()->size(); ++i)
 {
 const SwFrameFormat* pFrameFormat = 
(*m_pImpl->m_pDoc->GetSpzFrameFormats())[i];
 const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
-if ((RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
+if ( !isGraphicNode(pFrameFormat) &&
+(RndStdIds::FLY_AT_PARA == rAnchor.GetAnchorId() || 
RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
 aStartPam.Start()->nNode.GetIndex() <= 
rAnchor.GetContentAnchor()->nNode.GetIndex() &&
 aStartPam.End()->nNode.GetIndex() >= 
rAnchor.GetContentAnchor()->nNode.GetIndex())
 {
diff --git 

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

2018-10-28 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|2 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit cb7500ddb8de6c41fca84a0009ffe22240bb1845
Author: Justin Luth 
AuthorDate: Sat Oct 27 17:04:02 2018 +0300
Commit: Justin Luth 
CommitDate: Mon Oct 29 04:33:13 2018 +0100

tdf#108954 docxexport: only emit section if diff from current

For the very last paragraph, if a header or footer was defined in
the section, then a dummy section was always being added, but that
should only happen if the section is different from the current one.
If they are the same, then the pageDesc will be created anyway, so
a dummy isn't needed to prevent it from getting lost.

Change-Id: I5e3a53e2810622c7232aa23575740bd775c5a595
Reviewed-on: https://gerrit.libreoffice.org/62430
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 040b4e4766ff..f460e384fd53 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -586,6 +586,8 @@ DECLARE_OOXMLEXPORT_TEST(testN780843b, "n780843b.docx")
 uno::Reference 
xPageStyle(getStyles("PageStyles")->getByName(aStyleName), uno::UNO_QUERY);
 uno::Reference xFooterText = getProperty< 
uno::Reference >(xPageStyle, "FooterText");
 CPPUNIT_ASSERT_EQUAL( OUString("hidden footer"), xFooterText->getString() 
);
+
+CPPUNIT_ASSERT_EQUAL( 7, getParagraphs() );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testShadow, "imgshadow.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b5a75c2e8be4..fb94a73eaa4e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5843,7 +5843,8 @@ void DocxAttributeOutput::SectionBreak( sal_uInt8 nC, 
const WW8_SepInfo* pSectio
 // footer, otherwise we go with the properties of the
 // section (and not the page style), which never has
 // headers/footers.
-if (const SwPageDesc* pPageDesc = pSectionInfo->pPageDesc)
+const SwPageDesc* pPageDesc = pSectionInfo->pPageDesc;
+if ( pPageDesc && pPageDesc != 
m_rExport.m_pCurrentPageDesc )
 {
 const auto& rMaster = pPageDesc->GetMaster();
 bEmit = rMaster.GetHeader().IsActive() || 
rMaster.GetFooter().IsActive();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-25 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlimport/data/reqif-page-style.xhtml |1 
 sw/qa/extras/htmlimport/htmlimport.cxx  |8 +
 sw/source/filter/html/swhtml.cxx|   31 
 sw/source/filter/html/swhtml.hxx|6 +--
 sw/source/filter/inc/fltini.hxx |5 +++
 5 files changed, 36 insertions(+), 15 deletions(-)

New commits:
commit 094e7b6a1028620c2b1503de8b51dc6a2482e290
Author: Miklos Vajna 
AuthorDate: Thu Oct 25 14:22:02 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 25 16:47:19 2018 +0200

sw HTML import: avoid custom default page style in reqif mode

Would be "HTML" by default, but reqif-html is mostly very simple
documents and the custom page styles is unexpected.

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

diff --git a/sw/qa/extras/htmlimport/data/reqif-page-style.xhtml 
b/sw/qa/extras/htmlimport/data/reqif-page-style.xhtml
new file mode 100644
index ..36f5aa11768b
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/reqif-page-style.xhtml
@@ -0,0 +1 @@
+aaabbb
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index ad404d7e4f3a..52a6a7145bc4 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -349,6 +349,14 @@ DECLARE_HTMLIMPORT_TEST(testImageSize, "image-size.html")
 CPPUNIT_ASSERT_EQUAL(static_cast(aExpected.getHeight()), 
aSize.Height);
 }
 
+DECLARE_HTMLIMPORT_TEST(testReqIfPageStyle, "reqif-page-style.xhtml")
+{
+// Without the accompanying fix in place, this test would have failed with
+// 'Expected: Standard, Actual  : HTML'.
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"),
+ getProperty(getParagraph(1), 
"PageStyleName"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 2e11911b7ece..879a95e0db9b 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -204,6 +204,8 @@ bool HTMLReader::SetStrmStgPtr()
 // Call for the general Reader-Interface
 ErrCode HTMLReader::Read( SwDoc , const OUString& rBaseURL, SwPaM , 
const OUString & rName )
 {
+SetupFilterOptions();
+
 if( !m_pStream )
 {
 OSL_ENSURE( m_pStream, "HTML-Read without stream" );
@@ -216,7 +218,7 @@ ErrCode HTMLReader::Read( SwDoc , const OUString& 
rBaseURL, SwPaM , co
 
 // Set the HTML page style, when it isn't a HTML document,
 // otherwise it's already set.
-if( 
!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) )
+if( 
!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) && 
m_aNamespace != "reqif-xhtml" )
 {
 rDoc.getIDocumentContentOperations().InsertPoolItem( rPam, 
SwFormatPageDesc(
 rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( 
RES_POOLPAGE_HTML, false )) );
@@ -229,7 +231,7 @@ ErrCode HTMLReader::Read( SwDoc , const OUString& 
rBaseURL, SwPaM , co
 tools::SvRef xParser = new SwHTMLParser( , rPam, 
*m_pStream,
 rName, rBaseURL, !m_bInsertMode, 
m_pMedium,
 IsReadUTF8(),
-m_bIgnoreHTMLComments );
+m_bIgnoreHTMLComments, 
m_aNamespace );
 
 SvParserState eState = xParser->CallParser();
 
@@ -253,7 +255,8 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 const OUString& rBaseURL,
 bool bReadNewDoc,
 SfxMedium* pMed, bool bReadUTF8,
-bool bNoHTMLComments )
+bool bNoHTMLComments,
+const OUString& rNamespace )
 : SfxHTMLParser( rIn, bReadNewDoc, pMed ),
 SwClient( nullptr ),
 m_aPathToFile( rPath ),
@@ -417,7 +420,13 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, 
SvStream& rIn,
 }
 }
 
-SetupFilterOptions();
+if (!rNamespace.isEmpty())
+{
+SetNamespace(rNamespace);
+m_bXHTML = true;
+if (rNamespace == "reqif-xhtml")
+m_bReqIF = true;
+}
 }
 
 SwHTMLParser::~SwHTMLParser()
@@ -5539,12 +5548,15 @@ void SwHTMLParser::AddMetaUserDefined( OUString const & 
i_rMetaName )
 }
 }
 
-void SwHTMLParser::SetupFilterOptions()
+void HTMLReader::SetupFilterOptions()
 {
-if (!GetMedium())
+// Reset state from previous Read() invocation.
+m_aNamespace.clear();
+
+if (!m_pMedium)
 return;
 
-const SfxItemSet* pItemSet = GetMedium()->GetItemSet();
+const SfxItemSet* pItemSet = m_pMedium->GetItemSet();
 if 

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

2018-10-24 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/ww8export.cxx |9 +
 sw/source/filter/ww8/wrtww8.cxx  |   15 +++
 sw/source/filter/ww8/ww8par.cxx  |6 ++
 3 files changed, 30 insertions(+)

New commits:
commit 0ed56b6a335d963f327d60650752c161654bf223
Author: Justin Luth 
AuthorDate: Thu Oct 18 21:26:13 2018 +0300
Commit: Miklos Vajna 
CommitDate: Wed Oct 24 10:37:05 2018 +0200

ww8export roundtrip forms password

This was already done for docx in LO6.0 with
commit 2694162969cf86ef366d3ce812fccd0630acc800

Patch initially developed to support tdf#120499 and depnds
on commit 953dad97c7ef7881c2ac6d73fe5266b44b15f3e2

Change-Id: I04b0693ed1e90f70b079040030c5bd9d2ccfbf13
Reviewed-on: https://gerrit.libreoffice.org/61952
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 33951f4f0666..cb73378615e7 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -364,6 +364,15 @@ DECLARE_WW8EXPORT_TEST(testCp144, "cp144.doc")
 CPPUNIT_ASSERT(pTextDoc);
 SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
 CPPUNIT_ASSERT_EQUAL( true, pDoc->getIDocumentSettingAccess().get( 
DocumentSettingId::PROTECT_FORM ) );
+
+uno::Sequence aGrabBag = getProperty< 
uno::Sequence >(mxComponent, "InteropGrabBag");
+sal_Int32 nPasswordHash = 0;
+for ( sal_Int32 i = 0; i < aGrabBag.getLength(); ++i )
+{
+if ( aGrabBag[i].Name == "FormPasswordHash" )
+aGrabBag[i].Value >>= nPasswordHash;
+}
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Password Hash", sal_Int32(609995782), 
nPasswordHash);
 }
 
 DECLARE_WW8EXPORT_TEST(testBorderColours, "bordercolours.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 5e22e0bb57a3..e72a5da2a952 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -510,6 +510,21 @@ static void WriteDop( WW8Export& rWrt )
 rDop.lKeyProtDoc != 0)
 {
 rDop.fProtEnabled =  true;
+// The password was ignored at import if forms protection was enabled,
+// so round-trip it since protection is still enabled.
+if ( rDop.lKeyProtDoc == 0 && xProps.is() )
+{
+uno::Sequence< beans::PropertyValue > aGrabBag;
+xProps->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+for ( sal_Int32 i = 0; i < aGrabBag.getLength(); ++i )
+{
+if ( aGrabBag[i].Name == "FormPasswordHash" )
+{
+aGrabBag[i].Value >>= rDop.lKeyProtDoc;
+break;
+}
+}
+}
 }
 else
 {
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b7fa6ed3f00a..a6b49ccf2c5a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1919,6 +1919,12 @@ void SwWW8ImplReader::ImportDop()
 // Still allow editing of form fields.
 if (!m_xWDop->fProtEnabled)
 m_pDocShell->SetModifyPasswordHash(m_xWDop->lKeyProtDoc);
+else if ( xDocProps.is() )
+{
+comphelper::SequenceAsHashMap 
aGrabBag(xDocProps->getPropertyValue("InteropGrabBag"));
+aGrabBag["FormPasswordHash"] <<= m_xWDop->lKeyProtDoc;
+xDocProps->setPropertyValue("InteropGrabBag", 
uno::Any(aGrabBag.getAsConstPropertyValueList()));
+}
 
 const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
 if (rOpt.IsUseEnhancedFields())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-20 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |2 
 sw/qa/extras/ww8export/ww8export2.cxx  |2 
 sw/source/filter/html/htmlbas.cxx  |2 
 sw/source/filter/html/htmldrawreader.cxx   |4 
 sw/source/filter/html/htmlfld.cxx  |   24 ++---
 sw/source/filter/html/htmlfly.hxx  |   10 +-
 sw/source/filter/html/htmlflyt.cxx |   10 +-
 sw/source/filter/html/htmlflywriter.cxx|4 
 sw/source/filter/html/htmlform.cxx |6 -
 sw/source/filter/html/htmlgrin.cxx |4 
 sw/source/filter/html/htmlnumreader.cxx|2 
 sw/source/filter/html/htmltab.cxx  |2 
 sw/source/filter/html/svxcss1.cxx  |  118 ++---
 sw/source/filter/html/swhtml.cxx   |4 
 sw/source/filter/html/swhtml.hxx   |6 -
 sw/source/ui/config/optpage.cxx|6 -
 sw/source/ui/frmdlg/frmpage.cxx|   72 -
 sw/source/ui/vba/vbafont.cxx   |2 
 sw/source/uibase/inc/frmpage.hxx   |4 
 sw/source/uibase/ribbar/workctrl.cxx   |2 
 20 files changed, 127 insertions(+), 159 deletions(-)

New commits:
commit 4ba5b003b594f9eb6c9b185208bdb72aef8273d0
Author: Noel Grandin 
AuthorDate: Fri Oct 19 13:57:40 2018 +0200
Commit: Noel Grandin 
CommitDate: Sat Oct 20 07:59:20 2018 +0200

loplugin:staticvar in sw

Change-Id: I73b0fb18febfe1d26bb63e1755b0b8c123aa854f
Reviewed-on: https://gerrit.libreoffice.org/62004
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 2f665ad620e5..40e9fb19c3ca 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -459,7 +459,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, 
"tdf112118.docx")
 // because DOCX import does two conversions between mm/100 and twips on 
the route, losing one
 // twip on the road and arriving with a value that is 2 mm/100 less. I 
don't see an obvious way
 // to avoid that.
-struct {
+static const struct {
 const char* styleName;
 struct {
 const char* sideName;
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index 078079f969ec..e1597f634a0c 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -825,7 +825,7 @@ DECLARE_OOXMLEXPORT_TEST( testObjectCrossReference, 
"object_cross_reference.odt"
 
 DECLARE_WW8EXPORT_TEST(testTdf112118_DOC, "tdf112118.doc")
 {
-struct {
+static const struct {
 const char* styleName;
 struct {
 const char* sideName;
diff --git a/sw/source/filter/html/htmlbas.cxx 
b/sw/source/filter/html/htmlbas.cxx
index be5daed030d2..4a20f7dd68ca 100644
--- a/sw/source/filter/html/htmlbas.cxx
+++ b/sw/source/filter/html/htmlbas.cxx
@@ -48,7 +48,7 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::container;
 
-static HTMLOutEvent aBodyEventTable[] =
+static HTMLOutEvent const aBodyEventTable[] =
 {
 { OOO_STRING_SVTOOLS_HTML_O_SDonload,OOO_STRING_SVTOOLS_HTML_O_onload, 
   SvMacroItemId::OpenDoc   },
 { OOO_STRING_SVTOOLS_HTML_O_SDonunload,  
OOO_STRING_SVTOOLS_HTML_O_onunload,  SvMacroItemId::PrepareCloseDoc   },
diff --git a/sw/source/filter/html/htmldrawreader.cxx 
b/sw/source/filter/html/htmldrawreader.cxx
index 8b7413ebdef3..d47e01a24acc 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -55,7 +55,7 @@
 
 using namespace css;
 
-static HTMLOptionEnum aHTMLMarqBehaviorTable[] =
+static HTMLOptionEnum const aHTMLMarqBehaviorTable[] =
 {
 { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll,SdrTextAniKind::Scroll   },
 { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate, SdrTextAniKind::Alternate},
@@ -63,7 +63,7 @@ static HTMLOptionEnum 
aHTMLMarqBehaviorTable[] =
 { nullptr, SdrTextAniKind(0)   }
 };
 
-static HTMLOptionEnum aHTMLMarqDirectionTable[] =
+static HTMLOptionEnum const aHTMLMarqDirectionTable[] =
 {
 { OOO_STRING_SVTOOLS_HTML_AL_left,  SdrTextAniDirection::Left   },
 { OOO_STRING_SVTOOLS_HTML_AL_right, SdrTextAniDirection::Right  },
diff --git a/sw/source/filter/html/htmlfld.cxx 
b/sw/source/filter/html/htmlfld.cxx
index 513f01650887..2c660150838a 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -43,7 +43,7 @@ struct HTMLNumFormatTableEntry
 NfIndexTableOffset const eFormat;
 };
 
-static HTMLOptionEnum aHTMLFieldTypeTable[] =
+static HTMLOptionEnum const aHTMLFieldTypeTable[] =
 {
 { OOO_STRING_SW_HTML_FT_author,   SwFieldIds::Author  },
 { OOO_STRING_SW_HTML_FT_sender,   SwFieldIds::ExtUser },
@@ -57,7 +57,7 @@ static HTMLOptionEnum aHTMLFieldTypeTable[] =
 { nullptr,

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

2018-10-19 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/ww8export3.cxx |1 -
 sw/source/filter/ww8/wrtw8sty.cxx |4 +---
 2 files changed, 1 insertion(+), 4 deletions(-)

New commits:
commit fa667b6dc410f3af57ef436cc117352c829f95e7
Author: Justin Luth 
AuthorDate: Thu Oct 18 09:38:47 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Oct 20 06:32:29 2018 +0200

sw mso export: PROTECT_FORM shouldn't force section to protected

PROTECT_FORM maps to enforcement = true, not "everything is protected".
"The enforcement of this property is determined by the documentProtection
element (§17.15.1.29), as it is possible to specify protection
without turning it on."

So, sections should retain their protected on/off status
regardless of the value of PROTECT_FORM. My guess was
that this was to offset the fact that DOCX import did not
import protected status, so this helped to protect the
sections that should not be unprotected. A followup
patch will address the import side.

patch initially developed to support tdf#120499.

Change-Id: I8ff6d31711651a4827cbb8520fd68e88273d6799
Reviewed-on: https://gerrit.libreoffice.org/61905
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 84f9e2f2d6cf..d5a888e60dd6 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -63,7 +63,6 @@ DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc")
 uno::Reference xSect(xSections->getByIndex(0), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section1 is protected", true, 
getProperty(xSect, "IsProtected"));
 xSect.set(xSections->getByIndex(3), uno::UNO_QUERY);
-if ( !mbExported )
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Section4 is protected", false, 
getProperty(xSect, "IsProtected"));
 }
 
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index a2d8856733fb..ca1ae82deee6 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1533,9 +1533,7 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
 AttrOutput().SectFootnoteEndnotePr();
 
 // forms
-bool formProtection = m_pDoc->getIDocumentSettingAccess().get( 
DocumentSettingId::PROTECT_FORM );
-formProtection |= rSepInfo.IsProtected();
-AttrOutput().SectionFormProtection( formProtection );
+AttrOutput().SectionFormProtection( rSepInfo.IsProtected() );
 
 // line numbers
 const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-18 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/data/fdo53985.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx|   23 +++
 sw/source/filter/ww8/ww8par.cxx  |8 
 3 files changed, 23 insertions(+), 8 deletions(-)

New commits:
commit 3e2e49074a59abbc9733e0c6e6914f902dd81664
Author: Justin Luth 
AuthorDate: Thu Oct 18 08:47:58 2018 +0300
Commit: Justin Luth 
CommitDate: Fri Oct 19 05:44:03 2018 +0200

ww8import: always protect document if set

Just because some sections are unprotected doesn't mean that
the document should not open in forms mode. MSWord 2016
opens it in "forms view" mode which also doesn't allow
editing those unrestricted settings. Only when choosing
the "Edit Document" view are the unprotected sections
editable - similar to LO turning off the Compatibility:
Protect Forms flag.

Unfortunately, the "I want to address this" comment
was from 2011, so obviously his temporarly solution
became more permanent that expected.

If this patch now blocks someone from being able to edit a
document (because now only the forms components of the
document are editable) they can remove the forms protection
by going to tools - options - LibreOffice Writer -
compatability - and disable Protect Form.

patch developed to support tdf#120499 and depends on the
patch for tdf#37778.

Change-Id: I86e26095ade6b2cf0ab8ea8fc941a92fa672a2f7
Reviewed-on: https://gerrit.libreoffice.org/61901
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/fdo53985.doc 
b/sw/qa/extras/ww8export/data/fdo53985.doc
new file mode 100644
index ..0c8f278dcf58
Binary files /dev/null and b/sw/qa/extras/ww8export/data/fdo53985.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 8d0475975eb4..84f9e2f2d6cf 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -9,6 +9,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -44,6 +45,28 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, 
"tdf37778_readonlySection.d
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), 
xSections->getCount());
 }
 
+DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xTables->getCount()); // Only 4 tables 
were imported.
+
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Compatibility: Protect form", true, 
pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) );
+
+uno::Reference 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xSections->getCount()); // The first 
paragraph wasn't counted as a section.
+
+uno::Reference xSect(xSections->getByIndex(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Section1 is protected", true, 
getProperty(xSect, "IsProtected"));
+xSect.set(xSections->getByIndex(3), uno::UNO_QUERY);
+if ( !mbExported )
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Section4 is protected", false, 
getProperty(xSect, "IsProtected"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, 
"tdf120225_textControlCrossRef.doc")
 {
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 2cd0cd918c59..db8f3cac3c08 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4459,8 +4459,6 @@ SwFormatPageDesc 
wwSectionManager::SetSwFormatPageDesc(mySegIter const ,
 
 void wwSectionManager::InsertSegments()
 {
-const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
-bool bUseEnhFields = rOpt.IsUseEnhancedFields();
 mySegIter aEnd = maSegments.end();
 mySegIter aStart = maSegments.begin();
 for (mySegIter aIter = aStart; aIter != aEnd; ++aIter)
@@ -4490,12 +4488,6 @@ void wwSectionManager::InsertSegments()
 || aIter->maSep.dxaLeft != aPrev->maSep.dxaLeft || 
aIter->maSep.dxaRight != aPrev->maSep.dxaRight )
 bInsertPageDesc = true;
 bool bProtected = SectionIsProtected(*aIter); // do we really  need 
this ?? I guess I have a different logic in editshell which disables this...
-if (bUseEnhFields && mrReader.m_xWDop->fProtEnabled && 
aIter->IsNotProtected())
-{
-// here we have the special case that the whole document is 
protected, with the exception of this section.
-// I want to address this when I do the section rework, so for the 
moment we 

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

2018-10-18 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx|   12 
 sw/source/filter/ww8/ww8par.cxx  |2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 8ba20167034f38ea2984bc8fb0e785da107cb82b
Author: Justin Luth 
AuthorDate: Thu Oct 18 08:17:40 2018 +0300
Commit: Justin Luth 
CommitDate: Thu Oct 18 08:36:21 2018 +0200

tdf#37778 ww8import: protect section only if protEnabled

Protection is not related to fReadOnlyRecommended

In Word, documentProtection enforcement is a document level
setting which is required for the section protection setting
to be enforced. formprot: "The enforcement of this property
is determined by the documentProtection element (§17.15.1.29),
as it is possible to specify protection without turning it on."

In LO, section protection is honored if it is simply enabled,
so only enable a section's protection if the enforcement
variable is set. Round-tripping will lose the fact that
sections are marked as protected if the enforcement is off.

patch initially developed to support tdf#120499 where
the focus is on sections, not on read-only and the
fake section that was being created.

Change-Id: I08c37ea6a9cc8fd1bdf7f36771b2d719bf9c93d6
Reviewed-on: https://gerrit.libreoffice.org/61899
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc 
b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc
new file mode 100644
index ..5e4fcdd760f4
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 41d4ddcfe84f..8d0475975eb4 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -32,6 +32,18 @@ public:
 }
 };
 
+DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, 
"tdf37778_readonlySection.doc")
+{
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+CPPUNIT_ASSERT( xStorable->isReadonly() );
+
+uno::Reference 
xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+// The problem was that section protection was being enabled in addition 
to being read-only.
+// This created an explicit section with protection. There should be just 
the default, non-explicit section.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), 
xSections->getCount());
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, 
"tdf120225_textControlCrossRef.doc")
 {
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d44c84ad14bd..2cd0cd918c59 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2361,7 +2361,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const 
SwPageDesc *pPrev,
 
 bool wwSectionManager::SectionIsProtected(const wwSection ) const
 {
-return (mrReader.m_xWwFib->m_fReadOnlyRecommended && 
!rSection.IsNotProtected());
+return ( mrReader.m_xWDop->fProtEnabled && !rSection.IsNotProtected() );
 }
 
 void wwSectionManager::SetHdFt(wwSection const , int nSect,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-16 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx   |   13 ++-
 sw/qa/extras/rtfexport/rtfexport.cxx |2 
 sw/source/filter/ww8/docxattributeoutput.cxx |9 --
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   62 +++
 4 files changed, 62 insertions(+), 24 deletions(-)

New commits:
commit 5d0c83fd4cf91083805f60f49e4fafd3d6ac73d4
Author: Mike Kaganski 
AuthorDate: Tue Oct 16 18:00:45 2018 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 16 19:53:32 2018 +0200

tdf#119885: OOXML import: try to get cell paddings as Word does

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 4db28720e0fa..794a76245525 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1160,7 +1160,18 @@ DECLARE_OOXMLEXPORT_TEST( testTableCellMargin, 
"table-cell-margin.docx" )
 cellLeftMarginFromOffice[i], aLeftMargin - 0.5 * 
aLeftBorderLine.LineWidth, 1 );
 // The 'a' in the fourth table should not be partly hidden by the 
border
 if ( i == 3 )
-CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( "Incorrect cell padding", 
0.5 * aLeftBorderLine.LineWidth, aLeftMargin, 1 );
+{
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect cell left padding",
+ 0.5 * 
aLeftBorderLine.LineWidth, aLeftMargin, 1);
+// tdf#119885: cell's edit area must touch right border
+sal_Int32 aRightMargin = -1;
+xPropSet->getPropertyValue("RightBorderDistance") >>= aRightMargin;
+uno::Any aRightBorder = xPropSet->getPropertyValue("RightBorder");
+table::BorderLine2 aRightBorderLine;
+aRightBorder >>= aRightBorderLine;
+CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Incorrect cell right 
padding",
+ 0.5 * 
aRightBorderLine.LineWidth, aRightMargin, 1);
+}
 }
 }
 
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 009cd00eb14d..8b6ecdb27f85 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -754,7 +754,7 @@ DECLARE_RTFEXPORT_TEST(testTdf84832, "tdf84832.docx")
 {
 uno::Reference xCell = getCell(getParagraphOrTable(2), "A1");
 // This was 0, as left padding wasn't exported.
-CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(113)),
+CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(108)),
  getProperty(xCell, "LeftBorderDistance"));
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0c9e4a04c63b..3d539978f096 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3175,15 +3175,6 @@ static void impl_cellMargins( FSHelperPtr const & 
pSerializer, const SvxBoxItem&
 continue;
 }
 
-if ( aBorders[i] == SvxBoxItemLine::LEFT ) {
-// Office's cell margin is measured from the right of the border.
-// While LO's cell spacing is measured from the center of the 
border.
-// So we add half left-border width to tblIndent value
-const SvxBorderLine* pLn = rBox.GetLine( *pBrd );
-if (pLn)
-nDist -= pLn->GetWidth() * 0.5;
-}
-
 if (!tagWritten) {
 pSerializer->startElementNS( XML_w, tag, FSEND );
 tagWritten = true;
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index ced27a0b80fa..fe8553e83cd9 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -266,9 +266,7 @@ void 
lcl_extractHoriOrient(std::vector& rFrameProperties,
 }
 }
 
-}
-
-static void lcl_DecrementHoriOrientPosition(std::vector& 
rFrameProperties, sal_Int32 nAmount)
+void lcl_DecrementHoriOrientPosition(std::vector& 
rFrameProperties, sal_Int32 nAmount)
 {
 // Shifts the frame left by the given value.
 for (beans::PropertyValue & rPropertyValue : rFrameProperties)
@@ -283,6 +281,42 @@ static void 
lcl_DecrementHoriOrientPosition(std::vector& r
 }
 }
 
+void lcl_adjustBorderDistance(TableInfo& rInfo, const table::BorderLine2& 
rLeftBorder,
+  const table::BorderLine2& rRightBorder)
+{
+// MS Word appears to do these things to adjust the cell horizontal area:
+//
+// bll = left borderline width
+// blr = right borderline width
+// cea = cell's edit area rectangle
+// cea_w = cea width
+// cml = cell's left margin 

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

2018-10-16 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfexport/data/tdf112520.docx |binary
 sw/qa/extras/rtfexport/rtfexport3.cxx  |   21 +
 sw/source/filter/ww8/rtfsdrexport.cxx  |   12 +---
 sw/source/filter/ww8/rtfsdrexport.hxx  |2 ++
 4 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 2b920bdc12f3bf3a196ec0d6d59043a68e663e33
Author: Miklos Vajna 
AuthorDate: Mon Oct 15 21:11:24 2018 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 16 09:02:46 2018 +0200

tdf#112520 RTF export: write ZOrder only for toplevel shapes

RTF export at the moment exports children of group shapes as a flat
shape list. This means that the order inside the group shape is not
relevant for the toplevel ZOrder, so just don't write it.

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

diff --git a/sw/qa/extras/rtfexport/data/tdf112520.docx 
b/sw/qa/extras/rtfexport/data/tdf112520.docx
new file mode 100644
index ..31c5a0afc21e
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf112520.docx differ
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 45be1c450cb4..26bbc8121372 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
 {
@@ -172,6 +173,26 @@ DECLARE_RTFEXPORT_TEST(testTdf117505, "tdf117505.odt")
  getProperty(xFirstPage, "HeaderHeight"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf112520, "tdf112520.docx")
+{
+if (!mbExported)
+return;
+
+// Assert that the white shape is on top of the yellow one.
+CPPUNIT_ASSERT_EQUAL(static_cast(0x00),
+ getProperty(getShape(2), "FillColor"));
+CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,
+ getProperty(getShape(2), 
"AnchorType"));
+CPPUNIT_ASSERT_EQUAL(static_cast(0xff),
+ getProperty(getShape(3), "FillColor"));
+// Without the accompanying fix in place, this test would have failed with
+// 'expected: 4, actual: 2'.
+// This means the draw page was 0/at-char/white, 1/at-char/yellow, 
2/at-page/white,
+// instead of the good 0/at-page/white, 1/at-char/yellow, 2/at-char/white.
+CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,
+ getProperty(getShape(3), 
"AnchorType"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx 
b/sw/source/filter/ww8/rtfsdrexport.cxx
index 51ec0f3f638e..55395917d739 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -90,10 +90,11 @@ void RtfSdrExport::CloseContainer()
 sal_uInt32 RtfSdrExport::EnterGroup(const OUString& /*rShapeName*/,
 const tools::Rectangle* /*pRect*/)
 {
+m_bInGroup = true;
 return GenerateShapeId();
 }
 
-void RtfSdrExport::LeaveGroup() { /* noop */}
+void RtfSdrExport::LeaveGroup() { m_bInGroup = false; }
 
 void RtfSdrExport::AddShape(sal_uInt32 nShapeType, ShapeFlag nShapeFlags, 
sal_uInt32 /*nShapeId*/)
 {
@@ -562,8 +563,13 @@ sal_Int32 RtfSdrExport::StartShape()
 m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE);
 
 // Write ZOrder.
-m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPZ);
-m_rAttrOutput.RunText().append(OString::number(m_pSdrObject->GetOrdNum()));
+if (!m_bInGroup)
+{
+// Order inside the group shape is not relevant for the flat shape list
+// we write.
+m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPZ);
+
m_rAttrOutput.RunText().append(OString::number(m_pSdrObject->GetOrdNum()));
+}
 
 for (auto it = m_aShapeProps.rbegin(); it != m_aShapeProps.rend(); ++it)
 lcl_AppendSP(m_rAttrOutput.RunText(), (*it).first.getStr(), 
(*it).second);
diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx 
b/sw/source/filter/ww8/rtfsdrexport.hxx
index c2c33de4aca2..b0c9f151e790 100644
--- a/sw/source/filter/ww8/rtfsdrexport.hxx
+++ b/sw/source/filter/ww8/rtfsdrexport.hxx
@@ -56,6 +56,8 @@ class RtfSdrExport final : public EscherEx
 /// Remember which shape types we had already written.
 std::unique_ptr m_pShapeTypeWritten;
 
+bool m_bInGroup = false;
+
 public:
 explicit RtfSdrExport(RtfExport& rExport);
 ~RtfSdrExport() override;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-10 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/ww8export.cxx |6 ++
 sw/source/filter/ww8/wrtww8.cxx  |1 +
 2 files changed, 7 insertions(+)

New commits:
commit 9943f37e8a80f2c4df6d58da4c50f3e7f3d6f3ce
Author: Justin Luth 
AuthorDate: Wed Oct 10 23:38:22 2018 +0300
Commit: Justin Luth 
CommitDate: Thu Oct 11 07:16:39 2018 +0200

related tdf#120225 ww8export: save PROTECT_FORM

Change-Id: I20664f8c2dc2c49feec17ee6a1df72776d43cc40
Reviewed-on: https://gerrit.libreoffice.org/61635
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index a53525a5ece7..33951f4f0666 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -11,6 +11,7 @@
 
 //#include 
 
+#include 
 #include 
 #include 
 #include 
@@ -358,6 +359,11 @@ DECLARE_WW8EXPORT_TEST(testCp144, "cp144.doc")
 uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
 // It wasn't possible to fill out this form.
 CPPUNIT_ASSERT_EQUAL(false, bool(xStorable->isReadonly()));
+
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+CPPUNIT_ASSERT_EQUAL( true, pDoc->getIDocumentSettingAccess().get( 
DocumentSettingId::PROTECT_FORM ) );
 }
 
 DECLARE_WW8EXPORT_TEST(testBorderColours, "bordercolours.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index b14a76d0c957..c6dda312b4b1 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -511,6 +511,7 @@ static void WriteDop( WW8Export& rWrt )
 }
 
 if ((rWrt.pSepx && rWrt.pSepx->DocumentIsProtected()) ||
+
rWrt.m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM ) 
||
 rDop.lKeyProtDoc != 0)
 {
 rDop.fProtEnabled =  true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-10-08 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf120287c.fodt |   46 +++
 sw/qa/extras/layout/layout.cxx   |   11 +++
 sw/source/core/text/inftxt.cxx   |   20 -
 sw/source/core/text/inftxt.hxx   |3 ++
 sw/source/core/text/itrform2.cxx |1 
 5 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit cb9ba1c2d0202b1932b637d83a9458879a1f2e6a
Author: Miklos Vajna 
AuthorDate: Mon Oct 8 10:48:36 2018 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 8 12:09:02 2018 +0200

Related: tdf#120287 sw layout, TabOverMargin: fix left margin handling

The old code only worked when left and first margin was 0; feed the
relevant margin to SwTextFormatInfo, so SwTextFormatInfo::GetLineWidth()
can compare against the right rectangle.

This way TabOverMargin compat flag results in layout that matches the
Word behavior for all 3 bugdocs from the bugreport.

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

diff --git a/sw/qa/extras/layout/data/tdf120287c.fodt 
b/sw/qa/extras/layout/data/tdf120287c.fodt
new file mode 100644
index ..f367336d79ec
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf120287c.fodt
@@ -0,0 +1,46 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+  true
+  high-resolution
+  false
+
+  
+  
+
+  
+  
+
+  
+  
+
+
+  
+  
+
+
+  
+
+  
+
+  
+
+  
+  
+
+  
+
+
+  
+
+  
+  
+
+  
+  
+
+  b) x x x Lorem ipsum dolor sit amet, 
consetetur sadips test Lorem ipsum dolor sit amet, consetetur 
sadips1 2 3 4 5 6 7 8 9 a b sed diam
+
+  
+
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index fbef817cd8fd..083c2f16302b 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -59,6 +59,7 @@ public:
 void testTdf119875();
 void testTdf120287();
 void testTdf120287b();
+void testTdf120287c();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testRedlineFootnotes);
@@ -90,6 +91,7 @@ public:
 CPPUNIT_TEST(testTdf119875);
 CPPUNIT_TEST(testTdf120287);
 CPPUNIT_TEST(testTdf120287b);
+CPPUNIT_TEST(testTdf120287c);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2571,6 +2573,15 @@ void SwLayoutWriter::testTdf120287b()
 assertXPath(pXmlDoc, "/root/page/body/txt[1]/Text[@nType='POR_TABRIGHT']", 
"nWidth", "17");
 }
 
+void SwLayoutWriter::testTdf120287c()
+{
+createDoc("tdf120287c.fodt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// This was 2, the second line was not broken into a 2nd and a 3rd one,
+// rendering text outside the paragraph frame.
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 3);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 74a046232bcd..da7f5ce7066a 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1706,9 +1706,25 @@ SwTwips 

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

2018-10-05 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf120287b.fodt |   45 +++
 sw/qa/extras/layout/layout.cxx   |   12 
 sw/source/core/text/portxt.cxx   |3 +-
 3 files changed, 59 insertions(+), 1 deletion(-)

New commits:
commit cb2f30897ca5d9ced5b4a4d801af6f0a22c98cc0
Author: Miklos Vajna 
AuthorDate: Fri Oct 5 10:31:26 2018 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 5 13:28:20 2018 +0200

Related: tdf#120287 sw layout, TabOverMargin: fix too wide tab portion

What happened is:

- the paragraph was split into two lines, at the correct position

- but then the first line checked how wide the tab portion can be, and
  there it concluded that it has a lot of space, so the tab portion was
  1418 twips wide, instead of the expected "almost zero" 69

The root of the problem was that first the text break was determined
using the TabOverMargin rules (more horizontal space), but later a check
validated the result ignoring the TabOverMargin flag (less horizontal
space). Fix this inconsistency by using GetLineWidth() in
SwTextPortion::Format_() instead of manual calculation.

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

diff --git a/sw/qa/extras/layout/data/tdf120287b.fodt 
b/sw/qa/extras/layout/data/tdf120287b.fodt
new file mode 100644
index ..137bb6c9d7ed
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf120287b.fodt
@@ -0,0 +1,45 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+  true
+  high-resolution
+  false
+
+  
+  
+
+  
+  
+
+  
+
+
+  
+
+
+  
+
+  
+
+  
+
+  
+  
+
+  
+
+
+  
+
+  
+  
+
+
+  
+  
+
+  b)Lorem ipsum dolor sit amet, 
consetetur sadips1 2 3 4 5 6 78a b c d e sed diam
+
+  
+
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 0233252ae88e..fbef817cd8fd 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -58,6 +58,7 @@ public:
 void testTdf117187();
 void testTdf119875();
 void testTdf120287();
+void testTdf120287b();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testRedlineFootnotes);
@@ -88,6 +89,7 @@ public:
 CPPUNIT_TEST(testTdf117187);
 CPPUNIT_TEST(testTdf119875);
 CPPUNIT_TEST(testTdf120287);
+CPPUNIT_TEST(testTdf120287b);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2559,6 +2561,16 @@ void SwLayoutWriter::testTdf120287()
 assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1);
 }
 
+void SwLayoutWriter::testTdf120287b()
+{
+createDoc("tdf120287b.fodt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// This was 1418, TabOverMargin did the right split of the paragraph to two
+// lines, but then calculated a too large tab portion size on the first
+// line.
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/Text[@nType='POR_TABRIGHT']", 
"nWidth", "17");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git 

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

2018-10-04 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf120287.fodt |   40 
 sw/qa/extras/layout/layout.cxx  |   12 +
 sw/source/filter/xml/xmlimp.cxx |   12 +
 3 files changed, 64 insertions(+)

New commits:
commit 54204d53eb4854715500edc064123e8d687381b2
Author: Miklos Vajna 
AuthorDate: Thu Oct 4 09:57:57 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 4 13:29:36 2018 +0200

tdf#120287 sw layout, TabOverMargin: imply PrinterIndependentLayout=high-res

In case an ODT document has the usual layout compat flags enabled (by
the DOC/DOCX/RTF imports) to emulate Word behavior, then it's expected
that Word will lay out the resulting ODT document similar to Writer.

This works most of the time, but in case exact spacing matters, it's
important that PrinterIndependentLayout is not disabled, as that doesn't
match the Word default and will result in mismatching Writer vs Word
layout.

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

diff --git a/sw/qa/extras/layout/data/tdf120287.fodt 
b/sw/qa/extras/layout/data/tdf120287.fodt
new file mode 100644
index ..55527c1e2797
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf120287.fodt
@@ -0,0 +1,40 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+  true
+  true
+  disabled
+
+  
+  
+
+  
+  
+
+
+  
+
+  
+  
+
+  
+
+  
+
+  
+  
+
+
+  
+
+  
+  
+
+  
+  
+
+  b)Lorem ipsum dolor sit amet, 
consetetur sadips1 2 3 4 5 6 78sed diam
+
+  
+
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index fc17a36500f9..79211e1c4007 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -49,6 +49,7 @@ public:
 void testTdf117188();
 void testTdf117187();
 void testTdf119875();
+void testTdf120287();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testRedlineFootnotes);
@@ -73,6 +74,7 @@ public:
 CPPUNIT_TEST(testTdf117188);
 CPPUNIT_TEST(testTdf117187);
 CPPUNIT_TEST(testTdf119875);
+CPPUNIT_TEST(testTdf120287);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1445,6 +1447,16 @@ void SwLayoutWriter::testTdf119875()
 CPPUNIT_ASSERT_LESS(nSecondTop, nFirstTop);
 }
 
+void SwLayoutWriter::testTdf120287()
+{
+createDoc("tdf120287.fodt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// This was 2, TabOverMargin Word-specific compat flag did not imply
+// default-in-Word printer-independent layout, resulting in an additional
+// line break.
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index dd419b586119..e76ae1a787fe 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1388,6 +1388,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence 
< PropertyValue > & aC
 bool bClippedPictures = false;

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

2018-09-28 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |5 -
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|   11 ---
 sw/source/filter/ww8/docxattributeoutput.cxx |   27 +++
 3 files changed, 7 insertions(+), 36 deletions(-)

New commits:
commit 5d4c6ee89ef6302db08c23bbe2d3fb4d7de3b1a3
Author: Justin Luth 
AuthorDate: Wed Sep 26 10:23:20 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Sep 29 07:16:34 2018 +0200

tdf#92026 docxexport: eliminate fake tblBorders

This patch depends on tdf#119760.

The border was based on whatever cell A1 had, but that fake
default was never passed to the cell's functions, so the
table border definition served no purpose whatsoever.
Cells had no idea whether they needed to override those
default borders, and this was bad for non-borders, because
then the default borders were assigned instead of none.

The other option would be to properly fill m_aTableStyleConf,
but that didn't seem valuable. Better, and less code churn,
to just eliminate the function altogether. (Well, the
empty function kept in place as a placeholder for
someone who decides it could be useful to reduce
the number of borders written out per cell.)

Unit test fdo80097.docx's fix was just trying to
prevent an invalid table border. Since that is still
obviously true when no table border is defined,
it is valid to just eliminate this part of the test.
(Having a table definition wouldn't be invalid
in the future, so I'm not testing for zero instances.)

Change-Id: I983dbe120bfc3354fefd14bc95ac01abccea7ea8
Reviewed-on: https://gerrit.libreoffice.org/60989
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 933bd58b1071..db52d019439b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -532,7 +532,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82177_tblBorders, 
"tdf82177_tblBorders.docx")
 uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
 uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
 uno::Reference< text::XTextTable > xTable( xTables->getByIndex(0), 
uno::UNO_QUERY );
-uno::Reference< table::XCell > xCell = xTable->getCellByName( "E5" );
+uno::Reference< table::XCell > xCell = xTable->getCellByName( "A5" );
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "BottomBorder").LineWidth);
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "LeftBorder").LineWidth);
+xCell.set(xTable->getCellByName( "E5" ));
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "TopBorder").LineWidth);
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "LeftBorder").LineWidth);
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 858f20d0e3b9..401af06a6533 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -669,17 +669,6 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
 if (!pXmlDocument)
 return;
 
-//Table Borders
-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
 = '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
 = '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);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b3e4df7a5f1a..a39ba872cf04 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3032,18 +3032,6 @@ static void impl_borderLine( FSHelperPtr const & 
pSerializer, sal_Int32 

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

2018-09-19 Thread Libreoffice Gerrit user
 sw/qa/extras/odfexport/data/tdf118393.odt   |binary
 sw/qa/extras/odfexport/odfexport.cxx|   47 +
 sw/qa/extras/ooxmlexport/data/tdf118393.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   51 
 sw/source/filter/ww8/wrtw8sty.cxx   |7 +++
 sw/source/filter/ww8/wrtww8.cxx |1 
 sw/source/filter/ww8/wrtww8.hxx |1 
 sw/source/filter/ww8/ww8atr.cxx |   29 +++
 8 files changed, 135 insertions(+), 1 deletion(-)

New commits:
commit fa8b2c533265a6d74e16ffae55673d6aa0fbf6a5
Author: Serge Krot 
AuthorDate: Wed Jun 27 11:18:41 2018 +0200
Commit: Thorsten Behrens 
CommitDate: Wed Sep 19 10:50:05 2018 +0200

tdf#118393: FILESAVE: DOCX Export loses header/footer

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

diff --git a/sw/qa/extras/odfexport/data/tdf118393.odt 
b/sw/qa/extras/odfexport/data/tdf118393.odt
new file mode 100755
index ..ff8d5400950b
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf118393.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 6bc124027511..4727f2266750 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1399,6 +1399,53 @@ DECLARE_ODFEXPORT_TEST(testFdo86963, "fdo86963.odt")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount());
 }
 
+// Check for correct header/footer with special first page with TOC inside:
+// - DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt")
+// - DECLARE_OOXMLEXPORT_TEST(testTdf118393, "tdf118393.odt")
+DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt")
+{
+CPPUNIT_ASSERT_EQUAL( 7, getPages() );
+
+// First page has no header/footer
+{
+xmlDocPtr pXmlDoc = parseLayoutDump();
+
+// check first page
+xmlXPathObjectPtr pXmlPage1Header = getXPathNode(pXmlDoc, 
"/root/page[1]/header");
+CPPUNIT_ASSERT_EQUAL(0, 
xmlXPathNodeSetGetLength(pXmlPage1Header->nodesetval));
+
+xmlXPathObjectPtr pXmlPage1Footer = getXPathNode(pXmlDoc, 
"/root/page[1]/footer");
+CPPUNIT_ASSERT_EQUAL(0, 
xmlXPathNodeSetGetLength(pXmlPage1Footer->nodesetval));
+
+// check second page in the same way
+xmlXPathObjectPtr pXmlPage2Header = getXPathNode(pXmlDoc, 
"/root/page[2]/header");
+CPPUNIT_ASSERT_EQUAL(1, 
xmlXPathNodeSetGetLength(pXmlPage2Header->nodesetval));
+
+xmlXPathObjectPtr pXmlPage2Footer = getXPathNode(pXmlDoc, 
"/root/page[2]/footer");
+CPPUNIT_ASSERT_EQUAL(1, 
xmlXPathNodeSetGetLength(pXmlPage2Footer->nodesetval));
+   }
+
+// All other pages should have header/footer
+
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[2]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[2]/footer/txt/text()"));
+
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[3]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[3]/footer/txt/text()"));
+
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[4]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[4]/footer/txt/text()"));
+
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[5]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[5]/footer/txt/text()"));
+
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[6]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[6]/footer/txt/text()"));
+
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[7]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Seite * von *"),   
parseDump("/root/page[7]/footer/txt/text()"));
+}
+
 DECLARE_ODFEXPORT_TEST(testGerrit13858, "gerrit13858.odt")
 {
 // Just make sure the output is valid.
diff --git a/sw/qa/extras/ooxmlexport/data/tdf118393.odt 
b/sw/qa/extras/ooxmlexport/data/tdf118393.odt
new file mode 100644
index ..ff8d5400950b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118393.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a1e2a5194904..c5d6b88db4b2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -90,6 +90,53 @@ DECLARE_OOXMLEXPORT_TEST(testFooterBodyDistance, 
"footer-body-distance.docx")
 assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1);
 }
 
+// Check for correct header/footer with special first page with TOC inside:
+// - DECLARE_ODFEXPORT_TEST(testTdf118393, "tdf118393.odt")
+// - 

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

2018-09-15 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx 
|binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
|   10 +++
 sw/source/filter/ww8/ww8atr.cxx   
|   30 +++---
 3 files changed, 31 insertions(+), 9 deletions(-)

New commits:
commit 2cdc870a7ee82d0faf35cdb5b2bf4e687cfd2b8d
Author: László Németh 
AuthorDate: Fri Sep 14 17:14:43 2018 +0200
Commit: László Németh 
CommitDate: Sat Sep 15 11:57:44 2018 +0200

tdf#115521 DOCX export: keep empty paragraphs in tracked deletion

of a paragraph sequence by inspecting every paragraph in a
"redline" range. Before this fix, all empty paragraphs of
a multiparagraph deletion reappeared as normal text in the DOCX
export.

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

diff --git 
a/sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx 
b/sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx
new file mode 100644
index ..fcd78e9cd105
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/testTrackChangesEmptyParagraphsInADeletion.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index e92bb8178b4b..9d0c9fa829ee 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -721,6 +721,16 @@ 
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedEmptyParagraph, "testTrackChange
 assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:del");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTrackChangesEmptyParagraphsInADeletion, 
"testTrackChangesEmptyParagraphsInADeletion.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+for (int i = 1; i < 12; ++i)
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[" + OString::number(i) + 
"]/w:pPr/w:rPr/w:del");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index a86094fda676..8cabd8d90f34 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5480,21 +5480,33 @@ const SwRedlineData* 
AttributeOutputBase::GetParagraphMarkerRedline( const SwTex
 
 const SwPosition* pCheckedStt = pRedl->Start();
 const SwPosition* pCheckedEnd = pRedl->End();
+sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
+sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
+sal_uLong uEndNodeIndex   = pCheckedEnd->nNode.GetIndex();
+sal_uLong uEndCharIndex   = pCheckedEnd->nContent.GetIndex();
+sal_uLong uNodeIndex = rNode.GetIndex();
 
-if( pCheckedStt->nNode == rNode )
+if( uStartNodeIndex <= uNodeIndex && uNodeIndex < uEndNodeIndex )
 {
 if ( !pCheckedEnd )
 continue;
 
-sal_uLong uStartNodeIndex = pCheckedStt->nNode.GetIndex();
-sal_uLong uStartCharIndex = pCheckedStt->nContent.GetIndex();
-sal_uLong uEndNodeIndex   = pCheckedEnd->nNode.GetIndex();
-sal_uLong uEndCharIndex   = pCheckedEnd->nContent.GetIndex();
-
 // Maybe add here a check that also the start & end of the redline 
is the entire paragraph
-if ( ( uStartNodeIndex == uEndNodeIndex - 1 ) &&
- ( uStartCharIndex == static_cast(rNode.Len()) ) &&
- ( uEndCharIndex == 0)
+if ( ( uStartNodeIndex < uEndNodeIndex ) &&
+ // check start:
+ // 1. start in the same node
+ (( uStartNodeIndex == uNodeIndex &&
+uStartCharIndex == static_cast(rNode.Len()) ) ||
+ // 2. or in a previous node
+uStartNodeIndex < uNodeIndex
+ ) &&
+ // check end:
+ // 1. end in the same node
+ (( uEndNodeIndex == (uNodeIndex + 1) &&
+uEndCharIndex == 0) ||
+ // 2. or end in after that
+uEndNodeIndex > (uNodeIndex + 1)
+ )
)
 {
 return &( pRedl->GetRedlineData() );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-14 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf119875.odt |binary
 sw/qa/extras/layout/layout.cxx |   15 +++
 sw/source/core/layout/sectfrm.cxx  |   28 
 3 files changed, 39 insertions(+), 4 deletions(-)

New commits:
commit b5937112d4035fb9ffb472e1bf36567d9c78c820
Author: Miklos Vajna 
AuthorDate: Fri Sep 14 17:38:32 2018 +0200
Commit: Miklos Vajna 
CommitDate: Fri Sep 14 19:54:17 2018 +0200

tdf#119875 sw: fix invalid pos of frame after 0-sized section with laycache

The interesting part of the layout of page 2 is:

- frame #40 is a section frame with a text frame which is in a list
  ("A")
- frame #48 is a section frame after that, with the same top=19213

Given that frame #40 has height > 0, they overlap when the page is
rendered. What happens is:

- frame #40 grows
- there are other section frames between #40 and #48 in-between, but
  they don't have an SwSection
- these frames are skipped
- then the position of #48 is invalidated

So the next time we calculate the position of #48, we look the last
skipped (previous) section frame (which still has top=19213, since its
position was not invalidated above), and since its height is 0, we
conclude that our current top=19213 is valid after all.

This is like this since commit 84a3db80b4fd66c6854b3135b5f69b61fd828e62
(initial import, 2000-09-18), so leave the code there that invalidates
not only the next frame, but all the way down to the first
non-SwSection-less-SwSectionFrame. But instead of just invalidating the
last frame, invalidate the in-between SwSection-less-SwSectionFrames as
well.

In practice this did not cause a problem in case the document has no
layout cache. If it does, then the frames are created on pages hinted by
the cache, then later moved to their final place. In practice this bug
was visible only in this later case. (I.e. such a layout cache can be
only created if the machine that saved the document last time does not
have the fonts needed by the document installed; and then the document
is opened on an other machine which has those fonts.)

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

diff --git a/sw/qa/extras/layout/data/tdf119875.odt 
b/sw/qa/extras/layout/data/tdf119875.odt
new file mode 100644
index ..6f579546e312
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf119875.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2e172660ebd2..99376832c634 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -37,6 +37,7 @@ public:
 void testTdf118058();
 void testTdf117188();
 void testTdf117187();
+void testTdf119875();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -56,6 +57,7 @@ public:
 CPPUNIT_TEST(testTdf118058);
 CPPUNIT_TEST(testTdf117188);
 CPPUNIT_TEST(testTdf117187);
+CPPUNIT_TEST(testTdf119875);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -341,6 +343,19 @@ void SwLayoutWriter::testTdf117187()
 assertXPath(pXmlDoc, "/root/page/body/txt/Special[@nType='POR_FLY']", 0);
 }
 
+void SwLayoutWriter::testTdf119875()
+{
+createDoc("tdf119875.odt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+sal_Int32 nFirstTop
+= getXPath(pXmlDoc, "/root/page[2]/body/section[1]/infos/bounds", 
"top").toInt32();
+sal_Int32 nSecondTop
+= getXPath(pXmlDoc, "/root/page[2]/body/section[2]/infos/bounds", 
"top").toInt32();
+// The first section had the same top value as the second one, so they
+// overlapped.
+CPPUNIT_ASSERT_LESS(nSecondTop, nFirstTop);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index 7824ae0e40f8..6853186ee2ca 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -46,6 +46,21 @@
 #include 
 #include 
 
+namespace
+{
+/**
+ * Performs the correct type of position invalidation depending on if we're in
+ * CalcContent().
+ */
+void InvalidateFramePos(SwFrame* pFrame, bool bInCalcContent)
+{
+if (bInCalcContent)
+pFrame->InvalidatePos_();
+else
+pFrame->InvalidatePos();
+}
+}
+
 SwSectionFrame::SwSectionFrame( SwSection , SwFrame* pSib )
 : SwLayoutFrame( rSect.GetFormat(), pSib )
 , SwFlowFrame( static_cast(*this) )
@@ -2216,15 +2231,20 @@ SwTwips SwSectionFrame::Grow_( SwTwips nDist, bool bTst 
)
 }
 if( GetNext() )
 {
+// Own height changed, need to invalidate the position of
+// next frames.
 SwFrame *pFrame = GetNext();
  

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

2018-09-14 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf82177_tblBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |   10 ++
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx  |   11 --
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx  |   10 --
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx  |   10 ++
 sw/source/filter/ww8/docxattributeoutput.cxx   |   27 -
 sw/source/filter/ww8/docxattributeoutput.hxx   |1 
 7 files changed, 20 insertions(+), 49 deletions(-)

New commits:
commit 65c43d97f3f03e944c6bc35eb44a1ebcde31094e
Author: Justin Luth 
AuthorDate: Mon Aug 27 21:22:01 2018 +0300
Commit: Miklos Vajna 
CommitDate: Fri Sep 14 09:07:36 2018 +0200

tdf#82177 docx export: eliminate invalid tbl insideV/H borders

Inherited from OOo, these insideV/H borders incorrectly assume
that every inside border will match the bottom/right border
of cell A1. For the most part this error is harmless since
every cell specifies every border anyway (that doesn't match
a table-style default). The only time it is visible is when
insideV/H specifies a border, but none is set on the cell.

The problem is that these pseudo-defaults are not passed
to the cellborders function as defaults, so cells have no idea
whether they need to override these values or not.

Since the implementation is completely flawed and unnecessary,
simply eliminate it.

(TODO: In fact, the entire tblBorders output is flawed,
as demonstrated by the outside borders in the unit test.)

One unit test is removed since insideV/H is no longer
being written (this was just a "lets specify what we
see being written out" test, not one concerned specifically
with insideV/H. Not enforcing the absence of insideV/H because
theoretically someone could legitimately add zero-width
borders to the table borders and still be valid.

The ordering of the borders test was moved from a
table borders test (no longer created) to a styles
border (which is still valid - a grabbag dump.)

Change-Id: Ie6786a66fe88d2c7e3bdcff8fda3b4f77cb988d7
Reviewed-on: https://gerrit.libreoffice.org/59675
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf82177_tblBorders.docx 
b/sw/qa/extras/ooxmlexport/data/tdf82177_tblBorders.docx
new file mode 100644
index ..88a237cf69c2
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf82177_tblBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 35209c0cecc3..c7400b974394 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -527,6 +527,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82177_insideCellBorders, 
"tdf82177_insideCellBor
 CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "LeftBorder").LineWidth);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf82177_tblBorders, "tdf82177_tblBorders.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference< text::XTextTable > xTable( xTables->getByIndex(0), 
uno::UNO_QUERY );
+uno::Reference< table::XCell > xCell = xTable->getCellByName( "E5" );
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "TopBorder").LineWidth);
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "LeftBorder").LineWidth);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
 {
 // This was 0, relative size of shape after bitmap was ignored.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 6da4c52fb83d..5e1ce6a70ffe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -345,17 +345,6 @@ DECLARE_OOXMLEXPORT_TEST(testMathVerticalStacks, 
"math-vertical_stacks.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTable, "table.odt")
 {
-// Validation test: order of elements were wrong.
-xmlDocPtr pXmlDoc = parseExport("word/document.xml");
-if (!pXmlDoc)
-return;
-// Order was: insideH, end, insideV.
-int nEnd = getXPathPosition(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "end");
-int nInsideH = getXPathPosition(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "insideH");
-int nInsideV = getXPathPosition(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "insideV");
-CPPUNIT_ASSERT(nEnd < nInsideH);
-CPPUNIT_ASSERT(nInsideH < nInsideV);
-
 // Make sure we write qFormat for well-known style names.
 assertXPath(parseExport("word/styles.xml"), 
"//w:style[@w:styleId='Normal']/w:qFormat", 1);
 }
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 

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

2018-09-14 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/testTrackChangesDeletedEmptyParagraph.docx 
|binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |
7 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |
1 +
 3 files changed, 8 insertions(+)

New commits:
commit 4e5f89d2d3511b6421b388ecaba2f61ada14d084
Author: László Németh 
AuthorDate: Thu Sep 13 16:41:51 2018 +0200
Commit: László Németh 
CommitDate: Fri Sep 14 09:53:03 2018 +0200

tdf#119848 DOCX export: keep tracked deleted empty line

when it has no other paragraph property change.

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

diff --git 
a/sw/qa/extras/ooxmlexport/data/testTrackChangesDeletedEmptyParagraph.docx 
b/sw/qa/extras/ooxmlexport/data/testTrackChangesDeletedEmptyParagraph.docx
new file mode 100644
index ..bd332efa4cfe
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/testTrackChangesDeletedEmptyParagraph.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index c7400b974394..e92bb8178b4b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -711,7 +711,14 @@ DECLARE_OOXMLEXPORT_TEST(testChart_BorderLine_Style, 
"Chart_BorderLine_Style.doc
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:spPr/a:ln/a:prstDash", 
"val", "sysDot");
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:spPr/a:ln/a:prstDash", 
"val", "sysDash");
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[3]/c:spPr/a:ln/a:prstDash", 
"val", "dash");
+}
 
+DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedEmptyParagraph, 
"testTrackChangesDeletedEmptyParagraph.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:rPr/w:del");
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 505ea1b74f8a..a72f89a7d022 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2084,6 +2084,7 @@ void DocxAttributeOutput::InitCollectedRunProperties()
 FSNS( XML_w, XML_specVanish ),
 FSNS( XML_w, XML_oMath ),
 FSNS( XML_w, XML_rPrChange ),
+FSNS( XML_w, XML_del ),
 FSNS( XML_w14, XML_glow ),
 FSNS( XML_w14, XML_shadow ),
 FSNS( XML_w14, XML_reflection ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-09-10 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|   11 ++-
 sw/source/filter/ww8/WW8TableInfo.cxx|5 -
 sw/source/filter/ww8/WW8TableInfo.hxx|1 -
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 +-
 4 files changed, 7 insertions(+), 24 deletions(-)

New commits:
commit d934fe802c228d5478cea228b84ba56b6c9b9241
Author: Justin Luth 
AuthorDate: Sat Sep 8 12:11:01 2018 +0300
Commit: Miklos Vajna 
CommitDate: Mon Sep 10 10:01:11 2018 +0200

tdf#82177 docx export: eliminate invalid tcPr insideV/H borders

better fix than cecf71c18da5430c10daa8522d38d5144edefc14 since:

17.4.25 insideV (Table Cell Inside Vertical Edges Border)
This element specifies the border which shall be displayed
on all interior vertical edges of the current group of table cells.
[Note: Although individual table cells have no concept of an
internal edge, which would render this property useless in
most cases, it is used to determine the cell borders to apply to a specific
group of cells as part of table conditional formatting in a table style,
for example, the inside vertical edges on the set of cells in the header
row. end note]

So, I interpret this as insideV/H having meaning only within
table styles, and not when directly applied to a cell. The only documents
I've seen with insideV/H directly applied to a cell seem to have been
created by LO - which dumps them everywhere, redundantly.

Tablestyle cell groupings are handled elsewhere via grabbag dumps,
so insideV/H borders can be eliminated from TableCellProperties.

Change-Id: I128417f0a0b485c85ede463daacb8feabc457302
Reviewed-on: https://gerrit.libreoffice.org/60187
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index eba875d4cbe3..809ff6ecb88f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -701,15 +701,8 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80097, "fdo80097.docx")
 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:bottom[@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:bottom[@w:color
 = '00']", 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:insideH[@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:insideH[@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:insideH[@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:insideH[@w:color
 = '00']", 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:insideV[@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:insideV[@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:insideV[@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:insideV[@w:color
 = '00']", 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:insideH",0);
+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:insideV",0);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo77129, "fdo77129.docx")
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx 
b/sw/source/filter/ww8/WW8TableInfo.cxx
index b41639243669..e27e3393f3bd 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -120,11 +120,6 @@ void WW8TableNodeInfoInner::setRect(const SwRect & rRect)
 maRect = rRect;
 }
 
-bool WW8TableNodeInfoInner::isFinalRow() const
-{
-return mpTable && mpTable->GetTabLines().size() - 1 == mnRow;
-}
-
 const SwNode * WW8TableNodeInfoInner::getNode() const
 {
 const SwNode * pResult = nullptr;
diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx 
b/sw/source/filter/ww8/WW8TableInfo.hxx
index f2a2db21806a..a3b6df799180 100644
--- a/sw/source/filter/ww8/WW8TableInfo.hxx
+++ b/sw/source/filter/ww8/WW8TableInfo.hxx
@@ -94,7 +94,6 @@ public:
 bool isEndOfCell() const { return mbEndOfCell;}
 bool isEndOfLine() const { return mbEndOfLine;}
 bool isFinalEndOfLine() const { return mbFinalEndOfLine;}
-bool isFinalRow() const;
 bool isFirstInTable() const { 

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

2018-09-04 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   39 ++
 sw/source/core/doc/DocumentRedlineManager.cxx |   22 ++
 2 files changed, 61 insertions(+)

New commits:
commit 1bbbe57dfc0b43d6b5444798d77dcdf5e4e76e49
Author: László Németh 
AuthorDate: Tue Aug 28 21:13:09 2018 +0200
Commit: László Németh 
CommitDate: Wed Sep 5 07:48:59 2018 +0200

tdf#119571 change tracking: show layout changes at paragraph join

in Show changes mode, too. Delayed update of the paragraph
layout at file saving etc. resulted invisible style changes.

All removed paragraphs get the style of the first (partially
deleted) paragraph to avoid text insertion with bad style in
the deleted area later, as in MSO (except the incomplete undo
of paragraph styles here and at other paragraph
formattings during change tracking).

Note: see also tdf#105413 for the remaining problem: style
changes after deleted paragraphs are losing in Show changes mode.

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

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 0a789a73b87d..77398885940c 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -24,10 +24,12 @@ class SwUiWriterTest2 : public SwModelTestBase
 public:
 void testTdf101534();
 void testTdf54819();
+void testTdf119571();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testTdf101534);
 CPPUNIT_TEST(testTdf54819);
+CPPUNIT_TEST(testTdf119571);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -91,6 +93,43 @@ void SwUiWriterTest2::testTdf54819()
  getProperty(getParagraph(1), 
"ParaStyleName"));
 }
 
+void SwUiWriterTest2::testTdf119571()
+{
+load(DATA_DIRECTORY, "tdf54819.fodt");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
+ getProperty(getParagraph(1), 
"ParaStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"),
+ getProperty(getParagraph(2), 
"ParaStyleName"));
+
+//turn on red-lining and show changes
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | 
RedlineFlags::ShowDelete
+  | 
RedlineFlags::ShowInsert);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// join paragraphs by removing the end of the first one with paragraph 
break
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, 
/*bBasicCall=*/false);
+pWrtShell->EndPara(/*bSelect=*/true);
+pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, 
/*bBasicCall=*/false);
+rtl::Reference pTransfer = new SwTransferable(*pWrtShell);
+pTransfer->Cut();
+
+// second paragraph changes its style in "Show changes" mode
+CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
+ getProperty(getParagraph(1), 
"ParaStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
+ getProperty(getParagraph(2), 
"ParaStyleName"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 6838e7fc8dcd..c5b259f6aef6 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1692,6 +1692,28 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 if (pDelNode != nullptr && pTextNode != nullptr && 
pDelNode != pTextNode)
 pTextNode->CopyCollFormat( *pDelNode );
 }
+else
+{
+// tdf#119571 update the style of the joined paragraph
+// after a partially deleted paragraph to show its correct 
style
+// in "Show changes" mode, too. All removed paragraphs
+// get the style of the first (partially deleted) paragraph
+// to avoid text insertion with bad style in the deleted
+// area later.
+SwContentNode* pDelNd = 
pStt->nNode.GetNode().GetContentNode();
+SwContentNode* pTextNd = 
pEnd->nNode.GetNode().GetContentNode();
+

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

2018-09-04 Thread Libreoffice Gerrit user
 sw/qa/extras/uiwriter/data2/tdf54819.fodt |9 ++
 sw/qa/extras/uiwriter/uiwriter2.cxx   |   36 ++
 sw/source/core/doc/DocumentRedlineManager.cxx |   13 +
 3 files changed, 58 insertions(+)

New commits:
commit 22639148ae5400bac98f32a75d7431b857c80195
Author: László Németh 
AuthorDate: Tue Aug 28 18:23:17 2018 +0200
Commit: László Németh 
CommitDate: Wed Sep 5 07:41:09 2018 +0200

tdf#54819 change tracking: keep paragraph style after full deletion

of the previous paragraph(s), as in editing without change tracking.

This is a workaround for the regression introduced by #i100466#.

NOTE: We change the style of the first removed paragraph to restore
normal editing function during change tracking, too. Manual fix
of the spoiled paragraph does the same style changes in the
previously deleted paragraphs, so this commit doesn't introduce
any new oddity.

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

diff --git a/sw/qa/extras/uiwriter/data2/tdf54819.fodt 
b/sw/qa/extras/uiwriter/data2/tdf54819.fodt
new file mode 100644
index ..f9a8e9d0b698
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf54819.fodt
@@ -0,0 +1,9 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" 
xmlns:css3t="http://www.w3.org/TR/css3-text/; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+  Lorem ipsum
+  dolor sit amet.
+
+  
+
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 239700294b71..0a789a73b87d 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -22,9 +23,11 @@ class SwUiWriterTest2 : public SwModelTestBase
 {
 public:
 void testTdf101534();
+void testTdf54819();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest2);
 CPPUNIT_TEST(testTdf101534);
+CPPUNIT_TEST(testTdf54819);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -55,6 +58,39 @@ void SwUiWriterTest2::testTdf101534()
 CPPUNIT_ASSERT(aSet.HasItem(RES_LR_SPACE));
 }
 
+void SwUiWriterTest2::testTdf54819()
+{
+load(DATA_DIRECTORY, "tdf54819.fodt");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+
+CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
+ getProperty(getParagraph(1), 
"ParaStyleName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"),
+ getProperty(getParagraph(2), 
"ParaStyleName"));
+
+//turn on red-lining and hide changes
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On);
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+CPPUNIT_ASSERT_MESSAGE("redlines shouldn't be visible",
+   !IDocumentRedlineAccess::IsShowChanges(
+   
pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// remove first paragraph with paragraph break
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+

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

2018-08-31 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/ww8export.cxx |3 +--
 sw/source/filter/ww8/wrtww8.cxx  |4 ++--
 sw/source/filter/ww8/wrtww8.hxx  |2 +-
 sw/source/filter/ww8/ww8atr.cxx  |2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 21f52dc70e0f74adc559375f560dff969b9498de
Author: Justin Luth 
AuthorDate: Wed Aug 29 19:48:18 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Sep 1 06:21:08 2018 +0200

Revert "tdf#117994 ww8export: extend Chp over CR"

This reverts commit 091aedc63de2f6c8f0f4c60dd1fa93fe4c6ddde4.

It was a regression-prone code area, so this was expected,
but disappointing.

Change-Id: Ibf0702dd634ba19bce9c0c5b2d2bd8b668f736c6
Reviewed-on: https://gerrit.libreoffice.org/59779
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 25af135a35f7..a53525a5ece7 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -675,8 +675,7 @@ DECLARE_WW8EXPORT_TEST(testTdf59896, "tdf59896.doc")
 DECLARE_WW8EXPORT_TEST(testTdf102334, "tdf102334.doc")
 {
 // This was false, i.e. the first run wasn't hidden, when it should have 
been
-// But this looks different (less hidden) in MSWord
-// CPPUNIT_ASSERT_EQUAL(true, getProperty(getRun(getParagraph(7), 
1), "CharHidden"));
+CPPUNIT_ASSERT_EQUAL(true, getProperty(getRun(getParagraph(7), 1), 
"CharHidden"));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf38778, 
"tdf38778_properties_in_run_for_field.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 3541c4711bd3..158c0bc15a27 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -995,7 +995,7 @@ sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 )
 return rF.CopyLastSprms(rLen);
 }
 
-void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* 
pSprms, const bool bExpandEmpty)
+void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* 
pSprms)
 {
 WW8_WrFkp* pF = m_Fkps.back().get();
 
@@ -1024,7 +1024,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short 
nVarLen,const sal_uInt8* pS
 pF->MergeToNew( nVarLen, pNewSprms );
 // has the prev EndFC an empty sprm and the current is empty too, then
 // expand only the old EndFc to the new EndFc
-else if( !nVarLen && (bExpandEmpty || pF->IsEmptySprm()) )
+else if( !nVarLen && pF->IsEmptySprm() )
 {
 pF->SetNewEnd( nEndFc );
 return ;
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 03e6411475d2..1b96c9aab0cb 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1287,7 +1287,7 @@ private:
 public:
 WW8_WrPlcPn( WW8Export& rWrt, ePLCFT ePl, WW8_FC nStartFc );
 ~WW8_WrPlcPn();
-void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* 
pSprms = nullptr, const bool bExpandEmpty=false);
+void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* 
pSprms = nullptr);
 void WriteFkps();
 void WritePlc();
 sal_uInt8 *CopyLastSprms(sal_uInt8 );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index c5cab3f6edf6..15ef3cae7c54 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1061,7 +1061,7 @@ void WW8AttributeOutput::OutputFKP(bool bForce)
 if (!m_rWW8Export.pO->empty() || bForce)
 {
 m_rWW8Export.m_pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
-m_rWW8Export.pO->size(), m_rWW8Export.pO->data(), 
m_rWW8Export.pO->empty() );
+m_rWW8Export.pO->size(), m_rWW8Export.pO->data() );
 m_rWW8Export.pO->clear();
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-31 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |   10 +
 sw/source/filter/ww8/WW8TableInfo.cxx  |4 ++
 sw/source/filter/ww8/WW8TableInfo.hxx  |1 
 sw/source/filter/ww8/docxattributeoutput.cxx   |   17 
+++---
 5 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit cecf71c18da5430c10daa8522d38d5144edefc14
Author: Justin Luth 
AuthorDate: Sat Aug 25 22:22:55 2018 +0300
Commit: Miklos Vajna 
CommitDate: Fri Aug 31 17:58:52 2018 +0200

tdf#82177 docx export: no inside borders on outside cells

Well, not on the bottom or right outside cells.
Obviously the presence of a bottom or a right in those
cases doesn't indicate an inside line.

Change-Id: I5d0661fd60f478a392b12fe9093c2e47e130631b
Reviewed-on: https://gerrit.libreoffice.org/59600
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx 
b/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx
new file mode 100644
index ..75c9a656da06
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf82177_outsideCellBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index e02d829b734f..e289d3a40dba 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -456,6 +456,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, 
"tdf112118.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf82177_outsideCellBorders, 
"tdf82177_outsideCellBorders.docx")
+{
+uno::Reference xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+uno::Reference< text::XTextTable > xTable( xTables->getByIndex(0), 
uno::UNO_QUERY );
+uno::Reference< table::XCell > xCell = xTable->getCellByName( "E4" );
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "TopBorder").LineWidth);
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
getProperty(xCell, "LeftBorder").LineWidth);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
 {
 // This was 0, relative size of shape after bitmap was ignored.
diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx 
b/sw/source/filter/ww8/WW8TableInfo.cxx
index 9713931d1e65..b41639243669 100644
--- a/sw/source/filter/ww8/WW8TableInfo.cxx
+++ b/sw/source/filter/ww8/WW8TableInfo.cxx
@@ -120,6 +120,10 @@ void WW8TableNodeInfoInner::setRect(const SwRect & rRect)
 maRect = rRect;
 }
 
+bool WW8TableNodeInfoInner::isFinalRow() const
+{
+return mpTable && mpTable->GetTabLines().size() - 1 == mnRow;
+}
 
 const SwNode * WW8TableNodeInfoInner::getNode() const
 {
diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx 
b/sw/source/filter/ww8/WW8TableInfo.hxx
index a3b6df799180..f2a2db21806a 100644
--- a/sw/source/filter/ww8/WW8TableInfo.hxx
+++ b/sw/source/filter/ww8/WW8TableInfo.hxx
@@ -94,6 +94,7 @@ public:
 bool isEndOfCell() const { return mbEndOfCell;}
 bool isEndOfLine() const { return mbEndOfLine;}
 bool isFinalEndOfLine() const { return mbFinalEndOfLine;}
+bool isFinalRow() const;
 bool isFirstInTable() const { return mbFirstInTable;}
 const SwTableBox * getTableBox() const { return mpTableBox;}
 const SwTable * getTable() const { return mpTable;}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 77101984d429..adb5e65d913b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3063,8 +3063,13 @@ static OutputBorderOptions lcl_getBoxBorderOptions()
 return rOptions;
 }
 
-static void impl_borders( FSHelperPtr const & pSerializer, const SvxBoxItem& 
rBox, const OutputBorderOptions& rOptions,
-  std::map 
 )
+static void impl_borders( FSHelperPtr const & pSerializer,
+  const SvxBoxItem& rBox,
+  const OutputBorderOptions& rOptions,
+  std::map ,
+  const bool bIsLastColumn = false,
+  const bool bIsLastRow = false )
 {
 static const SvxBoxItemLine aBorders[] =
 {
@@ -3156,14 +3161,14 @@ static void impl_borders( FSHelperPtr const & 
pSerializer, const SvxBoxItem& rBo
 bWriteInsideV = true;
 }
 }
-if (bWriteInsideH)
+if (bWriteInsideH && !bIsLastRow)
 {
 const table::BorderLine2 *aStyleProps = nullptr;
 if( rTableStyleConf.find( SvxBoxItemLine::BOTTOM ) != 
rTableStyleConf.end() )
 aStyleProps = [ SvxBoxItemLine::BOTTOM ];
 impl_borderLine( pSerializer, XML_insideH, 
rBox.GetLine(SvxBoxItemLine::BOTTOM), 0, false, aStyleProps );
 }

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

2018-08-30 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlexport/data/reqif-no-lang.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx |   11 +++
 sw/source/filter/html/wrthtml.cxx  |3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 81fac013cb365d711ad78a566ee1b5b13480b013
Author: Miklos Vajna 
AuthorDate: Thu Aug 30 15:08:36 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 30 18:45:42 2018 +0200

sw XHTML export: xml:lang is not relevant for ReqIF

I suppose if language is set, that happens in the wrapping ReqIF
document, not in the XHTML fragments.

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

diff --git a/sw/qa/extras/htmlexport/data/reqif-no-lang.odt 
b/sw/qa/extras/htmlexport/data/reqif-no-lang.odt
new file mode 100644
index ..c831921a42a4
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/reqif-no-lang.odt 
differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index c83170752496..861054868ec1 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -646,6 +646,17 @@ DECLARE_HTMLEXPORT_TEST(testOleNodataReqIf, 
"reqif-ole-nodata.odt")
 CPPUNIT_ASSERT(!aSource.isEmpty());
 }
 
+DECLARE_HTMLEXPORT_TEST(testNoLangReqIf, "reqif-no-lang.odt")
+{
+SvMemoryStream aStream;
+wrapFragment(aStream);
+xmlDocPtr pDoc = parseXmlStream();
+CPPUNIT_ASSERT(pDoc);
+
+// Make sure that xml:lang is not written in ReqIF mode.
+assertXPathNoAttribute(pDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:h1", "lang");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 2f8dde26a3bd..53b57fc4ce33 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1339,7 +1339,8 @@ sal_uInt16 SwHTMLWriter::GetLangWhichIdFromScript( 
sal_uInt16 nScript )
 
 void SwHTMLWriter::OutLanguage( LanguageType nLang )
 {
-if( LANGUAGE_DONTKNOW != nLang )
+// ReqIF mode: consumers would ignore language anyway.
+if (LANGUAGE_DONTKNOW != nLang && !mbReqIF)
 {
 OStringBuffer sOut;
 sOut.append(' ');
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-30 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlexport/data/reqif-ole-nodata.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx|   36 +--
 sw/source/filter/html/htmlplug.cxx|   72 --
 3 files changed, 86 insertions(+), 22 deletions(-)

New commits:
commit 5d997c029e53c31a3651a08f5012645097cec48f
Author: Miklos Vajna 
AuthorDate: Thu Aug 30 14:14:11 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 30 18:43:08 2018 +0200

sw XHTML export: improve dummy OLE object handling

It is possible that we not only have a dummy OLE object, but both the
replacement image and the native data is missing. Handle these enough so
that we don't give up exporting the document and also produce valid
output.

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

diff --git a/sw/qa/extras/htmlexport/data/reqif-ole-nodata.odt 
b/sw/qa/extras/htmlexport/data/reqif-ole-nodata.odt
new file mode 100644
index ..a4d3243a8bf3
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/reqif-ole-nodata.odt 
differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 696ca6041dad..c83170752496 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -35,6 +35,20 @@ public:
 m_eUnit(FUNIT_NONE)
 {}
 
+/**
+ * Wraps a reqif-xhtml fragment into an XHTML file, so an XML parser can
+ * parse it.
+ */
+void wrapFragment(SvMemoryStream& rStream)
+{
+rStream.WriteCharPtr(
+"http://www.w3.org/1999/xhtml\;>\n");
+SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
+rStream.WriteStream(aFileStream);
+rStream.WriteCharPtr("\n");
+rStream.Seek(0);
+}
+
 private:
 bool mustCalcLayoutOf(const char* filename) override
 {
@@ -603,11 +617,7 @@ DECLARE_HTMLEXPORT_TEST(testTransparentImage, 
"transparent-image.odt")
 DECLARE_HTMLEXPORT_TEST(testTransparentImageReqIf, "transparent-image.odt")
 {
 SvMemoryStream aStream;
-aStream.WriteCharPtr("http://www.w3.org/1999/xhtml\;>\n");
-SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
-aStream.WriteStream(aFileStream);
-aStream.WriteCharPtr("\n");
-aStream.Seek(0);
+wrapFragment(aStream);
 xmlDocPtr pDoc = parseXmlStream();
 CPPUNIT_ASSERT(pDoc);
 
@@ -620,6 +630,22 @@ DECLARE_HTMLEXPORT_TEST(testTransparentImageReqIf, 
"transparent-image.odt")
 CPPUNIT_ASSERT_MESSAGE(aMessage.toUtf8().getStr(), 
aSource.endsWith(".png"));
 }
 
+DECLARE_HTMLEXPORT_TEST(testOleNodataReqIf, "reqif-ole-nodata.odt")
+{
+// This failed, io::IOException was thrown during the filter() call.
+SvMemoryStream aStream;
+wrapFragment(aStream);
+xmlDocPtr pDoc = parseXmlStream();
+CPPUNIT_ASSERT(pDoc);
+
+// Make sure the native  element has the required data attribute.
+OUString aSource = getXPath(
+pDoc,
+
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:object",
+"data");
+CPPUNIT_ASSERT(!aSource.isEmpty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index d054fd393f65..cea1a75cacd0 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -63,6 +63,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -74,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -130,6 +132,33 @@ const HtmlFrmOpts HTML_FRMOPTS_OLE_CSS1   =
 HtmlFrmOpts::SAlign |
 HtmlFrmOpts::SSpace;
 
+namespace
+{
+/**
+ * Calculates a filename for an image, provided the HTML file name, the image
+ * itself and a wanted extension.
+ */
+OUString lcl_CalculateFileName(const OUString* pOrigFileName, const Graphic& 
rGraphic,
+   const OUString& rExtension)
+{
+OUString aFileName;
+
+if (pOrigFileName)
+aFileName = *pOrigFileName;
+INetURLObject aURL(aFileName);
+OUString aName(aURL.getBase());
+aName += "_";
+aName += aURL.getExtension();
+aName += "_";
+aName += OUString::number(rGraphic.GetChecksum(), 16);
+aURL.setBase(aName);
+aURL.setExtension(rExtension);
+aFileName = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+
+return aFileName;
+}
+}
+
 void SwHTMLParser::SetFixSize( const Size& rPixSize,
const Size& rTwipDfltSize,
bool bPrcWidth, bool bPrcHeight,
@@ -1465,18 +1494,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, 
const SwFrameFormat& rFrame
 
 // Calculate the file name, which is meant to be the same as the
 // replacement 

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

2018-08-29 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx   |5 +
 sw/source/filter/ww8/ww8par6.cxx|   12 +---
 3 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 2127581728ae61eca7470b288c21d1c02754fb5b
Author: Justin Luth 
AuthorDate: Thu Aug 16 15:49:37 2018 +0300
Commit: Miklos Vajna 
CommitDate: Wed Aug 29 11:20:15 2018 +0200

tdf#119232 ww8import: even page means default to start on page 2

I didn't see this mentioned in the sprm documentation,
but that is how MS Word seems to implement it.

Change-Id: I5b86ecf99a884e768877cdb0e71f43cdb9f2ad76
Reviewed-on: https://gerrit.libreoffice.org/59221
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc 
b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc
new file mode 100644
index ..c50bf46c0b58
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf119232_startEvenPage.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index d540cece3c6d..078079f969ec 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -282,6 +282,11 @@ DECLARE_WW8EXPORT_TEST(testTdf106174_rtlParaAlign, 
"tdf106174_rtlParaAlign.docx"
 CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(14), "ParaAdjust"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf119232_startEvenPage, 
"tdf119232_startEvenPage.doc")
+{
+CPPUNIT_ASSERT_EQUAL(sal_Int16(2), getProperty(getParagraph(1), 
"PageNumberOffset"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
 {
 uno::Reference 
xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index cc43a90d4077..7844ef2a07e9 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -874,6 +874,8 @@ void wwSectionManager::CreateSep(const long nTextPos)
 
 const sal_uInt16* pIds = eVer <= ww::eWW2 ? aVer2Ids0 : eVer <= ww::eWW7 ? 
aVer67Ids0 : aVer8Ids0;
 
+SprmResult aRes = pSep->HasSprm(pIds[0]);
+const sal_uInt8* pSprmBkc = aRes.pSprm;
 if (!maSegments.empty())
 {
 // Type of break: break codes are:
@@ -882,8 +884,6 @@ void wwSectionManager::CreateSep(const long nTextPos)
 // 2 New page
 // 3 Even page
 // 4 Odd page
-SprmResult aRes = pSep->HasSprm(pIds[0]);
-const sal_uInt8* pSprmBkc = aRes.pSprm;
 if (pSprmBkc && aRes.nRemainingData >= 1)
 aNewSection.maSep.bkc = *pSprmBkc;
 }
@@ -1036,7 +1036,13 @@ void wwSectionManager::CreateSep(const long nTextPos)
 
 aNewSection.maSep.pgnStart = ReadUSprm( pSep, pIds[7], 0 );
 
-SprmResult aRes;
+// if the document's first page number is unspecified, but it starts with 
an even page break,
+// then set the first page number to two
+if ( maSegments.empty() && !aNewSection.maSep.fPgnRestart && pSprmBkc && 
*pSprmBkc == 3 )
+{
+aNewSection.maSep.pgnStart = 2;
+aNewSection.maSep.fPgnRestart = 1;
+}
 
 if (eVer >= ww::eWW6)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-27 Thread Libreoffice Gerrit user
 sw/qa/extras/rtfexport/data/tdf116436_tableBackground.odt |binary
 sw/qa/extras/rtfexport/rtfexport3.cxx |   16 
 sw/source/filter/ww8/rtfattributeoutput.cxx   |   28 +++---
 3 files changed, 39 insertions(+), 5 deletions(-)

New commits:
commit 1a4bc964f15003c6aaec84989e3e47501b7f72df
Author: Justin Luth 
AuthorDate: Sat Aug 18 11:41:35 2018 +0300
Commit: Miklos Vajna 
CommitDate: Mon Aug 27 17:52:37 2018 +0200

tdf#116436 rtf export: add missing table background fill

MS formats only have support for Table and Cell fill.

Interestingly, MS Word doesn't let the cells inherit from
the Table fill setting,
so that value also needs to be written out into every cell.

Since Word apparently ignores the table color, I didn't
bother trying to search out how to export that in RTF
format.  (I did add it to DOCX since it was so easy to find.)

Change-Id: I7fe7723fb1603bc60608762aea79ff3b8122e073
Reviewed-on: https://gerrit.libreoffice.org/59282
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfexport/data/tdf116436_tableBackground.odt 
b/sw/qa/extras/rtfexport/data/tdf116436_tableBackground.odt
new file mode 100644
index ..1ae65f788d4b
Binary files /dev/null and 
b/sw/qa/extras/rtfexport/data/tdf116436_tableBackground.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index d27eec82fea9..45be1c450cb4 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -60,6 +60,22 @@ DECLARE_RTFEXPORT_TEST(testTdf108949_footnote, 
"tdf108949_footnote.rtf")
  
getProperty(xFootnote->getAnchor(), "CharColor"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf116436_tableBackground, 
"tdf116436_tableBackground.odt")
+{
+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");
+if (mbExported)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xF8DF7C), 
getProperty(xCell, "BackColor"));
+xCell.set(xTable->getCellByName("A6"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0x81D41A), getProperty(xCell, 
"BackColor"));
+xCell.set(xTable->getCellByName("B6"));
+if (mbExported)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFBCC), 
getProperty(xCell, "BackColor"));
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf104035, "tdf104035.rtf")
 {
 auto aTabStops = 
getProperty>(getParagraph(1), "ParaTabStops");
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 09241ae57b26..86bbb4201a2d 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -726,6 +726,21 @@ void RtfAttributeOutput::TableDefaultBorders(
 void RtfAttributeOutput::TableBackgrounds(
 ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner)
 {
+const SwTable* pTable = pTableTextNodeInfoInner->getTable();
+const SwTableBox* pTableBox = pTableTextNodeInfoInner->getTableBox();
+const SwTableLine* pTableLine = pTableBox->GetUpper();
+
+Color aColor = COL_AUTO;
+const SvxBrushItem* pTableColorProp
+= 
pTable->GetFrameFormat()->GetAttrSet().GetItem(RES_BACKGROUND);
+if (pTableColorProp)
+aColor = pTableColorProp->GetColor();
+
+const SvxBrushItem* pRowColorProp
+= 
pTableLine->GetFrameFormat()->GetAttrSet().GetItem(RES_BACKGROUND);
+if (pRowColorProp && pRowColorProp->GetColor() != COL_AUTO)
+aColor = pRowColorProp->GetColor();
+
 const SwWriteTableRows& aRows = m_pTableWrt->GetRows();
 SwWriteTableRow* pRow = aRows[pTableTextNodeInfoInner->getRow()];
 const SwWriteTableCell* const pCell
@@ -735,11 +750,14 @@ void RtfAttributeOutput::TableBackgrounds(
 if (pCellFormat->GetAttrSet().HasItem(RES_BACKGROUND, ))
 {
 auto& rBack = static_cast(*pItem);
-if (!rBack.GetColor().GetTransparency())
-{
-m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT);
-
m_aRowDefs.append(static_cast(m_rExport.GetColor(rBack.GetColor(;
-}
+if (rBack.GetColor() != COL_AUTO)
+aColor = rBack.GetColor();
+}
+
+if (!aColor.GetTransparency())
+{
+m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT);
+m_aRowDefs.append(static_cast(m_rExport.GetColor(aColor)));
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-24 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|3 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 7413216e02be9b2f8eb39d550c297021e92ef299
Author: Justin Luth 
AuthorDate: Thu Aug 23 21:15:23 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Aug 25 07:49:51 2018 +0200

tdf#70195 docx export: default header/footer at 720

This only impacts MSWord, which otherwise suggests
a new header start at 0. LO ignores that 0 and uses
a sane default.

Change-Id: Id9790038086de1e20918d4ab498a0ce93ca53b5c
Reviewed-on: https://gerrit.libreoffice.org/59523
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index beaa1b936cc4..ba02516709c4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -971,6 +971,9 @@ DECLARE_OOXMLEXPORT_TEST(test76108, "test76108.docx")
 if (!pXmlDoc) return;
 //docx file after RT is getting corrupted.
 assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin");
+
+// tdf#70195 the default header should start at 720, not 0
+assertXPath(pXmlDoc, "//w:pgMar", "header", "720");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4c6aba493ce7..e9ae6c5fd588 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7982,14 +7982,14 @@ void DocxAttributeOutput::FormatULSpace( const 
SvxULSpaceItem& rULSpace )
 
 HdFtDistanceGlue aDistances( *m_rExport.GetCurItemSet() );
 
-sal_Int32 nHeader = 0;
+sal_Int32 nHeader = 720;
 if ( aDistances.HasHeader() )
 nHeader = sal_Int32( aDistances.dyaHdrTop );
 
 // Page top
 m_pageMargins.nTop = aDistances.dyaTop;
 
-sal_Int32 nFooter = 0;
+sal_Int32 nFooter = 720;
 if ( aDistances.HasFooter() )
 nFooter = sal_Int32( aDistances.dyaHdrBottom );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-22 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|7 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 352efa5b3cb7d025b9a299e2fcade5f7822ed043
Author: Justin Luth 
AuthorDate: Wed Aug 22 09:10:04 2018 +0300
Commit: Justin Luth 
CommitDate: Thu Aug 23 06:24:01 2018 +0200

related tdf#76683 docx export: use firstLine, not hanging

for negative first line indents. TwipMeasure must be positive
even though contrary to their documentation, Microsoft still
uses the negative number. So this should have no noticable
impact, other than making the output valid.

Change-Id: Iafd9411c748f086dde3165c2ac7229b17a2312ab
Reviewed-on: https://gerrit.libreoffice.org/59423
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 57955e46e7f1..51287c7035cd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1148,6 +1148,13 @@ DECLARE_OOXMLEXPORT_TEST(testActiveXOptionButtonGroup, 
"activex_option_button_gr
 DECLARE_OOXMLEXPORT_TEST(tdf112169, "tdf112169.odt")
 {
 // LO crashed while export because of character background color handling
+
+//tdf76683 - Cannot be negative number - use firstLine instead of hanging
+xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+if (!pXmlDoc)
+return;
+assertXPathNoAttribute(pXmlDoc, 
"/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pPr/w:ind", "hanging");
+assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pPr/w:ind", 
"firstLine","360");
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf103090, "tdf103090.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 00412096bbde..845763404813 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6635,9 +6635,10 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
 }
 
 sal_Int32 nToken = ecmaDialect ? XML_left : XML_start;
+sal_Int32 nIndentToken = nFirstLineIndex > 0 ? XML_firstLine : XML_hanging;
 m_pSerializer->singleElementNS( XML_w, XML_ind,
 FSNS( XML_w, nToken ), OString::number( nIndentAt ).getStr(),
-FSNS( XML_w, XML_hanging ), OString::number( -nFirstLineIndex 
).getStr(),
+FSNS( XML_w, nIndentToken ), OString::number( abs(nFirstLineIndex) 
).getStr(),
 FSEND );
 m_pSerializer->endElementNS( XML_w, XML_pPr );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-21 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx |binary
 sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx   |   27 
 sw/source/filter/ww8/ww8par6.cxx|   27 
 4 files changed, 54 insertions(+)

New commits:
commit 85818da3307a28b2d9c6fa5c1c97ca7833dfe24c
Author: Justin Luth 
AuthorDate: Wed Jul 11 22:37:00 2018 +0300
Commit: Justin Luth 
CommitDate: Wed Aug 22 06:14:28 2018 +0200

tdf#106174 ww8import: bidi - prev adjust? prev bidi?

Read_RTLJustify knows that it needs to swap in BiDi situations,
but sometimes it is read before BiDi status is known.
So Read_ParaBiDi needs to watch for this and do the swap afterwards.

Three situations to handle:
1.) bidi same as previous setting: no adjust change
2.) no previous adjust: set appropriate default for this bidi
3.) previous adjust and bidi different from previous: swap adjusts
(4. Unknown bidi treated like prev=LTR - one difference from DOCX)

Unit tests cover both situations - where BiDi is already known,
and where it is unknown.

Change-Id: I0b4e2383a4909fe79317dd9772d0be63f749da68
Reviewed-on: https://gerrit.libreoffice.org/57294
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx 
b/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx
new file mode 100644
index ..a222f5881461
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf106174_rtlParaAlign.docx differ
diff --git a/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc 
b/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc
new file mode 100644
index ..c643b96a4d3d
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf98620_rtlJustify.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index 91d1cdae23a3..d540cece3c6d 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -253,6 +254,32 @@ 
DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJ
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", 
text::HoriOrientation::LEFT_AND_WIDTH, getProperty(xTable, 
"HoriOrient"));
 CPPUNIT_ASSERT_MESSAGE("Table Indent", getProperty(xTable, 
"LeftMargin") > 3000);
 CPPUNIT_ASSERT_MESSAGE("Table Indent is 3750", getProperty(xTable, 
"LeftMargin") < 4000 );
+CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_RIGHT, 
static_cast(getProperty(getParagraphOrTable(2),
 "ParaAdjust")) );
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf98620_rtlJustify, "tdf98620_rtlJustify.doc")
+{
+CPPUNIT_ASSERT_EQUAL( style::ParagraphAdjust_RIGHT, 
static_cast(getProperty(getParagraph(1), 
"ParaAdjust")) );
+}
+
+DECLARE_WW8EXPORT_TEST(testTdf106174_rtlParaAlign, 
"tdf106174_rtlParaAlign.docx")
+{
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), 
getProperty(getParagraph(1), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_CENTER), 
getProperty(getParagraph(2), "ParaAdjust"));
+uno::Reference 
xPropertySet(getStyles("ParagraphStyles")->getByName("Another paragraph aligned 
to right"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(xPropertySet, "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(3), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(4), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(5), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT),  
getProperty(getParagraph(6), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(7), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(8), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT),  
getProperty(getParagraph(9), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT),  
getProperty(getParagraph(10), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(11), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT),  
getProperty(getParagraph(12), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_LEFT),  
getProperty(getParagraph(13), "ParaAdjust"));
+CPPUNIT_ASSERT_EQUAL(sal_Int16(style::ParagraphAdjust_RIGHT), 
getProperty(getParagraph(14), "ParaAdjust"));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
diff --git a/sw/source/filter/ww8/ww8par6.cxx 

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

2018-08-18 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt |binary
 sw/qa/extras/ww8export/ww8export2.cxx |   13 +
 sw/source/filter/ww8/wrtww8.cxx   |   36 +++---
 3 files changed, 31 insertions(+), 18 deletions(-)

New commits:
commit b576ab5073a8cdf5ca2db04838d255e142f5a896
Author: Justin Luth 
AuthorDate: Fri Aug 17 18:38:57 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Aug 18 13:09:07 2018 +0200

tdf#116436 doc export: add missing table background fill

MS formats only have support for Table and Cell fill.

Interestingly, MS Word doesn't let the cells inherit from
the Table fill setting,
so that value also needs to be written out into every cell.

Since Word apparently ignores the table color, I didn't
bother trying to search out how to export that in DOC
format.  (I did add it to DOCX since it was so easy to find.)

Change-Id: I8946f07b45f72fed5959369182882a7bf013b1d0
Reviewed-on: https://gerrit.libreoffice.org/59281
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt 
b/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt
new file mode 100644
index ..1ae65f788d4b
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf116436_tableBackground.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index bea2891126df..91d1cdae23a3 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -67,6 +67,19 @@ DECLARE_WW8EXPORT_TEST(testTdf55528_relativeTableWidth, 
"tdf55528_relativeTableW
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Table relative width percent", 
sal_Int16(98), getProperty(xTable, "RelativeWidth"));
  }
 
+DECLARE_WW8EXPORT_TEST(testTdf116436_tableBackground, 
"tdf116436_tableBackground.odt")
+{
+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");
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xF8DF7C), getProperty(xCell, 
"BackColor"));
+xCell.set(xTable->getCellByName("A6"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0x81D41A), getProperty(xCell, 
"BackColor"));
+xCell.set(xTable->getCellByName("B6"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFBCC), getProperty(xCell, 
"BackColor"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.doc")
 {
 CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, 
getProperty(getShape(1), "Surround"));
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 6274a3acfca9..81fdf13a4abf 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2582,6 +2582,7 @@ void WW8AttributeOutput::TableCellBorders(
 
 void WW8AttributeOutput::TableBackgrounds( 
ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
+const SwTable * pTab = pTableTextNodeInfoInner->getTable();
 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
 const SwTableLine * pTabLine = pTabBox->GetUpper();
 const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes();
@@ -2590,19 +2591,24 @@ void WW8AttributeOutput::TableBackgrounds( 
ww8::WW8TableNodeInfoInner::Pointer_t
 m_rWW8Export.InsUInt16( NS_sprm::sprmTDefTableShd80 );
 m_rWW8Export.pO->push_back( static_cast(nBoxes * 2) );  // Len
 
+Color aRowColor = COL_AUTO;
+const SvxBrushItem *pTableColorProp = 
pTab->GetFrameFormat()->GetAttrSet().GetItem(RES_BACKGROUND);
+if ( pTableColorProp )
+aRowColor = pTableColorProp->GetColor();
+
+const SvxBrushItem *pRowColorProp = 
pTabLine->GetFrameFormat()->GetAttrSet().GetItem(RES_BACKGROUND);
+if ( pRowColorProp && pRowColorProp->GetColor() != COL_AUTO )
+aRowColor = pRowColorProp->GetColor();
+
 for ( sal_uInt8 n = 0; n < nBoxes; n++ )
 {
 const SwTableBox * pBox1 = rTabBoxes[n];
 const SwFrameFormat * pFrameFormat = pBox1->GetFrameFormat();
-const SfxPoolItem * pI = nullptr;
-Color aColor;
+Color aColor = aRowColor;
 
-if ( SfxItemState::SET == pFrameFormat->GetAttrSet().GetItemState( 
RES_BACKGROUND, false,  ) )
-{
-aColor = dynamic_cast(pI)->GetColor();
-}
-else
-aColor = COL_AUTO;
+const SvxBrushItem *pCellColorProp = 
pFrameFormat->GetAttrSet().GetItem(RES_BACKGROUND);
+if ( pCellColorProp && pCellColorProp->GetColor() != COL_AUTO )
+aColor = pCellColorProp->GetColor();
 
 WW8_SHD aShd;
 WW8Export::TransBrush( aColor, aShd );
@@ -2624,17 +2630,11 @@ void WW8AttributeOutput::TableBackgrounds( 
ww8::WW8TableNodeInfoInner::Pointer_t
 {
 const SwTableBox * pBox1 = 

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

2018-08-18 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |9 ++
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx   |7 +
 sw/source/filter/ww8/docxattributeoutput.cxx|   27 +++-
 4 files changed, 42 insertions(+), 1 deletion(-)

New commits:
commit 8cc753d54ad1834709c5802115580adf65def89e
Author: Justin Luth 
AuthorDate: Fri Aug 17 14:35:51 2018 +0300
Commit: Justin Luth 
CommitDate: Sat Aug 18 13:01:27 2018 +0200

tdf#116436 docx export: add missing table background fill

MS formats only have support for Table and Cell fill.

Interestingly, MS Word doesn't let the cells inherit from
the Table fill setting (even though LO docx import currently does),
so that value also needs to be written out into every cell.

Change-Id: Ib49fddf52758ff641428de747ea290d1fcb894f3
Reviewed-on: https://gerrit.libreoffice.org/59260
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt 
b/sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt
new file mode 100644
index ..45f4a1c54b02
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf116436_rowFill.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index aba24b3f2d57..6974cb776550 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -51,6 +51,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf92524_autoColor, 
"tdf92524_autoColor.doc")
 CPPUNIT_ASSERT_EQUAL(COL_AUTO, 
Color(getProperty(getParagraph(1), "ParaBackColor")));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116436_rowFill, "tdf116436_rowFill.odt")
+{
+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");
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xF8DF7C), getProperty(xCell, 
"BackColor"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, 
"tdf46938_clearTabStop.docx")
 {
 // Number of tabstops should be zero, overriding the one in the style
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index e9b02ed948ef..eba875d4cbe3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1070,6 +1070,13 @@ DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt")
 {
 if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
 assertXPathContent(pXmlDoc, "(//w:t)[4]", "c");
+
+// tdf116436: The problem was that the table background was undefined, not 
white.
+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");
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0xff), getProperty(xCell, 
"BackColor"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testOO67471, "ooo67471-2.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3696f11070ef..00412096bbde 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3749,6 +3749,18 @@ void DocxAttributeOutput::TableDefinition( 
ww8::WW8TableNodeInfoInner::Pointer_t
 FSNS( XML_w, XML_val ), pJcVal,
 FSEND );
 
+// Output the table background color (although cell value still needs to 
be specified)
+const SvxBrushItem *pColorProp = 
pTableFormat->GetAttrSet().GetItem(RES_BACKGROUND);
+Color aColor = pColorProp ? pColorProp->GetColor() : COL_AUTO;
+if ( aColor != COL_AUTO )
+{
+OString sColor = msfilter::util::ConvertColor( aColor );
+m_pSerializer->singleElementNS( XML_w, XML_shd,
+FSNS( XML_w, XML_fill ), sColor.getStr( ),
+FSNS( XML_w, XML_val ), "clear",
+FSEND );
+}
+
 // Output the table borders
 TableDefaultBorders( pTableTextNodeInfoInner );
 
@@ -3811,12 +3823,25 @@ void DocxAttributeOutput::TableDefaultCellMargins( 
ww8::WW8TableNodeInfoInner::P
 
 void DocxAttributeOutput::TableBackgrounds( 
ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
+const SwTable *pTable = pTableTextNodeInfoInner->getTable();
 const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
+const SwTableLine *pTableRow = pTableBox->GetUpper();
 const SwFrameFormat *pFormat = pTableBox->GetFrameFormat( );
 
 const SvxBrushItem *pColorProp = 
pFormat->GetAttrSet().GetItem(RES_BACKGROUND);
 Color aColor = pColorProp ? pColorProp->GetColor() : COL_AUTO;
-  

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

2018-08-14 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf118058.fodt |   37 
 sw/qa/extras/layout/layout.cxx  |9 +++
 sw/source/core/layout/sectfrm.cxx   |   16 -
 3 files changed, 61 insertions(+), 1 deletion(-)

New commits:
commit d2d996db4806e84ae0bf6aef1c285b498f2d2867
Author: Miklos Vajna 
AuthorDate: Mon Aug 13 21:03:08 2018 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 14 08:15:05 2018 +0200

tdf#118058 sw, sections in tables: no split for multiple columns

The original use-case was "group a few paragraphs together" for the
split sections inside tables, i.e. it's safe to not split when the
section has multiple columns.

And the multiple columns case would mean that we don't find where to put
the follow section inside a table, resulting in a layout loop.

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

diff --git a/sw/qa/extras/layout/data/tdf118058.fodt 
b/sw/qa/extras/layout/data/tdf118058.fodt
new file mode 100644
index ..dbdf26bf519f
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf118058.fodt
@@ -0,0 +1,37 @@
+
+
+  
+
+  
+
+  
+  
+
+  
+
+
+  
+
+
+  
+
+  
+
+
+  
+
+
+  
+
+  
+  
+
+  
+
+  
+  
+
+  Para 
1.No. However, you will not be able to 
see the colours produced on a black-and-white 
set.
+
+  
+
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2ad2814436f8..364e78503b53 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -34,6 +34,7 @@ public:
 void testUserFieldTypeLanguage();
 void testTdf109137();
 void testForcepoint72();
+void testTdf118058();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -50,6 +51,7 @@ public:
 CPPUNIT_TEST(testUserFieldTypeLanguage);
 CPPUNIT_TEST(testTdf109137);
 CPPUNIT_TEST(testForcepoint72);
+CPPUNIT_TEST(testTdf118058);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -299,6 +301,13 @@ void SwLayoutWriter::testTdf109137()
 //just care it doesn't crash
 void SwLayoutWriter::testForcepoint72() { createDoc("forcepoint72-1.rtf"); }
 
+void SwLayoutWriter::testTdf118058()
+{
+SwDoc* pDoc = createDoc("tdf118058.fodt");
+// This resulted in a layout loop.
+pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/layout/sectfrm.cxx 
b/sw/source/core/layout/sectfrm.cxx
index f604b95cbcf4..2c3acaf41527 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -621,7 +621,21 @@ namespace
 return true;
 
 // The frame is in a table, see if the table is in a section.
-return !pFrame->FindTabFrame()->IsInSct();
+bool bRet = !pFrame->FindTabFrame()->IsInSct();
+
+if (bRet)
+{
+// Don't try to split if the frame itself is a section frame with
+// multiple columns.
+if (pFrame->IsSctFrame())
+{
+const SwFrame* pLower = pFrame->GetLower();
+if (pLower && pLower->IsColumnFrame())
+bRet = false;
+}
+}
+
+return bRet;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-12 Thread Libreoffice Gerrit user
 sw/qa/extras/ww8export/ww8export.cxx |3 ++-
 sw/source/filter/ww8/wrtww8.cxx  |4 ++--
 sw/source/filter/ww8/wrtww8.hxx  |2 +-
 sw/source/filter/ww8/ww8atr.cxx  |2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 091aedc63de2f6c8f0f4c60dd1fa93fe4c6ddde4
Author: Justin Luth 
AuthorDate: Sat Aug 4 13:55:47 2018 +0300
Commit: Justin Luth 
CommitDate: Mon Aug 13 06:07:35 2018 +0200

tdf#117994 ww8export: extend Chp over CR

Plan to revert this within a month - just a test and see.

MS Word has a placeholder that can receive chacter formatting
for the carriage return, but LO doesn't really. So normally
when LO exports, the CR is "unformated", which really
can affect things like paragraph size, or numbering.
So, extend the current character formatting to cover
the CR, so that what we see in Writer is what we get in Word.

This will cause regressions as Writer round-trips documents
that it incorrectly reads. (In other words, even though they
don't look right in Writer, they still used toround-tripped
OK, but now they will be saved with LO's distortions.)
Since normally if we *save* in writer, that implies that
changes have been made, and theoretically the document
looks the way the user wants to re-preserve it, it
is better to now have the document look as Writer
sees it than to preserve some prior formatting.

This really breaks unit test tdf102334.doc, but that
round-tripped document is already *really* broken in Word.
With this patch, it looks like the original again.
(tdf102334.doc looks bad in LO no matter what, it just looks
worse in this case.)

Change-Id: I04d3fdc7dbc66f8732456d7ac5b309c454992d8b
Reviewed-on: https://gerrit.libreoffice.org/58594
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index a53525a5ece7..25af135a35f7 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -675,7 +675,8 @@ DECLARE_WW8EXPORT_TEST(testTdf59896, "tdf59896.doc")
 DECLARE_WW8EXPORT_TEST(testTdf102334, "tdf102334.doc")
 {
 // This was false, i.e. the first run wasn't hidden, when it should have 
been
-CPPUNIT_ASSERT_EQUAL(true, getProperty(getRun(getParagraph(7), 1), 
"CharHidden"));
+// But this looks different (less hidden) in MSWord
+// CPPUNIT_ASSERT_EQUAL(true, getProperty(getRun(getParagraph(7), 
1), "CharHidden"));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf38778, 
"tdf38778_properties_in_run_for_field.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 10f53ab15b05..6274a3acfca9 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -995,7 +995,7 @@ sal_uInt8 *WW8_WrPlcPn::CopyLastSprms(sal_uInt8 )
 return rF.CopyLastSprms(rLen);
 }
 
-void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* 
pSprms)
+void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* 
pSprms, const bool bExpandEmpty)
 {
 WW8_WrFkp* pF = m_Fkps.back().get();
 
@@ -1024,7 +1024,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short 
nVarLen,const sal_uInt8* pS
 pF->MergeToNew( nVarLen, pNewSprms );
 // has the prev EndFC an empty sprm and the current is empty too, then
 // expand only the old EndFc to the new EndFc
-else if( !nVarLen && pF->IsEmptySprm() )
+else if( !nVarLen && (bExpandEmpty || pF->IsEmptySprm()) )
 {
 pF->SetNewEnd( nEndFc );
 return ;
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index dde8717443c6..d7854815bae9 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1287,7 +1287,7 @@ private:
 public:
 WW8_WrPlcPn( WW8Export& rWrt, ePLCFT ePl, WW8_FC nStartFc );
 ~WW8_WrPlcPn();
-void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* 
pSprms = nullptr);
+void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* 
pSprms = nullptr, const bool bExpandEmpty=false);
 void WriteFkps();
 void WritePlc();
 sal_uInt8 *CopyLastSprms(sal_uInt8 );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3f82fa3963dc..774684ee91b6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1070,7 +1070,7 @@ void WW8AttributeOutput::OutputFKP(bool bForce)
 if (!m_rWW8Export.pO->empty() || bForce)
 {
 m_rWW8Export.m_pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
-m_rWW8Export.pO->size(), m_rWW8Export.pO->data() );
+m_rWW8Export.pO->size(), m_rWW8Export.pO->data(), 
m_rWW8Export.pO->empty() );
 m_rWW8Export.pO->clear();
 }
 }
___
Libreoffice-commits mailing list

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

2018-08-10 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx|5 +
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|5 +
 sw/source/filter/ww8/docxattributeoutput.cxx |   20 +---
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit ae74abcd85dc529aeab9e710f18b3089fdf2906f
Author: Justin Luth 
AuthorDate: Thu Aug 9 19:44:26 2018 +0300
Commit: Miklos Vajna 
CommitDate: Fri Aug 10 12:18:39 2018 +0200

tdf#116549 docx export: write "nil" to uninherit a border

If styles would provide a border, then non-borders need
to be explicitly written out.

Unit tests prove this out for both styles and pragraphs.

Change-Id: I4195d38622adc09831f6dad64840a92a42c494b5
Reviewed-on: https://gerrit.libreoffice.org/58803
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index ddba448248d4..04f393309ee0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -660,6 +660,11 @@ DECLARE_OOXMLEXPORT_TEST(testTableCurruption, 
"tableCurrupt.docx")
 return;
 CPPUNIT_ASSERT(pXmlDoc) ;
 assertXPath(pXmlDoc, "/w:hdr/w:tbl[1]/w:tr[1]/w:tc[1]",1);
+
+// tdf#116549: header paragraph should not have a bottom border.
+uno::Reference xHeaderText = getProperty< 
uno::Reference >(getStyles("PageStyles")->getByName("First Page"), 
"HeaderText");
+table::BorderLine2 aHeaderBottomBorder = getProperty( 
getParagraphOfText( 1, xHeaderText ), "BottomBorder");
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aHeaderBottomBorder.LineWidth);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testDateControl, "date-control.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index fca3263616b9..57955e46e7f1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -767,6 +767,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103976, "tdf103976.docx")
 uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
 // This was 0, table style inheritance went wrong and w:afterLines had 
priority over w:after.
 CPPUNIT_ASSERT_EQUAL(static_cast(convertTwipToMm100(60)), 
getProperty(getParagraphOfText(1, xCell->getText()), 
"ParaBottomMargin"));
+
+// tdf#116549: heading 2 style should not have a bottom border.
+uno::Reference 
xStyle(getStyles("ParagraphStyles")->getByName("Heading 2"), uno::UNO_QUERY);
+table::BorderLine2 aBottomBorder = getProperty(xStyle, 
"BottomBorder");
+CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aBottomBorder.LineWidth);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf106001, "tdf106001.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9ea5388cbc4b..f97ffe2645a6 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2971,7 +2971,7 @@ static void impl_borderLine( FSHelperPtr const & 
pSerializer, sal_Int32 elementT
 break;
 }
 }
-else if( rStyleProps == nullptr )
+else if ( !rStyleProps || !rStyleProps->LineWidth )
 // no line, and no line set by the style either:
 // there is no need to write the property
 return;
@@ -8528,8 +8528,22 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& 
rBox )
 // Open the paragraph's borders tag
 m_pSerializer->startElementNS( XML_w, XML_pBdr, FSEND );
 
-std::map aEmptyMap; // empty 
styles map
-impl_borders( m_pSerializer, rBox, aOutputBorderOptions, aEmptyMap );
+std::map aStyleBorders;
+const SvxBoxItem* pInherited = nullptr;
+if ( GetExport().m_pStyAttr )
+pInherited = GetExport().m_pStyAttr->GetItem(RES_BOX);
+else if ( GetExport().m_pCurrentStyle && 
GetExport().m_pCurrentStyle->DerivedFrom() )
+pInherited = 
GetExport().m_pCurrentStyle->DerivedFrom()->GetAttrSet().GetItem(RES_BOX);
+
+if ( pInherited )
+{
+aStyleBorders[ SvxBoxItemLine::TOP ] = 
SvxBoxItem::SvxLineToLine(pInherited->GetTop(), /*bConvert=*/false);
+aStyleBorders[ SvxBoxItemLine::BOTTOM ] = 
SvxBoxItem::SvxLineToLine(pInherited->GetBottom(), false);
+aStyleBorders[ SvxBoxItemLine::LEFT ] = 
SvxBoxItem::SvxLineToLine(pInherited->GetLeft(), false);
+aStyleBorders[ SvxBoxItemLine::RIGHT ] = 
SvxBoxItem::SvxLineToLine(pInherited->GetRight(), false);
+}
+
+impl_borders( m_pSerializer, rBox, aOutputBorderOptions, aStyleBorders 
);
 
 // Close the paragraph's borders tag
 m_pSerializer->endElementNS( XML_w, XML_pBdr );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-09 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/forcepoint72-1.rtf |binary
 sw/qa/extras/layout/layout.cxx  |5 
 sw/source/core/text/frmform.cxx |   29 +---
 3 files changed, 31 insertions(+), 3 deletions(-)

New commits:
commit 718dd013b1a005665edc5db93c08163d38743513
Author: Michael Stahl 
AuthorDate: Tue Aug 7 21:20:02 2018 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 9 18:37:01 2018 +0200

forcepoint#72 negative string index

The problem is that the pMaster->GetFormatted() screws up the offset of
the follow frame; there isn't any hope of fixing this up when it happens
so deep inside Format_()... so instead try a conservative check on the
outside (can't check the position there as Format_ moves around quite a
bit) and format the master there already, and then SetOfst() to fix
things.

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

diff --git a/sw/qa/extras/layout/data/forcepoint72-1.rtf 
b/sw/qa/extras/layout/data/forcepoint72-1.rtf
new file mode 100644
index ..ad11b45a4551
Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint72-1.rtf differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 9bf7affcfd87..2ad2814436f8 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -33,6 +33,7 @@ public:
 void testTdf109077();
 void testUserFieldTypeLanguage();
 void testTdf109137();
+void testForcepoint72();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -48,6 +49,7 @@ public:
 CPPUNIT_TEST(testTdf109077);
 CPPUNIT_TEST(testUserFieldTypeLanguage);
 CPPUNIT_TEST(testTdf109137);
+CPPUNIT_TEST(testForcepoint72);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -294,6 +296,9 @@ void SwLayoutWriter::testTdf109137()
 /*nNumberOfNodes=*/1);
 }
 
+//just care it doesn't crash
+void SwLayoutWriter::testForcepoint72() { createDoc("forcepoint72-1.rtf"); }
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index c0d2ca2b413c..2c9424bd6529 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1460,11 +1460,9 @@ void SwTextFrame::Format_( SwTextFormatter , 
SwTextFormatInfo ,
 const SwLineLayout* pLine=nullptr;
 if (pMaster)
 {
-if( !pMaster->HasPara() )
-pMaster->GetFormatted();
 if (!pMaster->HasPara())
 {   // master could be locked because it's being formatted upstack
-SAL_WARN("sw", "SwTextFrame::Format_: failed to format 
master!");
+SAL_WARN("sw", "SwTextFrame::Format_: master not formatted!");
 }
 else
 {
@@ -1472,6 +1470,7 @@ void SwTextFrame::Format_( SwTextFormatter , 
SwTextFormatInfo ,
 SwTextIter aMasterLine( pMaster,  );
 aMasterLine.Bottom();
 pLine = aMasterLine.GetCurr();
+assert(aMasterLine.GetEnd() == GetOfst());
 }
 }
 SwLinePortion* pRest = pLine ?
@@ -1837,6 +1836,30 @@ void SwTextFrame::Format( vcl::RenderContext* 
pRenderContext, const SwBorderAttr
 
 // We do not want to be interrupted during formatting
 TextFrameLockGuard aLock(this);
+
+// this is to ensure that the similar code in SwTextFrame::Format_
+// finds the master formatted in case it's needed
+if (IsFollow() && IsFieldFollow())
+{
+SwTextFrame *pMaster = FindMaster();
+assert(pMaster);
+if (!pMaster->HasPara())
+{
+pMaster->GetFormatted();
+}
+if (!pMaster->HasPara())
+{   // master could be locked because it's being formatted upstack
+SAL_WARN("sw", "SwTextFrame::Format: failed to format 
master!");
+}
+else
+{
+SwTextSizeInfo aInf( pMaster );
+SwTextIter aMasterLine( pMaster,  );
+aMasterLine.Bottom();
+SetOfst(aMasterLine.GetEnd());
+}
+}
+
 SwTextLineAccess aAccess( this );
 const bool bNew = !aAccess.IsAvailable();
 const bool bSetOfst =
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-08 Thread Libreoffice Gerrit user
 sw/qa/extras/unowriter/unowriter.cxx |   33 +
 sw/source/core/unocore/unoframe.cxx  |7 +++
 sw/source/core/unocore/unomap1.cxx   |2 +-
 3 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit 587803ba46055d43b5b108be744fdde17aeabc7c
Author: Miklos Vajna 
AuthorDate: Wed Aug 8 17:58:20 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 8 19:18:19 2018 +0200

sw TextGraphicObject: handle XBitmap for GraphicURL

This restores compatibility for API users who called getByName() on the
bitmap table and expected that the result can be set as a value for the
GraphicURL property.

Changing the property type to cppu::UnoType::get() is
necessary, otherwise scripting languages figure out (via reflection)
that the type doesn't match, and SwXFrame::setPropertyValue() is not
called.

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

diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index cde8b9b9c47d..96945d25a40f 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -22,10 +22,12 @@ class SwUnoWriter : public SwModelTestBase
 public:
 void testDefaultCharStyle();
 void testGraphicDesciptorURL();
+void testGraphicDesciptorURLBitmap();
 
 CPPUNIT_TEST_SUITE(SwUnoWriter);
 CPPUNIT_TEST(testDefaultCharStyle);
 CPPUNIT_TEST(testGraphicDesciptorURL);
+CPPUNIT_TEST(testGraphicDesciptorURLBitmap);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -82,6 +84,37 @@ void SwUnoWriter::testGraphicDesciptorURL()
 CPPUNIT_ASSERT(xGraphic.is());
 }
 
+void SwUnoWriter::testGraphicDesciptorURLBitmap()
+{
+loadURL("private:factory/swriter", nullptr);
+
+// Load a bitmap into the bitmap table.
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xBitmaps(
+xFactory->createInstance("com.sun.star.drawing.BitmapTable"), 
uno::UNO_QUERY);
+OUString aGraphicURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"test.jpg";
+xBitmaps->insertByName("test", uno::makeAny(aGraphicURL));
+
+// Create a graphic.
+uno::Reference xTextGraphic(
+xFactory->createInstance("com.sun.star.text.TextGraphicObject"), 
uno::UNO_QUERY);
+xTextGraphic->setPropertyValue("GraphicURL", xBitmaps->getByName("test"));
+xTextGraphic->setPropertyValue("AnchorType",
+   
uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
+
+// Insert it.
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xBodyText(xTextDocument->getText(), 
uno::UNO_QUERY);
+uno::Reference xCursor(xBodyText->createTextCursor());
+uno::Reference xTextContent(xTextGraphic, 
uno::UNO_QUERY);
+xBodyText->insertTextContent(xCursor, xTextContent, false);
+
+// This failed: setting GraphicURL to the result of getByName() did not
+// work anymore.
+auto xGraphic = 
getProperty>(getShape(1), "Graphic");
+CPPUNIT_ASSERT(xGraphic.is());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUnoWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index c16f1b301b20..15f4b88b01f8 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2754,8 +2754,15 @@ void SwXFrame::attachToRange(const uno::Reference< 
text::XTextRange > & xTextRan
 if (m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0, pGraphicURL))
 {
 OUString sGraphicURL;
+uno::Reference xBitmap;
 if (((*pGraphicURL) >>= sGraphicURL) && !sGraphicURL.isEmpty())
 aGraphic = vcl::graphic::loadFromURL(sGraphicURL);
+else if ((*pGraphicURL) >>= xBitmap)
+{
+uno::Reference xGraphic(xBitmap, 
uno::UNO_QUERY);
+if (xGraphic.is())
+aGraphic = xGraphic;
+}
 }
 
 const ::uno::Any* pGraphicAny;
diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index 6716483ea1a8..de331a18cbf8 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -850,7 +850,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetGraphicPropertyMap(
 { OUString(UNO_NAME_REPLACEMENT_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, 
cppu::UnoType::get(), 0, 0 },
 { OUString(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER,  
cppu::UnoType::get(), 0, 0 },
 { OUString(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, 
cppu::UnoType::get(), 0, 0 },
-{ OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_URL, 
cppu::UnoType::get(), 0, 0 },
+{ OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_URL, 
cppu::UnoType::get(), 0, 0 },
 { 

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

2018-08-07 Thread Libreoffice Gerrit user
 sw/qa/core/data/html/pass/ofz9733-1.html |1 +
 sw/source/filter/html/htmlsect.cxx   |2 +-
 sw/source/filter/html/htmltab.cxx|   18 +++---
 sw/source/filter/html/swhtml.hxx |2 +-
 4 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 74132131e74813834d2a09ff68e614415fe44747
Author: Caolán McNamara 
AuthorDate: Tue Aug 7 09:54:41 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 7 13:31:37 2018 +0200

ofz#9733 drop bookmarks in deleted range

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

diff --git a/sw/qa/core/data/html/pass/ofz9733-1.html 
b/sw/qa/core/data/html/pass/ofz9733-1.html
new file mode 100644
index ..3da9bdb80839
--- /dev/null
+++ b/sw/qa/core/data/html/pass/ofz9733-1.html
@@ -0,0 +1 @@
+�
\ No newline at end of file
diff --git a/sw/source/filter/html/htmlsect.cxx 
b/sw/source/filter/html/htmlsect.cxx
index 818f90652f36..606b754d630e 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -200,7 +200,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
 
 if (!PendingObjectsInPaM(aDelPam))
 {
-ClearFootnotesInRange(aDelPam.GetMark()->nNode, 
aDelPam.GetPoint()->nNode);
+ClearFootnotesMarksInRange(aDelPam.GetMark()->nNode, 
aDelPam.GetPoint()->nNode);
 m_xDoc->getIDocumentContentOperations().DelFullPara(aDelPam);
 }
 
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 5048ad6db408..69df8477af5a 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4898,7 +4899,7 @@ namespace
 };
 }
 
-void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const 
SwNodeIndex& rPtNdIdx)
+void SwHTMLParser::ClearFootnotesMarksInRange(const SwNodeIndex& rMkNdIdx, 
const SwNodeIndex& rPtNdIdx)
 {
 //similarly for footnotes
 if (m_pFootEndNoteImpl)
@@ -4912,9 +4913,14 @@ void SwHTMLParser::ClearFootnotesInRange(const 
SwNodeIndex& rMkNdIdx, const SwNo
 }
 
 //follow DelFlyInRange pattern here
-const bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
+assert(rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex());
 
 SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
+
+//ofz#9733 drop bookmarks in this range
+IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+pMarkAccess->deleteMarks(rMkNdIdx, SwNodeIndex(rPtNdIdx, 1), nullptr, 
nullptr, nullptr);
+
 SwFrameFormats& rTable = *pDoc->GetSpzFrameFormats();
 for ( auto i = rTable.size(); i; )
 {
@@ -4924,9 +4930,7 @@ void SwHTMLParser::ClearFootnotesInRange(const 
SwNodeIndex& rMkNdIdx, const SwNo
 if (pAPos &&
 ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
  (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)) &&
-( bDelFwrd
-? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
-: rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx ))
+( rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx ))
 {
 if( rPtNdIdx != pAPos->nNode )
 {
@@ -4935,7 +4939,7 @@ void SwHTMLParser::ClearFootnotesInRange(const 
SwNodeIndex& rMkNdIdx, const SwNo
 // But only fly formats own their content, not draw formats.
 if (rContent.GetContentIdx() && pFormat->Which() == 
RES_FLYFRMFMT)
 {
-ClearFootnotesInRange(*rContent.GetContentIdx(),
+ClearFootnotesMarksInRange(*rContent.GetContentIdx(),
   
SwNodeIndex(*rContent.GetContentIdx()->GetNode().EndOfSectionNode()));
 }
 }
@@ -4952,7 +4956,7 @@ void SwHTMLParser::DeleteSection(SwStartNode* pSttNd)
 
 //similarly for footnotes
 SwNodeIndex aSttIdx(*pSttNd), aEndIdx(*pSttNd->EndOfSectionNode());
-ClearFootnotesInRange(aSttIdx, aEndIdx);
+ClearFootnotesMarksInRange(aSttIdx, aEndIdx);
 
 m_xDoc->getIDocumentContentOperations().DeleteSection(pSttNd);
 
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index c8d5d32c3ccc..b3560065c326 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -633,7 +633,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
 // tags realized via character styles
 void NewCharFormat( HtmlTokenId nToken );
 
-void ClearFootnotesInRange(const SwNodeIndex& rSttIdx, const SwNodeIndex& 
rEndIdx);
+void ClearFootnotesMarksInRange(const SwNodeIndex& rSttIdx, const 
SwNodeIndex& rEndIdx);
 
 void DeleteSection(SwStartNode* pSttNd);
 

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

2018-08-07 Thread Libreoffice Gerrit user
 sw/qa/extras/unowriter/data/test.jpg |binary
 sw/qa/extras/unowriter/unowriter.cxx |   35 +++
 sw/source/core/unocore/unoframe.cxx  |   10 ++
 3 files changed, 45 insertions(+)

New commits:
commit bba0ccd743a3d023e4829155571cdf0318fcb81c
Author: Miklos Vajna 
AuthorDate: Tue Aug 7 11:06:30 2018 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 7 12:45:46 2018 +0200

sw TextGraphicObject: fix GraphicURL handling in the descriptor

Commit dfee7d93b4e863d673c45921f79bb876b5738ea6 (sw: get rid of
FN_UNO_GRAPHIC_U_R_L and "GraphicURL" property, 2018-03-08) removed
support for string-based graphic references, then a later commit
restored the setter. But one scenario (when setting the graphic URL
before inserting the text graphic object) was still unsupported for real
URL setter; restore that as well.

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

diff --git a/sw/qa/extras/unowriter/data/test.jpg 
b/sw/qa/extras/unowriter/data/test.jpg
new file mode 100644
index ..12b393569efb
Binary files /dev/null and b/sw/qa/extras/unowriter/data/test.jpg differ
diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index 59a045586423..cde8b9b9c47d 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -9,15 +9,23 @@
 
 #include 
 #include 
+#include 
+
+namespace
+{
+char const DATA_DIRECTORY[] = "/sw/qa/extras/unowriter/data/";
+}
 
 /// Test to assert UNO API call results of Writer.
 class SwUnoWriter : public SwModelTestBase
 {
 public:
 void testDefaultCharStyle();
+void testGraphicDesciptorURL();
 
 CPPUNIT_TEST_SUITE(SwUnoWriter);
 CPPUNIT_TEST(testDefaultCharStyle);
+CPPUNIT_TEST(testGraphicDesciptorURL);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -47,6 +55,33 @@ void SwUnoWriter::testDefaultCharStyle()
  getProperty(xCursorProps, 
"CharPosture"));
 }
 
+void SwUnoWriter::testGraphicDesciptorURL()
+{
+loadURL("private:factory/swriter", nullptr);
+
+// Create a graphic object, but don't insert it yet.
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTextGraphic(
+xFactory->createInstance("com.sun.star.text.TextGraphicObject"), 
uno::UNO_QUERY);
+
+// Set an URL on it.
+OUString aGraphicURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"test.jpg";
+xTextGraphic->setPropertyValue("GraphicURL", uno::makeAny(aGraphicURL));
+xTextGraphic->setPropertyValue("AnchorType",
+   
uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
+
+// Insert it.
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xBodyText(xTextDocument->getText(), 
uno::UNO_QUERY);
+uno::Reference xCursor(xBodyText->createTextCursor());
+uno::Reference xTextContent(xTextGraphic, 
uno::UNO_QUERY);
+xBodyText->insertTextContent(xCursor, xTextContent, false);
+
+// This failed, the graphic object had no graphic.
+auto xGraphic = 
getProperty>(getShape(1), "Graphic");
+CPPUNIT_ASSERT(xGraphic.is());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUnoWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index bf25aeb4d4f7..c16f1b301b20 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2748,6 +2748,16 @@ void SwXFrame::attachToRange(const uno::Reference< 
text::XTextRange > & xTextRan
 {
 UnoActionContext aActionContext(pDoc);
 Graphic aGraphic;
+
+// Read graphic URL from the descriptor, if it has any.
+const ::uno::Any* pGraphicURL;
+if (m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0, pGraphicURL))
+{
+OUString sGraphicURL;
+if (((*pGraphicURL) >>= sGraphicURL) && !sGraphicURL.isEmpty())
+aGraphic = vcl::graphic::loadFromURL(sGraphicURL);
+}
+
 const ::uno::Any* pGraphicAny;
 const bool bHasGraphic = m_pProps->GetProperty(FN_UNO_GRAPHIC, 0, 
pGraphicAny);
 if (bHasGraphic)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-07 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf109137.docx |binary
 sw/qa/extras/layout/layout.cxx  |   20 
 sw/source/core/doc/textboxhelper.cxx|2 ++
 3 files changed, 22 insertions(+)

New commits:
commit 59f5f666a5085ae58a8dd164636a6bea47e6bddc
Author: Miklos Vajna 
AuthorDate: Mon Aug 6 21:42:32 2018 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 7 09:14:03 2018 +0200

tdf#109137 sw textbox: fix initial wrap type of a shape's textbox

This was already working for the DOCX import by luck. Make the wrap type
explicit, so the ODF import has it correctly.

The wrap type for the hidden sw text frame ("textbox of a shape") should
be always "through", wrapping is only performed for the surrounding draw
shape.

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

diff --git a/sw/qa/extras/layout/data/tdf109137.docx 
b/sw/qa/extras/layout/data/tdf109137.docx
new file mode 100644
index ..03e2423bc155
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf109137.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2325fd84e5a2..9bf7affcfd87 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -8,6 +8,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,6 +32,7 @@ public:
 void testTdf117923();
 void testTdf109077();
 void testUserFieldTypeLanguage();
+void testTdf109137();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -45,6 +47,7 @@ public:
 CPPUNIT_TEST(testTdf117923);
 CPPUNIT_TEST(testTdf109077);
 CPPUNIT_TEST(testUserFieldTypeLanguage);
+CPPUNIT_TEST(testTdf109137);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -274,6 +277,23 @@ void SwLayoutWriter::testUserFieldTypeLanguage()
 assertXPath(pXmlDoc, "/root/page/body/txt/Special[@nType='POR_FLD']", 
"rText", "1,234.56");
 }
 
+void SwLayoutWriter::testTdf109137()
+{
+createDoc("tdf109137.docx");
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+uno::Sequence 
aDescriptor(comphelper::InitPropertySequence({
+{ "FilterName", uno::Any(OUString("writer8")) },
+}));
+xStorable->storeToURL(aTempFile.GetURL(), aDescriptor);
+loadURL(aTempFile.GetURL(), "tdf109137.odt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// This was 0, the blue rectangle moved from the 1st to the 2nd page.
+assertXPath(pXmlDoc, "/root/page[1]/body/txt/anchored/fly/notxt",
+/*nNumberOfNodes=*/1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index c84131f5f3a1..acd112c17c2b 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -86,6 +86,8 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape)
 
 xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, 
uno::makeAny(text::SizeType::FIX));
 
+xPropertySet->setPropertyValue(UNO_NAME_SURROUND, 
uno::makeAny(text::WrapTextMode_THROUGH));
+
 uno::Reference xNamed(xTextFrame, uno::UNO_QUERY);
 xNamed->setName(pShape->GetDoc()->GetUniqueFrameName());
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-08-03 Thread Libreoffice Gerrit user
 sw/qa/core/uwriter.cxx  |1 +
 sw/source/core/access/acccell.cxx   |1 +
 sw/source/core/access/acccontext.cxx|1 +
 sw/source/core/access/accmap.cxx|1 +
 sw/source/core/access/accpara.cxx   |1 +
 sw/source/core/access/acctable.cxx  |1 +
 sw/source/core/access/acctextframe.cxx  |1 +
 sw/source/core/attr/calbck.cxx  |1 +
 sw/source/core/attr/format.cxx  |1 +
 sw/source/core/bastyp/swcache.cxx   |1 +
 sw/source/core/crsr/bookmrk.cxx |1 +
 sw/source/core/crsr/crsrsh.cxx  |1 +
 sw/source/core/doc/CntntIdxStore.cxx|1 +
 sw/source/core/doc/DocumentContentOperationsManager.cxx |1 +
 sw/source/core/doc/DocumentDeviceManager.cxx|1 +
 sw/source/core/doc/DocumentDrawModelManager.cxx |1 +
 sw/source/core/doc/DocumentRedlineManager.cxx   |1 +
 sw/source/core/doc/DocumentStylePoolManager.cxx |1 +
 sw/source/core/doc/docbasic.cxx |1 +
 sw/source/core/doc/docbm.cxx|1 +
 sw/source/core/doc/docdesc.cxx  |1 +
 sw/source/core/doc/docdraw.cxx  |1 +
 sw/source/core/doc/docfmt.cxx   |1 +
 sw/source/core/doc/docnew.cxx   |1 +
 sw/source/core/doc/docredln.cxx |1 +
 sw/source/core/doc/htmltbl.cxx  |1 +
 sw/source/core/doc/tblafmt.cxx  |1 +
 sw/source/core/doc/textboxhelper.cxx|1 +
 sw/source/core/docnode/ndsect.cxx   |1 +
 sw/source/core/docnode/ndtbl.cxx|1 +
 sw/source/core/draw/dcontact.cxx|1 +
 sw/source/core/edit/edundo.cxx  |1 +
 sw/source/core/layout/atrfrm.cxx|1 +
 sw/source/core/layout/dbg_lay.cxx   |1 +
 sw/source/core/layout/findfrm.cxx   |1 +
 sw/source/core/layout/flowfrm.cxx   |1 +
 sw/source/core/layout/flycnt.cxx|1 +
 sw/source/core/layout/frmtool.cxx   |1 +
 sw/source/core/layout/ftnfrm.cxx|1 +
 sw/source/core/layout/hffrm.cxx |1 +
 sw/source/core/layout/layact.cxx|1 +
 sw/source/core/layout/laycache.cxx  |1 +
 sw/source/core/layout/pagechg.cxx   |1 +
 sw/source/core/layout/pagedesc.cxx  |1 +
 sw/source/core/layout/paintfrm.cxx  |1 +
 sw/source/core/layout/sectfrm.cxx   |1 +
 sw/source/core/layout/tabfrm.cxx|1 +
 sw/source/core/swg/SwXMLTextBlocks.cxx  |1 +
 sw/source/core/table/swnewtable.cxx |1 +
 sw/source/core/text/frmform.cxx |1 +
 sw/source/core/text/inftxt.cxx  |1 +
 sw/source/core/text/porfly.cxx  |1 +
 sw/source/core/text/porlay.cxx  |1 +
 sw/source/core/tox/ToxLinkProcessor.cxx |1 +
 sw/source/core/tox/tox.cxx  |1 +
 sw/source/core/txtnode/atrfld.cxx   |1 +
 sw/source/core/txtnode/ndhints.cxx  |1 +
 sw/source/core/txtnode/ndtxt.cxx|1 +
 sw/source/core/txtnode/thints.cxx   |1 +
 sw/source/core/txtnode/txtedt.cxx   |1 +
 sw/source/core/undo/undobj.cxx  |1 +
 sw/source/core/unocore/unocoll.cxx  |1 +
 sw/source/core/unocore/unocrsrhelper.cxx|1 +
 sw/source/core/unocore/unodraw.cxx  |1 +
 sw/source/core/unocore/unoflatpara.cxx  |1 +
 sw/source/core/unocore/unoframe.cxx |1 +
 sw/source/core/unocore/unoportenum.cxx  |1 +
 sw/source/core/unocore/unoredline.cxx   |1 +
 sw/source/core/unocore/unorefmk.cxx |1 +
 sw/source/core/unocore/unosett.cxx  |1 +
 sw/source/core/unocore/unostyle.cxx |1 +
 sw/source/core/unocore/unotbl.cxx   |1 +
 sw/source/core/unocore/unotext.cxx  |1 +
 sw/source/core/view/vdraw.cxx   |1 +
 sw/source/core/view/viewimp.cxx |1 +
 sw/source/core/view/viewsh.cxx  

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

2018-07-26 Thread Libreoffice Gerrit user
 sw/qa/extras/layout/data/tdf109077.docx |binary
 sw/qa/extras/layout/layout.cxx  |   14 ++
 sw/source/core/text/porfly.cxx  |8 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 11d87b35474b642e99e7aa397aa18992c1bc20c9
Author: Miklos Vajna 
AuthorDate: Thu Jul 26 09:04:41 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jul 26 11:47:13 2018 +0200

tdf#109077 sw textbox: fix as-char shapes with custom print area in para

Regression from d379d18666aa42031359ca8eb34b0021960347ae (oox: import
WPS shape with text as shape with textbox, 2014-06-18), the position of
the textbox should be relative to the print area of the text frame, not
to the text frame itself.

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

diff --git a/sw/qa/extras/layout/data/tdf109077.docx 
b/sw/qa/extras/layout/data/tdf109077.docx
new file mode 100644
index ..c0a67d2765c0
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf109077.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index ea2e24f06b75..96dfcc0a2757 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -27,6 +27,7 @@ public:
 void testTdf117245();
 void testTdf118672();
 void testTdf117923();
+void testTdf109077();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -39,6 +40,7 @@ public:
 CPPUNIT_TEST(testTdf117245);
 CPPUNIT_TEST(testTdf118672);
 CPPUNIT_TEST(testTdf117923);
+CPPUNIT_TEST(testTdf109077);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -236,6 +238,18 @@ void SwLayoutWriter::testTdf117923()
 assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"nHeight", "220");
 }
 
+void SwLayoutWriter::testTdf109077()
+{
+createDoc("tdf109077.docx");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+sal_Int32 nShapeTop
+= getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", 
"top").toInt32();
+sal_Int32 nTextBoxTop = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", 
"top").toInt32();
+// This was 281: the top of the shape and its textbox should match, though
+// tolerate differences <= 1px (about 15 twips).
+CPPUNIT_ASSERT_LESS(static_cast(15), nTextBoxTop - nShapeTop);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 19084dfe8379..b74c28d8ec7a 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -351,16 +351,20 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, 
const Point ,
 {
 // It has, so look up its text rectangle, and adjust the position
 // of the textbox accordingly.
+// Both rectangles are absolute, SwFormatHori/VertOrient's position
+// is relative to the print area of the anchor text frame.
 tools::Rectangle aTextRectangle = 
SwTextBoxHelper::getTextRectangle(pShape);
 
 SwFormatHoriOrient aHori(pTextBox->GetHoriOrient());
 aHori.SetHoriOrient(css::text::HoriOrientation::NONE);
-sal_Int32 nLeft = aTextRectangle.getX() - 
rFrame.getFrameArea().Left();
+sal_Int32 nLeft = aTextRectangle.getX() - 
rFrame.getFrameArea().Left()
+  - rFrame.getFramePrintArea().Left();
 aHori.SetPos(nLeft);
 
 SwFormatVertOrient aVert(pTextBox->GetVertOrient());
 aVert.SetVertOrient(css::text::VertOrientation::NONE);
-sal_Int32 const nTop = aTextRectangle.getY() - 
rFrame.getFrameArea().Top();
+sal_Int32 const nTop = aTextRectangle.getY() - 
rFrame.getFrameArea().Top()
+   - rFrame.getFramePrintArea().Top();
 aVert.SetPos(nTop);
 
 pTextBox->LockModify();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-20 Thread Libreoffice Gerrit user
 sw/qa/core/data/ww8/pass/forcepoint50-grfanchor-1.doc |binary
 sw/source/filter/ww8/ww8par6.cxx  |6 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit e97a2073b5c8a209f224c70b04e9a1cddab30add
Author: Caolán McNamara 
AuthorDate: Fri Jul 20 12:28:54 2018 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 20 15:05:15 2018 +0200

forcepoint#51 anchor location deleted before graphic anchor processed

try deferring to after anchor stack is cleared

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

diff --git a/sw/qa/core/data/ww8/pass/forcepoint50-grfanchor-1.doc 
b/sw/qa/core/data/ww8/pass/forcepoint50-grfanchor-1.doc
new file mode 100644
index ..91ee6b58f210
Binary files /dev/null and 
b/sw/qa/core/data/ww8/pass/forcepoint50-grfanchor-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index fbc3ecf271bb..7abf127ec0fd 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2526,6 +2526,7 @@ void SwWW8ImplReader::StopApo()
 Color aBg(0xFE, 0xFF, 0xFF, 0xFF);  //Transparent by default
 
 SwTextNode* pNd = aPref.GetNode().GetTextNode();
+SwTextNode* pJoinNext = nullptr;
 if (pNd && m_xSFlyPara->pFlyFormat)
 {
 /*
@@ -2555,13 +2556,16 @@ void SwWW8ImplReader::StopApo()
 }
 
 //Get rid of extra empty paragraph
-pNd->JoinNext();
+pJoinNext = pNd;
 }
 
 if (m_xSFlyPara->pFlyFormat)
 m_xSFlyPara->pFlyFormat->SetFormatAttr(SvxBrushItem(aBg, 
RES_BACKGROUND));
 
 DeleteAnchorStack();
+if (pJoinNext)
+pJoinNext->JoinNext();
+
 m_xAnchorStck = std::move(m_xSFlyPara->xOldAnchorStck);
 
 // When inserting a graphic into the fly frame using the auto
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-18 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlexport/htmlexport.cxx  |   20 
 sw/qa/extras/inc/swmodeltestbase.hxx|2 ++
 sw/source/filter/html/htmlflywriter.cxx |1 +
 3 files changed, 23 insertions(+)

New commits:
commit 1a884ea69b2c8b98719fa3cd298b42a6d584cd41
Author: Miklos Vajna 
AuthorDate: Wed Jul 18 14:00:29 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 18 18:21:29 2018 +0200

sw HTML export: force PNG output harder in reqif mode

Need to disable one more flag to avoid GIF for transparent images.

Also start asserting reqif-xhtml output with an XML parser.

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

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 9c5724f7212e..696ca6041dad 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -600,6 +600,26 @@ DECLARE_HTMLEXPORT_TEST(testTransparentImage, 
"transparent-image.odt")
 CPPUNIT_ASSERT_MESSAGE(aMessage.toUtf8().getStr(), 
aSource.endsWith(".gif"));
 }
 
+DECLARE_HTMLEXPORT_TEST(testTransparentImageReqIf, "transparent-image.odt")
+{
+SvMemoryStream aStream;
+aStream.WriteCharPtr("http://www.w3.org/1999/xhtml\;>\n");
+SvFileStream aFileStream(maTempFile.GetURL(), StreamMode::READ);
+aStream.WriteStream(aFileStream);
+aStream.WriteCharPtr("\n");
+aStream.Seek(0);
+xmlDocPtr pDoc = parseXmlStream();
+CPPUNIT_ASSERT(pDoc);
+
+OUString aSource = getXPath(
+pDoc,
+
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:object",
+"data");
+OUString aMessage = "src attribute is: " + aSource;
+// This was GIF, when the intention was to force PNG.
+CPPUNIT_ASSERT_MESSAGE(aMessage.toUtf8().getStr(), 
aSource.endsWith(".png"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index 3bcc7116b091..d3d64c8ea434 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -997,6 +997,8 @@ protected:
 xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("field"), 
BAD_CAST("urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"));
 xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("formx"), 
BAD_CAST("urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"));
 xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("css3t"), 
BAD_CAST("http://www.w3.org/TR/css3-text/;));
+// reqif-xhtml
+xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("reqif-xhtml"), 
BAD_CAST("http://www.w3.org/1999/xhtml;));
 }
 };
 
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 6db21469f368..79b111405704 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1837,6 +1837,7 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, 
const SwFrameFormat& rF
 // output.
 aFilterName = "PNG";
 nFlags &= ~XOutFlags::UseNativeIfPossible;
+nFlags &= ~XOutFlags::UseGifIfSensible;
 aMimeType = "image/png";
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-18 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlexport/data/transparent-image.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx |   11 +++
 sw/source/filter/html/htmlflywriter.cxx|8 +++-
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 6af1637d0cf85566ca8482cc284669c4968ae977
Author: Miklos Vajna 
AuthorDate: Wed Jul 18 11:35:20 2018 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 18 13:55:46 2018 +0200

sw HTML export: fix writing transparent images

It is possible ImpGraphic::ImplSetPrepared() should handle this
directly, though.

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

diff --git a/sw/qa/extras/htmlexport/data/transparent-image.odt 
b/sw/qa/extras/htmlexport/data/transparent-image.odt
new file mode 100644
index ..0c5fb8de0790
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/transparent-image.odt 
differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 0cc519ab288d..9c5724f7212e 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -589,6 +589,17 @@ DECLARE_HTMLEXPORT_TEST(testList, "list.html")
 CPPUNIT_ASSERT(aStream.indexOf("") != -1);
 }
 
+DECLARE_HTMLEXPORT_TEST(testTransparentImage, "transparent-image.odt")
+{
+htmlDocPtr pDoc = parseHtml(maTempFile);
+CPPUNIT_ASSERT(pDoc);
+
+OUString aSource = getXPath(pDoc, "/html/body/p/img", "src");
+OUString aMessage = "src attribute is: " + aSource;
+// This was a jpeg, transparency was lost.
+CPPUNIT_ASSERT_MESSAGE(aMessage.toUtf8().getStr(), 
aSource.endsWith(".gif"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 42a45951ed81..6db21469f368 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1840,7 +1840,13 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, 
const SwFrameFormat& rF
 aMimeType = "image/png";
 }
 
-ErrCode nErr = XOutBitmap::WriteGraphic( pGrfNd->GetGrf(), 
aGraphicURL,
+const Graphic& rGraphic = pGrfNd->GetGrf();
+
+// So that Graphic::IsTransparent() can report true.
+if (!rGraphic.isAvailable())
+const_cast(rGraphic).makeAvailable();
+
+ErrCode nErr = XOutBitmap::WriteGraphic( rGraphic, aGraphicURL,
 aFilterName, nFlags,  );
 if( nErr )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-17 Thread Libreoffice Gerrit user
 sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx |8 +++-
 sw/source/filter/ww8/docxattributeoutput.cxx   |6 +-
 writerfilter/source/dmapper/DomainMapper.cxx   |2 +-
 4 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 2bc84658cce1df5050fe788dd0c8a0906a1ca2c3
Author: Justin Luth 
AuthorDate: Wed Jul 11 17:21:51 2018 +0300
Commit: Justin Luth 
CommitDate: Wed Jul 18 07:37:41 2018 +0200

related tdf#63561 docx: styles inherit tabstops too

Add import and export support for style-parent
tabstop inheritance.

This patch is dependent on GetPropertyFromStyleSheet
commit 39171b82b245a7589b9258337a18d6dd281f8ed2

Change-Id: I0245d0e08f140b6cb473c96cffa6f5a4ceff8944
Reviewed-on: https://gerrit.libreoffice.org/57278
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs2.docx
new file mode 100644
index ..cf674f3c460f
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 70e46790c5a0..31a8a70989d8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -58,7 +58,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, 
"tdf46938_clearTabStop.docx"
 
 DECLARE_OOXMLEXPORT_TEST(testTdf63561_clearTabs, "tdf63561_clearTabs.docx")
 {
-// MSO2013 gives 5,7, and 4 respectively
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5), getProperty< 
uno::Sequence >(getParagraph(1), "ParaTabStops").getLength());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(7), getProperty< 
uno::Sequence >(getParagraph(3), "ParaTabStops").getLength());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), getProperty< 
uno::Sequence >(getParagraph(4), "ParaTabStops").getLength());
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf63561_clearTabs2, "tdf63561_clearTabs2.docx")
+{
 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< 
uno::Sequence >(getParagraph(1), "ParaTabStops").getLength());
 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< 
uno::Sequence >(getParagraph(3), "ParaTabStops").getLength());
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4), getProperty< 
uno::Sequence >(getParagraph(4), "ParaTabStops").getLength());
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2de8e1b68d04..0c5ae1043f72 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7707,7 +7707,11 @@ static void impl_WriteTabElement( FSHelperPtr const & 
pSerializer,
 
 void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop )
 {
-const SvxTabStopItem* pInheritedTabs = GetExport().m_pStyAttr ? 
GetExport().m_pStyAttr->GetItem(RES_PARATR_TABSTOP) : nullptr;
+const SvxTabStopItem* pInheritedTabs = nullptr;
+if ( GetExport().m_pStyAttr )
+pInheritedTabs = 
GetExport().m_pStyAttr->GetItem(RES_PARATR_TABSTOP);
+else if ( GetExport().m_pCurrentStyle && 
GetExport().m_pCurrentStyle->DerivedFrom() )
+pInheritedTabs = 
GetExport().m_pCurrentStyle->DerivedFrom()->GetAttrSet().GetItem(RES_PARATR_TABSTOP);
 const sal_uInt16 nInheritedTabCount = pInheritedTabs ? 
pInheritedTabs->Count() : 0;
 const sal_uInt16 nCount = rTabStop.Count();
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 443be5a54930..124a2061904d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1840,7 +1840,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
 // fdo#81033: for RTF, a tab stop is inherited from the style if it
 // is also applied to the paragraph directly, and cleared if it is
 // not applied to the paragraph directly => don't InitTabStopFromStyle
-if (!IsStyleSheetImport() && !IsRTFImport())
+if ( !IsRTFImport() )
 {
 uno::Any aValue = 
m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_TAB_STOPS);
 uno::Sequence< style::TabStop > aStyleTabStops;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-16 Thread Libreoffice Gerrit user
 sw/qa/core/data/ww8/pass/forcepoint50-rows-1.doc |binary
 sw/source/core/layout/tabfrm.cxx |   20 +++-
 2 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit 3da20d39e2cbda4d4c01ad206668924ab8c3f2b6
Author: Caolán McNamara 
AuthorDate: Mon Jul 16 08:48:11 2018 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 16 13:06:05 2018 +0200

forcepoint#50 refetch FirstNonHeadlineRow

Invalid read of size 8
   at 0x43D42DE6: SwFrame::GetUpper() const (frame.hxx:664)
   by 0x44427435: SwRowFrame::ShouldRowKeepWithNext() const 
(tabfrm.cxx:4618)
   by 0x4441FA5C: SwTabFrame::MakeAll(OutputDevice*) (tabfrm.cxx:2403)
   by 0x4433492F: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:343)
   by 0x44431B6F: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1799)
   by 0x44334430: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:246)
   by 0x44431B6F: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1799)
   by 0x44334430: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:246)
   by 0x44431B6F: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1799)
   by 0x44334A67: SwFrame::OptPrepareMake() (calcmove.cxx:354)
   by 0x443982CE: SwFrame::OptCalc() const (frame.hxx:1051)
   by 0x44395F18: SwLayAction::FormatContent_(SwContentFrame const*, 
SwPageFrame const*) (layact.cxx:1794)
 Address 0x352771b0 is 144 bytes inside a block of size 280 free'd
   at 0x4C2EDAC: free (vg_replace_malloc.c:530)
   by 0x4E5B9D7: rtl_freeMemory_SYSTEM(void*) (alloc_global.cxx:237)
   by 0x4E5BC93: rtl_freeMemory (alloc_global.cxx:303)
   by 0x4E5A7A2: rtl_cache_free (alloc_cache.cxx:1081)
   by 0xF28B5B9: FixedMemPool::Free(void*) (mempool.cxx:49)
   by 0x442FF36D: SwRowFrame::operator delete(void*, unsigned long) 
(rowfrm.hxx:123)
   by 0x444243E8: SwRowFrame::~SwRowFrame() (tabfrm.cxx:3702)
   by 0x4441630C: SwFrame::DestroyFrame(SwFrame*) (ssfrm.cxx:384)
   by 0x4441AC31: SwTabFrame::RemoveFollowFlowLine() (tabfrm.cxx:900)
   by 0x4441D7EB: SwTabFrame::MakeAll(OutputDevice*) (tabfrm.cxx:1836)
   by 0x4433492F: SwFrame::PrepareMake(OutputDevice*) (calcmove.cxx:343)
   by 0x44431B6F: SwFrame::Calc(OutputDevice*) const (trvlfrm.cxx:1799)

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

diff --git a/sw/qa/core/data/ww8/pass/forcepoint50-rows-1.doc 
b/sw/qa/core/data/ww8/pass/forcepoint50-rows-1.doc
new file mode 100644
index ..e91f9dd3242c
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/forcepoint50-rows-1.doc 
differ
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 8fad05cf2508..a5538ea3f707 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -164,7 +164,7 @@ void SwTabFrame::RegistFlys()
 }
 
 void SwInvalidateAll( SwFrame *pFrame, long nBottom );
-static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
+static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom );
 static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva );
 // #i26945# - add parameter <_bOnlyRowsAndCells> to control
 // that only row and cell frames are formatted.
@@ -1562,8 +1562,7 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame,
 return bRet;
 }
 
-// returns false if pRow is invalid
-static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
+static void lcl_RecalcRow( SwRowFrame* pRow, long nBottom )
 {
 // FME 2007-08-30 #i81146# new loop control
 int nLoopControlRuns_1 = 0;
@@ -1621,7 +1620,7 @@ static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom 
)
 if (!bRowStillExists)
 {
 SAL_WARN("sw.layout", "no row anymore at " << pRow);
-return false;
+return;
 }
 
 // NEW TABLES
@@ -1665,8 +1664,7 @@ static bool lcl_RecalcRow( SwRowFrame* pRow, long nBottom 
)
 }
 }
 break;
-} while (true);
-return true;
+} while( true );
 }
 
 static void lcl_RecalcTable( SwTabFrame& rTab,
@@ -2353,7 +2351,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 
 // 1. Try: bTryToSplit = true  => Try to split the row.
 // 2. Try: bTryToSplit = false => Split the table between the rows.
-if ((pFirstNonHeadlineRow && pFirstNonHeadlineRow->GetNext()) || 
bTryToSplit )
+if ( pFirstNonHeadlineRow->GetNext() || bTryToSplit )
 {
 SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
 if( IsInSct() || GetUpper()->IsInTab() ) // TABLE IN TABLE)
@@ -2362,11 +2360,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 
 {
 SetInRecalcLowerRow( true );
-   

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

2018-07-13 Thread Libreoffice Gerrit user
 sw/qa/extras/htmlexport/data/reqif.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx |   14 ++
 sw/source/filter/html/htmlatr.cxx  |   70 -
 3 files changed, 67 insertions(+), 17 deletions(-)

New commits:
commit 2b9e55aa4ce070eb5301adb67af85d062eb1dc36
Author: Miklos Vajna 
AuthorDate: Fri Jul 13 15:26:34 2018 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 13 16:35:55 2018 +0200

sw HTML export: fix XHTML mode of 'Heading 7' style

Font name, font size.

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

diff --git a/sw/qa/extras/htmlexport/data/reqif.odt 
b/sw/qa/extras/htmlexport/data/reqif.odt
new file mode 100644
index ..a094202e9775
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/reqif.odt differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 499d8c3dc0c8..0cc519ab288d 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -508,6 +508,20 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable2, 
"reqif-table2.odt")
 CPPUNIT_ASSERT(aStream.indexOf("") != -1);
 }
 
+DECLARE_HTMLEXPORT_TEST(testReqIfWellFormed, "reqif.odt")
+{
+SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+CPPUNIT_ASSERT(pStream);
+pStream->Seek(STREAM_SEEK_TO_END);
+sal_uInt64 nLength = pStream->Tell();
+pStream->Seek(0);
+OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+// This failed,  was written.
+CPPUNIT_ASSERT(aStream.indexOf(" was written.
+CPPUNIT_ASSERT(aStream.indexOf("(rHt), 
aNames, 0,
rHTMLWrt.IsHTMLMode(HTMLMODE_FONT_GENERIC) );
-OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font " "
-OOO_STRING_SVTOOLS_HTML_O_face "=\"";
-rWrt.Strm().WriteOString( sOut );
-HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, rHTMLWrt.m_eDestEnc, 
_aNonConvertableCharacters )
-   .WriteCharPtr( "\">" );
+if (rHTMLWrt.mbXHTML)
+{
+OString sOut = "<" + rHTMLWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_span
+   " " OOO_STRING_SVTOOLS_HTML_O_style 
"=\"font-family: ";
+rWrt.Strm().WriteOString(sOut);
+HTMLOutFuncs::Out_String(rWrt.Strm(), aNames, rHTMLWrt.m_eDestEnc,
+ _aNonConvertableCharacters)
+.WriteCharPtr("\">");
+}
+else
+{
+OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font " "
+OOO_STRING_SVTOOLS_HTML_O_face "=\"";
+rWrt.Strm().WriteOString( sOut );
+HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, 
rHTMLWrt.m_eDestEnc, _aNonConvertableCharacters )
+   .WriteCharPtr( "\">" );
+}
 }
 else
-HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_font, false );
+{
+if (rHTMLWrt.mbXHTML)
+HTMLOutFuncs::Out_AsciiTag(
+rWrt.Strm(), rHTMLWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_span, false);
+else
+HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_font, false );
+}
 
 return rWrt;
 }
@@ -2709,24 +2727,42 @@ static Writer& OutHTML_SvxFontHeight( Writer& rWrt, 
const SfxPoolItem& rHt )
 
 if( rHTMLWrt.m_bTagOn )
 {
-OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font;
-
-sal_uInt32 nHeight = static_cast(rHt).GetHeight();
-sal_uInt16 nSize = rHTMLWrt.GetHTMLFontSize( nHeight );
-sOut += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" +
-OString::number(static_cast(nSize)) + "\"";
-rWrt.Strm().WriteOString( sOut );
+if (rHTMLWrt.mbXHTML)
+{
+OString sOut = "<" + rHTMLWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_span;
 
-if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )
+sal_uInt32 nHeight = static_cast(rHt).GetHeight();
+// Twips -> points.
+sal_uInt16 nSize = nHeight / 20;
+sOut += " " OOO_STRING_SVTOOLS_HTML_O_style "=\"font-size: "
++ OString::number(static_cast(nSize)) + "pt\"";
+rWrt.Strm().WriteOString(sOut);
+}
+else
 {
-// always export font size as CSS option, too
-OutCSS1_HintStyleOpt( rWrt, rHt );
+OString sOut = "<" OOO_STRING_SVTOOLS_HTML_font;
+
+sal_uInt32 nHeight = static_cast(rHt).GetHeight();
+sal_uInt16 nSize = rHTMLWrt.GetHTMLFontSize( nHeight );
+sOut += " " OOO_STRING_SVTOOLS_HTML_O_size "=\"" +
+OString::number(static_cast(nSize)) + "\"";
+rWrt.Strm().WriteOString( sOut );
+
+if( rHTMLWrt.m_bCfgOutStyles && rHTMLWrt.m_bTextAttr )

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

2018-07-13 Thread Xisco Fauli
 sw/qa/extras/ooxmlexport/data/tdf118702.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx   |9 +
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx   |4 
 sw/source/filter/ww8/ww8atr.cxx |1 -
 4 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit b0e2dbca5164c494a669bd48f8ff058f4c1ad710
Author: Xisco Fauli 
Date:   Thu Jul 12 14:12:05 2018 +0200

tdf#118702: partially revert the fix for tdf#78907

This is a regression from 2df0d9d32d05f08ccf673fd0f61f650438511acb

Reverting it as the unitest from tdf#78907 still passes.
Besides, adding a new unittest for tdf#118702

Finally, adapt ooxmlexport9 and remove pointless assert which fails
with:

ooxmlexport9.cxx:557:Assertion
Test name: testBnc519228OddBreaks::Import_Export_Import
equality assertion failed
- Expected: 
- Actual  : 

Failures !!!
Run: 155   Failure total: 1   Failures: 1   Errors: 0


Change-Id: I486e9489ef6c3978cbcf90f3b9885248f4f92110
Reviewed-on: https://gerrit.libreoffice.org/57338
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf118702.odt 
b/sw/qa/extras/ooxmlexport/data/tdf118702.odt
new file mode 100644
index ..d55099242d04
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118702.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index c7a808a24e41..e9b02ed948ef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -569,6 +569,15 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78907,"fdo78907.docx")
 assertXPath ( pXmlDoc1, 
"/w:ftr[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl", 0 );
 }
 
+DECLARE_OOXMLEXPORT_TEST(tdf118702,"tdf118702.odt")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:sectPr/w:type", 
"val", "nextPage" );
+assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:sectPr/w:pgSz", 
"orient", "landscape" );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo79822, "fdo79822.docx")
 {
 /* File getting crash while saving in LO.
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 5df206d75a90..f1a260b87057 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -551,10 +551,6 @@ DECLARE_OOXMLEXPORT_TEST(testBnc519228OddBreaks, 
"bnc519228_odd-breaksB.docx")
 
 // Page2 comes from follow of style for page 1 and should be a normal 
page. Also check the two page style have the same properties,
 // since page style for page1 was created from page style for page 2.
-uno::Any page2StyleAny = uno::Reference(
-getParagraph(2, "This is page 2, which is obviously an even page."),
-uno::UNO_QUERY_THROW)->getPropertyValue("PageDescName");
-CPPUNIT_ASSERT_EQUAL(uno::Any(), page2StyleAny);
 OUString page2StyleName = getProperty( page1Style, "FollowStyle" 
);
 uno::Reference 
page2Style(getStyles("PageStyles")->getByName(page2StyleName), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), 
page2Style->getPropertyValue("PageStyleLayout"));
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 2a847e21c09e..f404d9ab2498 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -493,7 +493,6 @@ void MSWordExportBase::OutputSectionBreaks( const 
SfxItemSet *pSet, const SwNode
 }
 }
 }
-bNewPageDesc = false; // if next node has RES_BREAK(page break) 
then bNewPageDesc value should be false.
 bBreakSet = true;
 
 if ( !bRemoveHardBreakInsideTable )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-11 Thread Mark Hung
 sw/qa/extras/ww8export/data/tdf118564.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx  |6 ++
 sw/source/filter/ww8/ww8par3.cxx  |4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 4dfc014cb3838b61faef32991c8083787ee6d60c
Author: Mark Hung 
Date:   Sat Jul 7 23:37:59 2018 +0800

tdf#118564 sw/ww8filter - map NFC 11 to SVX_NUM_NUMBER_LOWER_ZH.

The attribute name of the numbering format code  11 is "japaneseCounting"
[1]. Although it seemd like a Japanese counting guessing from its name,
it's actually use the same characters used by Chinese lower numbers [2].

Ref:
[1]https://msdn.microsoft.com/en-us/library/dd923798(v=office.12).aspx
[2]https://msdn.microsoft.com/en-us/library/dd772856(v=office.12).aspx

Change-Id: I241be1e5e118197207cbc51334272b532e23c25f
Reviewed-on: https://gerrit.libreoffice.org/57138
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/sw/qa/extras/ww8export/data/tdf118564.doc 
b/sw/qa/extras/ww8export/data/tdf118564.doc
new file mode 100755
index ..4040e05e27bf
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118564.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx 
b/sw/qa/extras/ww8export/ww8export.cxx
index 5e46c38ea337..a53525a5ece7 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -1129,6 +1129,12 @@ DECLARE_WW8EXPORT_TEST(testWw8Cjklist35, "cjklist35.doc")
 CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf118564, "tdf118564.doc")
+{
+sal_Int16   numFormat = getNumberingTypeOfParagraph(3);
+CPPUNIT_ASSERT_EQUAL(style::NumberingType::NUMBER_LOWER_ZH, numFormat);
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf92281, "tdf92281.doc")
 {
 uno::Reference xRun(getRun(getParagraph(1),1), 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 5c0bee451514..b7149da0ae4c 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -761,11 +761,11 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, 
std::unique_ptrhttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-11 Thread Miklos Vajna
 sw/qa/extras/layout/data/tdf118672.odt |binary
 sw/qa/extras/layout/layout.cxx |   27 +++
 sw/source/core/text/inftxt.cxx |6 --
 sw/source/core/text/xmldump.cxx|   19 ---
 4 files changed, 47 insertions(+), 5 deletions(-)

New commits:
commit 4b345f95ce7cb09011892bf465cfdf3811adaf8e
Author: Miklos Vajna 
Date:   Wed Jul 11 14:29:36 2018 +0200

tdf#118672 sw layout, TabOverMargin: allow using the area over the tab 
portion

TabOverMargin in general is about allowing the cursor to jump over a
margin if there is an explicit tab stop there.

A corner-case is what to do when there is enough content so a line break
is necessary for the characters after the tab portion. Allow using the
area up to the edge of the whole text frame (i.e. over the tab
position), this matches what Word does.

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

diff --git a/sw/qa/extras/layout/data/tdf118672.odt 
b/sw/qa/extras/layout/data/tdf118672.odt
new file mode 100644
index ..5f480f670ada
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf118672.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 1ff1c23c6df4..ea2e24f06b75 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 
 static char const DATA_DIRECTORY[] = "/sw/qa/extras/layout/data/";
 
@@ -24,6 +25,7 @@ public:
 void testTableExtrusion2();
 void testTdf116848();
 void testTdf117245();
+void testTdf118672();
 void testTdf117923();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
@@ -35,6 +37,7 @@ public:
 CPPUNIT_TEST(testTableExtrusion2);
 CPPUNIT_TEST(testTdf116848);
 CPPUNIT_TEST(testTdf117245);
+CPPUNIT_TEST(testTdf118672);
 CPPUNIT_TEST(testTdf117923);
 CPPUNIT_TEST_SUITE_END();
 
@@ -196,6 +199,30 @@ void SwLayoutWriter::testTdf117245()
 assertXPath(pXmlDoc, "/root/page/body/txt[2]/LineBreak", 1);
 }
 
+void SwLayoutWriter::testTdf118672()
+{
+createDoc("tdf118672.odt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+
+// Check if we have hyphenation support, otherwise can't test 
SwHyphPortion.
+uno::Reference xLinguServiceManager
+= 
linguistic2::LinguServiceManager::create(comphelper::getProcessComponentContext());
+uno::Sequence aLocales
+= 
xLinguServiceManager->getAvailableLocales("com.sun.star.linguistic2.Hyphenator");
+auto it = std::find_if(aLocales.begin(), aLocales.end(), [](const 
lang::Locale& rLocale) {
+return rLocale.Language == "en" && rLocale.Country == "US";
+});
+if (it == aLocales.end())
+return;
+
+OUString aLine1("He heard quiet steps behind him. That didn't bode well. 
Who could be fol*1 2 "
+"3 4 5 6 7 8 9 10con-");
+// This ended as "fol*1 2 3 4 5 6 7 8 9", i.e. "10con-" was moved to the 
next line.
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[1]", "Line", 
aLine1);
+OUString aLine2("setetur");
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[2]", "Line", 
aLine2);
+}
+
 void SwLayoutWriter::testTdf117923()
 {
 createDoc("tdf117923.doc");
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 5c7faa1b8511..eeff3e39eb14 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1702,11 +1702,13 @@ SwTwips SwTextFormatInfo::GetLineWidth()
 if (!pLastTab)
 return nLineWidth;
 
+// Consider tab portions over the printing bounds of the text frame.
 if (pLastTab->GetTabPos() <= Width())
 return nLineWidth;
 
-// Consider tab portions over the printing bounds of the text frame.
-nLineWidth = pLastTab->GetTabPos() - X();
+// If there is one such tab portion, then text is allowed to use the full
+// text frame area (even over the actual tab portion).
+nLineWidth = GetTextFrame()->getFrameArea().Width() - X();
 
 return nLineWidth;
 }
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index d29d7abdbd7a..7ad0a25fdf98 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -32,6 +32,8 @@ class XmlPortionDumper:public SwPortionHandler
   private:
 xmlTextWriterPtr writer;
 TextFrameIndex ofs;
+const OUString& m_rText;
+OUString m_aLine;
 
 static const char* getTypeName( sal_uInt16 nType )
 {
@@ -105,7 +107,7 @@ class XmlPortionDumper:public SwPortionHandler
 
   public:
 
-explicit XmlPortionDumper( xmlTextWriterPtr some_writer ):writer( 
some_writer ), ofs( 0 )
+explicit XmlPortionDumper( xmlTextWriterPtr some_writer, const OUString& 
rText ):writer( some_writer ), ofs( 0 ), m_rText(rText)
 {
 }
 
@@ -120,7 +122,6 @@ class 

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

2018-07-11 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx|8 +++
 sw/source/filter/ww8/docxattributeoutput.cxx  |   42 --
 3 files changed, 28 insertions(+), 22 deletions(-)

New commits:
commit 859a0389b5639397e9c46cd4828a35793bd194f8
Author: Justin Luth 
Date:   Wed Jul 11 08:18:22 2018 +0300

tdf#63561 docx export: "clear" unused inherited tabs

If a style contains tab definitions, then the paragraph inherits
these. They are added to any tabs defined at the paragraph
level. Unwanted inherited tabs must be explicitly removed.

(TODO: LO ought to be inheriting from ALL parents, so the same
logic ought to apply to a style's parent tabs, but currently
LO does not import that way. So the proof unit test looks
different in MSO compared to LO.)

Change-Id: Ida8ed2792482655d512c753fdff8d02062d895a8
Reviewed-on: https://gerrit.libreoffice.org/57255
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs.docx 
b/sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs.docx
new file mode 100644
index ..228b9b5478ba
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf63561_clearTabs.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 1b979bb79cb0..70e46790c5a0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -56,6 +56,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf46938_clearTabStop, 
"tdf46938_clearTabStop.docx"
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< 
uno::Sequence >(getParagraph(1), "ParaTabStops").getLength());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf63561_clearTabs, "tdf63561_clearTabs.docx")
+{
+// MSO2013 gives 5,7, and 4 respectively
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< 
uno::Sequence >(getParagraph(1), "ParaTabStops").getLength());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< 
uno::Sequence >(getParagraph(3), "ParaTabStops").getLength());
+CPPUNIT_ASSERT_EQUAL(sal_Int32(4), getProperty< 
uno::Sequence >(getParagraph(4), "ParaTabStops").getLength());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf82065_Ind_start_strict, 
"tdf82065_Ind_start_strict.docx")
 {
 uno::Reference 
xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1709cd036739..2de8e1b68d04 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7707,31 +7707,13 @@ static void impl_WriteTabElement( FSHelperPtr const & 
pSerializer,
 
 void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop )
 {
-sal_uInt16 nCount = rTabStop.Count();
+const SvxTabStopItem* pInheritedTabs = GetExport().m_pStyAttr ? 
GetExport().m_pStyAttr->GetItem(RES_PARATR_TABSTOP) : nullptr;
+const sal_uInt16 nInheritedTabCount = pInheritedTabs ? 
pInheritedTabs->Count() : 0;
+const sal_uInt16 nCount = rTabStop.Count();
 
 //  must contain at least one , so don't write it empty
-if( nCount == 0 )
-{
-// clear style tabs - otherwise style will override...
-if( GetExport().m_pStyAttr )
-{
-const SvxTabStopItem* pStyleTabs = 
GetExport().m_pStyAttr->GetItem(RES_PARATR_TABSTOP);
-if( pStyleTabs && pStyleTabs->Count() )
-{
-m_pSerializer->startElementNS( XML_w, XML_tabs, FSEND );
-for( int i = 0; i < pStyleTabs->Count(); ++i )
-{
-m_pSerializer->singleElementNS( XML_w, XML_tab,
-FSNS( XML_w, XML_val ), OString("clear"),
-FSNS( XML_w, XML_pos ), 
OString::number(pStyleTabs->At(i).GetTabPos()),
-FSEND );
-}
-m_pSerializer->endElementNS( XML_w, XML_tabs );
-}
-}
-
+if ( !nCount && !nInheritedTabCount )
 return;
-}
 if( nCount == 1 && rTabStop[ 0 ].GetAdjustment() == SvxTabAdjust::Default )
 {
 GetExport().setDefaultTabStop( rTabStop[ 0 ].GetTabPos());
@@ -7740,6 +7722,22 @@ void DocxAttributeOutput::ParaTabStop( const 
SvxTabStopItem& rTabStop )
 
 m_pSerializer->startElementNS( XML_w, XML_tabs, FSEND );
 
+// clear unused inherited tabs - otherwise the style will add them back in
+sal_Int32 nCurrTab = 0;
+for ( sal_uInt16 i = 0; i < nInheritedTabCount; ++i )
+{
+while ( nCurrTab < nCount && rTabStop[nCurrTab] < 
pInheritedTabs->At(i) )
+++nCurrTab;
+
+if ( nCurrTab == nCount || pInheritedTabs->At(i) < rTabStop[nCurrTab] )
+{
+m_pSerializer->singleElementNS( XML_w, XML_tab,
+FSNS( XML_w, XML_val ), OString("clear"),
+ 

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

2018-07-10 Thread Miklos Vajna
 sw/qa/extras/htmlexport/data/reqif-p.xhtml |1 +
 sw/qa/extras/htmlexport/htmlexport.cxx |4 
 sw/source/filter/html/wrthtml.cxx  |   18 +++---
 3 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 967eb080ac91e3b59fb244dc6d6106a264d0fbf1
Author: Miklos Vajna 
Date:   Tue Jul 10 13:54:54 2018 +0200

sw HTML export: fix bookmark output in XHTML mode

Missing XML namespace, wrong attribute name, missing escaping for the
bookmark name.

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

diff --git a/sw/qa/extras/htmlexport/data/reqif-p.xhtml 
b/sw/qa/extras/htmlexport/data/reqif-p.xhtml
index fa69342d00a6..304857d9a9f8 100644
--- a/sw/qa/extras/htmlexport/data/reqif-p.xhtml
+++ b/sw/qa/extras/htmlexport/data/reqif-p.xhtml
@@ -5,3 +5,4 @@
 s
 s
 s
+
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 229c553502cd..499d8c3dc0c8 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -372,6 +372,10 @@ DECLARE_HTMLEXPORT_TEST(testReqIfParagraph, 
"reqif-p.xhtml")
 
 // This was "" instead of CSS + namespace prefix was missing.
 CPPUNIT_ASSERT(aStream.indexOf("") != -1);
 }
 
 DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleData, "reqif-ole-data.xhtml")
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 02a1eec40068..c0347613752e 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1110,9 +1110,21 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 
 )
 void SwHTMLWriter::OutAnchor( const OUString& rName )
 {
 OStringBuffer sOut;
-sOut.append("<" OOO_STRING_SVTOOLS_HTML_anchor " " 
OOO_STRING_SVTOOLS_HTML_O_name "=\"");
-Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
-HTMLOutFuncs::Out_String( Strm(), rName, m_eDestEnc, 
_aNonConvertableCharacters ).WriteCharPtr( "\">" );
+sOut.append("<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor " ");
+if (!mbXHTML)
+{
+sOut.append(OOO_STRING_SVTOOLS_HTML_O_name "=\"");
+Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
+HTMLOutFuncs::Out_String( Strm(), rName, m_eDestEnc, 
_aNonConvertableCharacters ).WriteCharPtr( "\">" );
+}
+else
+{
+// XHTML wants 'id' instead of 'name', also the value can't contain
+// spaces.
+sOut.append(OOO_STRING_SVTOOLS_HTML_O_id "=\"");
+Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
+HTMLOutFuncs::Out_String( Strm(), rName.replace(' ', '_'), m_eDestEnc, 
_aNonConvertableCharacters ).WriteCharPtr( "\">" );
+}
 HTMLOutFuncs::Out_AsciiTag( Strm(), GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_anchor, false );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-05 Thread Miklos Vajna
 sw/qa/extras/htmlexport/data/reqif-ole-img.xhtml |2 +-
 sw/qa/extras/htmlexport/data/reqif-png-img.xhtml |2 +-
 sw/qa/extras/htmlexport/htmlexport.cxx   |3 +++
 sw/source/filter/html/htmlgrin.cxx   |3 ++-
 sw/source/filter/html/htmlplug.cxx   |   20 +++-
 sw/source/filter/html/swhtml.hxx |3 +++
 6 files changed, 29 insertions(+), 4 deletions(-)

New commits:
commit bcc9feb94c481ee885c763d8fadfc9209acb117c
Author: Miklos Vajna 
Date:   Thu Jul 5 09:17:18 2018 +0200

sw HTML import: strip query & fragment for  and file URLs

There are two cases: when the  is a child of an outer 
(we create an embedded object) and the non-embedded  case (we
create an image). Call the new SwHTMLParser::StripQueryFromPath() in
both cases.

INetURLObject considers this query/fragment part as "name" (end of
"path"), so just do it manually.

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

diff --git a/sw/qa/extras/htmlexport/data/reqif-ole-img.xhtml 
b/sw/qa/extras/htmlexport/data/reqif-ole-img.xhtml
index b552783068ae..6217412ae597 100644
--- a/sw/qa/extras/htmlexport/data/reqif-ole-img.xhtml
+++ b/sw/qa/extras/htmlexport/data/reqif-ole-img.xhtml
@@ -1,6 +1,6 @@
 
 
-OLE 
Object
+OLE Object
 
 
 
diff --git a/sw/qa/extras/htmlexport/data/reqif-png-img.xhtml 
b/sw/qa/extras/htmlexport/data/reqif-png-img.xhtml
index f31795e35224..637a7c2ac4b6 100644
--- a/sw/qa/extras/htmlexport/data/reqif-png-img.xhtml
+++ b/sw/qa/extras/htmlexport/data/reqif-png-img.xhtml
@@ -1,4 +1,4 @@
 
-OLE 
Object
+OLE Object
 
 
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 8cb60396691d..5d82b82c9524 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -391,6 +391,7 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOleImg, 
"reqif-ole-img.xhtml")
 // This failed, OLE object had no replacement image.
 // And then it also failed when the export lost the replacement image.
 uno::Reference xGraphic = 
xObject->getReplacementGraphic();
+// This failed when query and fragment of file:// URLs were not ignored.
 CPPUNIT_ASSERT(xGraphic.is());
 
 uno::Reference xShape(xObject, uno::UNO_QUERY);
@@ -456,6 +457,8 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfPngImg, 
"reqif-png-img.xhtml")
 
 // Make sure that both RTF and PNG versions are written.
 CPPUNIT_ASSERT(aStream.indexOf("text/rtf") != -1);
+// This failed when images with a query in their file:// URL failed to
+// import.
 CPPUNIT_ASSERT(aStream.indexOf("image/png") != -1);
 }
 
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index 0a9050f3475a..8b3ddaf0f601 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -349,7 +349,8 @@ void SwHTMLParser::InsertImage()
 case HtmlOptionId::DATA:
 aGraphicData = rOption.GetString();
 if (!InternalImgToPrivateURL(aGraphicData))
-aGraphicData = INetURLObject::GetAbsURL(m_sBaseURL, 
aGraphicData);
+aGraphicData = INetURLObject::GetAbsURL(
+m_sBaseURL, 
SwHTMLParser::StripQueryFromPath(m_sBaseURL, aGraphicData));
 break;
 case HtmlOptionId::ALIGN:
 eVertOri =
diff --git a/sw/source/filter/html/htmlplug.cxx 
b/sw/source/filter/html/htmlplug.cxx
index 30277b8bf3a9..22738a13b934 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -72,6 +72,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -299,6 +300,19 @@ void SwHTMLParser::SetSpace( const Size& rPixSpace,
 }
 }
 
+OUString SwHTMLParser::StripQueryFromPath(const OUString& rBase, const 
OUString& rPath)
+{
+if (!comphelper::isFileUrl(rBase))
+return rPath;
+
+sal_Int32 nIndex = rPath.indexOf('?');
+
+if (nIndex != -1)
+return rPath.copy(0, nIndex);
+
+return rPath;
+}
+
 bool SwHTMLParser::InsertEmbed()
 {
 OUString aURL, aType, aName, aAlt, aId, aStyle, aClass;
@@ -420,9 +434,13 @@ bool SwHTMLParser::InsertEmbed()
INetURLObject(m_sBaseURL), aURL,
URIHelper::GetMaybeFileHdl()) );
 bool bHasData = !aData.isEmpty();
+
 try
 {
-aURLObj.SetURL(rtl::Uri::convertRelToAbs(m_sBaseURL, aData));
+// Strip query and everything after that for file:// URLs, browsers do
+// the same.
+aURLObj.SetURL(rtl::Uri::convertRelToAbs(
+m_sBaseURL, SwHTMLParser::StripQueryFromPath(m_sBaseURL, aData)));
 }
 catch (const rtl::MalformedUriException& /*rException*/)
 {
diff --git 

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

2018-07-03 Thread Luke Deller
 sw/qa/extras/ww8export/data/tdf118412.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx |   10 ++
 sw/source/filter/ww8/ww8par6.cxx  |2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 9f331575ad8d371c95a18e33a245d404e873ca8a
Author: Luke Deller 
Date:   Fri Jun 29 00:40:14 2018 +1000

tdf#118412: DOC incorrect bottom page margin

Fix a silly typo when determining if the page has a bottom margin

Change-Id: I96857951725d00978c43d850d0e1bc64ab61d965
Reviewed-on: https://gerrit.libreoffice.org/56602
Tested-by: Jenkins
Reviewed-by: Luke Deller 

diff --git a/sw/qa/extras/ww8export/data/tdf118412.doc 
b/sw/qa/extras/ww8export/data/tdf118412.doc
new file mode 100644
index ..ef9b26cb3af8
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf118412.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index 83eaac7b9de5..c4d552393899 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -871,6 +871,16 @@ DECLARE_WW8EXPORT_TEST(testTdf118133, "tdf118133.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(15240), 
getShape(1)->getSize().Width);
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf118412, "tdf118412.doc")
+{
+/* Check that the first page's bottom margin is 1.251cm (not 2.540cm) */
+OUString sPageStyleName = getProperty(getParagraph(1), 
"PageStyleName");
+uno::Reference xPageStyle(
+getStyles("PageStyles")->getByName(sPageStyleName), uno::UNO_QUERY);
+sal_Int32 nBottomMargin = getProperty(xPageStyle, 
"BottomMargin");
+CPPUNIT_ASSERT_EQUAL(static_cast(1251), nBottomMargin);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 2f81599eb5b6..f53501c2485c 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -498,7 +498,7 @@ void wwSectionManager::GetPageULData(const wwSection 
,
 
 /* Check whether this section has headers / footers */
 sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD;
-sal_uInt16 nFooterMask = WW8_HEADER_EVEN | WW8_HEADER_ODD;
+sal_uInt16 nFooterMask = WW8_FOOTER_EVEN | WW8_FOOTER_ODD;
 /* Ignore the presence of a first-page header/footer unless it is enabled 
*/
 if( rSection.HasTitlePage() )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-02 Thread Mike Kaganski
 sw/qa/extras/layout/data/tdf117923.doc |binary
 sw/qa/extras/layout/layout.cxx |   15 +++
 sw/source/filter/ww8/ww8par.cxx|3 +++
 test/source/xmltesttools.cxx   |7 ++-
 4 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 942f1056b51e53358d42ff8da8a1bbdce9ba5303
Author: Mike Kaganski 
Date:   Mon Jul 2 20:31:32 2018 +1000

tdf#117923: handle direct formatting for numbering in .doc

Since commit df07d6cb9f62c0a2c4b29bd850d4efb4fcd4790b, we do for DOCX.
DOC also has this problem, so set the relevant compatibility flag on
import for this format, too.

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

diff --git a/sw/qa/extras/layout/data/tdf117923.doc 
b/sw/qa/extras/layout/data/tdf117923.doc
new file mode 100644
index ..c43cf40c9f52
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf117923.doc differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2356832cc4ba..1ff1c23c6df4 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -24,6 +24,7 @@ public:
 void testTableExtrusion2();
 void testTdf116848();
 void testTdf117245();
+void testTdf117923();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
@@ -34,6 +35,7 @@ public:
 CPPUNIT_TEST(testTableExtrusion2);
 CPPUNIT_TEST(testTdf116848);
 CPPUNIT_TEST(testTdf117245);
+CPPUNIT_TEST(testTdf117923);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -194,6 +196,19 @@ void SwLayoutWriter::testTdf117245()
 assertXPath(pXmlDoc, "/root/page/body/txt[2]/LineBreak", 1);
 }
 
+void SwLayoutWriter::testTdf117923()
+{
+createDoc("tdf117923.doc");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+
+// Check that we actually test the line we need
+assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", "GHI 
GHI GHI GHI");
+assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"nType", "POR_NUMBER");
+assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"rText", "2.");
+// The numbering height was 960.
+assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", 
"nHeight", "220");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index c2a7c02f7f5b..301c37a12409 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1795,6 +1795,9 @@ void SwWW8ImplReader::ImportDop()
 m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TAB_COMPAT, 
true);
 // #i24363# tab stops relative to indent
 
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TABS_RELATIVE_TO_INDENT,
 false);
+// tdf#117923
+m_rDoc.getIDocumentSettingAccess().set(
+DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, true);
 
 // Import Default Tabs
 long nDefTabSiz = m_xWDop->dxaTab;
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 45347b0c111b..c3e314e49ed4 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -88,7 +88,12 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, 
const OString& rXPath)
 xmlXPathNodeSetGetLength(pXmlNodes) > 0);
 
 xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
-OUString s(convert((pXmlNode->children[0]).content));
+xmlNodePtr pXmlChild = pXmlNode->children;
+OUString s;
+while (pXmlChild && pXmlChild->type != XML_TEXT_NODE)
+pXmlChild = pXmlChild->next;
+if (pXmlChild && pXmlChild->type == XML_TEXT_NODE)
+s = convert(pXmlChild->content);
 xmlXPathFreeObject(pXmlObj);
 return s;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-07-02 Thread Nickson Thanda
 sw/qa/extras/uiwriter/uiwriter.cxx |   15 +++
 sw/source/core/edit/autofmt.cxx|8 
 sw/source/uibase/docvw/edtwin.cxx  |3 +--
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 391134e4cc0cf444ac50c6df02073de57ad9c466
Author: Nickson Thanda 
Date:   Fri Jun 22 04:59:16 2018 +0100

tdf#51223 can now undo auto-capitalise with enter

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

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index e6ab7cdaf515..3dc0e7a233ea 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -345,6 +345,7 @@ public:
 void testTdf116789();
 void testTdf117225();
 void testTdf91801();
+void testTdf51223();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -541,6 +542,7 @@ public:
 CPPUNIT_TEST(testTdf116789);
 CPPUNIT_TEST(testTdf117225);
 CPPUNIT_TEST(testTdf91801);
+CPPUNIT_TEST(testTdf51223);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -6311,6 +6313,19 @@ void SwUiWriterTest::testTdf91801()
 CPPUNIT_ASSERT_EQUAL(555.0, xCell->getValue());
 }
 
+void SwUiWriterTest::testTdf51223()
+{
+SwDoc* pDoc = createDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
+sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+pWrtShell->Insert("i");
+pWrtShell->SplitNode(true);
+CPPUNIT_ASSERT_EQUAL(OUString("I"), 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+rUndoManager.Undo();
+CPPUNIT_ASSERT_EQUAL(OUString("i"), 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 19dff285050c..33a41866af1a 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2611,6 +2611,14 @@ void SwEditShell::AutoFormatBySplitNode()
 
 SwAutoFormat aFormat( this, aAFFlags, >GetMark()->nNode,
 >GetPoint()->nNode );
+SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get().GetAutoCorrect();
+if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | 
ACFlags::CapitalStartWord |
+ACFlags::AddNonBrkSpace | 
ACFlags::ChgOrdinalNumber |
+ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr 
| ACFlags::Autocorrect ))
+pACorr = nullptr;
+
+if( pACorr )
+AutoCorrect( *pACorr,false, u'\0' );
 
 //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor!
 Pop(PopMode::DeleteCurrent);
diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 09f2794b067e..bbf7c8400dd6 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1851,8 +1851,7 @@ KEYINPUT_CHECKTABLE:
 SelectionType::TableCell | 
SelectionType::DrawObject |
 SelectionType::DrawObjectEditMode)) )
 {
-eKeyState = SwKeyState::CheckAutoCorrect;
-eNextKeyState = SwKeyState::AutoFormatByInput;
+eKeyState = SwKeyState::AutoFormatByInput;
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-28 Thread Justin Luth
 sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt |binary
 sw/qa/extras/ww8export/ww8export2.cxx  |   12 
 sw/source/filter/ww8/wrtw8esh.cxx  |3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 1cedd88d40a26a55ce433f8b742215aea83a5382
Author: Justin Luth 
Date:   Thu Jun 28 15:48:40 2018 +0300

tdf#118421 ww8export: rotate vertically: not Lines or groups

Lines and Groups often are exceptions.
Normally, the import code swaps vertical rotations also. In the case
of lines (from the tests that I observed) lines don't have a rotation
value at that point during import, so no correction is made.
Grouping always messes things up.

Change-Id: I344c5a29f887294b751ffc87c01b30e472cfb4c2
Reviewed-on: https://gerrit.libreoffice.org/56595
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt 
b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt
new file mode 100644
index ..556f2564c7a2
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf70838b_verticalRotation.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index e4e61cb6a084..83eaac7b9de5 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -315,6 +315,18 @@ DECLARE_WW8EXPORT_TEST(testTdf70838, "tdf70838.odt")
 CPPUNIT_ASSERT(aRect.GetHeight() > aRect.GetWidth());
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf70838b_verticalRotation, 
"tdf70838b_verticalRotation.odt")
+{
+SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
+SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+SdrPage* pPage = 
pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+tools::Rectangle aGroupShape = pPage->GetObj(0)->GetSnapRect();
+tools::Rectangle aLine = pPage->GetObj(2)->GetSnapRect();
+
+CPPUNIT_ASSERT_MESSAGE("Smiley faces are round", aGroupShape.GetHeight() > 
aGroupShape.GetWidth());
+CPPUNIT_ASSERT_MESSAGE("Line is taller, not wider", aLine.GetHeight() > 
aLine.GetWidth());
+}
+
 DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" )
 {
 // First check box anchored as a floating object
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 2949accdce54..34d3a650ecc6 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -692,7 +692,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
 
 // rotating to vertical means swapping height and width as 
seen in SvxMSDffManager::ImportShape
 const long nAngle = NormAngle360( pObj->GetRotateAngle() );
-if ( ( nAngle > 4500 && nAngle <= 13500 ) || ( nAngle > 
22500 && nAngle <= 31500 ) )
+const bool bAllowSwap = pObj->GetObjIdentifier() != 
OBJ_LINE && pObj->GetObjIdentifier() != OBJ_GRUP;
+if ( bAllowSwap && (( nAngle > 4500 && nAngle <= 13500 ) 
|| ( nAngle > 22500 && nAngle <= 31500 )) )
 {
 const long nWidth  = aRect.getWidth();
 const long nHeight = aRect.getHeight();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-25 Thread Andrea Gelmini
 0 files changed

New commits:
commit 7053e417e96891a6807273ba000b9d65866892cc
Author: Andrea Gelmini 
Date:   Mon Jun 25 11:52:51 2018 +0200

Removed executable permission on (odt|cxx) files

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

diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank.odt 
b/sw/qa/extras/uiwriter/data/tdf113877_blank.odt
old mode 100755
new mode 100644
diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt 
b/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt
old mode 100755
new mode 100644
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
old mode 100755
new mode 100644
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
old mode 100755
new mode 100644
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-24 Thread Serge Krot
 sw/qa/extras/uiwriter/data/tdf113877_blank.odt |binary
 sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt |binary
 sw/qa/extras/uiwriter/uiwriter.cxx |   68 +
 sw/source/core/txtnode/ndtxt.cxx   |   43 
 4 files changed, 110 insertions(+), 1 deletion(-)

New commits:
commit baf3cec77db5f03200c038101e77720fae2ffba3
Author: Serge Krot 
Date:   Mon Jun 18 18:15:55 2018 +0200

tdf#113877 Insert doc: merge list into text with specifc style

When inserting document, in the current position the text could have custom
style but really it is the same Standard style. Therefore we should not
merge first inserted node into the insert position and just overwrite
style in the insert position with text style from the inserted node.

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

diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank.odt 
b/sw/qa/extras/uiwriter/data/tdf113877_blank.odt
new file mode 100755
index ..741d7d5e6d0a
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf113877_blank.odt 
differ
diff --git a/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt 
b/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt
new file mode 100755
index ..3dbebda6f93c
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf113877_blank_ownStandard.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
old mode 100644
new mode 100755
index d2086048ad94..e6ab7cdaf515
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -302,6 +302,8 @@ public:
 void testTdf72942();
 void testTdf113877();
 void testTdf113877NoMerge();
+void testTdf113877_default_style();
+void testTdf113877_Standard_style();
 void testMsWordCompTrailingBlanks();
 void testCreateDocxAnnotation();
 void testTdf107976();
@@ -496,6 +498,8 @@ public:
 CPPUNIT_TEST(testTdf72942);
 CPPUNIT_TEST(testTdf113877);
 CPPUNIT_TEST(testTdf113877NoMerge);
+CPPUNIT_TEST(testTdf113877_default_style);
+CPPUNIT_TEST(testTdf113877_Standard_style);
 CPPUNIT_TEST(testMsWordCompTrailingBlanks);
 CPPUNIT_TEST(testCreateDocxAnnotation);
 CPPUNIT_TEST(testTdf107976);
@@ -5577,6 +5581,70 @@ void SwUiWriterTest::testTdf113877NoMerge()
 CPPUNIT_ASSERT(listId6 != listId7);
 }
 
+// Related test to testTdf113877(): Inserting into empty document a new 
document with list.
+// Insert position has NO its own paragraph style ("Standard" will be used).
+//
+// Resulting document should be the same for following tests:
+// - testTdf113877_default_style()
+// - testTdf113877_Standard_style()
+//
+void SwUiWriterTest::testTdf113877_default_style()
+{
+load(DATA_DIRECTORY, "tdf113877_blank.odt");
+
+// set a page cursor into the end of the document
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+xCursor->jumpToEndOfPage();
+
+// insert the same document at current cursor position
+{
+const OUString insertFileid = 
m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"tdf113877_insert_numbered_list_abcd.odt";
+uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence({ { "Name", 
uno::makeAny(insertFileid) } }));
+lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+}
+
+const OUString listId1 = getProperty(getParagraph(1), "ListId");
+const OUString listId2 = getProperty(getParagraph(2), "ListId");
+const OUString listId3 = getProperty(getParagraph(3), "ListId");
+
+CPPUNIT_ASSERT_EQUAL(listId1, listId2);
+CPPUNIT_ASSERT_EQUAL(listId1, listId3);
+}
+
+// Related test to testTdf113877(): Inserting into empty document a new 
document with list.
+// Insert position has its own paragraph style derived from "Standard", but 
this style is the same as "Standard".
+//
+// Resulting document should be the same for following tests:
+// - testTdf113877_default_style()
+// - testTdf113877_Standard_style()
+//
+void SwUiWriterTest::testTdf113877_Standard_style()
+{
+load(DATA_DIRECTORY, "tdf113877_blank_ownStandard.odt");
+
+// set a page cursor into the end of the document
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+xCursor->jumpToEndOfPage();
+
+// insert the same document at current cursor position
+{
+const OUString insertFileid = 
m_directories.getURLFromSrc(DATA_DIRECTORY) + 

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

2018-06-19 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf117805.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx  |   13 +
 sw/source/filter/ww8/docxsdrexport.cxx  |   11 +--
 3 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 853350787df9a8d92c269ef1b6e764863e74ec2a
Author: Miklos Vajna 
Date:   Mon Jun 18 21:06:30 2018 +0200

tdf#117805 DOCX export: fix lost header with at-page anchored frames

The bug has two parts: on one hand, the header was not completely lost,
just was written inside a shape. This is not valid, but at least our own
import understood that. This commit restores that old behavior, focusing
on just the regression part of the bugreport.

On the other hand the exported header is still referenced at an
incorrect location: the correct location would be the end of the
document. But that is follow-up work, it seems that never worked.

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf117805.odt 
b/sw/qa/extras/ooxmlexport/data/tdf117805.odt
new file mode 100644
index ..828384b3613d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf117805.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 87d35f8a300c..730765a8c9ff 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -191,6 +191,19 @@ DECLARE_OOXMLEXPORT_TEST(testSignatureLineShape, 
"signature-line-all-props-set.d
 CPPUNIT_ASSERT_EQUAL(OUString("Check the machines!"), 
aSigningInstructions);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf117805, "tdf117805.odt")
+{
+if (!mbExported)
+return;
+
+uno::Reference xNameAccess
+= 
packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory),
+  maTempFile.GetURL());
+// This failed, the header was lost. It's still referenced at an incorrect
+// location in document.xml, though.
+CPPUNIT_ASSERT(xNameAccess->hasByName("word/header1.xml"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
 {
 // The horizontal positioning of the star shape affected the positioning of
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 8acb92e3e9ac..b714481d0043 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -117,6 +117,13 @@ void lclMovePositionWithRotation(awt::Point& aPos, const 
Size& rSize, sal_Int64
 aPos.X += nXDiff;
 aPos.Y += nYDiff;
 }
+
+/// Determines if the anchor is inside a paragraph.
+bool IsAnchorTypeInsideParagraph(const ww8::Frame* pFrame)
+{
+const SwFormatAnchor& rAnchor = 
pFrame->GetFrameFormat().GetAttrSet().GetAnchor();
+return rAnchor.GetAnchorId() != RndStdIds::FLY_AT_PAGE;
+}
 }
 
 ExportDataSaveRestore::ExportDataSaveRestore(DocxExport& rExport, sal_uLong 
nStt, sal_uLong nEnd,
@@ -1395,7 +1402,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* 
pParentFrame, int nAncho
   bool bTextBoxOnly)
 {
 bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
-m_pImpl->m_bDMLAndVMLDrawingOpen = true;
+m_pImpl->m_bDMLAndVMLDrawingOpen = 
IsAnchorTypeInsideParagraph(pParentFrame);
 
 sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
 const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
@@ -1690,7 +1697,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* 
pParentFrame, int nAncho
 void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool 
bTextBoxOnly)
 {
 bool bDMLAndVMLDrawingOpen = m_pImpl->m_bDMLAndVMLDrawingOpen;
-m_pImpl->m_bDMLAndVMLDrawingOpen = true;
+m_pImpl->m_bDMLAndVMLDrawingOpen = 
IsAnchorTypeInsideParagraph(pParentFrame);
 
 sax_fastparser::FSHelperPtr pFS = m_pImpl->m_pSerializer;
 const SwFrameFormat& rFrameFormat = pParentFrame->GetFrameFormat();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-18 Thread Mike Kaganski
 sw/qa/extras/ooxmlexport/data/tdf107969.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |7 +++
 sw/source/filter/ww8/docxexport.cxx  |6 ++
 3 files changed, 13 insertions(+)

New commits:
commit c67b7d795589aaf8f3396a379ef348bd650cb2dc
Author: Mike Kaganski 
Date:   Mon Jun 18 14:09:56 2018 +1000

tdf#107969: use proper serializer for VML in footnotes/endnotes

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf107969.docx 
b/sw/qa/extras/ooxmlexport/data/tdf107969.docx
new file mode 100644
index ..e674bcb5db72
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107969.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 6d099e57f8bb..87d35f8a300c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -388,6 +388,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116801, "tdf116801.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("D1"), xCell->getString());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf107969, "tdf107969.docx")
+{
+// A VML object in a footnote's tracked changes caused write past end of 
document.xml at export to docx.
+// After that, importing after export failed with
+// SAXParseException: '[word/document.xml line 2]: Extra content at the 
end of the document', Stream 'word/document.xml'.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 0e04a2220a5e..9355677fed3c 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -681,11 +681,14 @@ void DocxExport::WriteFootnotesEndnotes()
 m_pAttrOutput->SetSerializer( pFootnotesFS );
 // tdf#99227
 m_pSdrExport->setSerializer( pFootnotesFS );
+// tdf#107969
+m_pVMLExport->SetFS(pFootnotesFS);
 
 // do the work
 m_pAttrOutput->FootnotesEndnotes( true );
 
 // switch the serializer back
+m_pVMLExport->SetFS(m_pDocumentFS);
 m_pSdrExport->setSerializer( m_pDocumentFS );
 m_pAttrOutput->SetSerializer( m_pDocumentFS );
 }
@@ -705,11 +708,14 @@ void DocxExport::WriteFootnotesEndnotes()
 m_pAttrOutput->SetSerializer( pEndnotesFS );
 // tdf#99227
 m_pSdrExport->setSerializer( pEndnotesFS );
+// tdf#107969
+m_pVMLExport->SetFS(pEndnotesFS);
 
 // do the work
 m_pAttrOutput->FootnotesEndnotes( false );
 
 // switch the serializer back
+m_pVMLExport->SetFS(m_pDocumentFS);
 m_pSdrExport->setSerializer( m_pDocumentFS );
 m_pAttrOutput->SetSerializer( m_pDocumentFS );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-14 Thread Mike Kaganski
 sw/qa/extras/uiwriter/data/tdf91801.fodt |   21 +
 sw/qa/extras/uiwriter/uiwriter.cxx   |   11 +++
 sw/source/core/bastyp/calc.cxx   |2 ++
 3 files changed, 34 insertions(+)

New commits:
commit 82fc1fdebc622507d4220fefa72b9b4bda0f55d8
Author: Mike Kaganski 
Date:   Thu Jun 14 20:25:26 2018 +1000

tdf#91801: also restore command (formula) string on validating value

SwUserFieldType::GetValue calls SwCalc::Calculate on this object, which
resets own m_sCommand to the variable name being verified. Restore it
after calculations, like other values.

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

diff --git a/sw/qa/extras/uiwriter/data/tdf91801.fodt 
b/sw/qa/extras/uiwriter/data/tdf91801.fodt
new file mode 100755
index ..4d5486f71bbb
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf91801.fodt
@@ -0,0 +1,21 @@
+
+
+http://openoffice.org/2004/writer; office:version="1.2" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+
+
+   
+   
+
+
+ 
+  111
+ 
+
+   
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 924ff04f6911..d2086048ad94 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -342,6 +342,7 @@ public:
 void testHtmlCopyImages();
 void testTdf116789();
 void testTdf117225();
+void testTdf91801();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -535,6 +536,7 @@ public:
 CPPUNIT_TEST(testHtmlCopyImages);
 CPPUNIT_TEST(testTdf116789);
 CPPUNIT_TEST(testTdf117225);
+CPPUNIT_TEST(testTdf91801);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -6232,6 +6234,15 @@ void SwUiWriterTest::testTdf117225()
 CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
 }
 
+void SwUiWriterTest::testTdf91801()
+{
+// Tests calculation with several user field variables without prior user 
fields
+createDoc("tdf91801.fodt");
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"));
+CPPUNIT_ASSERT_EQUAL(555.0, xCell->getValue());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 30a1ca83a5ab..1e407f8a0225 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -449,6 +449,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns 
)
 sal_Int32 nCommandPos = m_nCommandPos;
 SwCalcOper eCurrOper = m_eCurrOper;
 SwCalcOper eCurrListOper = m_eCurrListOper;
+OUString sCurrCommand = m_sCommand;
 
 pFnd->nValue.PutDouble( pUField->GetValue( *this ) );
 
@@ -459,6 +460,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns 
)
 m_nCommandPos = nCommandPos;
 m_eCurrOper = eCurrOper;
 m_eCurrListOper = eCurrListOper;
+m_sCommand = sCurrCommand;
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-06 Thread Caolán McNamara
 sw/qa/core/data/ww8/fail/forcepoint-44.doc |binary
 sw/source/core/layout/pagechg.cxx  |4 ++--
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c6222fb6b8b429fa2e767c73ad616147f95ab1b9
Author: Caolán McNamara 
Date:   Tue Jun 5 21:37:00 2018 +0100

forcepoint#44 merge into isDeleteForbidden

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

diff --git a/sw/qa/core/data/ww8/fail/forcepoint-44.doc 
b/sw/qa/core/data/ww8/fail/forcepoint-44.doc
new file mode 100644
index ..100422a2249c
Binary files /dev/null and b/sw/qa/core/data/ww8/fail/forcepoint-44.doc differ
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index d31162d79aa3..ee41a0d4f77b 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1237,6 +1237,8 @@ namespace
 {
 bool isDeleteForbidden(const SwPageFrame *pDel)
 {
+if (pDel->IsDeleteForbidden())
+return true;
 const SwLayoutFrame* pBody = pDel->FindBodyCont();
 const SwFrame* pBodyContent = pBody ? pBody->Lower() : nullptr;
 return pBodyContent && pBodyContent->IsDeleteForbidden();
@@ -1264,8 +1266,6 @@ namespace
  !pSibling->FindFirstBodyContent() &&
  (!pRefPage || !isDeleteForbidden(pSibling)) )
 {
-if (pSibling->IsDeleteForbidden())
-throw uno::RuntimeException("bad layout");
 pRoot->RemovePage( pRefSibling, SwRemoveResult::Next ) ;
 return false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-06-06 Thread Luke Deller
 sw/qa/extras/ww8export/data/tdf117885.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx |   19 +++
 sw/source/filter/ww8/ww8par6.cxx  |   16 +++-
 3 files changed, 30 insertions(+), 5 deletions(-)

New commits:
commit 6c68e52532d45c97a83b2396bd40c98ade9b5bb4
Author: Luke Deller 
Date:   Thu May 31 23:16:26 2018 +1000

Fix top margin in DOC import for tdf#117885

When calculating the height of the top/bottom margin, we take into
account whether the DOC section has a header/footer enabled.

If the DOC section contains only a first-page header/footer, and the
display of first-page header/footer in this section is not enabled,
then we must consider the section to have no header/footer.

(Also add a test case using the doc supplied by the reporter in
 tdf#117885)

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

diff --git a/sw/qa/extras/ww8export/data/tdf117885.doc 
b/sw/qa/extras/ww8export/data/tdf117885.doc
new file mode 100644
index ..bf8d0ef03d61
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117885.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index f7ec720bce99..af3185d5e41b 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -821,6 +821,25 @@ DECLARE_WW8EXPORT_TEST(testTdf117503, "tdf117503.docx")
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf117885, "tdf117885.doc")
+{
+xmlDocPtr pXmlDoc = parseLayoutDump();
+
+/* Get the vertical position of the paragraph containing the text "Start" 
*/
+sal_Int32 nParaA_Top = getXPath(pXmlDoc,
+"/root/page/body/column[1]/body/txt[text()='Start']/infos/bounds", 
"top"
+).toInt32();
+
+/* Get the vertical position of the paragraph containing the text "Top B" 
*/
+sal_Int32 nParaB_Top = getXPath(pXmlDoc,
+"/root/page/body/column[2]/body/txt[text()='Top B']/infos/bounds", 
"top"
+).toInt32();
+
+/* These two paragraphs are supposed to be at the top of the left
+ * and right columns respectively.  Check that they actually line up: */
+CPPUNIT_ASSERT_EQUAL(nParaA_Top, nParaB_Top);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 621a7060b4e7..227fe8937a0f 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -496,8 +496,17 @@ void wwSectionManager::GetPageULData(const wwSection 
,
 nWWUp += rSection.maSep.dzaGutter;
 }
 
-rData.bHasHeader = (rSection.maSep.grpfIhdt &
-(WW8_HEADER_EVEN | WW8_HEADER_ODD | WW8_HEADER_FIRST)) != 0;
+/* Check whether this section has headers / footers */
+sal_uInt16 nHeaderMask = WW8_HEADER_EVEN | WW8_HEADER_ODD;
+sal_uInt16 nFooterMask = WW8_HEADER_EVEN | WW8_HEADER_ODD;
+/* Ignore the presence of a first-page header/footer unless it is enabled 
*/
+if( rSection.HasTitlePage() )
+{
+nHeaderMask |= WW8_HEADER_FIRST;
+nFooterMask |= WW8_FOOTER_FIRST;
+}
+rData.bHasHeader = (rSection.maSep.grpfIhdt & nHeaderMask) != 0;
+rData.bHasFooter = (rSection.maSep.grpfIhdt & nFooterMask) != 0;
 
 if( rData.bHasHeader )
 {
@@ -518,9 +527,6 @@ void wwSectionManager::GetPageULData(const wwSection 
,
 else // no header -> just use Up as-is
 rData.nSwUp = std::abs(nWWUp);
 
-rData.bHasFooter = (rSection.maSep.grpfIhdt &
-(WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST)) != 0;
-
 if( rData.bHasFooter )
 {
 rData.nSwLo = nWWFBot;  // footer -> convert
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-31 Thread Mark Hung
 sw/qa/extras/layout/data/table-extrusion1.odt |binary
 sw/qa/extras/layout/data/table-extrusion2.odt |binary
 sw/qa/extras/layout/layout.cxx|   43 ++
 sw/source/core/layout/paintfrm.cxx|   28 ++--
 4 files changed, 53 insertions(+), 18 deletions(-)

New commits:
commit 1e21902106cbe57658bed03ed24d4d0863685cfd
Author: Mark Hung 
Date:   Sat May 26 22:34:49 2018 +0800

tdf#117884: intersect border with paint area of upper frame.

This patch fix regression caused by e87cc12eaf53 and allow
table borders rendered in the left or right page margin.

Also add another test case (testTableExtrusion2) to assure
inner table can't have wider border than outer table.

Change-Id: I7a86b379dee08fb2f23385183a42d0ebde007370
Reviewed-on: https://gerrit.libreoffice.org/54862
Tested-by: Jenkins 
Reviewed-by: Mark Hung 

diff --git a/sw/qa/extras/layout/data/table-extrusion1.odt 
b/sw/qa/extras/layout/data/table-extrusion1.odt
new file mode 100755
index ..10600fa54c86
Binary files /dev/null and b/sw/qa/extras/layout/data/table-extrusion1.odt 
differ
diff --git a/sw/qa/extras/layout/data/table-extrusion2.odt 
b/sw/qa/extras/layout/data/table-extrusion2.odt
new file mode 100755
index ..63fc74f46db8
Binary files /dev/null and b/sw/qa/extras/layout/data/table-extrusion2.odt 
differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
old mode 100644
new mode 100755
index a7eb24e89208..2356832cc4ba
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -20,6 +20,8 @@ public:
 void testTdf116925();
 void testTdf117028();
 void testTdf106390();
+void testTableExtrusion1();
+void testTableExtrusion2();
 void testTdf116848();
 void testTdf117245();
 
@@ -28,6 +30,8 @@ public:
 CPPUNIT_TEST(testTdf116925);
 CPPUNIT_TEST(testTdf117028);
 CPPUNIT_TEST(testTdf106390);
+CPPUNIT_TEST(testTableExtrusion1);
+CPPUNIT_TEST(testTableExtrusion2);
 CPPUNIT_TEST(testTdf116848);
 CPPUNIT_TEST(testTdf117245);
 CPPUNIT_TEST_SUITE_END();
@@ -132,6 +136,45 @@ void SwLayoutWriter::testTdf106390()
 assertXPath(pXmlDoc, sXPath, 0);
 }
 
+void SwLayoutWriter::testTableExtrusion1()
+{
+SwDoc* pDoc = createDoc("table-extrusion1.odt");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Dump the rendering of the first page as an XML file.
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+sal_Int32 nRight = getXPath(pXmlDoc, "//sectrectclipregion", 
"right").toInt32();
+sal_Int32 nLeft = (nRight + getXPath(pXmlDoc, "(//rect)[1]", 
"right").toInt32()) / 2;
+
+// Expect table borders in right page margin.
+const OString sXPath = "//polyline/point[@x>" + OString::number(nLeft) + " 
and @x<"
+   + OString::number(nRight) + "]";
+
+assertXPath(pXmlDoc, sXPath, 4);
+}
+
+void SwLayoutWriter::testTableExtrusion2()
+{
+SwDoc* pDoc = createDoc("table-extrusion2.odt");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Dump the rendering of the first page as an XML file.
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+// End point position of the outer table.
+sal_Int32 nX = getXPath(pXmlDoc, "(//polyline[1]/point)[2]", 
"x").toInt32();
+
+// Do not allow inner table extrude outer table.
+const OString sXPath = "//polyline/point[@x>" + OString::number(nX) + "]";
+
+assertXPath(pXmlDoc, sXPath, 0);
+}
+
 void SwLayoutWriter::testTdf116848()
 {
 SwDoc* pDoc = createDoc("tdf116848.odt");
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index cd76c222b040..b684c5ac1b2c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2308,8 +2308,8 @@ class SwTabFramePainter
 const SwTabFrame& mrTabFrame;
 
 void Insert( SwLineEntry&, bool bHori );
-void Insert( const SwFrame& rFrame, const SvxBoxItem& rBoxItem );
-void HandleFrame( const SwLayoutFrame& rFrame );
+void Insert(const SwFrame& rFrame, const SvxBoxItem& rBoxItem, const 
SwRect );
+void HandleFrame(const SwLayoutFrame& rFrame, const SwRect& rPaintArea);
 void FindStylesForLine( const Point&,
 const Point&,
 svx::frame::Style*,
@@ -2324,10 +2324,11 @@ public:
 SwTabFramePainter::SwTabFramePainter( const SwTabFrame& rTabFrame )
 : mrTabFrame( rTabFrame )
 {
-HandleFrame( rTabFrame );
+SwRect aPaintArea = rTabFrame.GetUpper()->GetPaintArea();
+HandleFrame(rTabFrame, aPaintArea);
 }
 
-void SwTabFramePainter::HandleFrame( const SwLayoutFrame& rLayoutFrame )
+void 

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

2018-05-25 Thread Justin Luth
 sw/qa/extras/ooxmlexport/data/fdo80800b_tableStyle.docx |binary
 sw/qa/extras/ooxmlexport/data/tdf117297_tableStyle.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx   |   47 
 sw/source/core/unocore/unotbl.cxx   |   31 ++
 sw/source/core/unocore/unotext.cxx  |   26 
 writerfilter/source/dmapper/DomainMapper.cxx|   18 --
 6 files changed, 80 insertions(+), 42 deletions(-)

New commits:
commit 5e4d89f59614cec08376e1e77625f8610a1490e5
Author: Justin Luth 
Date:   Fri May 18 07:01:59 2018 +0300

tdf#117297 sw unotbl XCell: apply char/para style props to text

This is specifically for the benefit of DOCX import, but it
also makes sense in general. If a SwXCell is given char/para
properties, then apply those properties (without overwriting)
to the cell's contents.

This allows ANY paragraph or character properties that are applied
to a table style to become the "default" for the table.

This fixes a number of things:
-remove one-off hack to get PROP_PARA_LINE_SPACING to work.
-works for all character and paragraph properties (except those
shared with tables like borders).
-works in multi-paragraph cells. Previously those could return
AMBIGUOUS state, in which case the style wasn't applied at all.

Change-Id: Ia98c129879575c1aa8ca1fe2a64f4991c0a264e8
Reviewed-on: https://gerrit.libreoffice.org/54511
Tested-by: Jenkins 
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo80800b_tableStyle.docx 
b/sw/qa/extras/ooxmlexport/data/fdo80800b_tableStyle.docx
new file mode 100644
index ..bde907cf227a
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/fdo80800b_tableStyle.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf117297_tableStyle.docx 
b/sw/qa/extras/ooxmlexport/data/tdf117297_tableStyle.docx
new file mode 100644
index ..57260f81609f
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf117297_tableStyle.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 12483de3a041..b6125d78aedb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -863,6 +863,53 @@ 
DECLARE_OOXMLEXPORT_TEST(testTableCellWithDirectFormatting, "fdo80800.docx")
 
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo80800b_tableStyle, "fdo80800b_tableStyle.docx")
+{
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Cell1 1.5lines"), xPara->getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell A1 1.5 line spacing", sal_Int16(150), 
getProperty(xPara, "ParaLineSpacing").Height);
+
+xCell.set(xTable->getCellByName("B1"), uno::UNO_QUERY);
+xParaEnumAccess.set(xCell->getText(), uno::UNO_QUERY);
+xParaEnum = xParaEnumAccess->createEnumeration();
+xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Cell2 Implicit (Single)"), 
xPara->getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 single line spacing", 
sal_Int16(100), getProperty(xPara, 
"ParaLineSpacing").Height);
+
+xCell.set(xTable->getCellByName("C1"), uno::UNO_QUERY);
+xParaEnumAccess.set(xCell->getText(), uno::UNO_QUERY);
+xParaEnum = xParaEnumAccess->createEnumeration();
+xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Cell3 Implicit (Single)"), 
xPara->getString());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("C1 paragraph1 single line spacing", 
sal_Int16(100), getProperty(xPara, 
"ParaLineSpacing").Height);
+xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("C1 paragraph3 line spacing", sal_Int16(212), 
getProperty(xPara, "ParaLineSpacing").Height);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testTdf117297_tableStyle, "tdf117297_tableStyle.docx")
+{
+uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
+uno::Reference xCell(xTable->getCellByName("B1"), 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
+uno::Reference xText(xPara->getText(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Green text, default size (9), 1.5 spaced"), 
xPara->getString());
+

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

2018-05-24 Thread Mark Hung
 sw/qa/extras/layout/data/tdf106390.odt |binary
 sw/qa/extras/layout/layout.cxx |   20 
 sw/source/core/layout/paintfrm.cxx |   14 ++
 3 files changed, 30 insertions(+), 4 deletions(-)

New commits:
commit e87cc12eaf53efa9b221eae7167ea15bc7896752
Author: Mark Hung 
Date:   Wed May 23 11:25:05 2018 +0800

tdf#106390 Intersect the table borders with upper frames.

Also removes dead code because SwTabFramePainter::Insert()
is always called with a cell frame and IsTabFrame() always
returns false.

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

diff --git a/sw/qa/extras/layout/data/tdf106390.odt 
b/sw/qa/extras/layout/data/tdf106390.odt
new file mode 100755
index ..b2adf5332e34
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf106390.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 4d05162a7d74..a7eb24e89208 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -19,6 +19,7 @@ public:
 void testTdf116830();
 void testTdf116925();
 void testTdf117028();
+void testTdf106390();
 void testTdf116848();
 void testTdf117245();
 
@@ -26,6 +27,7 @@ public:
 CPPUNIT_TEST(testTdf116830);
 CPPUNIT_TEST(testTdf116925);
 CPPUNIT_TEST(testTdf117028);
+CPPUNIT_TEST(testTdf106390);
 CPPUNIT_TEST(testTdf116848);
 CPPUNIT_TEST(testTdf117245);
 CPPUNIT_TEST_SUITE_END();
@@ -112,6 +114,24 @@ void SwLayoutWriter::testTdf117028()
 assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
 }
 
+void SwLayoutWriter::testTdf106390()
+{
+SwDoc* pDoc = createDoc("tdf106390.odt");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Dump the rendering of the first page as an XML file.
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+sal_Int32 nBottom = getXPath(pXmlDoc, "//sectrectclipregion", 
"bottom").toInt32();
+
+// No end point of line segments shall go below the bottom of the clipping 
area.
+const OString sXPath = "//polyline/point[@y>" + OString::number(nBottom) + 
"]";
+
+assertXPath(pXmlDoc, sXPath, 0);
+}
+
 void SwLayoutWriter::testTdf116848()
 {
 SwDoc* pDoc = createDoc("tdf116848.odt");
diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 1d1cf069385c..cd76c222b040 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2729,10 +2729,16 @@ void SwTabFramePainter::Insert( const SwFrame& rFrame, 
const SvxBoxItem& rBoxIte
 {
 // build 4 line entries for the 4 borders:
 SwRect aBorderRect = rFrame.getFrameArea();
-if ( rFrame.IsTabFrame() )
-{
-aBorderRect = rFrame.getFramePrintArea();
-aBorderRect.Pos() += rFrame.getFrameArea().Pos();
+// Frame area of a table might be larger than the containing frame
+// so we have to intersect the border rect with upper frames til
+// the first frame that is not part of a table.
+const SwLayoutFrame *pUpper = rFrame.GetUpper();
+while(pUpper)
+{
+aBorderRect.Intersection(pUpper->getFrameArea());
+if (!pUpper->IsInTab())
+break;
+pUpper = pUpper->GetUpper();
 }
 
 bool const 
bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-23 Thread Miklos Vajna
 sw/qa/extras/rtfexport/data/tdf117505.odt   |binary
 sw/qa/extras/rtfexport/rtfexport3.cxx   |   11 +++
 sw/source/filter/ww8/rtfattributeoutput.cxx |9 -
 sw/source/filter/ww8/rtfexport.cxx  |3 +++
 sw/source/filter/ww8/rtfexport.hxx  |4 
 5 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 5956828c88501ef1366e60010b05053a8e1e642e
Author: Miklos Vajna 
Date:   Tue May 22 22:05:24 2018 +0200

tdf#117505 RTF export: fix incorrect header distance for first/follow pages

In case the first and the follow page format has different header
distances, the DOC and DOCX import work with the distance from the first
page format when they take the last item from the MSWordSections
container at the end of the export.

RTF writes section info before the document content, and in case there
are separate first and follow page formats, then we work with the follow
format since commit 20a53cb9e9c7b797c091fe6ac6a34dfb28c61304
(INTEGRATION: CWS limerickfilterteam08 (1.16.32); FILE MERGED,
2003-09-01) as a fix for i#13107.

There is no perfect solution here, the sw doc model can store different
header distances for first and follow pages, while Word works with a
single distance. But RTF/DOCX/DOC import puts the relevant header
distance to the first page format and DOCX/DOC export reads the distance
from there, so be consistent and do the same in the RTF export as well.

This means the DOCX import -> RTF export -> RTF import sequence from the
bugreport will result in a correct header distance.

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

diff --git a/sw/qa/extras/rtfexport/data/tdf117505.odt 
b/sw/qa/extras/rtfexport/data/tdf117505.odt
new file mode 100644
index ..91bde8f92393
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf117505.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 142c7f6c8381..d27eec82fea9 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -145,6 +145,17 @@ DECLARE_RTFEXPORT_TEST(testTdf117268, "tdf117268.rtf")
 CPPUNIT_ASSERT_EQUAL(xCell, xAnchorCell);
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf117505, "tdf117505.odt")
+{
+uno::Reference 
xPageStyles(getStyles("PageStyles"));
+uno::Reference 
xFirstPage(xPageStyles->getByName("First Page"),
+   uno::UNO_QUERY);
+// This was 499, small header height resulted in visible whitespace from
+// remaining top margin -> header content moved down.
+CPPUNIT_ASSERT_EQUAL(static_cast(1499),
+ getProperty(xFirstPage, "HeaderHeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 56c0d2f9d293..42199d4770b6 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3017,7 +3017,14 @@ void RtfAttributeOutput::FormatULSpace(const 
SvxULSpaceItem& rULSpace)
 if (!m_rExport.GetCurItemSet())
 return;
 
-sw::util::HdFtDistanceGlue aDistances(*m_rExport.GetCurItemSet());
+// If we export a follow page format, then our doc model has
+// separate header/footer distances for the first page and the
+// follow pages, but Word can have only a single distance. In case
+// the two values differ, work with the value from the first page
+// format to be in sync with the import.
+sw::util::HdFtDistanceGlue 
aDistances(m_rExport.GetFirstPageItemSet()
+  ? 
*m_rExport.GetFirstPageItemSet()
+  : 
*m_rExport.GetCurItemSet());
 
 if (aDistances.dyaTop)
 {
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 0b206edcf693..7c5e096ea5b3 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -1348,7 +1348,10 @@ void RtfExport::OutPageDescription(const SwPageDesc& 
rPgDsc, bool bCheckForFirst
 
 const SwFormat* pFormat = _pCurrentPageDesc->GetMaster(); //GetLeft();
 m_bOutPageDescs = true;
+if (m_pCurrentPageDesc != )
+m_pFirstPageItemSet = ().GetAttrSet();
 OutputFormat(*pFormat, true, false);
+m_pFirstPageItemSet = nullptr;
 m_bOutPageDescs = false;
 
 // normal header / footer (without a style)
diff --git a/sw/source/filter/ww8/rtfexport.hxx 
b/sw/source/filter/ww8/rtfexport.hxx
index 

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

2018-05-15 Thread Caolán McNamara
 sw/qa/core/data/html/pass/ofz8255-1.html |1 +
 sw/source/core/layout/atrfrm.cxx |   16 
 2 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 881636aed7b1b5d2e4929a31751b45a656b6fe8a
Author: Caolán McNamara 
Date:   Mon May 14 14:37:03 2018 +0100

ofz#8255 check multiply

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

diff --git a/sw/qa/core/data/html/pass/ofz8255-1.html 
b/sw/qa/core/data/html/pass/ofz8255-1.html
new file mode 100644
index ..7bad71504edd
--- /dev/null
+++ b/sw/qa/core/data/html/pass/ofz8255-1.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7f4d27ad6e1c..57012946c9b5 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -994,16 +995,23 @@ sal_uInt16 SwFormatCol::CalcPrtColWidth( sal_uInt16 nCol, 
sal_uInt16 nAct ) cons
 
 void SwFormatCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct )
 {
-if(!GetNumCols())
+if (!GetNumCols())
 return;
+
 //First set the column widths with the current width, then calculate the
 //column's requested width using the requested total width.
-
 const sal_uInt16 nGutterHalf = nGutterWidth ? nGutterWidth / 2 : 0;
 
 //Width of PrtAreas is totalwidth - spacings / count
-const sal_uInt16 nPrtWidth =
-(nAct - ((GetNumCols()-1) * nGutterWidth)) / GetNumCols();
+sal_uInt16 nSpacings;
+bool bFail = o3tl::checked_multiply(GetNumCols() - 1, 
nGutterWidth, nSpacings);
+if (bFail)
+{
+SAL_WARN("sw.core", "SwFormatVertOrient::Calc: overflow");
+return;
+}
+
+const sal_uInt16 nPrtWidth = (nAct - nSpacings) / GetNumCols();
 sal_uInt16 nAvail = nAct;
 
 //The first column is PrtWidth + (gap width / 2)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-14 Thread Caolán McNamara
 sw/qa/core/data/ww8/pass/ofz7322-1.doc |binary
 sw/source/core/doc/docbm.cxx   |9 -
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 90875893fbf95d9ef6081646ec36fc03b416
Author: Caolán McNamara 
Date:   Mon May 14 16:50:30 2018 +0100

ofz#7322 lcl_MarkEqualByStart sort logic differs from that of operator==

when it encounters a SwPosition with a SwIndex nContent whose m_pIndexReg is
null and compares to one whose m_pIndexReg is not null, where both have an
m_nIndex of 0.

operator== considers them different, while lcl_MarkEqualByStart doesn't care
and sorts them as equal

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

diff --git a/sw/qa/core/data/ww8/pass/ofz7322-1.doc 
b/sw/qa/core/data/ww8/pass/ofz7322-1.doc
new file mode 100644
index ..5f4858849acf
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/ofz7322-1.doc differ
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 45618432f67d..65ae2df1c182 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -225,6 +225,13 @@ namespace
 return false;
 }
 
+bool lcl_MarkEqualByStart(const IDocumentMarkAccess::pMark_t& rpFirst,
+  const IDocumentMarkAccess::pMark_t& rpSecond)
+{
+return !lcl_MarkOrderingByStart(rpFirst, rpSecond) &&
+   !lcl_MarkOrderingByStart(rpSecond, rpFirst);
+}
+
 IDocumentMarkAccess::iterator_t lcl_FindMark(
 IDocumentMarkAccess::container_t& rMarks,
 const IDocumentMarkAccess::pMark_t& rpMarkToFind)
@@ -235,7 +242,7 @@ namespace
 // since there are usually not too many marks on the same start
 // position, we are not doing a bisect search for the upper bound
 // but instead start to iterate from pMarkLow directly
-while(ppCurrentMark != rMarks.end() && **ppCurrentMark == 
*rpMarkToFind)
+while (ppCurrentMark != rMarks.end() && 
lcl_MarkEqualByStart(*ppCurrentMark, rpMarkToFind))
 {
 if(ppCurrentMark->get() == rpMarkToFind.get())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-11 Thread Miklos Vajna
 sw/qa/extras/layout/data/tdf117245.odt |binary
 sw/qa/extras/layout/layout.cxx |   14 ++
 sw/source/core/text/guess.cxx  |2 +-
 sw/source/core/text/inftxt.cxx |   23 +++
 sw/source/core/text/inftxt.hxx |6 ++
 sw/source/core/text/itrform2.cxx   |2 +-
 6 files changed, 45 insertions(+), 2 deletions(-)

New commits:
commit 7758d6609da2c1df978818823f6f9856b99dcefc
Author: Miklos Vajna 
Date:   Thu May 10 15:53:16 2018 +0200

tdf#117245 sw layout: extend TabOverMargin compat mode

This layout compatibility flag is supposed to mimic Word behavior, but
in both cases we failed to lay out the text as Word does.

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

diff --git a/sw/qa/extras/layout/data/tdf117245.odt 
b/sw/qa/extras/layout/data/tdf117245.odt
new file mode 100644
index ..7008c325bace
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf117245.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index aa2146354fc0..4d05162a7d74 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -20,12 +20,14 @@ public:
 void testTdf116925();
 void testTdf117028();
 void testTdf116848();
+void testTdf117245();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
 CPPUNIT_TEST(testTdf116925);
 CPPUNIT_TEST(testTdf117028);
 CPPUNIT_TEST(testTdf116848);
+CPPUNIT_TEST(testTdf117245);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -117,6 +119,18 @@ void SwLayoutWriter::testTdf116848()
 pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
 }
 
+void SwLayoutWriter::testTdf117245()
+{
+createDoc("tdf117245.odt");
+xmlDocPtr pXmlDoc = parseLayoutDump();
+// This was 2, TabOverMargin did not use a single line when there was
+// enough space for the text.
+assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak", 1);
+
+// This was 2, same problem elsewhere due to code duplication.
+assertXPath(pXmlDoc, "/root/page/body/txt[2]/LineBreak", 1);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 5ddf80485522..b3cb3b02d472 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -70,7 +70,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo ,
 1 :
 0 ;
 
-SwTwips nLineWidth = rInf.Width() - rInf.X();
+SwTwips nLineWidth = rInf.GetLineWidth();
 sal_Int32 nMaxLen = rInf.GetText().getLength() - rInf.GetIdx();
 
 const SvxAdjust& rAdjust = 
rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 65e25af2ee58..d66f946a04ed 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -57,6 +57,7 @@
 #include "porftn.hxx"
 #include "porrst.hxx"
 #include "itratr.hxx"
+#include "portab.hxx"
 #include 
 #include 
 #include 
@@ -1688,6 +1689,28 @@ bool SwTextFormatInfo::LastKernPortion()
 return false;
 }
 
+SwTwips SwTextFormatInfo::GetLineWidth()
+{
+SwTwips nLineWidth = Width() - X();
+
+const bool bTabOverMargin = 
GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(
+DocumentSettingId::TAB_OVER_MARGIN);
+if (!bTabOverMargin)
+return nLineWidth;
+
+SwTabPortion* pLastTab = GetLastTab();
+if (!pLastTab)
+return nLineWidth;
+
+if (pLastTab->GetTabPos() <= Width())
+return nLineWidth;
+
+// Consider tab portions over the printing bounds of the text frame.
+nLineWidth = pLastTab->GetTabPos() - X();
+
+return nLineWidth;
+}
+
 SwTextSlot::SwTextSlot(
 const SwTextSizeInfo *pNew,
 const SwLinePortion *pPor,
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 91f7ef655fb0..ac85d3da4281 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -540,6 +540,12 @@ public:
 void Width( const sal_uInt16 nNew ) { m_nWidth = nNew; }
void Init();
 
+/**
+ * Returns the distance between the current horizontal position and the end
+ * of the line.
+ */
+SwTwips GetLineWidth();
+
 // Returns the first changed position of the paragraph
 inline sal_Int32 GetReformatStart() const;
 
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 39f68943cb91..f8b8b16c679b 100755
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -979,7 +979,7 @@ SwTextPortion *SwTextFormatter::NewTextPortion( 

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

2018-05-07 Thread Miklos Vajna
 sw/qa/extras/htmlexport/data/list.html |4 
 sw/qa/extras/htmlexport/htmlexport.cxx |   13 +
 sw/source/filter/html/htmlatr.cxx  |3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit e5834a3967b3b182d1b7b7a5b500aaea2ea423be
Author: Miklos Vajna 
Date:   Mon May 7 13:59:58 2018 +0200

sw HTML export: ensure  is not closed before list item content

Seems to be a regression from commit
c30cf5a3d7902018b0a752fa2060b8f2a2caafc2 (sw html: use HtmlWriter in
htmlatr in some places, 2014-03-16).

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

diff --git a/sw/qa/extras/htmlexport/data/list.html 
b/sw/qa/extras/htmlexport/data/list.html
new file mode 100644
index ..867521155add
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/list.html
@@ -0,0 +1,4 @@
+
+   foo
+   bar
+
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index a582ac00b41a..f7aaec10a79b 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -529,6 +529,19 @@ DECLARE_HTMLEXPORT_ROUNDTRIP_TEST(testReqIfOle2, 
"reqif-ole2.xhtml")
 // exception of type com.sun.star.io.IOException was thrown.
 }
 
+DECLARE_HTMLEXPORT_TEST(testList, "list.html")
+{
+SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+CPPUNIT_ASSERT(pStream);
+pStream->Seek(STREAM_SEEK_TO_END);
+sal_uInt64 nLength = pStream->Tell();
+pStream->Seek(0);
+OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+// This failed, it was , i.e. list item was closed before content
+// started.
+CPPUNIT_ASSERT(aStream.indexOf("") != -1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index 3f10864aefd9..fffc6dcf320d 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -764,7 +764,8 @@ void OutHTML_SwFormat( Writer& rWrt, const SwFormat& 
rFormat,
 rInfo.bOutLi = true;
 }
 else
-html.endAttribute();
+// Finish the opening element, but don't close it.
+html.characters(OString());
 }
 
 if( rHWrt.m_nDefListLvl > 0 && !bForceDL )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-05-01 Thread Caolán McNamara
 sw/qa/core/data/ww8/pass/forcepoint-layout-1.doc |binary
 sw/source/core/layout/fly.cxx|1 +
 sw/source/core/layout/pagechg.cxx|2 ++
 3 files changed, 3 insertions(+)

New commits:
commit 2a957e408530cd16526d793c87f0e6fd4bed1548
Author: Caolán McNamara 
Date:   Mon Apr 16 16:45:14 2018 +0100

forcepoint#39 bad layout

reproducible with ./instdir/program/soffice.bin --headless --convert-to pdf 
sw/qa/core/data/ww8/pass/forcepoint-layout-1.doc

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

diff --git a/sw/qa/core/data/ww8/pass/forcepoint-layout-1.doc 
b/sw/qa/core/data/ww8/pass/forcepoint-layout-1.doc
new file mode 100755
index ..37801a9b14e2
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/forcepoint-layout-1.doc 
differ
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 90cf8c5ae5d1..7e6876432a67 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1422,6 +1422,7 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
 }
 
 {
+SwFrameDeleteGuard aDeletePageGuard(pSect->FindPageFrame());
 SwFrameDeleteGuard aDeleteGuard(pSect);
 pFrame->Calc(pRenderContext);
 }
diff --git a/sw/source/core/layout/pagechg.cxx 
b/sw/source/core/layout/pagechg.cxx
index 238f44cc1afb..d31162d79aa3 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1264,6 +1264,8 @@ namespace
  !pSibling->FindFirstBodyContent() &&
  (!pRefPage || !isDeleteForbidden(pSibling)) )
 {
+if (pSibling->IsDeleteForbidden())
+throw uno::RuntimeException("bad layout");
 pRoot->RemovePage( pRefSibling, SwRemoveResult::Next ) ;
 return false;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-27 Thread Justin Luth
 sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt |binary
 sw/qa/extras/ww8export/ww8export2.cxx|9 +++
 sw/source/filter/ww8/ww8par2.cxx |   14 +--
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit a3783c0af4bd21eb9c001aadc60c660c06a47779
Author: Justin Luth 
Date:   Fri Mar 30 21:36:42 2018 +0300

tdf#106062 ww8import: skip fake tab only on hanging indent

Export has changed, so that it only exports a tab when the
footnote paragraph has a hanging indent. Adjusting the import
code to match that change.

Please test with MSO before flagging this patch as a regression.
Certainly there will be some documents previously saved by LO
which will now, in LO, show an extra tab character after the footnote.
Any previously saved document without a hanging indent will display
this extra tab. However, MSO has always seen that extra tab, so
these patches are enhancing compatibility.

Change-Id: Id074ca0f3246eaee9807b907757cbeb6f1bbe7b4
Reviewed-on: https://gerrit.libreoffice.org/52173
Tested-by: Jenkins 
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt 
b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt
new file mode 100644
index ..af5e225ea08c
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf106062_nonHangingFootnote.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index bca0d6b745fb..bc9a104740bb 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -209,6 +209,15 @@ DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, 
"tdf108448_endNote.odt")
 CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in Endnote i", 1, 
getParagraphs(xEndnote) );
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf106062_nonHangingFootnote, 
"tdf106062_nonHangingFootnote.odt")
+{
+uno::Reference xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
+uno::Reference xTextRange(xFootnotes->getByIndex(0), 
uno::UNO_QUERY);
+// This failed, tab between the footnote number and the footnote content 
was lost on import.
+CPPUNIT_ASSERT_MESSAGE( "Footnote starts with a tab", 
xTextRange->getString().startsWith("\t") );
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf116570_exportFootnote, 
"tdf116570_exportFootnote.odt")
 {
 uno::Reference xFootnotesSupplier(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 56c45f4d5ba5..cb68c03c438d 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -245,10 +245,20 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
 const OUString  = pTNd->GetText();
 if (rText[0] == sChar[0])
 {
+// Allow MSO to emulate LO footnote text starting at left 
margin - only meaningful with hanging indent
+sal_Int32 nFirstLineIndent=0;
+SfxItemSet aSet( m_rDoc.GetAttrPool(), 
svl::Items{} );
+if ( pTNd->GetAttr(aSet) )
+{
+const SvxLRSpaceItem* pLRSpace = 
aSet.GetItem(RES_LR_SPACE);
+if ( pLRSpace )
+nFirstLineIndent = pLRSpace->GetTextFirstLineOfst();
+}
+
 m_pPaM->GetPoint()->nContent.Assign( pTNd, 0 );
 m_pPaM->SetMark();
-// Strip out tabs we may have inserted on export #i24762#
-if (rText.getLength() > 1 && rText[1] == 0x09)
+// Strip out aesthetic tabs we may have inserted on export 
#i24762#
+if (nFirstLineIndent < 0 && rText.getLength() > 1 && rText[1] 
== 0x09)
 ++m_pPaM->GetMark()->nContent;
 ++m_pPaM->GetMark()->nContent;
 m_xReffingStck->Delete(*m_pPaM);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-27 Thread Caolán McNamara
 sw/qa/core/data/ww6/pass/ofz-redlining-1.doc |binary
 sw/source/filter/ww8/ww8par.cxx  |3 +++
 sw/source/filter/ww8/ww8par.hxx  |3 ++-
 sw/source/filter/ww8/ww8par2.cxx |1 +
 4 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit e71d05eaa9a8c9e628b256f3e889b85ac11ed474
Author: Caolán McNamara 
Date:   Fri Apr 27 15:42:26 2018 +0100

ofz#8038 defer subdocument redlining to end of parse like main document

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

diff --git a/sw/qa/core/data/ww6/pass/ofz-redlining-1.doc 
b/sw/qa/core/data/ww6/pass/ofz-redlining-1.doc
new file mode 100644
index ..b2f60eb2a251
Binary files /dev/null and b/sw/qa/core/data/ww6/pass/ofz-redlining-1.doc differ
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 8e8d2f99bfd0..c9b994a76f94 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2028,6 +2028,7 @@ void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
 pRdr->m_xCtrlStck = std::move(mxOldStck);
 
 pRdr->m_xRedlineStack->closeall(*pRdr->m_pPaM->GetPoint());
+pRdr->m_aFrameRedlines.emplace(std::move(pRdr->m_xRedlineStack));
 pRdr->m_xRedlineStack = std::move(mxOldRedlines);
 
 pRdr->DeleteAnchorStack();
@@ -5298,6 +5299,8 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const 
*pGloss)
 // are updated
 m_aExtraneousParas.delete_all_from_doc();
 m_xRedlineStack->closeall(*m_pPaM->GetPoint());
+while (!m_aFrameRedlines.empty())
+m_aFrameRedlines.pop();
 m_xRedlineStack.reset();
 
 // For i120928,achieve the graphics from the special bookmark with is for 
graphic bullet
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 68e4063217a1..37d74e6c0d26 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1090,7 +1090,8 @@ private:
 This stack is for redlines, because their sequence of discovery can
 be out of order of their order of insertion into the document.
 */
-std::unique_ptr m_xRedlineStack;
+std::stack m_aFrameRedlines; 
//inside frames, tables, etc
+std::unique_ptr m_xRedlineStack;//main document
 
 /*
 This stack is for fields that get referenced later, e.g. BookMarks and TOX.
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 0bfeeb680fb8..56c45f4d5ba5 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2701,6 +2701,7 @@ void WW8TabDesc::MoveOutsideTable()
 void WW8TabDesc::FinishSwTable()
 {
 m_pIo->m_xRedlineStack->closeall(*m_pIo->m_pPaM->GetPoint());
+m_pIo->m_aFrameRedlines.emplace(std::move(m_pIo->m_xRedlineStack));
 m_pIo->m_xRedlineStack = std::move(mxOldRedlineStack);
 
 WW8DupProperties aDup(m_pIo->m_rDoc,m_pIo->m_xCtrlStck.get());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-26 Thread Justin Luth
 sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc |binary
 sw/source/filter/ww8/ww8graf2.cxx   |3 ++-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9e450605d8a5675a8bbabfffe167a72286f1731a
Author: Justin Luth 
Date:   Mon Apr 23 09:27:00 2018 +0300

tdf#117129 ww8import: prevent divide-by-zero

Before commit ffc3358515799057e72379b76a1165c6ea5a9bd1 for
tdf#75539, the divisor was hard-coded at 1000. The preceeding code
also notes that an undefined relativeWidth is forced to 1000.
So, on an invalid divisor, revert to previous behaviour.

Change-Id: I40210194eec39682d9ab3ce68268d343af16e2b1
Reviewed-on: https://gerrit.libreoffice.org/53308
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
Tested-by: Jenkins 
Reviewed-by: Justin Luth 

diff --git a/sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc 
b/sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc
new file mode 100644
index ..9fca8ef048ae
Binary files /dev/null and b/sw/qa/core/data/ww8/pass/tdf117129_dxagoal0.doc 
differ
diff --git a/sw/source/filter/ww8/ww8graf2.cxx 
b/sw/source/filter/ww8/ww8graf2.cxx
index 6cda45844ac1..2998c26f93f3 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -584,10 +584,11 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj 
const * pTextObj,
 relativeWidth = pRecord->isHorizontalRule ? 1000 : 0;
 if( relativeWidth != 0 )
 {
+const sal_Int16 nScale = aPic.dxaGoal ? aPic.dxaGoal : 
1000;
 aPic.mx = msword_cast(
 m_aSectionManager.GetPageWidth() -
 m_aSectionManager.GetPageRight() -
-m_aSectionManager.GetPageLeft()) * relativeWidth / 
aPic.dxaGoal;
+m_aSectionManager.GetPageLeft()) * relativeWidth / 
nScale;
 aPD = WW8PicDesc( aPic );
 // This SetSnapRect() call adjusts the size of the
 // object itself, no idea why it's this call (or even
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-23 Thread Miklos Vajna
 sw/qa/extras/htmlimport/data/image-lazy-read.html |   11 +++
 sw/qa/extras/htmlimport/htmlimport.cxx|8 
 sw/source/filter/html/htmlgrin.cxx|   21 +++--
 3 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit a0f5c5e6d16ef9e3db140a922912ff2a49a224b7
Author: Miklos Vajna 
Date:   Mon Apr 23 14:10:10 2018 +0200

sw HTML import: lazy-read inline images

Also prefer Graphic::GetPrefSize() over Graphic::GetSizePixel(), since the
previous does not swap in the image.

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

diff --git a/sw/qa/extras/htmlimport/data/image-lazy-read.html 
b/sw/qa/extras/htmlimport/data/image-lazy-read.html
new file mode 100644
index ..afc19a7a62d0
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/image-lazy-read.html
@@ -0,0 +1,11 @@
+
+
+aaa
+
+
+bbb
+
+
+
+
+
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index 5829cdcd4d31..fecd3c53b5b6 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -224,6 +224,14 @@ DECLARE_HTMLIMPORT_TEST(testImageWidthAuto, 
"image-width-auto.html")
 CPPUNIT_ASSERT_EQUAL(Size(1835, 560), rSize.GetSize());
 }
 
+DECLARE_HTMLIMPORT_TEST(testImageLazyRead, "image-lazy-read.html")
+{
+auto xGraphic = 
getProperty(getShape(1), "Graphic");
+Graphic aGraphic(xGraphic);
+// This failed, import loaded the graphic, it wasn't lazy-read.
+CPPUNIT_ASSERT(!aGraphic.isAvailable());
+}
+
 DECLARE_HTMLIMPORT_TEST(testChangedby, "meta-changedby.html")
 {
 SwXTextDocument* pTextDoc = dynamic_cast(mxComponent.get());
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index 869d92c3c435..cb25a316277f 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -480,8 +480,25 @@ IMAGE_SETEVENT:
 std::unique_ptr const pStream(aGraphicURL.getData());
 if (pStream)
 {
-if (ERRCODE_NONE == 
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, "", *pStream))
+GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
+aGraphic = rFilter.ImportUnloadedGraphic(*pStream);
+if (aGraphic)
+{
 sGrfNm.clear();
+
+if (!bHeightProvided || !bWidthProvided)
+{
+Size aPrefSize = aGraphic.GetPrefSize();
+nWidth = aPrefSize.getWidth();
+nHeight = aPrefSize.getHeight();
+}
+}
+
+if (!sGrfNm.isEmpty())
+{
+if (ERRCODE_NONE == rFilter.ImportGraphic(aGraphic, "", 
*pStream))
+sGrfNm.clear();
+}
 }
 }
 else if (m_sBaseURL.isEmpty() || !aGraphicData.isEmpty())
@@ -497,7 +514,7 @@ IMAGE_SETEVENT:
 aGraphic.SetDefaultType();
 }
 
-if (!bHeightProvided || !bWidthProvided)
+if (!nHeight || !nWidth)
 {
 Size aPixelSize = 
aGraphic.GetSizePixel(Application::GetDefaultDevice());
 if (!bWidthProvided)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-18 Thread Miklos Vajna
 sw/qa/extras/htmlexport/data/reqif-table2.odt |binary
 sw/qa/extras/htmlexport/htmlexport.cxx|   21 ++---
 sw/source/filter/html/htmltabw.cxx|   17 +
 3 files changed, 27 insertions(+), 11 deletions(-)

New commits:
commit b263c92250834993f954ed9535f67225d330861c
Author: Miklos Vajna 
Date:   Wed Apr 18 18:56:05 2018 +0200

sw XHTML export: close  for tables

By switching to HtmlWriter instead of manually constructing HTML
elements / attributes.

Also fix a validity problem for ReqIF (transitional XHTML still allows
that, so not depending on mbXHTML here).

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

diff --git a/sw/qa/extras/htmlexport/data/reqif-table2.odt 
b/sw/qa/extras/htmlexport/data/reqif-table2.odt
new file mode 100644
index ..772dde0dd6a9
Binary files /dev/null and b/sw/qa/extras/htmlexport/data/reqif-table2.odt 
differ
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index bafe6798c8c4..a582ac00b41a 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -56,9 +56,12 @@ private:
 setFilterOptions("XHTML");
 else if (getTestName().indexOf("ReqIf") != -1)
 {
-setImportFilterOptions("xhtmlns=reqif-xhtml");
-// Bypass filter detect.
-setImportFilterName("HTML (StarWriter)");
+if (OString(filename).endsWith(".xhtml"))
+{
+setImportFilterOptions("xhtmlns=reqif-xhtml");
+// Bypass filter detect.
+setImportFilterName("HTML (StarWriter)");
+}
 // Export options (implies XHTML).
 setFilterOptions("xhtmlns=reqif-xhtml");
 }
@@ -475,6 +478,18 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable, 
"reqif-table.xhtml")
 assertXPathNoAttribute(pDoc, "/html/body/div/table/tr/th", "bgcolor");
 }
 
+DECLARE_HTMLEXPORT_TEST(testReqIfTable2, "reqif-table2.odt")
+{
+SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+CPPUNIT_ASSERT(pStream);
+pStream->Seek(STREAM_SEEK_TO_END);
+sal_uInt64 nLength = pStream->Tell();
+pStream->Seek(0);
+OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+// This failed,  was written.
+CPPUNIT_ASSERT(aStream.indexOf("") != -1);
+}
+
 DECLARE_HTMLEXPORT_TEST(testReqIfList, "reqif-list.xhtml")
 {
 SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index 0b73f5687afe..28a2d416075a 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -340,6 +340,10 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
 nWidth = GetAbsWidth( nCol, nColSpan );
 }
 
+if (rWrt.mbReqIF)
+// ReqIF implies strict XHTML: no width for .
+bOutWidth = false;
+
 long nHeight = pCell->GetHeight() > 0
 ? GetAbsHeight( pCell->GetHeight(), nRow, nRowSpan )
 : 0;
@@ -734,8 +738,8 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 
 const SwWriteTableCol *pColumn = m_aCols[nCol];
 
-OStringBuffer sOutStr;
-sOutStr.append('<').append(rWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_col);
+HtmlWriter html(rWrt.Strm(), rWrt.maNamespace);
+html.start(OOO_STRING_SVTOOLS_HTML_col);
 
 sal_uInt32 nWidth;
 bool bRel;
@@ -750,14 +754,11 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 nWidth = bRel ? GetRelWidth(nCol,1) : GetAbsWidth(nCol,1);
 }
 
-sOutStr.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width).
-append("=\"");
 if( bRel )
-sOutStr.append(static_cast(nWidth)).append('*');
+html.attribute(OOO_STRING_SVTOOLS_HTML_O_width, 
OString::number(nWidth) + "*");
 else
-
sOutStr.append(static_cast(SwHTMLWriter::ToPixel(nWidth,false)));
-sOutStr.append("\">");
-rWrt.Strm().WriteCharPtr( sOutStr.makeStringAndClear().getStr() );
+html.attribute(OOO_STRING_SVTOOLS_HTML_O_width, 
OString::number(SwHTMLWriter::ToPixel(nWidth,false)));
+html.end();
 
 if( bColGroups && pColumn->bRightBorder && nColhttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-18 Thread Miklos Vajna
 sw/qa/extras/htmlimport/data/image-size.html |   25 +
 sw/qa/extras/htmlimport/data/libreoffice.jpg |binary
 sw/qa/extras/htmlimport/htmlimport.cxx   |   13 +
 sw/source/filter/html/htmlgrin.cxx   |   14 ++
 4 files changed, 52 insertions(+)

New commits:
commit 84854917835b13851d4855fa5eb30036a38b9166
Author: Miklos Vajna 
Date:   Wed Apr 18 09:46:34 2018 +0200

sw HTML import: use GraphicDescriptor to determine default size

Rather than the hardcoded HTML_DFLT_IMG_WIDTH / HTML_DFLT_IMG_HEIGHT
defines.

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

diff --git a/sw/qa/extras/htmlimport/data/image-size.html 
b/sw/qa/extras/htmlimport/data/image-size.html
new file mode 100644
index ..a26c606100cf
--- /dev/null
+++ b/sw/qa/extras/htmlimport/data/image-size.html
@@ -0,0 +1,25 @@
+
+
+
+   
+   
+   
+   @page { size: 21.59cm 27.94cm; margin: 2cm }
+   p { margin-bottom: 0.25cm; line-height: 115%; background: 
transparent }
+   
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/qa/extras/htmlimport/data/libreoffice.jpg 
b/sw/qa/extras/htmlimport/data/libreoffice.jpg
new file mode 100644
index ..14af080b147f
Binary files /dev/null and b/sw/qa/extras/htmlimport/data/libreoffice.jpg differ
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx 
b/sw/qa/extras/htmlimport/htmlimport.cxx
index fa06d7a1a64c..5829cdcd4d31 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -313,6 +313,19 @@ DECLARE_HTMLIMPORT_TEST(testReqIfBr, "reqif-br.xhtml")
 CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("aaa\nbbb"));
 }
 
+DECLARE_HTMLIMPORT_TEST(testImageSize, "image-size.html")
+{
+awt::Size aSize = getShape(1)->getSize();
+OutputDevice* pDevice = Application::GetDefaultDevice();
+Size aPixelSize(200, 400);
+Size aExpected = pDevice->PixelToLogic(aPixelSize, 
MapMode(MapUnit::Map100thMM));
+
+// This was 1997, i.e. a hardcoded default, we did not look at the image
+// header when the HTML markup declared no size.
+CPPUNIT_ASSERT_EQUAL(static_cast(aExpected.getWidth()), 
aSize.Width);
+CPPUNIT_ASSERT_EQUAL(static_cast(aExpected.getHeight()), 
aSize.Height);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index dfda37fd0dc3..869d92c3c435 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -620,6 +620,20 @@ IMAGE_SETEVENT:
 bool bSetScaleImageMap = false;
 sal_uInt8 nPrcWidth = 0, nPrcHeight = 0;
 
+if (!nWidth || !nHeight)
+{
+GraphicDescriptor aDescriptor(aGraphicURL);
+if (aDescriptor.Detect(/*bExtendedInfo=*/true))
+{
+// Try to use size info from the image header before defaulting to
+// HTML_DFLT_IMG_WIDTH/HEIGHT.
+aTwipSz = 
Application::GetDefaultDevice()->PixelToLogic(aDescriptor.GetSizePixel(),
+
MapMode(MapUnit::MapTwip));
+nWidth = aTwipSz.getWidth();
+nHeight = aTwipSz.getHeight();
+}
+}
+
 if( !nWidth || !nHeight )
 {
 // When the graphic is in a table, it will be requested immediately,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-18 Thread Patrick Jaap
 sw/qa/extras/odfimport/data/tdf116195.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx  |8 
 sw/source/filter/xml/xmlimp.cxx   |2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit fe3d5766fa3c42f6cf8d1ea47af820e0b1c1cf48
Author: Patrick Jaap 
Date:   Tue Apr 10 15:29:56 2018 +0200

tdf#116195 swap a compatibility value

There was a minor bug in the compat flag, leading
to a regression from commit 8d62b79f168180c6992eb483ec864d473050635f

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

diff --git a/sw/qa/extras/odfimport/data/tdf116195.odt 
b/sw/qa/extras/odfimport/data/tdf116195.odt
new file mode 100644
index ..21a601f69d66
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf116195.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 1d4737318517..3b879d9f82ff 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -902,5 +902,13 @@ DECLARE_ODFIMPORT_TEST(testTdf108482, "tdf108482.odt")
 );
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf116195, "tdf116195.odt")
+{
+// The image was set to zero height due to a regression
+CPPUNIT_ASSERT_EQUAL(
+sal_Int32(12960), 
parseDump("/root/page/anchored/fly/notxt/infos/bounds", "height").toInt32()
+);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 8def02edd002..64c71c6fb46b 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1620,7 +1620,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence 
< PropertyValue > & aC
 if (!bSubtractFlysAnchoredAtFlys)
 xProps->setPropertyValue("SubtractFlysAnchoredAtFlys", makeAny(true));
 
-if ( !bDisableOffPagePositioning )
+if ( bDisableOffPagePositioning )
 xProps->setPropertyValue("DisableOffPagePositioning", makeAny(true));
 
 SwDoc *pDoc = getDoc();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-17 Thread Gabor Kelemen
 sw/qa/core/test_ToxLinkProcessor.cxx  |1 -
 sw/source/core/access/accpara.cxx |1 -
 sw/source/core/access/accportions.cxx |1 -
 sw/source/core/crsr/viscrs.cxx|1 -
 sw/source/core/doc/docedt.cxx |1 -
 sw/source/core/doc/docfld.cxx |1 -
 sw/source/core/doc/poolfmt.cxx|1 -
 sw/source/core/frmedt/feshview.cxx|1 -
 sw/source/core/swg/swblocks.cxx   |1 -
 sw/source/core/tox/ToxLinkProcessor.cxx   |1 -
 sw/source/core/unocore/unoidx.cxx |1 -
 sw/source/core/unocore/unoobj2.cxx|1 -
 sw/source/core/view/viewimp.cxx   |1 -
 sw/source/core/view/viewpg.cxx|2 --
 sw/source/core/view/vprint.cxx|1 -
 sw/source/filter/html/swhtml.cxx  |1 -
 sw/source/filter/ww8/ww8par.cxx   |1 -
 sw/source/ui/dialog/swdlgfact.cxx |1 -
 sw/source/ui/dochdl/selglos.cxx   |1 -
 sw/source/ui/index/cntex.cxx  |1 -
 sw/source/ui/misc/swmodalredlineacceptdlg.cxx |1 -
 sw/source/ui/utlui/swrenamexnameddlg.cxx  |1 -
 sw/source/uibase/app/apphdl.cxx   |2 --
 sw/source/uibase/app/swdll.cxx|2 --
 sw/source/uibase/dbui/dbtree.cxx  |1 -
 sw/source/uibase/dialog/regionsw.cxx  |1 -
 sw/source/uibase/docvw/PageBreakWin.cxx   |1 -
 sw/source/uibase/docvw/edtwin.cxx |1 -
 sw/source/uibase/docvw/romenu.cxx |1 -
 sw/source/uibase/envelp/syncbtn.cxx   |1 -
 sw/source/uibase/index/idxmrk.cxx |1 -
 sw/source/uibase/shells/beziersh.cxx  |1 -
 sw/source/uibase/shells/drformsh.cxx  |1 -
 sw/source/uibase/shells/drwbassh.cxx  |1 -
 sw/source/uibase/shells/drwtxtex.cxx  |1 -
 sw/source/uibase/shells/drwtxtsh.cxx  |1 -
 sw/source/uibase/shells/grfsh.cxx |1 -
 sw/source/uibase/shells/grfshex.cxx   |1 -
 sw/source/uibase/shells/listsh.cxx|1 -
 sw/source/uibase/shells/mediash.cxx   |1 -
 sw/source/uibase/shells/navsh.cxx |1 -
 sw/source/uibase/shells/olesh.cxx |1 -
 sw/source/uibase/shells/textdrw.cxx   |2 --
 sw/source/uibase/shells/textsh2.cxx   |1 -
 sw/source/uibase/shells/txtattr.cxx   |1 -
 sw/source/uibase/uiview/view.cxx  |1 -
 sw/source/uibase/uiview/view0.cxx |1 -
 sw/source/uibase/uiview/viewmdi.cxx   |1 -
 sw/source/uibase/utlui/gloslst.cxx|2 --
 sw/source/uibase/utlui/uitool.cxx |1 -
 sw/source/uibase/web/wformsh.cxx  |1 -
 sw/source/uibase/web/wfrmsh.cxx   |1 -
 sw/source/uibase/web/wgrfsh.cxx   |1 -
 sw/source/uibase/web/wlistsh.cxx  |1 -
 sw/source/uibase/web/wolesh.cxx   |1 -
 sw/source/uibase/web/wtabsh.cxx   |1 -
 sw/source/uibase/web/wtextsh.cxx  |1 -
 sw/source/uibase/web/wview.cxx|1 -
 58 files changed, 63 deletions(-)

New commits:
commit b3f094c2573de12bf3d386f19b924b536cb89af0
Author: Gabor Kelemen 
Date:   Mon Mar 26 01:49:01 2018 +0200

tdf#42949 Remove unnecessary localization headers from sw

Found by searching for the header names and the localization function:
git grep -l -e \ sw | xargs grep -c -e SwResId -e 
StartProgress -e GetResource | grep :0$ | grep -v /pch

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

diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx 
b/sw/qa/core/test_ToxLinkProcessor.cxx
index 00c10aa16271..c4998751a640 100644
--- a/sw/qa/core/test_ToxLinkProcessor.cxx
+++ b/sw/qa/core/test_ToxLinkProcessor.cxx
@@ -20,7 +20,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 5a779d55548a..238fcfa62f83 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -42,7 +42,6 @@
 #include 
 #include 
 #include "accpara.hxx"
-#include 
 #include "accportions.hxx"
 #include 
 #include 
diff --git a/sw/source/core/access/accportions.cxx 
b/sw/source/core/access/accportions.cxx
index a4c2009ed7f8..48be5185f308 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -24,7 +24,6 @@
 #include 
 
 // for portion replacement in Special()
-#include 
 #include 
 
 // for GetWordBoundary(...), GetSentenceBoundary(...):
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx

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

2018-04-17 Thread Miklos Vajna
 sw/qa/extras/layout/data/tdf116848.odt |binary
 sw/qa/extras/layout/layout.cxx |9 +
 sw/source/core/layout/findfrm.cxx  |5 -
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit e4b335fac90a2128a5df3641050d6382883de1e8
Author: Miklos Vajna 
Date:   Mon Apr 16 22:14:12 2018 +0200

tdf#116848 sw, sections in tables: no split in headers or footers

The motivation for split section-in-tables was multiple pages, so
disabling it for headers/footers is not a problem, and fixes the layout
loop.

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

diff --git a/sw/qa/extras/layout/data/tdf116848.odt 
b/sw/qa/extras/layout/data/tdf116848.odt
new file mode 100644
index ..e3a96c78a521
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf116848.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 9a73e2025147..aa2146354fc0 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -19,11 +19,13 @@ public:
 void testTdf116830();
 void testTdf116925();
 void testTdf117028();
+void testTdf116848();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
 CPPUNIT_TEST(testTdf116925);
 CPPUNIT_TEST(testTdf117028);
+CPPUNIT_TEST(testTdf116848);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -108,6 +110,13 @@ void SwLayoutWriter::testTdf117028()
 assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
 }
 
+void SwLayoutWriter::testTdf116848()
+{
+SwDoc* pDoc = createDoc("tdf116848.odt");
+// This resulted in a layout loop.
+pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/layout/findfrm.cxx 
b/sw/source/core/layout/findfrm.cxx
index 60b37f363555..baca3edfa189 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1265,9 +1265,12 @@ static bool lcl_IsInSectionDirectly( const SwFrame *pUp )
 else if( pUp->IsSctFrame() )
 {
 auto pSection = static_cast(pUp);
+const SwFrame* pHeaderFooter = pSection->FindFooterOrHeader();
+// When the section frame is not in header/footer:
 // Allow move of frame in case our only column is not growable.
 // Also allow if there is a previous section frame (to move back).
-return bSeenColumn || !pSection->Growable() || 
pSection->GetPrecede();
+bool bAllowOutsideHeaderFooter = !pSection->Growable() || 
pSection->GetPrecede();
+return bSeenColumn || (!pHeaderFooter && 
bAllowOutsideHeaderFooter);
 }
 else if( pUp->IsTabFrame() )
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-16 Thread Miklos Vajna
 sw/qa/extras/layout/data/tdf117028.docx |binary
 sw/qa/extras/layout/layout.cxx  |   24 
 sw/source/core/access/accpara.cxx   |2 +-
 sw/source/core/doc/notxtfrm.cxx |2 +-
 sw/source/core/inc/frame.hxx|3 ++-
 sw/source/core/layout/paintfrm.cxx  |   23 ++-
 sw/source/core/text/inftxt.cxx  |2 +-
 sw/source/core/txtnode/fntcache.cxx |2 +-
 8 files changed, 44 insertions(+), 14 deletions(-)

New commits:
commit d9420a64fbb288020d33b681f40a858db49afca7
Author: Miklos Vajna 
Date:   Mon Apr 16 10:11:26 2018 +0200

tdf#117028 sw: conditionally consider fill of shape for in-textbox auto 
color

Commit f966767e1ccfa432da33e1a0fd6de69e17a36bc3 (tdf#116925 sw: consider
fill styles of shape for in-textbox auto color, 2018-04-10) did this
unconditionally, but there are two cases:

1) Shape (with textbox) has a fill, in that case auto text color of
textbox should consider the shape fill.

2) Shape has no fill, in that case the shape fill should not be
considered when counting the background of a transparent fly frame.

Fix 2) without breaking 1) by making the change to
SwFrame::GetBackgroundBrush() opt-in, and only use it for auto font
color, not in other cases.

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

diff --git a/sw/qa/extras/layout/data/tdf117028.docx 
b/sw/qa/extras/layout/data/tdf117028.docx
new file mode 100644
index ..877264b4db33
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf117028.docx differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 3709e306f53d..9a73e2025147 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -18,10 +18,12 @@ class SwLayoutWriter : public SwModelTestBase
 public:
 void testTdf116830();
 void testTdf116925();
+void testTdf117028();
 
 CPPUNIT_TEST_SUITE(SwLayoutWriter);
 CPPUNIT_TEST(testTdf116830);
 CPPUNIT_TEST(testTdf116925);
+CPPUNIT_TEST(testTdf117028);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -84,6 +86,28 @@ void SwLayoutWriter::testTdf116925()
 
"/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/push[3]/textcolor[@color='#ff']",
 1);
 }
 
+void SwLayoutWriter::testTdf117028()
+{
+SwDoc* pDoc = createDoc("tdf117028.docx");
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Dump the rendering of the first page as an XML file.
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+MetafileXmlDump dumper;
+xmlDocPtr pXmlDoc = dumper.dumpAndParse(*xMetaFile);
+CPPUNIT_ASSERT(pXmlDoc);
+
+// The only polypolygon in the rendering result was the white background we
+// want to avoid.
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "//polypolygon");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+CPPUNIT_ASSERT_EQUAL(0, xmlXPathNodeSetGetLength(pXmlNodes));
+xmlXPathFreeObject(pXmlObj);
+
+// Make sure the text is still rendered.
+assertXPathContent(pXmlDoc, "//textarray/text", "Hello");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index f2dff93ebf2c..5a779d55548a 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -994,7 +994,7 @@ static bool lcl_GetBackgroundColor( Color & rColor,
 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
 
 if ( pFrame &&
- pFrame->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, 
pSectionTOXColor, aDummyRect, false ) )
+ pFrame->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, 
pSectionTOXColor, aDummyRect, false, /*bConsiderTextBox=*/false ) )
 {
 if ( pSectionTOXColor )
 {
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 4c6c8ffc80e9..6dd910fab9ee 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -187,7 +187,7 @@ static void lcl_ClearArea( const SwFrame ,
 SwRect aOrigRect;
 drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes;
 
-if ( rFrame.GetBackgroundBrush( aFillAttributes, pItem, pCol, 
aOrigRect, false ) )
+if ( rFrame.GetBackgroundBrush( aFillAttributes, pItem, pCol, 
aOrigRect, false, /*bConsiderTextBox=*/false ) )
 {
 SwRegionRects const region(rPtArea);
 basegfx::utils::B2DClipState aClipState;
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index ee21f12bd6f0..b9d90f9a0f37 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -557,7 +557,8 @@ 

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

2018-04-16 Thread Patrick Jaap
 sw/qa/extras/ooxmlimport/data/tdf116486.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |6 ++
 sw/source/core/text/itrform2.cxx |   12 
 3 files changed, 18 insertions(+)

New commits:
commit d07fc485d46f431405a3f6a002f951a08c559677
Author: Patrick Jaap 
Date:   Tue Apr 10 13:24:04 2018 +0200

tdf#116486 Consider upper margin in paragraph positioning with flys

The problem was the following:
There is a paragraph with an upper margin defined. Also, there
is a flyframe intersecting this upper margin. The desired behavior
is to reposition the parapgraph, such that it (including it's upper
margin) is located below the flyframe.

This patch increases the bounding rectangle of the paragraph by the
upper margin.

For compatibility, there is a compat-flag query. I re-used a related one.

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

diff --git a/sw/qa/extras/ooxmlimport/data/tdf116486.docx 
b/sw/qa/extras/ooxmlimport/data/tdf116486.docx
new file mode 100644
index ..c6a4891b0cf4
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf116486.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index ef0d085e699c..439658a63b39 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1586,6 +1586,12 @@ DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx")
 CPPUNIT_ASSERT_EQUAL(static_cast(0), xDrawPage->getCount());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx")
+{
+OUString aTop = parseDump("/root/page/body/txt/Special", "nHeight");
+CPPUNIT_ASSERT_EQUAL( OUString("4006"), aTop );
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in 
ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 7fc2ae4005df..f05a5f872509 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2278,12 +2278,24 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo 
 )
 SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X()
   + nLeftMar - nLeftMin , nHeight );
 
+// tdf#116486: consider also the upper margin from getFramePrintArea 
because intersections
+// with this additional space should lead to repositioning of 
paragraphs
+// For compatibility we grab a related compat flag:
+if ( 
GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS)
 )
+{
+const long nUpper = m_pFrame->getFramePrintArea().Top();
+// Increase the rectangle
+if( nUpper > 0 && nTop >= nUpper  )
+aLine.SubTop( nUpper );
+}
 SwRect aLineVert( aLine );
 if ( m_pFrame->IsRightToLeft() )
 m_pFrame->SwitchLTRtoRTL( aLineVert );
 
 if ( m_pFrame->IsVertical() )
 m_pFrame->SwitchHorizontalToVertical( aLineVert );
+
+// GetFrame(...) determines and returns the intersection rectangle
 SwRect aInter( rTextFly.GetFrame( aLineVert ) );
 
 if ( m_pFrame->IsRightToLeft() )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-04-13 Thread Miklos Vajna
 sw/qa/extras/ooxmlexport/data/tdf116985.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   10 ++
 sw/source/core/layout/anchoreddrawobject.cxx |   17 -
 3 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit c8b976ac64c9cac360f7c4fd9844fcfac7ba25a8
Author: Miklos Vajna 
Date:   Fri Apr 13 15:09:53 2018 +0200

tdf#116985 sw: fix geometry of textbox of shape with relative size

Relative size of shapes are calculated by the layout, so the normal doc
model-level synchronization between the shape and its textbox was not
enough.

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116985.docx 
b/sw/qa/extras/ooxmlexport/data/tdf116985.docx
new file mode 100644
index ..2a8e2023884d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116985.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index ea584e6c6ef9..9e7d943d3e37 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -359,6 +359,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116976, "tdf116976.docx")
  getProperty(getShape(1), "RelativeWidth"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116985, "tdf116985.docx")
+{
+// Body frame width is 10800, 40% is the requested relative width, with 144
+// spacing to text on the left/right side.  So ideal width would be 4032,
+// was 3431. Allow one pixel tolerance, though.
+sal_Int32 nWidth
+= parseDump("/root/page[1]/body/txt[1]/anchored/fly/infos/bounds", 
"width").toInt32();
+CPPUNIT_ASSERT(nWidth > 4000);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx 
b/sw/source/core/layout/anchoreddrawobject.cxx
index 8f96c6fd8bca..e1afbd3feb3a 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -32,6 +32,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -659,9 +661,22 @@ const SwRect SwAnchoredDrawObject::GetObjBoundRect() const
 
 bool bEnableSetModified = 
pDoc->getIDocumentState().IsEnableSetModified();
 pDoc->getIDocumentState().SetEnableSetModified(false);
-const_cast< SdrObject* >( GetDrawObj() )->Resize( 
aCurrObjRect.TopLeft(),
+auto pObject = const_cast(GetDrawObj());
+pObject->Resize( aCurrObjRect.TopLeft(),
 Fraction( nTargetWidth, aCurrObjRect.GetWidth() ),
 Fraction( nTargetHeight, aCurrObjRect.GetHeight() ), false 
);
+
+if (SwFrameFormat* pFrameFormat = FindFrameFormat(pObject))
+{
+if (SwTextBoxHelper::isTextBox(pFrameFormat, RES_DRAWFRMFMT))
+{
+// Shape has relative size and also a textbox, update its 
text area as well.
+uno::Reference 
xShape(pObject->getUnoShape(), uno::UNO_QUERY);
+SwTextBoxHelper::syncProperty(pFrameFormat, RES_FRM_SIZE, 
MID_FRMSIZE_SIZE,
+  
uno::makeAny(xShape->getSize()));
+}
+}
+
 pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   4   5   6   7   8   >