[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - 39 commits - avmedia/source basctl/uiconfig chart2/source chart2/uiconfig configure.ac cui/source cui/uiconfig dbaccess/source desktop/scripts external/neon extras/source include/svx include/vcl sc/CppunitTest_sc_shapetest.mk sc/Module_sc.mk sc/qa sc/source sd/source sfx2/source shell/source svl/qa svl/source svx/source sw/CppunitTest_sw_core_doc.mk sw/CppunitTest_sw_uibase_shells.mk sw/inc sw/Module_sw.mk sw/qa sw/source translations vcl/qa vcl/qt5 vcl/source vcl/unx writerfilter/CppunitTest_writerfilter_dmapper.mk writerfilter/qa writerfilter/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 10 15:34:42 UTC 2020


 avmedia/source/gstreamer/gstplayer.cxx                               |    9 
 basctl/uiconfig/basicide/ui/defaultlanguage.ui                       |    6 
 chart2/source/controller/dialogs/DialogModel.cxx                     |    2 
 chart2/uiconfig/ui/steppedlinesdlg.ui                                |    8 
 configure.ac                                                         |    2 
 cui/source/customize/acccfg.cxx                                      |    2 
 cui/source/options/fontsubs.cxx                                      |   24 +
 cui/source/options/fontsubs.hxx                                      |    4 
 cui/source/options/optgenrl.cxx                                      |    2 
 cui/uiconfig/ui/bulletandposition.ui                                 |   38 ++
 cui/uiconfig/ui/optfontspage.ui                                      |  149 ++++---
 cui/uiconfig/ui/optsavepage.ui                                       |   15 
 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx                    |    2 
 desktop/scripts/soffice.sh                                           |    8 
 external/neon/UnpackedTarball_neon.mk                                |    1 
 external/neon/neon_uri_parse_allow_others.patch                      |   22 +
 extras/source/templates/presnt/Alizarin/styles.xml                   |   80 ++--
 extras/source/templates/presnt/Beehive/styles.xml                    |   82 ++--
 extras/source/templates/presnt/Blue_Curve/styles.xml                 |   80 ++--
 extras/source/templates/presnt/Blueprint_Plans/styles.xml            |   80 ++--
 extras/source/templates/presnt/BrightBlue/styles.xml                 |   58 +--
 extras/source/templates/presnt/Classy_Red/content.xml                |    2 
 extras/source/templates/presnt/Classy_Red/styles.xml                 |   94 ++--
 extras/source/templates/presnt/DNA/styles.xml                        |   50 +-
 extras/source/templates/presnt/Focus/styles.xml                      |  120 +++---
 extras/source/templates/presnt/Forestbird/styles.xml                 |  130 +++---
 extras/source/templates/presnt/Impress/styles.xml                    |   88 ++--
 extras/source/templates/presnt/Inspiration/styles.xml                |   60 +--
 extras/source/templates/presnt/Lights/styles.xml                     |  106 ++---
 extras/source/templates/presnt/LushGreen/content.xml                 |    2 
 extras/source/templates/presnt/LushGreen/styles.xml                  |  130 +++---
 extras/source/templates/presnt/Metropolis/styles.xml                 |   72 +--
 extras/source/templates/presnt/Midnightblue/styles.xml               |  128 +++---
 extras/source/templates/presnt/Nature_Illustration/styles.xml        |   82 ++--
 extras/source/templates/presnt/Pencil/styles.xml                     |   84 ++--
 extras/source/templates/presnt/Piano/styles.xml                      |   82 ++--
 extras/source/templates/presnt/Portfolio/styles.xml                  |  106 ++---
 extras/source/templates/presnt/Sunset/content.xml                    |    2 
 extras/source/templates/presnt/Sunset/styles.xml                     |   60 +--
 extras/source/templates/presnt/Vintage/content.xml                   |    4 
 extras/source/templates/presnt/Vintage/styles.xml                    |  140 +++----
 extras/source/templates/presnt/Vivid/content.xml                     |    4 
 extras/source/templates/presnt/Vivid/styles.xml                      |  110 ++---
 include/svx/svdoashp.hxx                                             |    1 
 include/vcl/notebookbar.hxx                                          |    7 
 sc/CppunitTest_sc_shapetest.mk                                       |   53 ++
 sc/Module_sc.mk                                                      |    1 
 sc/qa/unit/data/ods/tdf119191_FitToCellSize.ods                      |binary
 sc/qa/unit/data/ods/tdf119191_transformedShape.ods                   |binary
 sc/qa/unit/scshapetest.cxx                                           |  189 ++++++++++
 sc/source/core/data/drwlayer.cxx                                     |    5 
 sc/source/core/data/postit.cxx                                       |    2 
 sc/source/ui/docshell/docsh.cxx                                      |   20 -
 sc/source/ui/view/drawvie4.cxx                                       |    6 
 sc/source/ui/view/prevwsh.cxx                                        |    4 
 sd/source/ui/dlg/BulletAndPositionDlg.cxx                            |    9 
 sfx2/source/notebookbar/SfxNotebookBar.cxx                           |   15 
 shell/source/win32/SysShExec.cxx                                     |   34 +
 svl/qa/unit/test_URIHelper.cxx                                       |   13 
 svl/source/misc/urihelper.cxx                                        |   10 
 svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx            |   20 +
 svx/source/svdraw/svdoashp.cxx                                       |   66 +++
 sw/CppunitTest_sw_core_doc.mk                                        |   72 +++
 sw/CppunitTest_sw_uibase_shells.mk                                   |    3 
 sw/Module_sw.mk                                                      |    1 
 sw/inc/IDocumentContentOperations.hxx                                |    2 
 sw/inc/fesh.hxx                                                      |    2 
 sw/qa/core/data/ooxml/pass/tdf108272.docx                            |binary
 sw/qa/core/doc/doc.cxx                                               |   65 +++
 sw/qa/extras/layout/data/stable-at-page-anchored-fly-position.odt    |binary
 sw/qa/extras/layout/layout.cxx                                       |   43 ++
 sw/qa/extras/ooxmlexport/data/footnotesep.fodt                       |   86 ++++
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx                            |   16 
 sw/qa/extras/ooxmlimport/data/tdf129912.docx                         |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx                            |   36 +
 sw/qa/uibase/shells/shells.cxx                                       |   52 ++
 sw/source/core/doc/DocumentContentOperationsManager.cxx              |   10 
 sw/source/core/frmedt/fefly1.cxx                                     |    2 
 sw/source/core/inc/DocumentContentOperationsManager.hxx              |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx                         |   12 
 sw/source/uibase/dialog/watermarkdialog.cxx                          |    2 
 sw/source/uibase/shells/drwtxtex.cxx                                 |   18 
 sw/source/uibase/uiview/pview.cxx                                    |    4 
 translations                                                         |    2 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx                               |    5 
 vcl/qt5/Qt5Transferable.cxx                                          |    5 
 vcl/source/control/button.cxx                                        |    5 
 vcl/source/control/edit.cxx                                          |    6 
 vcl/source/control/notebookbar.cxx                                   |   32 +
 vcl/source/control/wizardmachine.cxx                                 |    2 
 vcl/source/filter/png/pngread.cxx                                    |    2 
 vcl/source/gdi/pdfwriter_impl.cxx                                    |   10 
 vcl/unx/gtk3/gtk3gtkinst.cxx                                         |    5 
 writerfilter/CppunitTest_writerfilter_dmapper.mk                     |    1 
 writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx                 |   77 ++++
 writerfilter/qa/cppunittests/dmapper/data/floating-table-header.docx |binary
 writerfilter/source/dmapper/DomainMapper.cxx                         |    1 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx                    |    7 
 writerfilter/source/dmapper/PropertyMap.cxx                          |   12 
 99 files changed, 2170 insertions(+), 1215 deletions(-)

New commits:
commit 53e0c512d39795ecd4e23191ae5a6a9bd63ba4a9
Merge: d791e1677170 289d2e5c86ff
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Mon Feb 10 15:09:05 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Mon Feb 10 15:09:05 2020 +0100

    Merge branch 'libreoffice-6-4'
    
    into distro/lhm/libreoffice-6-4+backports
    
    Change-Id: If4b51680f1305c8f6a908e7b69a23af6d407b3ad

commit 289d2e5c86ffa99bc6a8c6c51f630d629afcd954
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Feb 7 15:34:33 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Feb 10 13:51:59 2020 +0100

    tdf#130501: Fix off-by-one error in URIHelper::resolveIdnaHost
    
    Change-Id: Ibc231308d0fc93085933ae7d80dc8c4b2699fe02
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88204
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 4c0394461af4d6bcba059161113abffbb484efe8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88295
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/svl/qa/unit/test_URIHelper.cxx b/svl/qa/unit/test_URIHelper.cxx
index 11b7d0359b2a..5954bcd39289 100644
--- a/svl/qa/unit/test_URIHelper.cxx
+++ b/svl/qa/unit/test_URIHelper.cxx
@@ -463,6 +463,19 @@ void Test::testResolveIdnaHost() {
     CPPUNIT_ASSERT_EQUAL(
         OUString("foo://xn--mnchen-3ya.de"),
         URIHelper::resolveIdnaHost(u"foo://Mu\u0308nchen.de"));
+
+    CPPUNIT_ASSERT_EQUAL(
+        OUString("foo://example.xn--m-eha"), URIHelper::resolveIdnaHost(u"foo://example.mü"));
+
+    CPPUNIT_ASSERT_EQUAL(
+        OUString("foo://example.xn--m-eha:0"), URIHelper::resolveIdnaHost(u"foo://example.mü:0"));
+
+    CPPUNIT_ASSERT_EQUAL(
+        OUString("foo://xn--e1afmkfd.xn--p1ai"), URIHelper::resolveIdnaHost(u"foo://пример.рф"));
+
+    CPPUNIT_ASSERT_EQUAL(
+        OUString("foo://xn--e1afmkfd.xn--p1ai:0"),
+        URIHelper::resolveIdnaHost(u"foo://пример.рф:0"));
 }
 
 css::uno::Reference< css::uno::XComponentContext > Test::m_context;
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index 62177ac79e25..127134d1ab72 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -742,12 +742,14 @@ OUString URIHelper::resolveIdnaHost(OUString const & url) {
     if (auth.isEmpty())
         return url;
     sal_Int32 hostStart = auth.indexOf('@') + 1;
-    sal_Int32 hostEnd = auth.getLength() - 1;
-    while (hostEnd > hostStart && rtl::isAsciiDigit(auth[hostEnd])) {
+    sal_Int32 hostEnd = auth.getLength();
+    while (hostEnd > hostStart && rtl::isAsciiDigit(auth[hostEnd - 1])) {
         --hostEnd;
     }
-    if (!(hostEnd > hostStart && auth[hostEnd] == ':')) {
-        hostEnd = auth.getLength() - 1;
+    if (hostEnd > hostStart && auth[hostEnd - 1] == ':') {
+        --hostEnd;
+    } else {
+        hostEnd = auth.getLength();
     }
     auto asciiOnly = true;
     for (auto i = hostStart; i != hostEnd; ++i) {
commit 942c0d71a91839fc1762c7e93417e7bb703ea3cf
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 7 17:54:50 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Feb 10 12:43:34 2020 +0100

    tdf#130482 sw: fix text alignment in shape text
    
    Regression from commit a3c7a8282ddd08c7ed4a15d23089d09e418f8fae
    (jsdialogs: apply .uno:Color and CharBackColor to floating text frames,
    2019-11-08), the problem was that the original code populated aNewAttr, while
    SetAttrToMarked() was only invoked in case there were arguments.
    
    Fix this by making pNewAttrs a copy, so lcl_convertStringArguments() can
    work on it in place, and then restore the old code that copied from
    pNewAttrs to aNewAttr.  This fixes the no-arguments case and keeps the
    lcl_convertStringArguments() case working.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88227
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit b03504bf054bd4094b985ef8ebb9ac55fa69a487)
    
    Change-Id: If7bf2d7b21e48d513a512ec6127b61ee74635ef5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88296
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/CppunitTest_sw_uibase_shells.mk b/sw/CppunitTest_sw_uibase_shells.mk
index a4bb21c3d67e..9734b395bca6 100644
--- a/sw/CppunitTest_sw_uibase_shells.mk
+++ b/sw/CppunitTest_sw_uibase_shells.mk
@@ -21,9 +21,12 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uibase_shells, \
     comphelper \
     cppu \
     cppuhelper \
+    editeng \
     sal \
     sfx \
     svl \
+    svx \
+    svxcore \
     sw \
     test \
     unotest \
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 8701db9a052e..05b5c6b5e27b 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -13,12 +13,22 @@
 #include <sfx2/viewfrm.hxx>
 #include <vcl/GraphicObject.hxx>
 #include <vcl/gdimtf.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdview.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/adjustitem.hxx>
+#include <editeng/outlobj.hxx>
+#include <editeng/editobj.hxx>
+#include <editeng/editids.hrc>
+#include <svx/sdtaitm.hxx>
 
 #include <IDocumentContentOperations.hxx>
 #include <cmdid.h>
 #include <fmtanchr.hxx>
 #include <view.hxx>
 #include <wrtsh.hxx>
+#include <IDocumentDrawModelAccess.hxx>
+#include <drawdoc.hxx>
 
 static char const DATA_DIRECTORY[] = "/sw/qa/uibase/shells/data/";
 
@@ -69,6 +79,48 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testTdf130179)
     CPPUNIT_ASSERT(!pItem);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testShapeTextAlignment)
+{
+// FIXME find out why this fails on macOS
+#ifndef MACOSX
+    // Create a document with a rectangle in it.
+    SwDoc* pDoc = createDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    Point aStartPos(1000, 1000);
+    pWrtShell->BeginCreate(static_cast<sal_uInt16>(OBJ_RECT), aStartPos);
+    Point aMovePos(2000, 2000);
+    pWrtShell->MoveCreate(aMovePos);
+    pWrtShell->EndCreate(SdrCreateCmd::ForceEnd);
+
+    // Start shape text edit.
+    SwView* pView = pDoc->GetDocShell()->GetView();
+    // Select the shape.
+    pView->GetViewFrame()->GetDispatcher()->Execute(FN_CNTNT_TO_NEXT_FRAME, SfxCallMode::SYNCHRON);
+    pView->StopShellTimer();
+    // Start the actual text edit.
+    SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount());
+    SdrObject* pObject = pPage->GetObj(0);
+    pView->EnterShapeDrawTextMode(pObject);
+    pView->AttrChangedNotify(nullptr);
+
+    // Change paragraph adjustment to center.
+    pView->GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER,
+                                                    SfxCallMode::SYNCHRON);
+
+    // End shape text edit.
+    pWrtShell->EndTextEdit();
+
+    const OutlinerParaObject* pOutliner = pObject->GetOutlinerParaObject();
+    // Without the accompanying fix in place, this test would have failed, because the shape had no
+    // text or text formatting. In other words the paragraph adjustment command was ignored.
+    CPPUNIT_ASSERT(pOutliner);
+    const SfxItemSet& rParaAttribs = pOutliner->GetTextObject().GetParaAttribs(0);
+    SvxAdjust eAdjust = rParaAttribs.GetItem(EE_PARA_JUST)->GetAdjust();
+    CPPUNIT_ASSERT_EQUAL(SvxAdjust::Center, eAdjust);
+#endif
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index fae34754fe5a..60bdf16380be 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -152,7 +152,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
     const sal_uInt16 nSlot = rReq.GetSlot();
 
     const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
-    const SfxItemSet *pNewAttrs = rReq.GetArgs();
+    std::unique_ptr<SfxItemSet> pNewAttrs(rReq.GetArgs() ? rReq.GetArgs()->Clone() : nullptr);
 
     bool bRestoreSelection = false;
     ESelection aOldSelection;
@@ -650,21 +650,15 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
             assert(false && "wrong dispatcher");
             return;
     }
-
-    std::unique_ptr<SfxItemSet> pNewArgs = pNewAttrs ? pNewAttrs->Clone() : nullptr;
-    if (pNewArgs)
+    if (nEEWhich && pNewAttrs)
     {
-        lcl_convertStringArguments(nSlot, pNewArgs);
+        lcl_convertStringArguments(nSlot, pNewAttrs);
 
-        if (nEEWhich)
-        {
-            std::unique_ptr<SfxPoolItem> pNewItem(pNewArgs->Get(nWhich).CloneSetWhich(nEEWhich));
-            pNewArgs->Put(*pNewItem);
-        }
-
-        SetAttrToMarked(*pNewArgs);
+        aNewAttr.Put(pNewAttrs->Get(nWhich).CloneSetWhich(nEEWhich));
     }
 
+    SetAttrToMarked(aNewAttr);
+
     GetView().GetViewFrame()->GetBindings().InvalidateAll(false);
 
     if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
commit 153dafe1147bc29fc0e656d0cb8994112ecea1a0
Author:     Onur Yilmaz <onuryilmaz0750 at gmail.com>
AuthorDate: Tue Feb 4 16:27:38 2020 +0300
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon Feb 10 12:40:36 2020 +0100

    tdf#130148 Gallery drop-down list in Impress B&N dialog shows only start...
    
    Change-Id: Ieb8d79d7b3d291ffb36a7daaee0716d4ed8c9a85
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87972
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 5088e6d34b0ffba423f8633ee83673a9c1d40036)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88299
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
index 7ce6a227fe3f..498ea1befcc5 100644
--- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -897,12 +897,9 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButt
                     pVD->DrawBitmapEx(Point(), aBitmap);
 
                     // We want to show only icon names not full path.
-                    // That part finds the last index of the slash and
-                    // gets the part before .gif
-
-                    sal_Int32 last = sGrfName.lastIndexOf("/");
-                    last++;
-                    OUString sIconName = sGrfName.getToken(0, '.', last);
+                    aObj.removeExtension();
+                    OUString sIconName
+                        = aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
 
                     m_xGalleryMenu->append(sItemId, sIconName, *pVD);
                 }
commit a4567fb085ae313f514d2001b9e52499c9887a56
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Feb 4 14:29:46 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Feb 10 12:23:58 2020 +0100

    tdf#129912 correctly stop unstyled footnote parsing
    
    The bug document somehow manages to generated a footnote, which
    never terminates the format loop in SwTextFrame::Format_.
    
    It contains an unstyled footnote, which I wasn't able to reproduce
    to create in Word. So I manually edited the XML of the included
    unit test document, which I used to develop the original patch,
    and which reproduces the broken parsing behaviour.
    
    This patch correctly stops the parsing of the custom footnote
    reference, if the text run containing the footnote reference is
    finished, which also fixes loading the bug document.
    
    The unit test checks various footnote variants, which represent
    different problems I found when developing the custom footnote
    parsing in commit a991ad93dcd6807d0eacd11a50c2ae43a2cfb882
    ("tdf#121441 improve DOCX footnote import") and now also includes
    an unstyled one.
    
    It also contains a (still?) broken footnote test, with a complex
    differing footnote.
    
    Change-Id: I748955285d76b6f3122d1da5d8823068f3d7633f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87981
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 7d886eec953efa593708db9560d0e69ac12c99cf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87993
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf129912.docx b/sw/qa/extras/ooxmlimport/data/tdf129912.docx
new file mode 100644
index 000000000000..d87255ffd61d
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf129912.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 29a1e4e0dcf0..82a18d353b0c 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -25,6 +25,8 @@
 #include <IMark.hxx>
 #include <sortedobjs.hxx>
 #include <anchoredobject.hxx>
+#include <fmtftn.hxx>
+#include <ftnidx.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -541,6 +543,40 @@ DECLARE_OOXMLIMPORT_TEST(testTdf129659, "tdf129659.docx")
     // don't crash on footnote with page break
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf129912, "tdf129912.docx")
+{
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtShell);
+
+    // Goto*FootnoteAnchor iterates the footnotes in a ring, so we need the amount of footnotes to stop the loop
+    sal_Int32 nCount = pWrtShell->GetDoc()->GetFootnoteIdxs().size();
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(5), nCount);
+
+    // the expected footnote labels
+    // TODO: the 5th label is actually wrong (missing the "PR" after the symbol part), but the "b" is there?!
+    const sal_Unicode pLabel5[] = { u'\xF0D1', u'\xF031', u'\xF032', u'\x0062' };
+    const OUString sFootnoteLabels[] = {
+        OUString(u'\xF0A7'), "1", "2", OUString(u'\xF020'), { pLabel5, SAL_N_ELEMENTS(pLabel5) }
+    };
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(SAL_N_ELEMENTS(sFootnoteLabels)), nCount);
+
+    pWrtShell->GotoPrevFootnoteAnchor();
+    nCount--;
+    while (nCount >= 0)
+    {
+        SwFormatFootnote aFootnoteNote;
+        CPPUNIT_ASSERT(pWrtShell->GetCurFootnote(&aFootnoteNote));
+        OUString sNumStr = aFootnoteNote.GetNumStr();
+        if (sNumStr.isEmpty())
+            sNumStr = OUString::number(aFootnoteNote.GetNumber());
+        CPPUNIT_ASSERT_EQUAL(sFootnoteLabels[nCount], sNumStr);
+        pWrtShell->GotoPrevFootnoteAnchor();
+        nCount--;
+    }
+}
+
 // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 4ea227cd8e0e..61136bd30a56 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -958,7 +958,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         break;
         case NS_ooxml::LN_CT_FtnEdnRef_id:
             // footnote or endnote reference id - not needed
-            m_pImpl->StartCustomFootnote(m_pImpl->GetTopContext());
         break;
         case NS_ooxml::LN_CT_Color_themeColor:
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeColor", TDefTableHandler::getThemeColorTypeString(nIntValue));
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe6283616c1e..c24cc03726c4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -685,6 +685,13 @@ void    DomainMapper_Impl::PopProperties(ContextType eId)
         deferredCharacterProperties.clear();
     }
 
+    if (!IsInFootOrEndnote() && IsInCustomFootnote() && !m_aPropertyStacks[eId].empty())
+    {
+        PropertyMapPtr pRet = m_aPropertyStacks[eId].top();
+        if (pRet->GetFootnote().is() && m_pFootnoteContext.is())
+            EndCustomFootnote();
+    }
+
     m_aPropertyStacks[eId].pop();
     m_aContextStack.pop();
     if(!m_aContextStack.empty() && !m_aPropertyStacks[m_aContextStack.top()].empty())
commit c51cada3dc0496fb2bcaa0d1360a202ce0efae80
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Feb 7 13:49:45 2020 +0100
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Mon Feb 10 08:12:30 2020 +0100

    tdf#129809 qt5: take a reference in case m_aContents is replaced
    
    This takes over Caolán's solution for gtk3 from
    dbcdc5cd98df5756a96559e467cad95c629343ca
    ("tdf#129809 take a reference in case m_aContents is replaced")
    for the qt5 case as well, to prevent that the XTransferable
    is destroyed along with the Qt5MimeData object as new QMimeData
    are set in the clipboard, as follows:
    
        1   Qt5Clipboard::setContents                                               Qt5Clipboard.cxx
        2   TransferableHelper::CopyToSelection                                     transfer.cxx
        3   TransferableHelper::CopyToSelection                                     transfer.cxx
        4   SwTransferable::CreateSelection                                         swdtflvr.cxx
        5   SwWrtShell::SttSelect                                                   select.cxx
        6   SwWrtShell::SelectTextAttr                                              move.cxx
        7   SwTransferable::GetData                                                 swdtflvr.cxx
        8   TransferableHelper::getTransferData2                                    transfer.cxx
        9   TransferableHelper::getTransferData                                     transfer.cxx
        10  Qt5MimeData::retrieveData                                               Qt5Transferable.cxx
        11  QMimeDataPrivate::retrieveTypedData                                     qvariant.h
        12  QMimeData::data                                                         qmimedata.cpp
        13  QInternalMimeData::renderDataHelper(QString const&, QMimeData const *)
        14  ??
        15  ??
        16  ??
        17  QXcbConnection::handleXcbEvent(xcb_generic_event_t *)
        18  QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>)
        19  ??
        20  g_main_context_dispatch
    
    Change-Id: Ic712c901a31131efc596cac7f00f14bb6a7ce068
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88192
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    (cherry picked from commit 1d7b1a15059a77fde9afa14d0b9a508142bfc247)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88258
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/qt5/Qt5Transferable.cxx b/vcl/qt5/Qt5Transferable.cxx
index 81a47871f411..3f19f6ec71cf 100644
--- a/vcl/qt5/Qt5Transferable.cxx
+++ b/vcl/qt5/Qt5Transferable.cxx
@@ -300,7 +300,10 @@ QVariant Qt5MimeData::retrieveData(const QString& mimeType, QVariant::Type) cons
 
     try
     {
-        aValue = m_aContents->getTransferData(aFlavor);
+        // tdf#129809 take a reference in case m_aContents is replaced during this call
+        css::uno::Reference<com::sun::star::datatransfer::XTransferable> xCurrentContents(
+            m_aContents);
+        aValue = xCurrentContents->getTransferData(aFlavor);
     }
     catch (...)
     {
commit 1fbf3a70dbbbab2f810afae5f3e928a6d59c6325
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Feb 8 20:06:23 2020 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sun Feb 9 07:59:46 2020 +0100

    Resolves: tdf#130484 controls become disabled on click final checkboxes
    
    they always triggered disabled the current state in the roadmap, but disabling
    a roadmap step now really disables the associated window in vcl.
    
    These two particular toggles don't actually affect the current roadmap state,
    so don't call state-modified when changing them.
    
    That doesn't change the ye-old weird case that the logical state of this final
    step is disabled, but don't let the wizard find that out when toggling
    radiobuttons that don't contribute to the roadmap state
    
    Change-Id: I5927d20ea461a294e76014892c90ad0b5f39fb6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88281
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index c806685f9f30..565cf61489b9 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -738,7 +738,6 @@ using namespace ::com::sun::star;
         , m_xFTFinalText(m_xBuilder->weld_label("finishText"))
     {
         m_xCBOpenAfterwards->connect_toggled(LINK(this, OFinalDBPageSetup, OnOpenSelected));
-        m_xCBStartTableWizard->connect_toggled(LINK(this,OGenericAdministrationPage,OnControlModifiedButtonClick));
         m_xRBRegisterDataSource->set_active(true);
         pController->SetFinalPage(this);
     }
@@ -796,7 +795,6 @@ using namespace ::com::sun::star;
     IMPL_LINK(OFinalDBPageSetup, OnOpenSelected, weld::ToggleButton&, rBox, void)
     {
         m_xCBStartTableWizard->set_sensitive(rBox.get_sensitive() && rBox.get_active());
-        callModifiedHdl();
     }
 }
 
commit 68072f4c0abbcfefcde930b779eb7703f5c91eb2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 7 16:27:15 2020 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sat Feb 8 21:14:54 2020 +0100

    crash in manage languages in basic ide
    
    when there is more than one language, there needs to be two separate
    columns with a renderer each, not one column with two renderers
    
    Change-Id: Id4f2c9938fd3bd0aa3e006166df6081d57ef57df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88223
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/basctl/uiconfig/basicide/ui/defaultlanguage.ui b/basctl/uiconfig/basicide/ui/defaultlanguage.ui
index 3904d8afc59e..88c9f1f2c5ba 100644
--- a/basctl/uiconfig/basicide/ui/defaultlanguage.ui
+++ b/basctl/uiconfig/basicide/ui/defaultlanguage.ui
@@ -181,6 +181,7 @@
                         <property name="model">liststore1</property>
                         <property name="headers_visible">False</property>
                         <property name="search_column">1</property>
+                        <property name="show_expanders">False</property>
                         <property name="enable_tree_lines">True</property>
                         <child internal-child="selection">
                           <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
@@ -195,6 +196,11 @@
                                 <attribute name="active">0</attribute>
                               </attributes>
                             </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+                            <property name="spacing">6</property>
                             <child>
                               <object class="GtkCellRendererText" id="cellrenderertext1"/>
                               <attributes>
commit c4fbf221477925598df837901b231d68acf218f7
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Thu Feb 6 16:24:53 2020 +0000
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Feb 8 18:07:52 2020 +0100

    neon: escape broken SharePoint 2016 URIs
    
    SharePoint returns broken URIs in its href replies, which aren't
    correctly URI encoded, but still "valid" URIs w.r.t. general and
    UTF8 encoding, e.g. http://<host>/Shared%20Documents/ümlaut.docx
    
    As a workaround, this allows all invalid / other bytes (except
    '\0') in the path of the URI in ne_uri_parse.
    
    Change-Id: I70e7d323837469d7ced429a42c009972f4fb0ebc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88120
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    Tested-by: Jenkins
    (cherry picked from commit 069aa870aadb9f9069e8715c8be30394410f0288)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88187
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/external/neon/UnpackedTarball_neon.mk b/external/neon/UnpackedTarball_neon.mk
index 74ac2eb38c97..725e1916cd28 100644
--- a/external/neon/UnpackedTarball_neon.mk
+++ b/external/neon/UnpackedTarball_neon.mk
@@ -25,6 +25,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,neon,\
 	external/neon/neon_fix_lock_token_on_if.patch \
 	external/neon/neon_fix_lock_timeout_windows.patch \
 	external/neon/neon_fix_sspi_session_timeout.patch \
+	external/neon/neon_uri_parse_allow_others.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/neon/neon_uri_parse_allow_others.patch b/external/neon/neon_uri_parse_allow_others.patch
new file mode 100644
index 000000000000..9de2cf6b9ae7
--- /dev/null
+++ b/external/neon/neon_uri_parse_allow_others.patch
@@ -0,0 +1,22 @@
+diff -ur src/ne_uri.c
+--- src/ne_uri.c	2020-02-07 10:49:58.764417840 +0000
++++ src/ne_uri.c	2020-02-07 10:51:33.675627141 +0000
+@@ -87,7 +87,8 @@
+ #define URI_PCHAR (URI_UNRESERVED | PC | URI_SUBDELIM | CL | AT)
+ /* invented: segchar = pchar / "/" */
+ /* (TKR) WS added */
+-#define URI_SEGCHAR (URI_PCHAR | FS | WS)
++/* also allow OT characters to parse SharePoint 2016 href URIs with unescaped UTF8 */
++#define URI_SEGCHAR (URI_PCHAR | FS | WS | OT)
+ /* query = *( pchar / "/" / "?" ) */
+ #define URI_QUERY (URI_PCHAR | FS | QU)
+ /* fragment == query */
+@@ -237,7 +238,7 @@
+ 
+     p = s;
+ 
+-    while (uri_lookup(*p) & URI_SEGCHAR)
++    while (uri_lookup(*p) & URI_SEGCHAR && *p != '\0')
+         p++;
+ 
+     /* => p = [ "?" query ] [ "#" fragment ] */
commit 696c29c1db48d5504a0929b3b11eec649de27fd2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 7 09:39:29 2020 +0000
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Sat Feb 8 03:44:46 2020 +0100

    tdf#129809 take a reference in case m_aContents is replaced
    
    Change-Id: I36ae74b6b3424bd2f0b71bc54838ec39e504b6d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88179
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 0b7e019b4de7..256aacc6b888 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -772,7 +772,10 @@ void VclGtkClipboard::ClipboardGet(GtkSelectionData *selection_data, guint info)
 {
     if (!m_aContents.is())
         return;
-    m_aConversionHelper.setSelectionData(m_aContents, selection_data, info);
+    // tdf#129809 take a reference in case m_aContents is replaced during this
+    // call
+    Reference<datatransfer::XTransferable> xCurrentContents(m_aContents);
+    m_aConversionHelper.setSelectionData(xCurrentContents, selection_data, info);
 }
 
 namespace
commit c852f0e4ac4cee2a1b69ff8b1c5cab6633664098
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 6 15:52:22 2020 +0000
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 7 19:40:45 2020 +0100

    tdf#130462 call SetMinOutputSizePixel before SetOutputSizePixel
    
    Change-Id: I04716e91b7c9b5f1e9db1fd175f5dcbe0600bf1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88116
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx
index 2fced940867e..57890c45a070 100644
--- a/vcl/source/control/wizardmachine.cxx
+++ b/vcl/source/control/wizardmachine.cxx
@@ -480,8 +480,8 @@ namespace vcl
             }
         }
         ImplCalcSize( aDlgSize );
-        SetOutputSizePixel( aDlgSize );
         SetMinOutputSizePixel( aDlgSize );
+        SetOutputSizePixel( aDlgSize );
     }
 
     void RoadmapWizard::StateChanged( StateChangedType nType )
commit 7efd182997cb29ed4820145efc99a6c18e2c3303
Author:     Regina Henschel <rb.henschel at t-online.de>
AuthorDate: Thu Nov 28 19:28:29 2019 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 7 18:40:31 2020 +0100

    tdf#119191 Implement SdrObjCustomShape::AdjustToMaxRect
    
    and use in ScDrawLayer::RecalcPos and in ScDrawView::FitToCellSize().
    Error was, that it was assumed, that SdObjCustomShape::SetSnapRect()
    changes the shape so, that it fits into the passed rectangle. That is
    true for other type of shapes, but not for custom shapes.
    
    Change-Id: Ib00d52087509f459165000abf43c7f244980a01b
    Reviewed-on: https://gerrit.libreoffice.org/84216
    Tested-by: Jenkins
    Reviewed-by: Regina Henschel <rb.henschel at t-online.de>
    (cherry picked from commit f44140bebb9c493d97ba5aef26c9692c53a6b93f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85043
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 02b957de95a0..ff51e20ec974 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -172,6 +172,7 @@ public:
     virtual void Shear(const Point& rRef, long nAngle, double tn, bool bVShear) override;
     virtual void SetSnapRect(const tools::Rectangle& rRect) override;
     virtual void SetLogicRect(const tools::Rectangle& rRect) override;
+    virtual void AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrinkOnly = false ) override;
 
     virtual void NbcMove(const Size& rSiz) override;
     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
diff --git a/sc/CppunitTest_sc_shapetest.mk b/sc/CppunitTest_sc_shapetest.mk
new file mode 100644
index 000000000000..cf97cf99da13
--- /dev/null
+++ b/sc/CppunitTest_sc_shapetest.mk
@@ -0,0 +1,53 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_shapetest))
+
+$(eval $(call gb_CppunitTest_use_external,sc_shapetest,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sc_shapetest))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_shapetest, \
+    sc/qa/unit/scshapetest \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_shapetest, \
+    cppu \
+    sal \
+    sc \
+    sfx \
+    subsequenttest \
+    svx \
+    svxcore \
+    test \
+    tl \
+    unotest \
+    utl \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_shapetest,\
+    -I$(SRCDIR)/sc/source/ui/inc \
+    -I$(SRCDIR)/sc/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sc_shapetest))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_shapetest))
+$(eval $(call gb_CppunitTest_use_vcl,sc_shapetest))
+
+$(eval $(call gb_CppunitTest_use_components,sc_shapetest,\
+    $(sc_unoapi_common_components) \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_shapetest))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index cbe32e32ebc2..d52537f1c908 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
 	CppunitTest_sc_dataprovider \
 	CppunitTest_sc_datatransformation \
 	CppunitTest_sc_cache_test \
+    CppunitTest_sc_shapetest \
 ))
 
 ifneq ($(DISABLE_GUI),TRUE)
diff --git a/sc/qa/unit/data/ods/tdf119191_FitToCellSize.ods b/sc/qa/unit/data/ods/tdf119191_FitToCellSize.ods
new file mode 100644
index 000000000000..ff43af5f7589
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf119191_FitToCellSize.ods differ
diff --git a/sc/qa/unit/data/ods/tdf119191_transformedShape.ods b/sc/qa/unit/data/ods/tdf119191_transformedShape.ods
new file mode 100644
index 000000000000..c3936a269627
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf119191_transformedShape.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
new file mode 100644
index 000000000000..8e3cbe2c7802
--- /dev/null
+++ b/sc/qa/unit/scshapetest.cxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/calc_unoapi_test.hxx>
+
+#include <sfx2/dispatch.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdpage.hxx>
+
+#include <docsh.hxx>
+#include <drwlayer.hxx>
+#include <tabvwsh.hxx>
+#include <userdat.hxx>
+
+#include <sc.hrc> // defines of slot-IDs
+
+using namespace css;
+
+namespace sc_apitest
+{
+class ScShapeTest : public CalcUnoApiTest
+{
+public:
+    ScShapeTest();
+
+    virtual void tearDown() override;
+
+    void testFitToCellSize();
+    void testCustomShapeCellAnchoredRotatedShape();
+
+    CPPUNIT_TEST_SUITE(ScShapeTest);
+    CPPUNIT_TEST(testFitToCellSize);
+    CPPUNIT_TEST(testCustomShapeCellAnchoredRotatedShape);
+    CPPUNIT_TEST_SUITE_END();
+
+private:
+    uno::Reference<lang::XComponent> mxComponent;
+};
+
+ScShapeTest::ScShapeTest()
+    : CalcUnoApiTest("sc/qa/unit/data/ods")
+{
+}
+
+static OUString lcl_compareRectWithTolerance(const tools::Rectangle& rExpected,
+                                             const tools::Rectangle& rActual,
+                                             const sal_Int32 nTolerance)
+{
+    OUString sErrors;
+    if (labs(rExpected.Left() - rActual.Left()) > nTolerance)
+        sErrors += "\nLeft expected " + OUString::number(rExpected.Left()) + " actual "
+                   + OUString::number(rActual.Left()) + " Tolerance "
+                   + OUString::number(nTolerance);
+    if (labs(rExpected.Top() - rActual.Top()) > nTolerance)
+        sErrors += "\nTop expected " + OUString::number(rExpected.Top()) + " actual "
+                   + OUString::number(rActual.Top()) + " Tolerance " + OUString::number(nTolerance);
+    if (labs(rExpected.GetWidth() - rActual.GetWidth()) > nTolerance)
+        sErrors += "\nWidth expected " + OUString::number(rExpected.GetWidth()) + " actual "
+                   + OUString::number(rActual.GetWidth()) + " Tolerance "
+                   + OUString::number(nTolerance);
+    if (labs(rExpected.GetHeight() - rActual.GetHeight()) > nTolerance)
+        sErrors += "\nHeight expected " + OUString::number(rExpected.GetHeight()) + " actual "
+                   + OUString::number(rActual.GetHeight()) + " Tolerance "
+                   + OUString::number(nTolerance);
+    return sErrors;
+}
+
+void ScShapeTest::testFitToCellSize()
+{
+    // The document has a cell anchored custom shape. Applying
+    // FitToCellSize should resize and position the shape so,
+    // that it fits into its anchor cell. That did not happened.
+    OUString aFileURL;
+    createFileURL("tdf119191_FitToCellSize.ods", aFileURL);
+    uno::Reference<css::lang::XComponent> xComponent = loadFromDesktop(aFileURL);
+    CPPUNIT_ASSERT(xComponent.is());
+
+    // Get the document model
+    SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
+    CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+
+    ScDocShell* pDocSh = dynamic_cast<ScDocShell*>(pFoundShell);
+    CPPUNIT_ASSERT(pDocSh);
+
+    // Get the shape
+    ScDocument& rDoc = pDocSh->GetDocument();
+    ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+    CPPUNIT_ASSERT(pDrawLayer);
+
+    const SdrPage* pPage = pDrawLayer->GetPage(0);
+    CPPUNIT_ASSERT(pPage);
+
+    SdrObjCustomShape* pObj = dynamic_cast<SdrObjCustomShape*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT(pObj);
+
+    // Get the document controller
+    ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false);
+    CPPUNIT_ASSERT(pViewShell);
+
+    // Get the draw view of the document
+    ScDrawView* pDrawView = pViewShell->GetViewData().GetScDrawView();
+    CPPUNIT_ASSERT(pDrawView);
+
+    // Select the shape
+    pDrawView->MarkNextObj();
+    CPPUNIT_ASSERT(pDrawView->AreObjectsMarked());
+
+    // Fit selected shape into cell
+    pViewShell->GetViewData().GetDispatcher().Execute(SID_FITCELLSIZE);
+
+    const tools::Rectangle& rShapeRect(pObj->GetSnapRect());
+    const tools::Rectangle aCellRect = rDoc.GetMMRect(1, 1, 1, 1, 0);
+    const OUString sErrors(lcl_compareRectWithTolerance(aCellRect, rShapeRect, 1));
+    CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+
+    pDocSh->DoClose();
+}
+
+void ScShapeTest::testCustomShapeCellAnchoredRotatedShape()
+{
+    // The example doc contains a cell anchored custom shape that is rotated
+    // and sheared. Error was, that the shape lost position and size on
+    // loading.
+    OUString aFileURL;
+    createFileURL("tdf119191_transformedShape.ods", aFileURL);
+    uno::Reference<css::lang::XComponent> xComponent = loadFromDesktop(aFileURL);
+    CPPUNIT_ASSERT(xComponent.is());
+
+    // Get the document model
+    SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
+    CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
+
+    ScDocShell* pDocSh = dynamic_cast<ScDocShell*>(pFoundShell);
+    CPPUNIT_ASSERT(pDocSh);
+
+    // Get the shape
+    ScDocument& rDoc = pDocSh->GetDocument();
+    ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+    CPPUNIT_ASSERT(pDrawLayer);
+
+    const SdrPage* pPage = pDrawLayer->GetPage(0);
+    CPPUNIT_ASSERT(pPage);
+
+    SdrObjCustomShape* pObj = dynamic_cast<SdrObjCustomShape*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT(pObj);
+
+    // Check Position and Size
+    tools::Rectangle aRect(2406, 754, 5774, 3692); // expected snap rect
+    rDoc.SetDrawPageSize(0); // trigger recalcpos
+    const tools::Rectangle& rShapeRect(pObj->GetSnapRect());
+    const OUString sPosSizeErrors(lcl_compareRectWithTolerance(aRect, rShapeRect, 1));
+    CPPUNIT_ASSERT_EQUAL(OUString(), sPosSizeErrors);
+
+    // Check anchor
+    ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj);
+    CPPUNIT_ASSERT_MESSAGE("expected object meta data", pData);
+
+    const OUString sExpected("start col 1 row 1 end col 2 row 8");
+    const OUString sActual("start col " + OUString::number(pData->maStart.Col()) + " row "
+                           + OUString::number(pData->maStart.Row()) + " end col "
+                           + OUString::number(pData->maEnd.Col()) + " row "
+                           + OUString::number(pData->maEnd.Row()));
+    CPPUNIT_ASSERT_EQUAL(sExpected, sActual);
+
+    pDocSh->DoClose();
+}
+
+void ScShapeTest::tearDown()
+{
+    if (mxComponent.is())
+    {
+        closeDocument(mxComponent);
+    }
+
+    CalcUnoApiTest::tearDown();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScShapeTest);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 4dd80df9a85a..515118d84c23 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1038,7 +1038,10 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
                 // order of these lines is important, modify rData.maLastRect carefully it is used as both
                 // a value and a flag for initialisation
                 rData.setShapeRect(GetDocument(), lcl_makeSafeRectangle(rData.getShapeRect()), pObj->IsVisible());
-                pObj->SetSnapRect(rData.getShapeRect());
+                if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
+                    pObj->AdjustToMaxRect(rData.getShapeRect());
+                else
+                    pObj->SetSnapRect(rData.getShapeRect());
                 // update 'unrotated anchor' it's the anchor we persist, it must be kept in sync
                 // with the normal Anchor
                 ResizeLastRectFromAnchor( pObj, rNoRotatedAnchor, true, bNegativePage, bCanResize );
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index e1f0d04da7a4..25c64c2e5ef3 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -569,8 +569,10 @@ void ScDrawView::FitToCellSize()
     }
 
     pUndoGroup->AddAction( std::make_unique<SdrUndoGeoObj>( *pObj ) );
-
-    pObj->SetSnapRect(aCellRect);
+    if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
+        pObj->AdjustToMaxRect(aCellRect);
+    else
+        pObj->SetSnapRect(aCellRect);
 
     pUndoGroup->SetComment(ScResId( STR_UNDO_FITCELLSIZE ));
     ScDocShell* pDocSh = pViewData->GetDocShell();
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 7afb195499cd..7d78963ea192 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -91,6 +91,9 @@
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/range/b2drange.hxx>
 #include <svdobjplusdata.hxx>
 #include "presetooxhandleadjustmentrelations.hxx"
 
@@ -2920,6 +2923,69 @@ void SdrObjCustomShape::RestGeoData(const SdrObjGeoData& rGeo)
     InvalidateRenderGeometry();
 }
 
+void SdrObjCustomShape::AdjustToMaxRect(const tools::Rectangle& rMaxRect, bool bShrinkOnly /* = false */)
+{
+    SAL_INFO_IF(bShrinkOnly, "svx", "Case bShrinkOnly == true is not implemented yet.");
+
+    if (rMaxRect.IsEmpty() || rMaxRect == GetSnapRect())
+        return;
+
+    // Get a matrix, that would produce the existing shape, when applied to a unit square
+    basegfx::B2DPolyPolygon aPolyPolygon; //not used, but formal needed
+    basegfx::B2DHomMatrix aMatrix;
+    TRGetBaseGeometry(aMatrix, aPolyPolygon);
+    // Using TRSetBaseGeometry(aMatrix, aPolyPolygon) would regenerate the current shape. But
+    // applying aMatrix to a unit square will not generate the current shape. Scaling,
+    // rotation and translation are correct, but shear angle has wrong sign. So break up
+    // matrix and create a mathematically correct new one.
+    basegfx::B2DTuple aScale;
+    basegfx::B2DTuple aTranslate;
+    double fRotate, fShearX;
+    aMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+    basegfx::B2DHomMatrix aMathMatrix;
+    aMathMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
+            aScale,
+            basegfx::fTools::equalZero(fShearX) ? 0.0 : -fShearX,
+            basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
+            aTranslate);
+
+    // Calculate scaling factors from size of the transformed unit polygon as ersatz for the not
+    // usable current snap rectangle.
+    basegfx::B2DPolygon aB2DPolygon(basegfx::utils::createUnitPolygon());
+    aB2DPolygon.transform(aMathMatrix);
+    basegfx::B2DRange aB2DRange(aB2DPolygon.getB2DRange());
+    double fPolygonWidth = aB2DRange.getWidth();
+    if (fPolygonWidth == 0)
+        fPolygonWidth = 1;
+    double fPolygonHeight = aB2DRange.getHeight();
+    if (fPolygonHeight == 0)
+        fPolygonHeight = 1;
+    const double aFactorX = static_cast<double>(rMaxRect.GetWidth()) / fPolygonWidth;
+    const double aFactorY = static_cast<double>(rMaxRect.GetHeight()) / fPolygonHeight;
+
+    // Generate matrix, that would produce the desired rMaxRect when applied to unit square
+    aMathMatrix.scale(aFactorX, aFactorY);
+    aB2DPolygon = basegfx::utils::createUnitPolygon();
+    aB2DPolygon.transform(aMathMatrix);
+    aB2DRange = aB2DPolygon.getB2DRange();
+    const double fPolygonLeft = aB2DRange.getMinX();
+    const double fPolygonTop = aB2DRange.getMinY();
+    aMathMatrix.translate(rMaxRect.getX() - fPolygonLeft, rMaxRect.getY() - fPolygonTop);
+
+    // Create a Matrix from aMathMatrix, which is usable with TRSetBaseGeometry
+    aMathMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+    aMatrix = basegfx::utils::createScaleShearXRotateTranslateB2DHomMatrix(
+            aScale,
+            basegfx::fTools::equalZero(fShearX) ? 0.0 : -fShearX,
+            basegfx::fTools::equalZero(fRotate) ? 0.0 : fRotate,
+            aTranslate);
+
+    // Now use TRSetBaseGeometry to actually perform scale, shear, rotate and translate
+    // on the shape. That considers gluepoints, interaction handles and text area, and includes
+    // setting rectangles dirty and broadcoast.
+    TRSetBaseGeometry(aMatrix, aPolyPolygon);
+}
+
 void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
 {
     // break up matrix
commit fb2382ad4f33b885650ad5156ccaec4e90661806
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Jan 6 10:49:31 2020 +0300
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 7 18:06:21 2020 +0100

    tdf#130187: Don't crash on exiting print preview with Notebookbar
    
    Crash caused by this sequence (tested in Writer):
    
    1. Closing print preview, frame is attached to controller;
    2. This calls SfxNotebookBar::StateMethod
    3. There notebookbar's listener is added to list of the controller's
       context change event listeners
    4. Then in SwPagePreview::~SwPagePreview, notebookbar's listener is
       added to that list again
    5. ContextChangeEventMultiplexer::addContextChangeEventListener
       detects second addition, and throws an unhandled exception.
    
    I don't know why starting listening is needed in SwPagePreview dtor;
    unfortunately commit d05b7b32d9ecb6fcb4a268eb68cdcee09bafa6dd doesn't
    say much about context and reasons.
    
    ControlListener is renamed to ControlListenerForCurrentController to
    emphasize that it operates on the current controller of notebookbar's
    frame; and its bListen parameter meaning was reverted: previously its
    "true" value awkwardly meant "stop listening". All direct operations
    with listener of notebookbar are replaced with calls to notebookbar's
    methods.
    
    In ContextChangeEventMultiplexer::addContextChangeEventListener,
    uno::UNO_QUERY_THROW was replaced with uno::UNO_QUERY, because not
    only chart controller may appear here, and it's not an error: e.g.
    SfxBaseController doesn't implement lang::XServiceInfo.
    
    Regression after commit d05b7b32d9ecb6fcb4a268eb68cdcee09bafa6dd.
    
    Change-Id: Ief1aed188d8f02a6cfe3ea25f4d082dfdf449f32
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86257
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87582

diff --git a/include/vcl/notebookbar.hxx b/include/vcl/notebookbar.hxx
index af904ca2ae5f..457a64b9a206 100644
--- a/include/vcl/notebookbar.hxx
+++ b/include/vcl/notebookbar.hxx
@@ -14,6 +14,7 @@
 #include <vcl/ctrl.hxx>
 #include <vcl/NotebookBarAddonsMerger.hxx>
 #include <vcl/settings.hxx>
+#include <set>
 #include <vector>
 
 namespace com { namespace sun { namespace star { namespace ui { class XContextChangeEventListener; } } } }
@@ -39,17 +40,17 @@ public:
 
     void SetSystemWindow(SystemWindow* pSystemWindow);
 
-    const css::uno::Reference<css::ui::XContextChangeEventListener>& getContextChangeEventListener() const { return m_pEventListener; }
-
     void StateChanged(const StateChangedType nStateChange ) override;
 
     void DataChanged(const DataChangedEvent& rDCEvt) override;
 
-    void ControlListener(bool bListen);
+    void ControlListenerForCurrentController(bool bListen);
+    void StopListeningAllControllers();
 
 private:
     VclPtr<SystemWindow> m_pSystemWindow;
     css::uno::Reference<css::ui::XContextChangeEventListener> m_pEventListener;
+    std::set<css::uno::Reference<css::frame::XController>> m_alisteningControllers;
     std::vector<NotebookbarContextControl*> m_pContextContainers;
     css::uno::Reference<css::frame::XFrame> mxFrame;
 
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index 493ce87228ce..fe3688abdd43 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -160,7 +160,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
 
     auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar();
     if (pNotebookBar)
-        pNotebookBar->ControlListener(true);
+        pNotebookBar->ControlListenerForCurrentController(false); // stop listening
 
     if ( auto pTabViewShell = dynamic_cast<ScTabViewShell*>( pOldSh) )
     {
@@ -189,7 +189,7 @@ ScPreviewShell::~ScPreviewShell()
         mpFrameWindow->SetCloseHdl(Link<SystemWindow&,void>()); // Remove close handler.
 
     if (auto& pBar = GetViewFrame()->GetWindow().GetSystemWindow()->GetNotebookBar())
-        pBar->ControlListener(false);
+        pBar->ControlListenerForCurrentController(true); // let it start listening now
 
     // #108333#; notify Accessibility that Shell is dying and before destroy all
     BroadcastAccessibility( SfxHint( SfxHintId::Dying ) );
diff --git a/sfx2/source/notebookbar/SfxNotebookBar.cxx b/sfx2/source/notebookbar/SfxNotebookBar.cxx
index 538886f202a1..a2d7f1f39b17 100644
--- a/sfx2/source/notebookbar/SfxNotebookBar.cxx
+++ b/sfx2/source/notebookbar/SfxNotebookBar.cxx
@@ -400,15 +400,7 @@ bool SfxNotebookBar::StateMethod(SystemWindow* pSysWindow,
 
             if(pView)
             {
-                Reference<XContextChangeEventMultiplexer> xMultiplexer
-                            = ContextChangeEventMultiplexer::get( xContext );
-
-                if(xFrame.is())
-                {
-                    xMultiplexer->addContextChangeEventListener(
-                                        pNotebookBar->getContextChangeEventListener(),
-                                        xFrame->getController());
-                }
+                pNotebookBar->ControlListenerForCurrentController(true);
             }
         }
 
@@ -430,10 +422,9 @@ void SfxNotebookBar::RemoveListeners(SystemWindow const * pSysWindow)
                         = ContextChangeEventMultiplexer::get(
                                 ::comphelper::getProcessComponentContext());
 
-    if (pSysWindow->GetNotebookBar())
+    if (auto pNotebookBar = pSysWindow->GetNotebookBar())
     {
-        xMultiplexer->removeAllContextChangeEventListeners(
-                           pSysWindow->GetNotebookBar()->getContextChangeEventListener());
+        pNotebookBar->StopListeningAllControllers();
     }
 }
 
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index e40ee2807de4..3e93705806f3 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1160,7 +1160,7 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
     SfxShell::BroadcastContextForActivation(true);
     //removelisteners for notebookbar
     if (auto& pBar = SfxViewFrame::Current()->GetWindow().GetSystemWindow()->GetNotebookBar())
-        pBar->ControlListener(true);
+        pBar->ControlListenerForCurrentController(false);
 
     SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
     if ( !pOldSh )
@@ -1228,7 +1228,7 @@ SwPagePreview::~SwPagePreview()
     m_pViewWin.disposeAndClear();
     if (SfxViewFrame* pCurrent = SfxViewFrame::Current())
         if (auto& pBar = pCurrent->GetWindow().GetSystemWindow()->GetNotebookBar())
-            pBar->ControlListener(false);
+            pBar->ControlListenerForCurrentController(true); // start listening now
     m_pScrollFill.disposeAndClear();
     m_pHScrollbar.disposeAndClear();
     m_pVScrollbar.disposeAndClear();
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index b178962f5d11..bcf2f7563ff5 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -97,6 +97,7 @@ void NotebookBar::dispose()
         m_pSystemWindow->GetTaskPaneList()->RemoveWindow(this);
     m_pSystemWindow.clear();
     disposeBuilder();
+    assert(m_alisteningControllers.empty());
     m_pEventListener.clear();
     Control::dispose();
 }
@@ -180,24 +181,41 @@ void SAL_CALL NotebookBarContextChangeEventListener::notifyContextChangeEvent(co
     }
 }
 
-void NotebookBar::ControlListener(bool bListen)
+void NotebookBar::ControlListenerForCurrentController(bool bListen)
 {
+    auto xController = mxFrame->getController();
     if(bListen)
     {
-        // remove listeners
-        css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (css::ui::ContextChangeEventMultiplexer::get(
+        // add listeners
+        if (m_alisteningControllers.count(xController) == 0)
+        {
+            auto xMultiplexer(css::ui::ContextChangeEventMultiplexer::get(
                 ::comphelper::getProcessComponentContext()));
-        xMultiplexer->removeContextChangeEventListener(getContextChangeEventListener(),mxFrame->getController());
+            xMultiplexer->addContextChangeEventListener(m_pEventListener, xController);
+            m_alisteningControllers.insert(xController);
+        }
     }
     else
     {
-        // add listeners
-        css::uno::Reference<css::ui::XContextChangeEventMultiplexer> xMultiplexer (css::ui::ContextChangeEventMultiplexer::get(
+        // remove listeners
+        if (m_alisteningControllers.count(xController))
+        {
+            auto xMultiplexer(css::ui::ContextChangeEventMultiplexer::get(
                 ::comphelper::getProcessComponentContext()));
-        xMultiplexer->addContextChangeEventListener(getContextChangeEventListener(),mxFrame->getController());
+            xMultiplexer->removeContextChangeEventListener(m_pEventListener, xController);
+            m_alisteningControllers.erase(xController);
+        }
     }
 }
 
+void NotebookBar::StopListeningAllControllers()
+{
+    auto xMultiplexer(
+        css::ui::ContextChangeEventMultiplexer::get(comphelper::getProcessComponentContext()));
+    xMultiplexer->removeAllContextChangeEventListeners(m_pEventListener);
+    m_alisteningControllers.clear();
+}
+
 void SAL_CALL NotebookBarContextChangeEventListener::disposing(const ::css::lang::EventObject&)
 {
     mpParent.clear();
commit 282cf1507d51573e5e9a4611b1e775b433168ca7
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 4 14:33:37 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 7 18:02:50 2020 +0100

    tdf#130362 sw: fix anchoring of inline math objects
    
    Regression from a7528cd6f17ea5c5b29e7d607e54c62de0d9e7db (sw: insert
    image: set anchor to at-char by default, 2019-11-18), that defaulted to
    at-char anchoring for charts and images.
    
    What was not considered is that math objects had a previous as-char
    default (not to-para), and that is supposed to be unchanged.
    
    (cherry picked from commit a2f85c062aafb3fd9dfb1c6c6e87e1e73e7545a3)
    
    Change-Id: I2a91af6425035b48a0e47ad9b10939945855cd16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87997
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/CppunitTest_sw_core_doc.mk b/sw/CppunitTest_sw_core_doc.mk
new file mode 100644
index 000000000000..487e02322ef4
--- /dev/null
+++ b/sw/CppunitTest_sw_core_doc.mk
@@ -0,0 +1,72 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sw_core_doc))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sw_core_doc))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sw_core_doc, \
+    sw/qa/core/doc/doc \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sw_core_doc, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    sfx \
+    sw \
+    test \
+    unotest \
+    utl \
+    vcl \
+    svt \
+    tl \
+    svl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sw_core_doc,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sw_core_doc,\
+    -I$(SRCDIR)/sw/inc \
+    -I$(SRCDIR)/sw/source/core/inc \
+    -I$(SRCDIR)/sw/source/uibase/inc \
+    -I$(SRCDIR)/sw/qa/inc \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sw_core_doc,\
+	udkapi \
+	offapi \
+	oovbaapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sw_core_doc))
+$(eval $(call gb_CppunitTest_use_vcl,sw_core_doc))
+
+$(eval $(call gb_CppunitTest_use_rdb,sw_core_doc,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_core_doc,\
+    officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sw_core_doc))
+
+$(eval $(call gb_CppunitTest_use_uiconfigs,sw_core_doc, \
+    modules/swriter \
+))
+
+$(eval $(call gb_CppunitTest_use_more_fonts,sw_core_doc))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index fa571852aea5..06ab4c8f8fa3 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -105,6 +105,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_apitests \
     CppunitTest_sw_unowriter \
     CppunitTest_sw_core_text \
+    CppunitTest_sw_core_doc \
     CppunitTest_sw_uibase_shells \
 ))
 
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx
index 6ba51df9f740..b6857c346a33 100644
--- a/sw/inc/IDocumentContentOperations.hxx
+++ b/sw/inc/IDocumentContentOperations.hxx
@@ -180,7 +180,7 @@ public:
     */
     virtual SwFlyFrameFormat* InsertEmbObject(
         const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj,
-        const SfxItemSet* pFlyAttrSet) = 0;
+        SfxItemSet* pFlyAttrSet) = 0;
 
     virtual SwFlyFrameFormat* InsertOLE(
         const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect,
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index b928420ea824..17348494d6d6 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -622,7 +622,7 @@ public:
     bool GetPageNumber( long nYPos, bool bAtCursorPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay ) const;
 
     SwFlyFrameFormat* InsertObject( const svt::EmbeddedObjectRef&,
-                const SfxItemSet* pFlyAttrSet );
+                SfxItemSet* pFlyAttrSet );
     bool    FinishOLEObj(); ///< Shutdown server.
 
     void GetTableAttr( SfxItemSet & ) const;
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
new file mode 100644
index 000000000000..3141c12011cc
--- /dev/null
+++ b/sw/qa/core/doc/doc.cxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <vcl/gdimtf.hxx>
+#include <comphelper/classids.hxx>
+#include <tools/globname.hxx>
+#include <svtools/embedhlp.hxx>
+
+#include <wrtsh.hxx>
+#include <fmtanchr.hxx>
+
+static char const DATA_DIRECTORY[] = "/sw/qa/core/doc/data/";
+
+/// Covers sw/source/core/doc/ fixes.
+class SwCoreDocTest : public SwModelTestBase
+{
+public:
+    SwDoc* createDoc(const char* pName = nullptr);
+};
+
+SwDoc* SwCoreDocTest::createDoc(const char* pName)
+{
+    if (!pName)
+        loadURL("private:factory/swriter", nullptr);
+    else
+        load(DATA_DIRECTORY, pName);
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+    return pTextDoc->GetDocShell()->GetDoc();
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType)
+{
+    // Given an empty document.
+    SwDoc* pDoc = createDoc();
+
+    // When inserting an a math object.
+    SwWrtShell* pShell = pDoc->GetDocShell()->GetWrtShell();
+    SvGlobalName aGlobalName(SO3_SM_CLASSID);
+    pShell->InsertObject(svt::EmbeddedObjectRef(), &aGlobalName);
+
+    // Then the anchor type should be as-char.
+    SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rFormats.size());
+    const SwFrameFormat& rFormat = *rFormats[0];
+    const SwFormatAnchor& rAnchor = rFormat.GetAnchor();
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1
+    // - Actual  : 4
+    // i.e. the anchor type was at-char, not as-char.
+    CPPUNIT_ASSERT_EQUAL(RndStdIds::FLY_AS_CHAR, rAnchor.GetAnchorId());
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index c10cd56e93d5..aeafeea3dc2e 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2855,14 +2855,22 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsertGraphicObject(
 
 SwFlyFrameFormat* DocumentContentOperationsManager::InsertEmbObject(
         const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj,
-                        const SfxItemSet* pFlyAttrSet)
+                        SfxItemSet* pFlyAttrSet)
 {
     sal_uInt16 nId = RES_POOLFRM_OLE;
     if (xObj.is())
     {
         SvGlobalName aClassName( xObj->getClassID() );
         if (SotExchange::IsMath(aClassName))
+        {
             nId = RES_POOLFRM_FORMEL;
+            if (pFlyAttrSet && pFlyAttrSet->HasItem(RES_ANCHOR))
+            {
+                // Clear the at-char anchor set in the SwFlyFrameAttrMgr ctor, so the as-char one
+                // set later in pFrameFormat is considered.
+                pFlyAttrSet->ClearItem(RES_ANCHOR);
+            }
+        }
     }
 
     SwFrameFormat* pFrameFormat = m_rDoc.getIDocumentStylePoolAccess().GetFrameFormatFromPool( nId );
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index db4c88897024..0a55c4f969dd 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -889,7 +889,7 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName,
 }
 
 SwFlyFrameFormat* SwFEShell::InsertObject( const svt::EmbeddedObjectRef&  xObj,
-                        const SfxItemSet* pFlyAttrSet )
+                        SfxItemSet* pFlyAttrSet )
 {
     SwFlyFrameFormat* pFormat = nullptr;
     SET_CURR_SHELL( this );
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index 4f523bec9f3d..2d600b6ff8ba 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -73,7 +73,7 @@ public:
 
     SwDrawFrameFormat* InsertDrawObj( const SwPaM &rRg, SdrObject& rDrawObj, const SfxItemSet& rFlyAttrSet ) override;
 
-    SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, const SfxItemSet* pFlyAttrSet) override;
+    SwFlyFrameFormat* InsertEmbObject(const SwPaM &rRg, const svt::EmbeddedObjectRef& xObj, SfxItemSet* pFlyAttrSet) override;
 
     SwFlyFrameFormat* InsertOLE(const SwPaM &rRg, const OUString& rObjName, sal_Int64 nAspect, const SfxItemSet* pFlyAttrSet,
                            const SfxItemSet* pGrfAttrSet) override;
commit c1fd8e49f27fba261b5a715426ff5523abf5ac2b
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Feb 5 16:11:40 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 7 17:57:43 2020 +0100

    DOCX import: don't give up on floating tables in headers completely
    
    This reverts commit 213d6390a2cc59d174173f4359c161625a9c4bdc (tdf#108272
    DOCX table-only header: fix SAX parser error, 2020-02-03), except its
    testcase and replaces it with a better fix that does not import all
    floating-table-in-header as non-floating tables.
    
    See the new testcase, which is 1 pages in Word, it was 3 pages in
    Writer, and with the better fix it's now 1 pages in Writer as well.
    
    Change-Id: Ica3500120f12222d7cf766d55c17d78164865026
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88037
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88098

diff --git a/writerfilter/CppunitTest_writerfilter_dmapper.mk b/writerfilter/CppunitTest_writerfilter_dmapper.mk
index 9805e28228a0..37a3dc5813c5 100644
--- a/writerfilter/CppunitTest_writerfilter_dmapper.mk
+++ b/writerfilter/CppunitTest_writerfilter_dmapper.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_CppunitTest_use_externals,writerfilter_dmapper,\
 $(eval $(call gb_CppunitTest_add_exception_objects,writerfilter_dmapper, \
     writerfilter/qa/cppunittests/dmapper/CellColorHandler \
     writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler \
+    writerfilter/qa/cppunittests/dmapper/PropertyMap \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,writerfilter_dmapper, \
diff --git a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx
new file mode 100644
index 000000000000..06c5611afe37
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+
+namespace
+{
+/// Tests for writerfilter/source/dmapper/PropertyMap.cxx.
+class Test : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+    uno::Reference<uno::XComponentContext> mxComponentContext;
+    uno::Reference<lang::XComponent> mxComponent;
+
+public:
+    void setUp() override;
+    void tearDown() override;
+    uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+};
+
+void Test::setUp()
+{
+    test::BootstrapFixture::setUp();
+
+    mxComponentContext.set(comphelper::getComponentContext(getMultiServiceFactory()));
+    mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void Test::tearDown()
+{
+    if (mxComponent.is())
+        mxComponent->dispose();
+
+    test::BootstrapFixture::tearDown();
+}
+
+char const DATA_DIRECTORY[] = "/writerfilter/qa/cppunittests/dmapper/data/";
+
+CPPUNIT_TEST_FIXTURE(Test, testFloatingTableHeader)
+{
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "floating-table-header.docx";
+    getComponent() = loadFromDesktop(aURL);
+    uno::Reference<frame::XModel> xModel(getComponent(), uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+        xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                              uno::UNO_QUERY);
+    xCursor->jumpToLastPage();
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1
+    // - Actual  : 3
+    // i.e. a document which is 1 page in Word was imported as a 3 page one.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), xCursor->getPage());
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/floating-table-header.docx b/writerfilter/qa/cppunittests/dmapper/data/floating-table-header.docx
new file mode 100644
index 000000000000..3840b2550d5b
Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/floating-table-header.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 5315e947ceae..f4d025739915 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -51,7 +51,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
     m_nGridAfter(0),
     m_nHeaderRepeat(0),
     m_nTableWidth(0),
-    m_bIsUnfloatTable(false),
+    m_bIsInShape(false),
     m_aTmpPosition(),
     m_aTmpTableProperties(),
     m_bPushCurrentWidth(false),
@@ -339,8 +339,8 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
             case NS_ooxml::LN_CT_TblPrBase_tblpPr:
                 {
                     writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
-                    // Ignore <w:tblpPr> in shape text or in table-only header, those tables should be always non-floating ones.
-                    if (!m_bIsUnfloatTable && pProperties.get())
+                    // Ignore <w:tblpPr> in shape text, those tables should be always non-floating ones.
+                    if (!m_bIsInShape && pProperties.get())
                     {
                         TablePositionHandlerPtr pHandler = m_aTmpPosition.back();
                         if ( !pHandler )
@@ -430,9 +430,9 @@ TablePositionHandler* DomainMapperTableManager::getCurrentTableRealPosition()
         return nullptr;
 }
 
-void DomainMapperTableManager::setIsUnfloatTable(bool bIsUnfloatTable)
+void DomainMapperTableManager::setIsInShape(bool bIsInShape)
 {
-    m_bIsUnfloatTable = bIsUnfloatTable;
+    m_bIsInShape = bIsInShape;
 }
 
 void DomainMapperTableManager::startLevel( )
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index d58d5e29095e..219986870ef3 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -46,8 +46,8 @@ class DomainMapperTableManager : public TableManager
     sal_uInt32      m_nGridAfter; ///< number of grid columns in the parent table's table grid which shall be left after the last cell in the table row
     sal_Int32       m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
     sal_Int32       m_nTableWidth; //might be set directly or has to be calculated from the column positions
-    /// Unfloat tables in a shape/table-only header (text append stack is not empty)
-    bool m_bIsUnfloatTable;
+    /// Are we in a shape (text append stack is not empty) or in the body document?
+    bool m_bIsInShape;
     OUString m_sTableStyleName;
     /// Grab-bag of table look attributes for preserving.
     comphelper::SequenceAsHashMap m_aTableLook;
@@ -131,7 +131,7 @@ public:
 
     using TableManager::isInCell;
 
-    void setIsUnfloatTable(bool bIsUnfloatTable);
+    void setIsInShape(bool bIsInShape);
 
 };
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 58aa43b82712..fe6283616c1e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1843,11 +1843,6 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper
 
     if (m_aTextAppendStack.empty())
         return;
-
-    // not a table-only header, don't avoid of floating tables
-    if (m_eInHeaderFooterImport == HeaderFooterImportState::header && !IsInShape() && hasTableManager() && !getTableManager().isInCell())
-        getTableManager().setIsUnfloatTable(false);
-
     // Before placing call to processDeferredCharacterProperties(), TopContextType should be CONTEXT_CHARACTER
     // processDeferredCharacterProperties() invokes only if character inserted
     if( pPropertyMap == m_pTopContext && !deferredCharacterProperties.empty() && (GetTopContextType() == CONTEXT_CHARACTER) )
@@ -2195,10 +2190,6 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, SectionPropertyMap::P
     m_eInHeaderFooterImport
         = bHeader ? HeaderFooterImportState::header : HeaderFooterImportState::footer;
 
-    // ignore <w:tblpPr> in table-only header, that table is imported as non-floating one
-    if (bHeader && hasTableManager())
-        getTableManager().setIsUnfloatTable(true);
-
     //get the section context
     PropertyMapPtr pContext = DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION);
     //ask for the header/footer name of the given type
@@ -2752,7 +2743,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
                         uno::makeAny( true ) );
         }
         m_bParaChanged = true;
-        getTableManager().setIsUnfloatTable(true);
+        getTableManager().setIsInShape(true);
     }
     catch ( const uno::Exception& )
     {
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index efe03cde337e..d83d2bd831dd 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1321,7 +1321,17 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
     {
         rInfo.m_nBreakType = m_nBreakType;
         if ( FloatingTableConversion( rDM_Impl, rInfo ) )
-            xBodyText->convertToTextFrame( rInfo.m_xStart, rInfo.m_xEnd, rInfo.m_aFrameProperties );
+        {
+            try
+            {
+                xBodyText->convertToTextFrame(rInfo.m_xStart, rInfo.m_xEnd,
+                                              rInfo.m_aFrameProperties);
+            }
+            catch (const uno::Exception&)
+            {
+                DBG_UNHANDLED_EXCEPTION("writerfilter", "convertToTextFrame() failed");
+            }
+        }
     }
     rPendingFloatingTables.clear();
 
commit bd704b167a07054335601aa86c636d7db84e982a
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Feb 3 13:54:57 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 7 17:57:07 2020 +0100

    tdf#108272 DOCX table-only header: fix SAX parser error
    
    Floating tables in table-only headers are imported
    as non-floating ones after a SAX parser error. Now
    we import them as non-floating ones from the beginning
    to avoid of the parser error.
    
    Change-Id: I0a816a7af642f402a25ed53d9766b1e8b82db789
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87874
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 213d6390a2cc59d174173f4359c161625a9c4bdc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88097
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/qa/core/data/ooxml/pass/tdf108272.docx b/sw/qa/core/data/ooxml/pass/tdf108272.docx
new file mode 100644
index 000000000000..8ee707c5ba8f
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/tdf108272.docx differ
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index f4d025739915..5315e947ceae 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -51,7 +51,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
     m_nGridAfter(0),
     m_nHeaderRepeat(0),
     m_nTableWidth(0),
-    m_bIsInShape(false),
+    m_bIsUnfloatTable(false),
     m_aTmpPosition(),
     m_aTmpTableProperties(),
     m_bPushCurrentWidth(false),
@@ -339,8 +339,8 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
             case NS_ooxml::LN_CT_TblPrBase_tblpPr:
                 {
                     writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
-                    // Ignore <w:tblpPr> in shape text, those tables should be always non-floating ones.
-                    if (!m_bIsInShape && pProperties.get())
+                    // Ignore <w:tblpPr> in shape text or in table-only header, those tables should be always non-floating ones.
+                    if (!m_bIsUnfloatTable && pProperties.get())
                     {
                         TablePositionHandlerPtr pHandler = m_aTmpPosition.back();
                         if ( !pHandler )
@@ -430,9 +430,9 @@ TablePositionHandler* DomainMapperTableManager::getCurrentTableRealPosition()
         return nullptr;
 }
 
-void DomainMapperTableManager::setIsInShape(bool bIsInShape)
+void DomainMapperTableManager::setIsUnfloatTable(bool bIsUnfloatTable)
 {
-    m_bIsInShape = bIsInShape;
+    m_bIsUnfloatTable = bIsUnfloatTable;
 }
 
 void DomainMapperTableManager::startLevel( )
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index 219986870ef3..d58d5e29095e 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -46,8 +46,8 @@ class DomainMapperTableManager : public TableManager
     sal_uInt32      m_nGridAfter; ///< number of grid columns in the parent table's table grid which shall be left after the last cell in the table row
     sal_Int32       m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
     sal_Int32       m_nTableWidth; //might be set directly or has to be calculated from the column positions
-    /// Are we in a shape (text append stack is not empty) or in the body document?
-    bool m_bIsInShape;
+    /// Unfloat tables in a shape/table-only header (text append stack is not empty)
+    bool m_bIsUnfloatTable;
     OUString m_sTableStyleName;
     /// Grab-bag of table look attributes for preserving.
     comphelper::SequenceAsHashMap m_aTableLook;
@@ -131,7 +131,7 @@ public:
 
     using TableManager::isInCell;
 
-    void setIsInShape(bool bIsInShape);
+    void setIsUnfloatTable(bool bIsUnfloatTable);
 
 };
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index fe6283616c1e..58aa43b82712 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1843,6 +1843,11 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper
 
     if (m_aTextAppendStack.empty())
         return;
+
+    // not a table-only header, don't avoid of floating tables
+    if (m_eInHeaderFooterImport == HeaderFooterImportState::header && !IsInShape() && hasTableManager() && !getTableManager().isInCell())
+        getTableManager().setIsUnfloatTable(false);
+
     // Before placing call to processDeferredCharacterProperties(), TopContextType should be CONTEXT_CHARACTER
     // processDeferredCharacterProperties() invokes only if character inserted
     if( pPropertyMap == m_pTopContext && !deferredCharacterProperties.empty() && (GetTopContextType() == CONTEXT_CHARACTER) )
@@ -2190,6 +2195,10 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, SectionPropertyMap::P
     m_eInHeaderFooterImport
         = bHeader ? HeaderFooterImportState::header : HeaderFooterImportState::footer;
 
+    // ignore <w:tblpPr> in table-only header, that table is imported as non-floating one
+    if (bHeader && hasTableManager())
+        getTableManager().setIsUnfloatTable(true);
+
     //get the section context
     PropertyMapPtr pContext = DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION);
     //ask for the header/footer name of the given type
@@ -2743,7 +2752,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
                         uno::makeAny( true ) );
         }
         m_bParaChanged = true;
-        getTableManager().setIsInShape(true);
+        getTableManager().setIsUnfloatTable(true);
     }
     catch ( const uno::Exception& )
     {
commit f0fcadffbbf0d5d98ce9d04ac0b4216043aabf3a
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Feb 6 18:51:45 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Feb 7 11:55:29 2020 +0100

    sw: improve DOCX export of footnote separator
    
    Don't only check the width of the line, but also the line style and the
    thickness (0 is not visible).
    
    Also there isn't a separate continuationSeparator in sw, so it should
    depend on the same condition as the separator.
    
    Unfortuantely Word doesn't support different separators per section.
    
    Change-Id: I55cb3d82ff20c7a21f7d256ec8ba4a43f1e71faa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88131
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 584c5827f549f39c92f267180889e650d3e99edf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88169
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/qa/extras/ooxmlexport/data/footnotesep.fodt b/sw/qa/extras/ooxmlexport/data/footnotesep.fodt
new file mode 100644
index 000000000000..f786580bb247
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/footnotesep.fodt
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:loext="urn:org:documentfoundation:names:experimenta
 l:office:xmlns:loext:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns
 :tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:meta><meta:creation-date>2020-02-06T14:04:13.152283572</meta:creation-date><dc:date>2020-02-06T14:08:19.939509466</dc:date><meta:editing-duration>PT4M8S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="2" meta:paragraph-count="4" meta:word-count="4" meta:character-count="8" meta:non-whitespace-character-count="8"/><meta:generator>LibreOfficeDev/7.0.0.0.alpha0$Linux_X86_64 LibreOffice_project/d2eff4b08869dd15b025c5801896e0332b14ba59</meta:generator></office:meta>
+ <office:font-face-decls>
+  <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/>
+  <style:font-face style:name="Calibri" svg:font-family="Calibri" style:font-family-generic="swiss"/>
+  <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Sans CN" svg:font-family="'Source Han Sans CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="graphic">
+   <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+   <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Calibri" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+  </style:default-style>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Calibri" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+  </style:default-style>
+  <style:default-style style:family="table">
+   <style:table-properties table:border-model="collapsing"/>
+  </style:default-style>
+  <style:default-style style:family="table-row">
+   <style:table-row-properties fo:keep-together="auto"/>
+  </style:default-style>
+  <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+  <style:style style:name="Footnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+   <style:paragraph-properties fo:margin-left="0.598cm" fo:margin-right="0cm" fo:text-indent="-0.598cm" style:auto-text-indent="false" text:number-lines="false" text:line-number="0"/>
+   <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+  </style:style>
+  <style:style style:name="Footnote_20_Symbol" style:display-name="Footnote Symbol" style:family="text"/>
+  <style:style style:name="Footnote_20_anchor" style:display-name="Footnote anchor" style:family="text">
+   <style:text-properties style:text-position="super 58%"/>
+  </style:style>
+
+  <text:notes-configuration text:note-class="footnote" text:citation-style-name="Footnote_20_Symbol" text:citation-body-style-name="Footnote_20_anchor" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+  <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+  <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Footnote">
+   <style:text-properties officeooo:rsid="00069b1f" officeooo:paragraph-rsid="00069b1f"/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="Sep">
+   <style:paragraph-properties style:page-number="auto"/>
+  </style:style>
+  <style:page-layout style:name="pm1">
+   <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+    <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+  <style:page-layout style:name="pm2">
+   <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+    <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+   </style:page-layout-properties>
+   <style:header-style/>
+   <style:footer-style/>
+  </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+  <style:master-page style:name="Standard" style:page-layout-name="pm2"/>
+  <style:master-page style:name="Sep" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+  <office:text text:use-soft-page-breaks="true">
+   <text:sequence-decls>
+    <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+    <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+   </text:sequence-decls>
+   <text:p text:style-name="Standard"><text:note text:id="ftn0" text:note-class="footnote"><text:note-citation>1</text:note-citation><text:note-body>
+      <text:p text:style-name="P1">foo</text:p></text:note-body></text:note></text:p>
+   <text:p text:style-name="P2"><text:note text:id="ftn1" text:note-class="footnote"><text:note-citation>2</text:note-citation><text:note-body>
+      <text:p text:style-name="P1">bar</text:p></text:note-body></text:note></text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 8e394f7a445c..67e07639b284 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -320,6 +320,22 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
     assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFootnoteSeparator, "footnotesep.fodt")
+{
+    // foontote separator definitions - taken from default page style
+    xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml");
+    assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[1]", "id", "0");
+    assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[1]", "type", "separator");
+    assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[1]/w:p[1]/w:r[1]/w:separator", 0);
+    assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[2]", "id", "1");
+    assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[2]", "type", "continuationSeparator");
+    assertXPath(pXmlFootnotes, "/w:footnotes[1]/w:footnote[2]/w:p[1]/w:r[1]/w:continuationSeparator", 0);
+
+    xmlDocPtr pXmlSettings = parseExport("word/settings.xml");
+    assertXPath(pXmlSettings, "/w:settings[1]/w:footnotePr[1]/w:footnote[1]", "id", "0");
+    assertXPath(pXmlSettings, "/w:settings[1]/w:footnotePr[1]/w:footnote[2]", "id", "1");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO77812, "fdo77812.docx")
 {
     /* Additional sectPr was getting inserted and hence Column properties
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4db137c95eae..35249c34e4f2 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7580,6 +7580,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
     sal_Int32 nIndex = 0;
 
     // separator
+    // note: can only be defined for the whole document, not per section
     m_pSerializer->startElementNS( XML_w, nItem,
             FSNS( XML_w, XML_id ), OString::number(nIndex++),
             FSNS( XML_w, XML_type ), "separator" );
@@ -7590,8 +7591,10 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
     if (bFootnotes)
     {
         const SwPageFootnoteInfo& rFootnoteInfo = m_rExport.m_pDoc->GetPageDesc(0).GetFootnoteInfo();
-        // Request a separator only in case the width is larger than zero.
-        bSeparator = double(rFootnoteInfo.GetWidth()) > 0;
+        // Request separator only if both width and thickness are non-zero.
+        bSeparator = rFootnoteInfo.GetLineStyle() != SvxBorderLineStyle::NONE
+                  && rFootnoteInfo.GetLineWidth() > 0
+                  && double(rFootnoteInfo.GetWidth()) > 0;
     }
 
     if (bSeparator)
@@ -7606,7 +7609,10 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
             FSNS( XML_w, XML_type ), "continuationSeparator" );
     m_pSerializer->startElementNS(XML_w, XML_p);
     m_pSerializer->startElementNS(XML_w, XML_r);
-    m_pSerializer->singleElementNS(XML_w, XML_continuationSeparator);
+    if (bSeparator)
+    {
+        m_pSerializer->singleElementNS(XML_w, XML_continuationSeparator);
+    }
     m_pSerializer->endElementNS( XML_w, XML_r );
     m_pSerializer->endElementNS( XML_w, XML_p );
     m_pSerializer->endElementNS( XML_w, nItem );
commit 5cbaec2ffd289f6b3e1dce15c00d5b1d3c2f815e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Feb 5 16:42:34 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Feb 7 11:11:27 2020 +0100

    Resolves: tdf#130340 null deref when nothing selected
    
    Change-Id: Ie406006cbcca566ddd32fd86a7e88f0c754dd02e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88048
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 24a601d0af99..4bdeaabfd884 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -1182,7 +1182,7 @@ IMPL_LINK(SfxAcceleratorConfigPage, SelectHdl, weld::TreeView&, rListBox, void)
         m_xRemoveButton->set_sensitive( false );
         m_xChangeButton->set_sensitive( false );
 
-        if (pEntry->m_bIsConfigurable)
+        if (pEntry && pEntry->m_bIsConfigurable)
         {
             if (pEntry->isConfigured())
                 m_xRemoveButton->set_sensitive(true);
commit ddc8bf253cacbc1b65956e84a6f3df30d060b19d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 6 14:30:33 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Feb 7 10:57:46 2020 +0100

    fix "Use data for document properties" checkbutton
    
    regression since...
    
    commit 3a15c034be9f557f350d0ba1f3a842151066eaae
    Date:   Tue Mar 12 09:59:35 2019 +0000
    
        weld SvxGeneralTabPage
    
    Change-Id: I7c4624255f70c3f0c4ccd4b79ebae7750ed2bbe9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88109
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 71b61b0cca79..c5177c65bf9c 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -376,7 +376,7 @@ void SvxGeneralTabPage::Reset( const SfxItemSet* rSet )
             vFields.front()->xEdit->grab_focus();
     }
 
-    m_xUseDataCB->set_sensitive( SvtSaveOptions().IsUseUserData() );
+    m_xUseDataCB->set_active(SvtSaveOptions().IsUseUserData());
 }
 
 
commit c1a79354e6ae96a287095abcfc53f41aa2d43358
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Feb 3 20:23:23 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Feb 6 13:00:12 2020 +0100

    tdf#129976 PDF export of PDF images: adapt transparency to rendering
    
    The bugdoc has a transparent PDF image, and we currently put a white
    background behind that in Impress, given that vcl::RenderPDFBitmaps()
    works with Bitmap instances, not BitmapEx ones.
    
    This means that in case we preserve transparency during PDF export, the
    content that was rendered OK now becomes unreadable.
    
    Adapt the PDF export to do the same as rendering by putting a white
    background behind the PDF image.
    

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list