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

2020-08-13 Thread Vasily Melenchuk (via logerrit)
 sw/inc/IDocumentSettingAccess.hxx  |3 ++-
 sw/qa/extras/ooxmlexport/data/128197_compat14.docx |binary
 sw/qa/extras/ooxmlexport/data/128197_compat15.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |   15 +++
 sw/source/core/doc/DocumentSettingManager.cxx  |7 +++
 sw/source/core/inc/DocumentSettingManager.hxx  |1 +
 sw/source/core/text/itrform2.cxx   |   10 ++
 sw/source/uibase/uno/SwXDocumentSettings.cxx   |   13 +
 writerfilter/source/dmapper/SettingsTable.cxx  |8 
 9 files changed, 56 insertions(+), 1 deletion(-)

New commits:
commit ed79b0f274c913ce8206a68a2ca9296b84ac0751
Author: Vasily Melenchuk 
AuthorDate: Thu Jun 11 09:45:03 2020 +0300
Commit: Thorsten Behrens 
CommitDate: Thu Aug 13 11:13:49 2020 +0200

tdf#128197: sw: different line height for DOCX with compat=14

Lines containing just a shape inline without any other text are
treated in DOCX with compatibility option 15 and 14 in a different
way: while compat=15 is layouting line exatly as LO does, in
compat=14 mode minimal line height takes into account just shape
height and not current font.

Change-Id: Id2bdab941a0bbaa9080567d736435d9e0babd490
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96080
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100542

diff --git a/sw/inc/IDocumentSettingAccess.hxx 
b/sw/inc/IDocumentSettingAccess.hxx
index f182027ded95..814f139b64fc 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -63,7 +63,8 @@ enum class DocumentSettingId
 
 // tdf#104349 tdf#104668
 MS_WORD_COMP_TRAILING_BLANKS,
-
+// tdf#128197 MS Word in some modes can have line height based on shape 
height, not on font
+MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY,
 UNIX_FORCE_ZERO_EXT_LEADING,
 TABS_RELATIVE_TO_INDENT,
 PROTECT_FORM,
diff --git a/sw/qa/extras/ooxmlexport/data/128197_compat14.docx 
b/sw/qa/extras/ooxmlexport/data/128197_compat14.docx
new file mode 100644
index ..507e28396019
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/128197_compat14.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/data/128197_compat15.docx 
b/sw/qa/extras/ooxmlexport/data/128197_compat15.docx
new file mode 100644
index ..d618b117cfec
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/128197_compat15.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 237e19092d1a..18a22bbdd30c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -35,6 +35,21 @@ protected:
 }
 };
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf128197)
+{
+load(mpTestDocumentPath, "128197_compat14.docx");
+xmlDocPtr pLayout14 = parseLayoutDump();
+sal_Int32 nHeight14 = getXPath(pLayout14, 
"//page[1]/body/txt[1]/infos/bounds", "height").toInt32();
+
+load(mpTestDocumentPath, "128197_compat15.docx");
+xmlDocPtr pLayout15 = parseLayoutDump();
+sal_Int32 nHeight15 = getXPath(pLayout15, 
"//page[1]/body/txt[1]/infos/bounds", "height").toInt32();
+
+// In compat mode=14 second line has size of the shape thus entire 
paragraph height is smaller
+// So nHeight14 < nHeight15
+CPPUNIT_ASSERT_LESS(nHeight15, nHeight14);
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf78749, "tdf78749.docx")
 {
 //Shape lost the background image before, now check if it still has...
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx 
b/sw/source/core/doc/DocumentSettingManager.cxx
index 11210614c56f..b7f3af73d2af 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -76,6 +76,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc 
)
 mbTabRelativeToIndent(true),
 mbProtectForm(false), // i#78591#
 mbMsWordCompTrailingBlanks(false), // tdf#104349 tdf#104668
+mbMsWordCompMinLineHeightByFly(false),
 mbInvertBorderSpacing (false),
 mbCollapseEmptyCellPara(true),
 mbTabAtLeftIndentForParagraphsInList(false), //#i89181#
@@ -181,6 +182,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ 
DocumentSettingId id) const
 case DocumentSettingId::PROTECT_FORM: return mbProtectForm;
 // tdf#104349 tdf#104668
 case DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS: return 
mbMsWordCompTrailingBlanks;
+case DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY: return 
mbMsWordCompMinLineHeightByFly;
 // #i89181#
 case DocumentSettingId::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: return 
mbTabAtLeftIndentForParagraphsInList;
 case DocumentSettingId::INVERT_BORDER_SPACING: return 
mbInvertBorderSpacing;
@@ -327,6 +329,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ 
DocumentSettingId id, 

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

2020-03-25 Thread Caolán McNamara (via logerrit)
 sw/inc/doc.hxx  |3 +++
 sw/inc/unomap.hxx   |1 +
 sw/qa/core/data/ww6/pass/ofz21168-1.doc |binary
 sw/source/core/doc/docnew.cxx   |1 +
 sw/source/core/undo/undobj.cxx  |4 ++--
 sw/source/core/unocore/unomap.cxx   |1 +
 sw/source/filter/basflt/shellio.cxx |7 +++
 sw/source/uibase/uno/unotxdoc.cxx   |   12 
 writerfilter/source/filter/RtfFilter.cxx|   14 ++
 writerfilter/source/filter/WriterFilter.cxx |5 +
 10 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit 0185241456971f06a7795fb4f304317027f50db9
Author: Caolán McNamara 
AuthorDate: Thu Mar 12 12:43:10 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Mar 25 14:35:46 2020 +0100

ofz#21168 sw,writerfilter: limit writerfilter hack to writerfilter

The problem is that at the end of WW8 import, a delete redline is
inserted that ends up calling DeleteAndJoin from inside
AppendRedline(). A fly is anchored AT_CHAR at (node 46, offset 0)
and the deletion goes from (node 46, offset 0) to
(node 48, offset 13) hence the special case check in
IsDestroyFrameAnchoredAtChar() for the IsInReading() prevents it
from being deleted, and then its anchor is still registered at the
node 46 when it gets deleted.

So try to restrict the WriterfilterHack to writerfilter, so it won't
affect WW8 import.

Unfortunately this is far less obvious than expected, because import can
happen for creating a new file, in which case it's all done via UNO in
writerfilter, or when inserting into an existing file, in which case
SwReader::Read() is used.

The SwDocShell's pMedium can't be used becuse in insert file case it
will be the loaded file, not the inserted file.

There isn't any obvious alternative to adding a silly UNO property for
the writerfilter to use.

Change-Id: Ia7fdc9bb1925202f6692ebee6e4b6b1fe50e5345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90384
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit c4dab726caaa73be9f9c731312080143b0a0b89d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90951

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c5075b20f844..b80e1157a7c9 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -301,6 +301,7 @@ private:
 bool mbInReading : 1;//< TRUE: Document is in the process 
of being read.
 bool mbInMailMerge   : 1;//< TRUE: Document is in the process 
of being written by mail merge.
 bool mbInXMLImport   : 1;//< TRUE: During xml import, 
attribute portion building is not necessary.
+bool mbInWriterfilterImport  : 1;//< TRUE: writerfilter import 
(DOCX,RTF)
 bool mbUpdateTOX : 1;//< TRUE: After loading document, 
update TOX.
 bool mbInLoadAsynchron   : 1;//< TRUE: Document is in the process 
of being loaded asynchronously.
 bool mbIsAutoFormatRedline   : 1;//< TRUE: Redlines are recorded by 
Autoformat.
@@ -962,6 +963,8 @@ public:
 
 bool IsInXMLImport() const { return mbInXMLImport; }
 void SetInXMLImport( bool bNew ) { mbInXMLImport = bNew; }
+bool IsInWriterfilterImport() const { return mbInWriterfilterImport; }
+void SetInWriterfilterImport(bool const b) { mbInWriterfilterImport = b; }
 
 // Manage types of tables/indices
 sal_uInt16 GetTOXTypeCount( TOXTypes eTyp ) const;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 36f8766e0e03..caee6bc5c209 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -245,6 +245,7 @@ struct SfxItemPropertyMapEntry;
 #define WID_DOC_LOCK_UPDATES1016
 #define WID_DOC_HAS_VALID_SIGNATURES1017
 #define WID_DOC_INTEROP_GRAB_BAG1018
+#define WID_DOC_WRITERFILTER1019
 #define WID_DOC_BUILDID 1024
 #define WID_DOC_ISTEMPLATEID1025
 #define WID_DOC_DEFAULT_PAGE_MODE   1069
diff --git a/sw/qa/core/data/ww6/pass/ofz21168-1.doc 
b/sw/qa/core/data/ww6/pass/ofz21168-1.doc
new file mode 100644
index ..3bafb1d36bf7
Binary files /dev/null and b/sw/qa/core/data/ww6/pass/ofz21168-1.doc differ
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 21d250ce59c3..984f2335bc45 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -242,6 +242,7 @@ SwDoc::SwDoc()
 mbInReading(false),
 mbInMailMerge(false),
 mbInXMLImport(false),
+mbInWriterfilterImport(false),
 mbUpdateTOX(false),
 mbInLoadAsynchron(false),
 mbIsAutoFormatRedline(false),
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 378df9595e50..3b3f8f2fd583 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@