rhbz#988516: DOCX import: fix context stack when importing header/footer

When a header/footer substream is parsed, a ParagraphGroup is started,
but not ended; so the properties of the last paragraph in the
header/footer are applied to a paragraph in the body.

The obvious fix to add a call to endParagraphGroup() at the end of w:p
element breaks table cells.  So add a call to endParagraphGroup() at
the end of the "hdr"/"ftr" element.

(The problem in the bugdoc became much more visible with commit
ca555c596043c88894b964ac5e21f5a7271d5f3b, but was there before)

Change-Id: Ib054f1882793049b39424c1076ba5d4b319cd027
(cherry picked from commit 2b78f2cd7b9e4bab0f3b3b9119238f36a1bbc7b2)
Reviewed-on: https://gerrit.libreoffice.org/8477
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
fdo#60833 user's wordbook should be selected by default

Change-Id: Ic710f719df3ba71a8b71e6ef8afd54d60e73c5d9
Reviewed-on: https://gerrit.libreoffice.org/8493
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
fdo#74854: better loose selection than crashing

- this is just a bandaid

Change-Id: Iebd901a9e88967e00e235f7f8849c48246e950d1
Reviewed-on: https://gerrit.libreoffice.org/8491
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
rhbz#1072607: (hopefully) fix crash in SvxRuler::MouseMove()

Not sure why mpParaItem is 0 here, add a check like in every other
SvxRuler method.

(regression from 47a77d7dbc427e51421e2df8d59695834cb74980)

Change-Id: Ic11a4d0c9b6ca217cd59d1d3f6789592996d2c1d
(cherry picked from commit 958616a323b7fe6b42cd642394cd90a9cd82e7f9)
Reviewed-on: https://gerrit.libreoffice.org/8492
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
fdo#75538 R^2 calculation of trendline similar to LINEST function

Modify for forced intercept of trendline, calculation of R^2 in the same
way as LINEST function does calculation
Update fo 4.2

Change-Id: I06ba4e7f5e07f7db150e1bf1070870bf64ad6f61
Reviewed-on: https://gerrit.libreoffice.org/8462
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
fdo#67104 Use correct command for show grid

Not sure why .uno:ViewGridLines & SID_SCGRIDSHOW were
introduced (in "merge sidebar feature" and related commits).

Reviewed-on: https://gerrit.libreoffice.org/8459
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit c3403ac888c2e62edaf8befe7982f5f8cc95c16f)

Conflicts:
	sc/sdi/scalc.sdi
	sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx

Change-Id: I90bdfaef86adcbfa44129b8f7f9df61ca7f35114
Reviewed-on: https://gerrit.libreoffice.org/8463
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
fdo#75718: Correctly count the length of trailing empty range.

This affects auto fill, apparently.

Change-Id: I653918d374122bc9bb938231934c149da79a3306
(cherry picked from commit 01de94471c20a8b9c36d6080638d70e57eac55bf)
Reviewed-on: https://gerrit.libreoffice.org/8501
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Various fixes (memory leak & crash) in the OpenCL interpreter code.

Pre-compiling of OpenCL kernel is disabled with this change.

(cherry picked from commit b981c089a9194f33b46272e3f4efa117241ea533)
(cherry picked from commit e253d46af3b47afd0006084bec89b02473ee457a)
(cherry picked from commit 0d7f89b021f1354a0fa607862296b11c9fd8a4dd)
(cherry picked from commit 5325137783825c498ed4236080ed7fe51cdec09a)
(cherry picked from commit 20ed6886ade81ee015a22b2eb3aeff64691971bf)
(cherry picked from commit 7a0ed3a406bd14bb2b52c383282daf4777ba76e0)

Conflicts:
	sc/source/core/data/formulacell.cxx

Change-Id: Iae97f4f877c329f443c7d222c6a2016678af2387
Reviewed-on: https://gerrit.libreoffice.org/8496
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Initialize OpenCL device on the main thread when pre-compiling kernels.

Else it would cause extremely hard-to-debug random crashes when interpreting
formulas with OpenCL.

And let's re-enable kernel pre-compilation with this fix.

Change-Id: Ib104bfdc3f56a02c052c837eb4bf3ecc95d562e0
(cherry picked from commit 6e24c789572aba5b6ee95e894f6d778777b1df58)
Reviewed-on: https://gerrit.libreoffice.org/8498
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
rhbz#1043551: sw: avoid division-by-0 in Text Grid painting code

Possible to trigger with a document containing:
    style:layout-grid-base-height="0cm"

(cherry picked from commit 71b55cf57460aec3fec948676251448934ba31d1)

got to love the sal_Int32 as long/int
(cherry picked from commit 18c89ae6ff01f3d555a7cb030eb4572d504e8de7)

Change-Id: Id3bd1f29157b39e8a577be0b87b86236dbe5a50c
Reviewed-on: https://gerrit.libreoffice.org/8497
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
fdo#75492: table names can start the same way and still be different

Change-Id: Icc5a6fb7cf3ed3c2171e628d22918af7038f8127
Reviewed-on: https://gerrit.libreoffice.org/8495
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
fdo#75962: Avoid unwanted number detection when placing page field name.

Change-Id: I1a3c57ec029e03198b8f190acfa8d59e142acaba
(cherry picked from commit 0919979bd1da3379e030b353a097d8fe1fd8341a)
Revert "fdo#75962: Avoid unwanted number detection when placing page field name."

This reverts commit f86d94a2d1b3a61d290c072431c0af8446ec15bf.
fdo#75243: MSO export: save custom properties with empty value

LO removes empty properties while saving the doc. This is required in some
business scenarios.
bSkipEmpty is set to false by default to enable LibreOffice to save
even empty properties.

Change-Id: I7aafe0c0be02a98fa6e72d73e9e4348a015da61f
(cherry picked from commit 3ba58a22bdd51cd4221547e0a0e95b6d2b987358)
Signed-off-by: Michael Stahl <mstahl@redhat.com>
fdo#72481 drawingml import: don't set CharEscapementHeight unconditionally

Commit 840a8573c8cebe67ddd3c9fe106c7dbd789bb334 (Fix fdo#70220
Superscript not imported from pptx., 2013-10-07) made it possible to set
CharEscapementHeight even if moBaseline is not set, but this causes
problems in the docx importer + not necessary, according to the bugdoc;
so just don't do that.

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

Commit and message cherry picked from:

commit 798a563db133ebed3876c245459d90ef54ee7c9a
Author: Miklos Vajna <vmiklos@collabora.co.uk>

Change-Id: Ib95ac449bd8fdf6376261ddc86108f0d23f2200e
Reviewed-on: https://gerrit.libreoffice.org/8415
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
fdo#75968 Fix OUString conversion

Change-Id: Ie865b16c163d47de34ab2fe23bb7432b7710877f
Reviewed-on: https://gerrit.libreoffice.org/8510
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit fc4ce3f5d0c630623eca5b55f8083d54e5beeeee)
Reviewed-on: https://gerrit.libreoffice.org/8511
fdo#75962: Avoid unwanted number detection when placing page field name.

Change-Id: I1a3c57ec029e03198b8f190acfa8d59e142acaba
(cherry picked from commit 0919979bd1da3379e030b353a097d8fe1fd8341a)
Reviewed-on: https://gerrit.libreoffice.org/8508
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
fdo#75628: SUM should inherit error if one is present in its references.

Change-Id: I94017fe91295dbb929f57be5e3fb26edf5032a8f
(cherry picked from commit d658c092f488fc0d4cb924fe3e34cab997db76e2)
Reviewed-on: https://gerrit.libreoffice.org/8504
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
cp#1000039 DOC import: ignore symbol charset of the symbol font

Otherwise characters unhandled by our OpenSymbol font (like Arabic 0-9
numbers) won't be rendered using an other font, as no other font
provides the symbol charset. Do this in
SwWW8ImplReader::GetFontParams(), where we already have font name ->
font family mappings for a few well-known fonts.

The DOCX filter does the same for quite some time, and that's how Arabic
numbers in text using the Symbol font were rendered, instead of little
rectangles.

Change-Id: Ib794cac19ad7b073e39f3cbd7d4bad3994151c14
(cherry picked from commit 8556cd881270823865662e9a7700da58d11c2785)
Reviewed-on: https://gerrit.libreoffice.org/8474
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
fdo#73115: Always run timeouts as events

Right-click popup menus run click events throught the LO main loop.
In case of KDE4 the LO main loop is run by a timer in the main thread,
with Qt::DirectConnection execution.

If the timeout actually starts a nested event loop for a new dialog,
the timer is blocked, the nested mainloop detects it was started
from the timeout and drops the blocked timout from polling, which
blocks any further LibreOffice event loop processing.

This changes the timers to Qt::QueuedConnection, so they always
generate an event and are processed by the Qt event loop.

Change-Id: Ie626b22be3d8f9b8934bcc5e9e0e67a365549cfc
(cherry picked from commit aeda478a02523cec146f6af69710f0391061db56)
Reviewed-on: https://gerrit.libreoffice.org/8514
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>