[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-7-0+backports' - 62 commits - bridges/source chart2/source configure.ac connectivity/source drawinglayer/source emfio/qa emfio/source extensions/source external/mariadb-connector-c external/nss external/python3 filter/source formula/source fpicker/source hardened_runtime.xcent.in helpcontent2 i18npool/CustomTarget_breakiterator.mk i18npool/source icon-themes/colibre icon-themes/colibre_svg include/formula include/o3tl include/svx Makefile.in odk/CustomTarget_unowinreg.mk readlicense_oo/license sal/rtl sc/source sd/Library_sd.mk sd/source sfx2/source solenv/bin solenv/clang-format solenv/flatpak-manifest.in svx/source sw/CppunitTest_sw_ooxmlexport16.mk sw/Module_sw.mk sw/qa sw/source sw/uiconfig translations vcl/source vcl/unx writerfilter/qa writerfilter/source xmlsecurity/qa

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 18 08:18:41 UTC 2020


 Makefile.in                                                           |    2 
 bridges/source/cpp_uno/shared/vtablefactory.cxx                       |   18 
 chart2/source/view/main/VLegend.cxx                                   |   17 
 configure.ac                                                          |    6 
 connectivity/source/commontools/TTableHelper.cxx                      |    5 
 connectivity/source/drivers/firebird/DatabaseMetaData.cxx             |    2 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx               |   48 
 emfio/qa/cppunit/emf/EmfImportTest.cxx                                |   36 
 emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf                   |binary
 emfio/qa/cppunit/emf/data/test_mm_himetric_ref.emf                    |binary
 emfio/source/reader/mtftools.cxx                                      |   58 
 extensions/source/macosx/spotlight/OOoContentDataParser.h             |    2 
 extensions/source/macosx/spotlight/OOoContentDataParser.m             |    7 
 extensions/source/macosx/spotlight/OOoMetaDataParser.h                |    2 
 extensions/source/macosx/spotlight/OOoMetaDataParser.m                |    6 
 extensions/source/propctrlr/standardcontrol.cxx                       |    5 
 external/mariadb-connector-c/StaticLibrary_mariadb-connector-c.mk     |    3 
 external/mariadb-connector-c/UnpackedTarball_mariadb-connector-c.mk   |   10 
 external/nss/nss_macosx.patch                                         |   21 
 external/python3/ExternalProject_python3.mk                           |   20 
 filter/source/msfilter/eschesdo.cxx                                   |   37 
 formula/source/ui/dlg/funcutl.cxx                                     |    8 
 fpicker/source/aqua/AquaFilePickerDelegate.hxx                        |    2 
 fpicker/source/aqua/SalAquaFilePicker.mm                              |    8 
 hardened_runtime.xcent.in                                             |    2 
 helpcontent2                                                          |    2 
 i18npool/CustomTarget_breakiterator.mk                                |    1 
 i18npool/source/breakiterator/data/char.txt                           |  119 
 icon-themes/colibre/cmd/32/mergecells.png                             |binary
 icon-themes/colibre/cmd/32/selecttable.png                            |binary
 icon-themes/colibre/cmd/32/splitcell.png                              |binary
 icon-themes/colibre/cmd/32/togglemergecells.png                       |binary
 icon-themes/colibre/cmd/lc_mergecells.png                             |binary
 icon-themes/colibre/cmd/lc_selecttable.png                            |binary
 icon-themes/colibre/cmd/lc_splitcell.png                              |binary
 icon-themes/colibre/cmd/lc_togglemergecells.png                       |binary
 icon-themes/colibre/cmd/sc_mergecells.png                             |binary
 icon-themes/colibre/cmd/sc_selecttable.png                            |binary
 icon-themes/colibre/cmd/sc_splitcell.png                              |binary
 icon-themes/colibre/cmd/sc_togglemergecells.png                       |binary
 icon-themes/colibre_svg/cmd/32/mergecells.svg                         |    2 
 icon-themes/colibre_svg/cmd/32/selecttable.svg                        |    2 
 icon-themes/colibre_svg/cmd/32/splitcell.svg                          |    2 
 icon-themes/colibre_svg/cmd/32/togglemergecells.svg                   |    2 
 icon-themes/colibre_svg/cmd/lc_mergecells.svg                         |    2 
 icon-themes/colibre_svg/cmd/lc_selecttable.svg                        |    2 
 icon-themes/colibre_svg/cmd/lc_splitcell.svg                          |    2 
 icon-themes/colibre_svg/cmd/lc_togglemergecells.svg                   |    2 
 icon-themes/colibre_svg/cmd/sc_mergecells.svg                         |    4 
 icon-themes/colibre_svg/cmd/sc_selecttable.svg                        |    3 
 icon-themes/colibre_svg/cmd/sc_splitcell.svg                          |    4 
 icon-themes/colibre_svg/cmd/sc_togglemergecells.svg                   |    5 
 include/formula/funcutl.hxx                                           |    5 
 include/o3tl/lru_map.hxx                                              |    1 
 include/svx/linectrl.hxx                                              |    5 
 include/svx/sdrpagewindow.hxx                                         |    4 
 include/svx/sidebar/LinePropertyPanelBase.hxx                         |    4 
 odk/CustomTarget_unowinreg.mk                                         |    2 
 readlicense_oo/license/CREDITS.fodt                                   | 4572 +++++-----
 sal/rtl/math.cxx                                                      |   99 
 sc/source/core/data/postit.cxx                                        |   11 
 sc/source/filter/xml/xmlexprt.cxx                                     |    5 
 sc/source/ui/namedlg/namedlg.cxx                                      |   16 
 sd/Library_sd.mk                                                      |    5 
 sd/source/filter/eppt/epptso.cxx                                      |    2 
 sd/source/ui/func/futransf.cxx                                        |    3 
 sd/source/ui/view/drviews2.cxx                                        |    4 
 sd/source/ui/view/sdview3.cxx                                         |    7 
 sfx2/source/appl/shutdowniconaqua.mm                                  |   18 
 sfx2/source/sidebar/SidebarController.cxx                             |   15 
 solenv/bin/macosx-codesign-app-bundle                                 |   10 
 solenv/clang-format/blacklist                                         |    1 
 solenv/flatpak-manifest.in                                            |    6 
 svx/source/sidebar/line/LinePropertyPanelBase.cxx                     |   18 
 svx/source/svdraw/sdrpagewindow.cxx                                   |   33 
 svx/source/svdraw/svdotxat.cxx                                        |   11 
 svx/source/svdraw/svdpagv.cxx                                         |   11 
 svx/source/tbxctrls/linectrl.cxx                                      |   10 
 sw/CppunitTest_sw_ooxmlexport16.mk                                    |   14 
 sw/Module_sw.mk                                                       |    1 
 sw/qa/core/layout/data/btlr-nested-cell.odt                           |binary
 sw/qa/core/layout/layout.cxx                                          |   26 
 sw/qa/extras/layout/data/tdf136816.odt                                |binary
 sw/qa/extras/layout/layout.cxx                                        |   13 
 sw/qa/extras/ooxmlexport/data/tdf123621.docx                          |binary
 sw/qa/extras/ooxmlexport/data/tdf138612.docx                          |binary
 sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx              |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx                            |    2 
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx                            |   11 
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx                            |   43 
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx                             |   17 
 sw/qa/extras/uiwriter/data3/tdf138130.docx                            |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx                                   |   30 
 sw/qa/extras/ww8export/data/tdf128501.doc                             |binary
 sw/qa/extras/ww8export/ww8export3.cxx                                 |   17 
 sw/qa/uitest/table/sheetToTable.py                                    |  107 
 sw/qa/uitest/writer_tests/data/hiddenRow.ods                          |binary
 sw/qa/uitest/writer_tests/data/tdf129083.odt                          |binary
 sw/source/core/crsr/swcrsr.cxx                                        |   10 
 sw/source/core/doc/docbm.cxx                                          |    7 
 sw/source/core/layout/anchoreddrawobject.cxx                          |   12 
 sw/source/core/layout/frmtool.cxx                                     |    9 
 sw/source/core/layout/ssfrm.cxx                                       |    3 
 sw/source/core/txtnode/ndtxt.cxx                                      |   11 
 sw/source/core/view/viewsh.cxx                                        |    5 
 sw/source/uibase/dochdl/swdtflvr.cxx                                  |   19 
 sw/source/uibase/docvw/AnnotationWin2.cxx                             |   11 
 sw/uiconfig/swriter/ui/pagemargincontrol.ui                           |    2 
 translations                                                          |    2 
 vcl/source/filter/jpeg/JpegReader.cxx                                 |    4 
 vcl/source/filter/jpeg/jpeg.h                                         |    2 
 vcl/source/filter/jpeg/jpegc.cxx                                      |    3 
 vcl/source/window/menu.cxx                                            |    7 
 vcl/unx/gtk3/a11y/gtk3atkaction.cxx                                   |    2 
 vcl/unx/gtk3/gtk3gtkinst.cxx                                          |   12 
 vcl/unx/gtk3/gtk3gtksalmenu.cxx                                       |    4 
 writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx                  |   24 
 writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx |binary
 writerfilter/source/dmapper/DomainMapper.cxx                          |    6 
 writerfilter/source/dmapper/DomainMapper.hxx                          |    2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx                     |   11 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx                     |    2 
 writerfilter/source/dmapper/PropertyMap.cxx                           |    9 
 writerfilter/source/dmapper/TablePropertiesHandler.hxx                |    3 
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx                         |    7 
 125 files changed, 3255 insertions(+), 2572 deletions(-)

New commits:
commit 6d7e059e8f632f35496b8528a90d6ad3dc4f6ae1
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Dec 18 08:21:02 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Dec 18 08:21:02 2020 +0100

    Revert "HACK: Revert "tdf#132940 Crash in mergedlo!vcl::Region::operator=""
    
    tdf#131281 has now properly been fixed with
    
        commit 5592d5e97810e68bcc0a70b2892c4ad487a06f81
        Author: Armin Le Grand (allotropia) <armin.le.grand at me.com>
        Date:   Tue Dec 15 00:52:05 2020 +0100
    
            tdf#131281 Always draw FormControls when TiledRendering
    
            When FormControls are not in layout mode it would be necessary
            to have real VCL ChildWindows in the client (usually the office).
            While this is done in the office itself and thus the visualization
            of FormControls (and their usage) is guaranteed, this is currently
            not the case for existing clients of TiledRendering.
    
            The big solution would be an API for the TiledRendering client
            to get infos for FormControls and create these locally (what would
            allow to have these editable/interactive and in the style of the
            client system). As long as this is not the case, I add this fallback
            to render the FormControls as content to the tiles to get them
            visualized at all.
    
    so drop the hack that was only done to make the revert of the
    commit that introduced the regression tdf#132940 apply
    cleanly.
    
    This reverts commit 1297eab938570ef6ffd7526fb59e1b97fdb22de8.

diff --git a/include/svx/sdrpagewindow.hxx b/include/svx/sdrpagewindow.hxx
index 80417a6729a0..f5cb98c297da 100644
--- a/include/svx/sdrpagewindow.hxx
+++ b/include/svx/sdrpagewindow.hxx
@@ -68,8 +68,8 @@ public:
     rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const;
 
     // #i72752# allow patcing SdrPaintWindow from SdrPageView::DrawLayer if needed
-    void patchPaintWindow(SdrPaintWindow& rPaintWindow);
-    void unpatchPaintWindow();
+    [[nodiscard]] SdrPaintWindow* patchPaintWindow(SdrPaintWindow& rPaintWindow);
+    void unpatchPaintWindow(SdrPaintWindow* pPreviousPaintWindow);
 
     // the repaint method. For migration from pPaintProc, use one more parameter
     void PrePaint();
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx
index fb3155c0eb14..6d197dab5282 100644
--- a/svx/source/svdraw/sdrpagewindow.cxx
+++ b/svx/source/svdraw/sdrpagewindow.cxx
@@ -163,22 +163,41 @@ rtl::Reference< sdr::overlay::OverlayManager > const & SdrPageWindow::GetOverlay
     return GetPaintWindow().GetOverlayManager();
 }
 
-void SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
+SdrPaintWindow* SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
 {
-    mpImpl->mpOriginalPaintWindow = mpImpl->mpPaintWindow;
-    mpImpl->mpPaintWindow = &rPaintWindow;
-    mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow);
+    if (!mpImpl->mpOriginalPaintWindow)
+    {
+        // first patch
+        mpImpl->mpOriginalPaintWindow = mpImpl->mpPaintWindow;
+        mpImpl->mpPaintWindow = &rPaintWindow;
+        mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow);
+        return mpImpl->mpOriginalPaintWindow;
+    }
+    else
+    {
+        // second or more patch
+        auto pPreviousPaintWindow = mpImpl->mpPaintWindow;
+        mpImpl->mpPaintWindow = &rPaintWindow;
+        mpImpl->mpOriginalPaintWindow->setPatched(&rPaintWindow);
+        return pPreviousPaintWindow;
+    }
 }
 
-void SdrPageWindow::unpatchPaintWindow()
+void SdrPageWindow::unpatchPaintWindow(SdrPaintWindow* pPreviousPaintWindow)
 {
-    DBG_ASSERT(mpImpl->mpOriginalPaintWindow, "SdrPageWindow::unpatchPaintWindow: paint window not patched!" );
-    if (mpImpl->mpOriginalPaintWindow)
+    if (pPreviousPaintWindow == mpImpl->mpOriginalPaintWindow)
     {
+        // first patch
         mpImpl->mpPaintWindow = mpImpl->mpOriginalPaintWindow;
         mpImpl->mpOriginalPaintWindow->setPatched(nullptr);
         mpImpl->mpOriginalPaintWindow = nullptr;
     }
+    else
+    {
+        // second or more patch
+        mpImpl->mpPaintWindow = pPreviousPaintWindow;
+        mpImpl->mpOriginalPaintWindow->setPatched(pPreviousPaintWindow);
+    }
 }
 
 void SdrPageWindow::PrePaint()
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 215e37bc7c94..480182782984 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -32,6 +32,7 @@
 #include <svx/sdrpagewindow.hxx>
 #include <svx/sdrpaintwindow.hxx>
 #include <comphelper/lok.hxx>
+#include <comphelper/scopeguard.hxx>
 #include <basegfx/range/b2irectangle.hxx>
 
 using namespace ::com::sun::star;
@@ -290,13 +291,13 @@ void SdrPageView::DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget,
                     else
                         aTemporaryPaintWindow.SetRedrawRegion(vcl::Region(rRect));
                     // patch the ExistingPageWindow
-                    pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
-
+                    auto pPreviousWindow = pPreparedTarget->patchPaintWindow(aTemporaryPaintWindow);
+                    // unpatch window when leaving the scope
+                    const ::comphelper::ScopeGuard aGuard(
+                        [&pPreviousWindow, &pPreparedTarget]() { pPreparedTarget->unpatchPaintWindow(pPreviousWindow); } );
+                    
                     // redraw the layer
                     pPreparedTarget->RedrawLayer(&nID, pRedirector, pPageFrame);
-
-                    // restore the ExistingPageWindow
-                    pPreparedTarget->unpatchPaintWindow();
                 }
                 else
                 {
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index b711cf472bad..ef26275ab9fd 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1719,6 +1719,7 @@ class RenderContextGuard
 {
     std::unique_ptr<SdrPaintWindow> m_TemporaryPaintWindow;
     SdrPageWindow* m_pPatchedPageWindow;
+    SdrPaintWindow* m_pPreviousPaintWindow = nullptr;
 
 public:
     RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue, SwViewShell* pShell)
@@ -1741,7 +1742,7 @@ public:
                     if (nullptr != m_pPatchedPageWindow)
                     {
                         m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue));
-                        m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
+                        m_pPreviousPaintWindow = m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
                     }
                 }
             }
@@ -1752,7 +1753,7 @@ public:
     {
         if(nullptr != m_pPatchedPageWindow)
         {
-            m_pPatchedPageWindow->unpatchPaintWindow();
+            m_pPatchedPageWindow->unpatchPaintWindow(m_pPreviousPaintWindow);
         }
     }
 };
commit 2869cb0306c61e88a6da82516c7f8f9680989663
Merge: ab1a1dd57489 5592d5e97810
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Dec 18 08:20:18 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Dec 18 08:20:18 2020 +0100

    Merge branch 'libreoffice-7-0' into distro/lhm/libreoffice-7-0+backports
    
    Change-Id: I5b6d41823bc68ee9e8bb940855a8572e5d04b96d

commit 5592d5e97810e68bcc0a70b2892c4ad487a06f81
Author:     Armin Le Grand (allotropia) <armin.le.grand at me.com>
AuthorDate: Tue Dec 15 00:52:05 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Dec 18 07:46:18 2020 +0100

    tdf#131281 Always draw FormControls when TiledRendering
    
    When FormControls are not in layout mode it would be necessary
    to have real VCL ChildWindows in the client (usually the office).
    While this is done in the office itself and thus the visualization
    of FormControls (and their usage) is guaranteed, this is currently
    not the case for existing clients of TiledRendering.
    
    The big solution would be an API for the TiledRendering client
    to get infos for FormControls and create these locally (what would
    allow to have these editable/interactive and in the style of the
    client system). As long as this is not the case, I add this fallback
    to render the FormControls as content to the tiles to get them
    visualized at all.
    
    Change-Id: I0f7a5e7dc028373145a6a19b639ce82bdafc149d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107735
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>
    (cherry picked from commit bcb8d2d3a08991b4e57189b81f8702aaa8af8a89)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107805
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 2e7aa5c96bad..f64d2b474246 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -20,6 +20,7 @@
 #include "vclpixelprocessor2d.hxx"
 #include "vclhelperbufferdevice.hxx"
 #include "helperwrongspellrenderer.hxx"
+#include <comphelper/lok.hxx>
 
 #include <sal/log.hxx>
 #include <tools/stream.hxx>
@@ -663,31 +664,50 @@ void VclPixelProcessor2D::processControlPrimitive2D(
 
         if (xNewGraphics.is())
         {
-            // link graphics and view
-            xControlView->setGraphics(xNewGraphics);
-
-            // get position
-            const basegfx::B2DHomMatrix aObjectToPixel(maCurrentTransformation
-                                                       * rControlPrimitive.getTransform());
-            const basegfx::B2DPoint aTopLeftPixel(aObjectToPixel * basegfx::B2DPoint(0.0, 0.0));
-
             // find out if the control is already visualized as a VCL-ChildWindow. If yes,
             // it does not need to be painted at all.
             uno::Reference<awt::XWindow2> xControlWindow(rXControl, uno::UNO_QUERY_THROW);
-            const bool bControlIsVisibleAsChildWindow(rXControl->getPeer().is()
-                                                      && xControlWindow->isVisible());
+            bool bControlIsVisibleAsChildWindow(rXControl->getPeer().is()
+                                                && xControlWindow->isVisible());
+
+            // tdf#131281 The FormControls are not painted when using the Tiled Rendering for a simple
+            // reason: when e.g. bControlIsVisibleAsChildWindow is true. This is the case because the
+            // office is in non-layout mode (default for controls at startup). For the common office
+            // this means that there exists a real VCL-System-Window for the control, so it is *not*
+            // painted here due to being exactly obscured by that real Window (and creates danger of
+            // flickering, too).
+            // Tiled Rendering clients usually do *not* have real VCL-Windows for the controls, but
+            // exactly that would be needed on each client displaying the tiles (what would be hard
+            // to do but also would have advantages - the clients would have real controls in the
+            //  shape of their traget system which could be interacted with...). It is also what the
+            // office does.
+            // For now, fallback to just render these controls when Tiled Rendering is active to just
+            // have them displayed on all clients.
+            if (bControlIsVisibleAsChildWindow && comphelper::LibreOfficeKit::isActive())
+            {
+                // Do force paint when we are in Tiled Renderer and FormControl is 'visible'
+                bControlIsVisibleAsChildWindow = false;
+            }
 
             if (!bControlIsVisibleAsChildWindow)
             {
-                // draw it. Do not forget to use the evtl. offsetted origin of the target device,
+                // Needs to be drawn. Link new graphics and view
+                xControlView->setGraphics(xNewGraphics);
+
+                // get position
+                const basegfx::B2DHomMatrix aObjectToPixel(maCurrentTransformation
+                                                           * rControlPrimitive.getTransform());
+                const basegfx::B2DPoint aTopLeftPixel(aObjectToPixel * basegfx::B2DPoint(0.0, 0.0));
+
+                // Do not forget to use the evtl. offsetted origin of the target device,
                 // e.g. when used with mask/transparence buffer device
                 const Point aOrigin(mpOutputDevice->GetMapMode().GetOrigin());
                 xControlView->draw(aOrigin.X() + basegfx::fround(aTopLeftPixel.getX()),
                                    aOrigin.Y() + basegfx::fround(aTopLeftPixel.getY()));
-            }
 
-            // restore original graphics
-            xControlView->setGraphics(xOriginalGraphics);
+                // restore original graphics
+                xControlView->setGraphics(xOriginalGraphics);
+            }
         }
     }
     catch (const uno::Exception&)
commit 33d85de4b964638192eabdb5753a5ca87d6892b7
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Dec 1 19:17:24 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Dec 17 16:52:15 2020 +0100

    tdf#128501: DOC export: fix lost bitmap fill for OOXML custom shapes
    
    this fix is based on 7032be2e9edd82dad2d67f1582aaa57676bda4a1
    which fixes the same problem for PPT filter
    
    Change-Id: Id62c29892dd3fce42d27e2e46a7933154cb973f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107003
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 2f9325b270fab10f6900aec30ca27135363c4c69)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107094
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index efe3c908b6b4..1443b46702c6 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -33,6 +33,7 @@
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <comphelper/extract.hxx>
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <basegfx/matrix/b2dhommatrix.hxx>
@@ -263,15 +264,35 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
             }
             else
             {
-                addShape(sal::static_int_cast< sal_uInt16 >(eShapeType),
-                         nMirrorFlags | ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor);
-                aPropOpt.CreateCustomShapeProperties( eShapeType, rObj.GetShapeRef() );
-                aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
-                if ( rObj.ImplGetText() )
+                const Reference< XPropertySet > xPropSet = rObj.mXPropSet;
+                drawing::FillStyle eFS = drawing::FillStyle_NONE;
+                if(xPropSet.is())
+                {
+                    uno::Reference< XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
+                    if ( xPropInfo.is() && xPropInfo->hasPropertyByName("FillStyle"))
+                        xPropSet->getPropertyValue("FillStyle") >>= eFS;
+                }
+
+                if (eFS == drawing::FillStyle_BITMAP && eShapeType == mso_sptMax)
+                {
+                    // We can't map this custom shape to a DOC preset and it has a bitmap fill.
+                    // Make sure that at least the bitmap fill is not lost.
+                    addShape( ESCHER_ShpInst_PictureFrame, ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor );
+                    if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, "Bitmap", false, true, true, bOOxmlExport ) )
+                        aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
+                }
+                else
                 {
-                    if ( !aPropOpt.IsFontWork() )
-                        aPropOpt.CreateTextProperties( rObj.mXPropSet, mpEscherEx->QueryTextID(
-                            rObj.GetShapeRef(), rObj.GetShapeId() ), true, false );
+                    addShape(sal::static_int_cast< sal_uInt16 >(eShapeType),
+                             nMirrorFlags | ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor);
+                    aPropOpt.CreateCustomShapeProperties( eShapeType, rObj.GetShapeRef() );
+                    aPropOpt.CreateFillProperties( rObj.mXPropSet, true );
+                    if ( rObj.ImplGetText() )
+                    {
+                        if ( !aPropOpt.IsFontWork() )
+                            aPropOpt.CreateTextProperties( rObj.mXPropSet, mpEscherEx->QueryTextID(
+                                rObj.GetShapeRef(), rObj.GetShapeId() ), true, false );
+                    }
                 }
             }
         }
diff --git a/sw/qa/extras/ww8export/data/tdf128501.doc b/sw/qa/extras/ww8export/data/tdf128501.doc
new file mode 100644
index 000000000000..3313e397a961
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf128501.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index a663a034074b..7d8756fbe6cb 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -71,6 +71,23 @@ DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf128501, "tdf128501.doc")
+{
+    if (!mbExported)
+    {
+        uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor = getShape(1);
+        CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShapeDescriptor->getShapeType());
+    }
+    else
+    {
+        uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor = getShape(1);
+        // Without the fix in place, this test would have failed with
+        // - Expected: FrameShape
+        // - Actual  : com.sun.star.drawing.CustomShape
+        CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType());
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote)
 {
     // Create a document, set footnote numbering type to ARABIC_ZERO.
commit 4114e5304425ff54e6957ef417e96e01a4cef532
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Tue Dec 15 14:17:15 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 15:20:43 2020 +0100

    tdf#136816: fix hidden legend entries in "Column and Line" charts
    
    Regression from commit: 300e65cc47f3d6ae1563350757dbfadc080d7452
    (tdf#123268 fix lost chart if all legend entries are hidden)
    
    Change-Id: Id59cd8d681dada123feadbe7910be7fbc7ec37f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107757
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 1eb25c11500a235aa141a327a5489f6861e60a89)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107802
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107874

diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index d16495e426f3..1975e5d8404c 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -1000,8 +1000,6 @@ void VLegend::createShapes(
                     std::vector<ViewLegendEntry> aNewEntries = pLegendEntryProvider->createLegendEntries(
                                                                     aMaxSymbolExtent, eLegendPosition, xLegendProp,
                                                                     xLegendContainer, m_xShapeFactory, m_xContext, mrModel);
-                    if (aNewEntries.size() == 0)
-                        return;
                     aViewEntries.insert( aViewEntries.end(), aNewEntries.begin(), aNewEntries.end() );
                 }
             }
@@ -1042,17 +1040,14 @@ void VLegend::createShapes(
                     // create the buttons
                     pButton->createShapes(xModelPage);
                 }
-            }
 
-            Reference< drawing::XShape > xBorder =
-                pShapeFactory->createRectangle( xLegendContainer,
-                        aLegendSize,
-                        awt::Point(0,0),
-                        aLineFillProperties.first,
-                        aLineFillProperties.second, ShapeFactory::StackPosition::Bottom );
+                Reference<drawing::XShape> xBorder = pShapeFactory->createRectangle(
+                    xLegendContainer, aLegendSize, awt::Point(0, 0), aLineFillProperties.first,
+                    aLineFillProperties.second, ShapeFactory::StackPosition::Bottom);
 
-            //because of this name this border will be used for marking the legend
-            ShapeFactory::setShapeName( xBorder, "MarkHandles" );
+                //because of this name this border will be used for marking the legend
+                ShapeFactory::setShapeName(xBorder, "MarkHandles");
+            }
         }
     }
     catch( const uno::Exception & )
diff --git a/sw/qa/extras/layout/data/tdf136816.odt b/sw/qa/extras/layout/data/tdf136816.odt
new file mode 100644
index 000000000000..0b6599bea319
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf136816.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index acf877c323bf..27eca2137324 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -4215,6 +4215,19 @@ static SwRect lcl_getVisibleFlyObjRect(SwWrtShell* pWrtShell)
     return aFlyRect;
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf136816)
+{
+    SwDoc* pDoc = createDoc("tdf136816.odt");
+    SwDocShell* pShell = pDoc->GetDocShell();
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+    // Check number of legend entries
+    assertXPath(pXmlDoc, "//text[contains(text(),\"Column\")]", 2);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testStableAtPageAnchoredFlyPosition)
 {
     // this doc has two page-anchored frames: one tiny on page 3 and one large on page 4.
commit 8b1efde9272adb2b7e4c438eba63193249216c9c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 17:35:32 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 14:10:32 2020 +0100

    tdf#138950 allow up to one short read to not trigger cancelling import
    
    Change-Id: Iedbfc344c311c40244ba2f58c56c62ac47584028
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107794
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/vcl/source/filter/jpeg/JpegReader.cxx b/vcl/source/filter/jpeg/JpegReader.cxx
index df7374770463..cbdac58aa3c6 100644
--- a/vcl/source/filter/jpeg/JpegReader.cxx
+++ b/vcl/source/filter/jpeg/JpegReader.cxx
@@ -47,7 +47,7 @@ static void init_source (j_decompress_ptr cinfo)
      * This is correct behavior for reading a series of images from one source.
      */
     source->start_of_file = TRUE;
-    source->no_data_available = FALSE;
+    source->no_data_available_failures = 0;
 }
 
 }
@@ -86,7 +86,7 @@ static boolean fill_input_buffer (j_decompress_ptr cinfo)
 
     if (!nbytes)
     {
-        source->no_data_available = TRUE;
+        source->no_data_available_failures++;
         if (source->start_of_file)     /* Treat empty input file as fatal error */
         {
             ERREXIT(cinfo, JERR_INPUT_EMPTY);
diff --git a/vcl/source/filter/jpeg/jpeg.h b/vcl/source/filter/jpeg/jpeg.h
index 2f951e065934..79ec824ada22 100644
--- a/vcl/source/filter/jpeg/jpeg.h
+++ b/vcl/source/filter/jpeg/jpeg.h
@@ -59,7 +59,7 @@ struct SourceManagerStruct {
     SvStream*   stream;                 /* source stream */
     JOCTET*     buffer;                 /* start of buffer */
     boolean     start_of_file;          /* have we gotten any data yet? */
-    boolean     no_data_available;
+    int         no_data_available_failures;
 };
 
 #endif
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index c1fbb535a8e4..3f6a362f826c 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -267,7 +267,8 @@ static void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputS
                 rContext.pCYMKBuffer.resize(nWidth * 4);
             }
 
-            for (*pLines = 0; *pLines < nHeight && !source->no_data_available; (*pLines)++)
+            // tdf#138950 allow up to one short read (no_data_available_failures <= 1) to not trigger cancelling import
+            for (*pLines = 0; *pLines < nHeight && source->no_data_available_failures <= 1; (*pLines)++)
             {
                 size_t yIndex = *pLines;
 
commit 4cc753b6b9a7011da3ea50a1c90ed10870b9a2e0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 15:17:27 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 14:07:43 2020 +0100

    tdf#138701 leave current combobox cursor valid if the contents won't change
    
    Change-Id: I6d7f5de7b79d447590fcfa325f4be7430eaffd5f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107708
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index a9b422440932..0b64c9518ef2 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -583,7 +583,10 @@ namespace pcr
     {
         OUString sText;
         _rValue >>= sText;
-        getTypedControlWindow()->set_entry_text( sText );
+        weld::ComboBox* pControlWindow = getTypedControlWindow();
+        // tdf#138701 leave current cursor valid if the contents won't change
+        if (pControlWindow->get_active_text() != sText)
+            pControlWindow->set_entry_text(sText);
     }
 
     Any SAL_CALL OComboboxControl::getValue()
commit 4b87577ea3f80e1e3df5ce1b492dea267577f072
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Dec 10 11:27:15 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 14:03:52 2020 +0100

    Resolves: tdf#138789 disable widgets on 'none' when status changes
    
    instead of when chage is dispatched, the chart case has its own
    dispatcher that disables the base class one. This fixes the reported
    problem, and the related problem of updating when moving focus from
    one line that has style 'none' to one that doesn't, and vice-versa,
    where no change is dispached on received on context change
    
    Change-Id: I6afb396e75ba93c13fcae71c52618cfce7f9cecb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107527
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 62f428aa5136..7ade8dc06643 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -32,6 +32,7 @@ class XLineStyleItem;
 class XLineDashItem;
 
 typedef std::function<bool(const OUString&, const css::uno::Any&)> LineStyleSelectFunction;
+typedef std::function<void(bool)> LineStyleIsNoneFunction;
 
 // SvxLineStyleController:
 class SVXCORE_DLLPUBLIC SvxLineStyleToolBoxControl final : public svt::PopupWindowController
@@ -40,6 +41,7 @@ private:
     std::unique_ptr<svx::ToolboxButtonLineStyleUpdater> m_xBtnUpdater;
 
     LineStyleSelectFunction m_aLineStyleSelectFunction;
+    LineStyleIsNoneFunction m_aLineStyleIsNoneFunction;
 
 public:
     SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
@@ -56,7 +58,10 @@ public:
 
     virtual ~SvxLineStyleToolBoxControl() override;
 
+    // called when the user selects a line style
     void setLineStyleSelectFunction(const LineStyleSelectFunction& aLineStyleSelectFunction);
+    // called when the line style changes, can be used to trigger disabling the arrows if the none line style is selected
+    void setLineStyleIsNoneFunction(const LineStyleIsNoneFunction& aLineStyleIsNoneFunction);
     void dispatchLineStyleCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
 
 private:
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index 40b4cc6f4688..2da80e9a6b54 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -45,7 +45,7 @@ namespace svx
 namespace sidebar
 {
 
-class DisableArrowsWrapper;
+class LineStyleNoneChange;
 
 class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
 {
@@ -116,7 +116,7 @@ private:
     //popup windows
     std::unique_ptr<LineWidthPopup> mxLineWidthPopup;
 
-    std::unique_ptr<DisableArrowsWrapper> mxDisableArrowsWrapper;
+    std::unique_ptr<LineStyleNoneChange> mxLineStyleNoneChange;
 
     sal_uInt16      mnTrans;
     MapUnit         meMapUnit;
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index f2c1b4553ea4..ef4778f4ad7c 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -36,26 +36,20 @@ const char SELECTWIDTH[] = "SelectWidth";
 namespace svx::sidebar {
 
 // trigger disabling the arrows if the none line style is selected
-class DisableArrowsWrapper
+class LineStyleNoneChange
 {
 private:
     LinePropertyPanelBase& m_rPanel;
 
 public:
-    DisableArrowsWrapper(LinePropertyPanelBase& rPanel)
+    LineStyleNoneChange(LinePropertyPanelBase& rPanel)
         : m_rPanel(rPanel)
     {
     }
 
-    bool operator()(const OUString& rCommand, const css::uno::Any& rValue)
+    void operator()(bool bLineStyleNone)
     {
-        if (rCommand == ".uno:XLineStyle")
-        {
-            css::drawing::LineStyle eLineStyle(css::drawing::LineStyle_NONE);
-            rValue >>= eLineStyle;
-            m_rPanel.SetNoneLineStyle(eLineStyle == css::drawing::LineStyle_NONE);
-        }
-        return false;
+        m_rPanel.SetNoneLineStyle(bLineStyleNone);
     }
 };
 
@@ -89,7 +83,7 @@ LinePropertyPanelBase::LinePropertyPanelBase(
     mxGridLineProps(m_xBuilder->weld_widget("lineproperties")),
     mxBoxArrowProps(m_xBuilder->weld_widget("arrowproperties")),
     mxLineWidthPopup(new LineWidthPopup(mxTBWidth.get(), *this)),
-    mxDisableArrowsWrapper(new DisableArrowsWrapper(*this)),
+    mxLineStyleNoneChange(new LineStyleNoneChange(*this)),
     mnTrans(0),
     meMapUnit(MapUnit::MapMM),
     mnWidthCoreValue(0),
@@ -150,7 +144,7 @@ void LinePropertyPanelBase::Initialize()
     mxLBCapStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeCapStyleHdl ) );
 
     SvxLineStyleToolBoxControl* pLineStyleControl = getLineStyleToolBoxControl(*mxLineStyleDispatch);
-    pLineStyleControl->setLineStyleSelectFunction(*mxDisableArrowsWrapper);
+    pLineStyleControl->setLineStyleIsNoneFunction(*mxLineStyleNoneChange);
 }
 
 void LinePropertyPanelBase::updateLineTransparence(bool bDisabled, bool bSetOrDefault,
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index df0115f5b91b..cece7eea8085 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -91,6 +91,7 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
         const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
         if (pItem)
         {
+            bool bNoneLineStyle = false;
             XDashListRef xList = pItem->GetDashList();
             int nIndex = m_xBtnUpdater->GetStyleIndex();
             switch (nIndex)
@@ -107,6 +108,7 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
                     }
                     else
                         pToolBox->SetItemImage(nId, Image(aEmpty));
+                    bNoneLineStyle = true;
                     break;
                 }
                 case 1:
@@ -128,6 +130,9 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
                         pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
                     break;
             }
+
+            if (m_aLineStyleIsNoneFunction)
+                m_aLineStyleIsNoneFunction(bNoneLineStyle);
         }
     }
 }
@@ -172,6 +177,11 @@ void SvxLineStyleToolBoxControl::setLineStyleSelectFunction(const LineStyleSelec
     m_aLineStyleSelectFunction = rLineStyleSelectFunction;
 }
 
+void SvxLineStyleToolBoxControl::setLineStyleIsNoneFunction(const LineStyleIsNoneFunction& rLineStyleIsNoneFunction)
+{
+    m_aLineStyleIsNoneFunction = rLineStyleIsNoneFunction;
+}
+
 void SvxLineStyleToolBoxControl::dispatchLineStyleCommand(const OUString& rCommand, const Sequence<PropertyValue>& rArgs)
 {
     if (m_aLineStyleSelectFunction && m_aLineStyleSelectFunction(rCommand, rArgs[0].Value))
commit 5fbd913cf62aa215c66f1f2de47723dc82c83571
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 16:35:24 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 13:54:56 2020 +0100

    tdf#138661 don't emit value-changed when not changed by user
    
    in the FormattedSpinButton which is the standard mode for these signals
    and what the SpinButton does, and in this case the FormattedSpinButton
    is considered "modified" when it shouldn't be
    
    Change-Id: I26865e099c02fdd2745c41b347b7006d8560fb20
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107711
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 0290359bebce..b8629d49cbd6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12235,6 +12235,18 @@ public:
         enable_notify_events();
     }
 
+    virtual void disable_notify_events() override
+    {
+        g_signal_handler_block(m_pButton, m_nValueChangedSignalId);
+        GtkInstanceEntry::disable_notify_events();
+    }
+
+    virtual void enable_notify_events() override
+    {
+        GtkInstanceEntry::enable_notify_events();
+        g_signal_handler_unblock(m_pButton, m_nValueChangedSignalId);
+    }
+
     virtual ~GtkInstanceFormattedSpinButton() override
     {
         g_signal_handler_disconnect(m_pButton, m_nInputSignalId);
commit 594a27f191347fadf25ddf795b4f68263ef8abb2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 16 12:42:05 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 13:51:49 2020 +0100

    tdf#138963 Clicking the position statusbar box disables selection
    
    if there is no object selected, since...
    
    commit d3dbbdce4eb71ae848e7682374e011c4a6129b15
    Date:   Wed Jan 17 15:20:31 2018 +0100
    
        lokdialog: Convert the Format -> ... -> Position and Size... to async exec.
    
        Change-Id: Idcdbfb1366db61e247c31eab5cb27a39978b0fd9
    
    Change-Id: I959789b055a880ac4c48a863c17eb6769b322577
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107800
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index 4984c675ec4c..fa7398e48b43 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -106,8 +106,7 @@ void FuTransform::DoExecute( SfxRequest& rReq )
         bWelded = true;
     }
 
-    if (!pDlg)
-        return;
+    assert(pDlg && "there must be a dialog at this point");
 
     auto pRequest = std::make_shared<SfxRequest>(rReq);
     rReq.Ignore(); // the 'old' request is not relevant any more
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 58cd5e5297b2..ae0f01121d63 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1461,7 +1461,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_ATTR_TRANSFORM:
         {
             SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView.get(), GetDoc(), rReq ) );
-            if (rReq.GetArgs())
+            // tdf#138963 conditions tested for here must be the same as those
+            // of the early returns from FuTransform::DoExecute
+            if (rReq.GetArgs() || !mpDrawView->AreObjectsMarked())
             {
                 Invalidate(SID_RULER_OBJECT);
                 Cancel();
commit 871940eba642bec3cc263b48048ee4ffbf8a6c0f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 14:51:47 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 13:49:50 2020 +0100

    tdf#138935 rsDeckId is invalid by the time collectUIInformation is called
    
    Change-Id: I4afc1ed1bbbfbbd510617a51b9aa6d627471d80d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107706
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 68066f4f4918..b890f9950f56 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -608,6 +608,8 @@ void SidebarController::OpenThenToggleDeck (
         }
     }
     RequestOpenDeck();
+    // before SwitchToDeck which may cause the rsDeckId string to be released
+    collectUIInformation(rsDeckId);
     SwitchToDeck(rsDeckId);
 
     // Make sure the sidebar is wide enough to fit the requested content
@@ -618,8 +620,6 @@ void SidebarController::OpenThenToggleDeck (
         if (mnSavedSidebarWidth < nRequestedWidth)
             SetChildWindowWidth(nRequestedWidth);
     }
-
-    collectUIInformation(rsDeckId);
 }
 
 void SidebarController::OpenThenSwitchToDeck (
commit a10c7ec17fe57c0367ce5a4cbefd89e8b63e069b
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Dec 12 12:16:27 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 13:36:30 2020 +0100

    tdf#138822: really undo when clicking Cancel in managing Named Ranges
    
    Change-Id: Ib4d15e7e5287221ea51eb3e20dd1811c97999306
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107635
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 1790ed500f3033581ee4a3ef43428d7fda4692cc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107807

diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 69181ec246b2..4262a824f902 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -462,6 +462,7 @@ IMPL_LINK_NOARG(ScNameDlg, OkBtnHdl, weld::Button&, void)
 
 IMPL_LINK_NOARG(ScNameDlg, CancelBtnHdl, weld::Button&, void)
 {
+    mbCloseWithoutUndo = true;
     response(RET_CANCEL);
 }
 
commit 88aa8f5343705008b86ef41512993a00d331a668
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Dec 15 10:01:03 2020 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Dec 16 15:57:54 2020 +0100

    tdf#138892 writerfilter: cancel style list if bNoNumbering
    
    This fixes 6.1 regression from tdf#95377's
    commit e24e2d2fb02239753c1520a0458b44683ea4cc2e.
    
    Starting in 7.0 (tdf#131321), paragraph styles kept their
    numbering property. But even before that, non-paragraphs
    marked by bNoNumbering were having their direct numbering
    removed, and then finishParagraph applied para-style
    numbering since there was no direct numbering.
    
    So, we need to pass the bNoNumbering to finishParagraph
    so that it can cancel out a style-assigned numbering.
    
    Change-Id: I0c24af4e9bd0ea3712179a47ed3550f91c8f44b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107738
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit bfcd952dc7820c4cf8761c4222d29ede039391dc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107795
    (cherry picked from commit e901ffcb93d217f2cc09021a3b2fecb36f9884f6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107796
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Justin Luth <justin_luth at sil.org>

diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 5a1512485d53..b01ce8d1f15a 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -14200,6 +14200,7 @@ sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
diff --git a/sw/CppunitTest_sw_ooxmlexport16.mk b/sw/CppunitTest_sw_ooxmlexport16.mk
new file mode 100644
index 000000000000..4e78cef57760
--- /dev/null
+++ b/sw/CppunitTest_sw_ooxmlexport16.mk
@@ -0,0 +1,14 @@
+# -*- 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 sw_ooxmlexport_test,16))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index be2e7e8d86c7..c1dff1df5c5a 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
     CppunitTest_sw_ooxmlexport13 \
     CppunitTest_sw_ooxmlexport14 \
     CppunitTest_sw_ooxmlexport15 \
+    CppunitTest_sw_ooxmlexport16 \
     CppunitTest_sw_ooxmlexport_template \
     CppunitTest_sw_ooxmlfieldexport \
     CppunitTest_sw_ooxmllinks \
diff --git a/sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx b/sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx
new file mode 100644
index 000000000000..5c0a0176e37c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
new file mode 100644
index 000000000000..174f2f0f7330
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -0,0 +1,43 @@
+/* -*- 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 <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+
+char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
+
+class Test : public SwModelTestBase
+{
+public:
+    Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") {}
+
+protected:
+    /**
+     * Denylist handling
+     */
+    bool mustTestImportOf(const char* filename) const override {
+        // If the testcase is stored in some other format, it's pointless to test.
+        return OString(filename).endsWith(".docx");
+    }
+};
+
+DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx")
+{
+    CPPUNIT_ASSERT_MESSAGE("Para1: Bullet point", !getProperty<OUString>(getParagraph(1), "NumberingStyleName").isEmpty());
+    CPPUNIT_ASSERT_MESSAGE("Para2: <blank line>", getProperty<OUString>(getParagraph(2), "NumberingStyleName").isEmpty());
+    CPPUNIT_ASSERT_MESSAGE("Para3: <blank line>", getProperty<OUString>(getParagraph(3), "NumberingStyleName").isEmpty());
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 76fc96b9f56c..d7f14e534d48 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3524,7 +3524,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
                 xContext->Erase(PROP_NUMBERING_LEVEL);
             }
             m_pImpl->SetParaSectpr(false);
-            finishParagraph(bRemove);
+            finishParagraph(bRemove, bNoNumbering);
             if (bRemove)
                 m_pImpl->RemoveLastParagraph();
         }
@@ -4005,11 +4005,11 @@ void DomainMapper::HandleRedline( Sprm& rSprm )
     m_pImpl->SetCurrentRedlineIsRead();
 }
 
-void DomainMapper::finishParagraph(const bool bRemove)
+void DomainMapper::finishParagraph(const bool bRemove, const bool bNoNumbering)
 {
     if (m_pImpl->m_pSdtHelper->validateDateFormat())
         m_pImpl->m_pSdtHelper->createDateContentControl();
-    m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove);
+    m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove, bNoNumbering);
 }
 
 } //namespace writerfilter
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index c8281f9334ec..179f06ccd77c 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -161,7 +161,7 @@ private:
     // Table
     virtual void lcl_entry(writerfilter::Reference<Properties>::Pointer_t ref) override;
 
-    void finishParagraph(const bool bRemove = false);
+    void finishParagraph(const bool bRemove = false, const bool bNoNumbering = false);
 
     static void handleUnderlineType(const Id nId, const ::tools::SvRef<PropertyMap>& rContext);
     void handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef<PropertyMap>& rContext, const bool bExchangeLeftRight);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ba2fa918f82f..7a248ca36aa2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1347,7 +1347,7 @@ static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleShee
     return lcl_getListId(pParent, rStyleTable, rNumberingFromBaseStyle);
 }
 
-void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove )
+void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove, const bool bNoNumbering )
 {
     if (m_bDiscardHeaderFooter)
         return;
@@ -1402,7 +1402,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
         //apply numbering level/style to paragraph if it was set at the style, but only if the paragraph itself
         //does not specify the numbering
         const sal_Int16 nListLevel = pStyleSheetProperties->GetListLevel();
-        if ( !isNumberingViaRule && nListLevel >= 0 )
+        if ( !bNoNumbering && !isNumberingViaRule && nListLevel >= 0 )
             pParaContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny(nListLevel), false );
 
         bool bNumberingFromBaseStyle = false;
@@ -1410,7 +1410,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
         auto const pList(GetListTable()->GetList(nListId));
         if (pList && nListId >= 0 && !pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
         {
-            if ( !isNumberingViaRule )
+            if ( bNoNumbering )
+                pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny(OUString()) );
+            else if ( !isNumberingViaRule )
             {
                 isNumberingViaStyle = true;
                 // Since LO7.0/tdf#131321 fixed the loss of numbering in styles, this OUGHT to be obsolete,
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index dc0693ecae6e..c423c9de5fe8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -677,7 +677,7 @@ public:
     void setParaSdtEndDeferred(bool bParaSdtEndDeferred);
     bool isParaSdtEndDeferred() const;
 
-    void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false);
+    void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false, const bool bNoNumbering = false);
     void appendTextPortion( const OUString& rString, const PropertyMapPtr& pPropertyMap );
     void appendTextContent(const css::uno::Reference<css::text::XTextContent>&, const css::uno::Sequence<css::beans::PropertyValue>&);
     void appendOLE( const OUString& rStreamName, const std::shared_ptr<OLEHandler>& pOleHandler );
commit b4e9f8093daecec90e8294287029070262a634ac
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Dec 14 21:05:02 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Dec 16 13:13:26 2020 +0100

    tdf#138600 sw: fix too small print area for btlr text in nested table
    
    Regression from commit 435ab51ec8920033b7865f27f4afee8a852a0b31
    (tdf#128399 sw btlr: fix clicking to lower rotated cell, 2019-10-29),
    the bugdoc has a btlr table cell and the row frame of the outer table
    has a bottom value which is very small at the point when
    SwFrame::GetPaintArea() is invoked for the inner btlr cell.
    
    This means the "cell should not leave its parent" mechanism kicks in and
    reduces the bottom of the paint area to a small value, so the text is
    not visible at all.
    
    Fix the problem by teaching SwFrame::GetPaintArea() that btlr cell
    frames are OK to leave their parent towards the bottom of the page; that
    parent will grow at a later phase of the layout process anyway.
    
    Change-Id: I99334bbf0116df8d8ed27f192c81c0441b6c797d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107730
    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/+/107787
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107818

diff --git a/sw/qa/core/layout/data/btlr-nested-cell.odt b/sw/qa/core/layout/data/btlr-nested-cell.odt
new file mode 100644
index 000000000000..ca7a4798db97
Binary files /dev/null and b/sw/qa/core/layout/data/btlr-nested-cell.odt differ
diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx
index 947152de49c6..6a6840f425a4 100644
--- a/sw/qa/core/layout/layout.cxx
+++ b/sw/qa/core/layout/layout.cxx
@@ -15,6 +15,8 @@
 #include <wrtsh.hxx>
 #include <IDocumentDrawModelAccess.hxx>
 #include <drawdoc.hxx>
+#include <IDocumentLayoutAccess.hxx>
+#include <rootfrm.hxx>
 
 static char const DATA_DIRECTORY[] = "/sw/qa/core/layout/data/";
 
@@ -171,6 +173,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxAutoGrowVertical)
     CPPUNIT_ASSERT(aShapeRect.IsInside(aFlyRect));
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell)
+{
+    // Load a document with a nested table, the inner A1 cell has a btlr text direction.
+    load(DATA_DIRECTORY, "btlr-nested-cell.odt");
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+    SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+    SwFrame* pPage = pLayout->GetLower();
+    SwFrame* pBody = pPage->GetLower();
+    SwFrame* pOuterTable = pBody->GetLower()->GetNext();
+    SwFrame* pInnerTable = pOuterTable->GetLower()->GetLower()->GetLower();
+
+    // Check the paint area of the only text frame in the cell.
+    SwFrame* pTextFrame = pInnerTable->GetLower()->GetLower()->GetLower();
+    long nFrameBottom = pTextFrame->getFrameArea().Bottom();
+    SwRect aPaintArea = pTextFrame->GetPaintArea();
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected greater or equal than: 2829
+    // - Actual  : 2080
+    // i.e. part of the text frame area was not painted, hiding the actual text.
+    CPPUNIT_ASSERT_GREATEREQUAL(nFrameBottom, aPaintArea.Bottom());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 1a92144a5583..59d7d64afdd8 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -626,7 +626,8 @@ SwRect SwFrame::GetPaintArea() const
             pTmp->IsCellFrame() || pTmp->IsRowFrame() || //nobody leaves a table!
             pTmp->IsRootFrame() )
         {
-            if( bLeft || aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 )
+            // BTLR is OK to expand towards the physical down direction. Physical down is left.
+            if( bLeft || (aRectFnSet.XDiff(nTmpLeft, nLeft) > 0 && !IsVertLRBT()) )
                 nLeft = nTmpLeft;
             if( bRight || aRectFnSet.XDiff(nRight, nTmpRight) > 0 )
                 nRight = nTmpRight;
commit bb3d6a788001436ef29d0f5e53431c8c0a75040e
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Sat Dec 12 13:43:48 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Dec 14 13:37:24 2020 +0100

    tdf#138851: Named range manager always display "Document (Global)" at launching
    
    In Init() method, call SelectionChanged() at the end so we're sure
    everything is up-to-date.
    
    Change-Id: I1bd8c44e172cd9f739650a6f76478214c0a31ac0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107628
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 7c3a91e320af..69181ec246b2 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -111,13 +111,6 @@ void ScNameDlg::Init()
                                 xTreeView->get_height_rows(10));
     m_xRangeManagerTable.reset(new ScRangeManagerTable(std::move(xTreeView), m_RangeMap, maCursorPos));
 
-    if (m_xRangeManagerTable->n_children())
-    {
-        m_xRangeManagerTable->set_cursor(0);
-        m_xRangeManagerTable->CheckForFormulaString();
-        SelectionChanged();
-    }
-
     m_xRangeManagerTable->connect_changed( LINK( this, ScNameDlg, SelectionChangedHdl_Impl ) );
 
     m_xBtnOk->connect_clicked( LINK( this, ScNameDlg, OkBtnHdl ) );
@@ -145,6 +138,14 @@ void ScNameDlg::Init()
     }
 
     CheckForEmptyTable();
+
+    if (m_xRangeManagerTable->n_children())
+    {
+        m_xRangeManagerTable->set_cursor(0);
+        m_xRangeManagerTable->CheckForFormulaString();
+        SelectionChanged();
+    }
+
 }
 
 bool ScNameDlg::IsRefInputMode() const
commit a60f4a6222fdbcb4a1adebe670eaf1636a014da6
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Dec 10 17:04:59 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 11 20:51:22 2020 +0100

    sw: add missing nullptr check
    
    introduced by 0aa0fda64057647219954480ac1bab86b0f0e433
    
    See: https://crashreport.libreoffice.org/stats/signature/SwCursor::UpDown(bool,unsigned%20short,Point%20const%20*,long,SwRootFrame%20&)
    Change-Id: Ifb7a86b0dfd1477d6ffa15c7d4d3289984747f87
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107561
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 0a80dcad342c1be71f467e46a0cf4f5dd1259056)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107615
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index e1237d8cffab..879d632dfc8b 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2044,9 +2044,15 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
         }
         else
         {
+            sal_Int32 nOffset = 0;
+
             // Jump to beginning or end of line when the cursor at first or last line.
-            SwNode& rNode = GetPoint()->nNode.GetNode();
-            const sal_Int32 nOffset = bUp ? 0 : rNode.GetTextNode()->GetText().getLength();
+            if(!bUp)
+            {
+                SwTextNode* pTextNd = GetPoint()->nNode.GetNode().GetTextNode();
+                if (pTextNd)
+                    nOffset = pTextNd->GetText().getLength();
+            }
             const SwPosition aPos(*GetContentNode(), nOffset);
 
             //if cursor has already been at start or end of file,
commit c918fad2cbc01e42394ac6ede21366a47532ecc2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 11 11:26:19 2020 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Fri Dec 11 17:28:36 2020 +0100

    tdf#76644 extended tips not shown for 'gen' menu items
    
    since...
    
    commit d7fe5ab30ca9df722eec33d428baedd258075eac
    Date:   Thu Aug 1 11:23:58 2013 +0200
    
        convert vcl/menu.hxx from XubString to OUString (second attempt)
    
    probably currently only useful with HELP_DEBUG=1
    
    Change-Id: I66e94e57e117d4e1d83f132a82377b28d3674d86
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107548
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index bcfbdbb37773..f48e1c3f0fbc 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1086,7 +1086,10 @@ OUString Menu::ImplGetHelpText( sal_uInt16 nItemId ) const
 {
     MenuItemData* pData = pItemList->GetData( nItemId );
 
-    if ( pData && pData->aHelpText.isEmpty() &&
+    if (!pData)
+        return OUString();
+
+    if ( pData->aHelpText.isEmpty() &&
          (( !pData->aHelpId.isEmpty()  ) || ( !pData->aCommandStr.isEmpty() )))
     {
         Help* pHelp = Application::GetHelp();
@@ -1099,7 +1102,7 @@ OUString Menu::ImplGetHelpText( sal_uInt16 nItemId ) const
         }
     }
 
-    return OUString();
+    return pData->aHelpText;
 }
 
 OUString Menu::GetHelpText( sal_uInt16 nItemId ) const
commit 863f2877fe4be1394b5d35dd18ce15cd30c1e9b7
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Dec 7 21:02:12 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Dec 11 16:22:20 2020 +0100

    tdf#135217 DOCX import: remove no longer needed top/bottom margin sync
    
    Regression from commit b7ae863efeb082816cc4fe660527a9650d90e186
    (tdf#117503 DOCX import: fix out of sync first/later top margin,
    2018-05-28), which adjusted the import so that the export can pair
    first/follow page styles and write them into a single Word section.
    
    But changing the import for pairing purposes is not a good idea after
    all, as it also affects the layout of the imported document.
    
    In the meantime, commit 51534ac2b9747975945acb6a1e1ba5cc6d73f5c2
    (tdf#127778 DOCX import: fix unexpected heading on non-first page when
    the first page has a heading, 2020-05-11) already fixed the export side,
    so this is not even necessary, just remove it.
    
    (cherry picked from commit 29993781ac991e85bfbd61f9e076c9d8088cd3ab)
    
    Change-Id: I94c02517ae1e0804547f81c43bb5890327d32376
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107400
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit d6674aaa23b34af702681beb4c0f219e6f50069c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107387
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx
index 71b3ab80e50b..2c7586649c01 100644
--- a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx
@@ -13,6 +13,8 @@
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
 
 using namespace ::com::sun::star;
 
@@ -63,6 +65,28 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableHeader)
     // 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());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFollowPageTopMargin)
+{
+    // Load a document with 2 pages: first page has larger top margin, second page has smaller top
+    // margin.
+    OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "follow-page-top-margin.docx";
+    getComponent() = loadFromDesktop(aURL);
+    uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(getComponent(),
+                                                                         uno::UNO_QUERY);
+    uno::Reference<container::XNameAccess> xStyleFamilies
+        = xStyleFamiliesSupplier->getStyleFamilies();
+    uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"),
+                                                        uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("Standard"), uno::UNO_QUERY);
+    auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>();
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 250
+    // - Actual  : 1249
+    // i.e. the top margin on page 2 was too large.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(250), nTopMargin);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx b/writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx
new file mode 100644
index 000000000000..ceae0b784e18
Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx differ
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index d510bfc8be35..297877d680dd 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1031,15 +1031,6 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
     //now set the top/bottom margin for the follow page style
     Insert( PROP_TOP_MARGIN, uno::makeAny( std::max<sal_Int32>(nTopMargin, 0) ) );
     Insert( PROP_BOTTOM_MARGIN, uno::makeAny( std::max<sal_Int32>(nBottomMargin, 0) ) );
-
-    if (bCopyFirstToFollow)
-    {
-        if (HasHeader(/*bFirstPage=*/true))
-            m_aFollowPageStyle->setPropertyValue("TopMargin", getProperty(PROP_TOP_MARGIN)->second);
-        if (HasFooter(/*bFirstPage=*/true))
-            m_aFollowPageStyle->setPropertyValue("BottomMargin",
-                                                 getProperty(PROP_BOTTOM_MARGIN)->second);
-    }
 }
 
 static uno::Reference< beans::XPropertySet > lcl_GetRangeProperties( bool bIsFirstSection,
commit a9d8d1ab16f8bead44b3383b0315e32f86a82e08
Author:     Rene Engelhard <rene at debian.org>
AuthorDate: Sat Dec 5 10:47:36 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Dec 11 12:32:22 2020 +0100

    use -static-libgcc for unowinreg.dll
    
    to fix
    
    "
    For another, at least the unowinreg.dll resulting from --enable-build-unowinreg
    on Fedora 33 would have had a dependency on libgcc_s_dw2-1.dll that would
    generally not have been available in a target Windows environment.
    "
    
    mentioned in 01241113947fc7bd7f7b765dd897bb023c8ca99
    
    Change-Id: Ib247c816f05de8c4ef20a939a86e780df5e40dea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107253
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 328988babda60300fd854a116ceca742a4bd79ca)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107538

diff --git a/odk/CustomTarget_unowinreg.mk b/odk/CustomTarget_unowinreg.mk
index 3a46ddfd6860..a847e1d6bb38 100644
--- a/odk/CustomTarget_unowinreg.mk
+++ b/odk/CustomTarget_unowinreg.mk
@@ -19,7 +19,7 @@ $(call gb_CustomTarget_get_workdir,odk/unowinreg)/unowinreg.dll : \
 		$(if $(filter FREEBSD,$(OS)),-I$(JAVA_HOME)/include/freebsd \
 		-I$(JAVA_HOME)/include/bsd -I$(JAVA_HOME)/include/linux,\
 		$(if $(filter NETBSD,$(OS)),-I$(JAVA_HOME)/include/netbsd))) \
-		-shared -o $@ $< \
+		-shared -static-libgcc -o $@ $< \
 		-Wl,--kill-at -lkernel32 -ladvapi32 && \
 	$(MINGWSTRIP) $@
 
commit 3b5b96ecdb7b9a1daabbc0b40c3fe9c598a1bd5b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 9 09:57:11 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Dec 11 12:30:18 2020 +0100

    negative return passed to parameter that cannot be negative
    
    Change-Id: I4b39a2130e961c6f2ca97695e4625df5a95e00b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107461
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 12aa623de2b2..ba2fa918f82f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -75,6 +75,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <editeng/flditem.hxx>
 #include <editeng/unotext.hxx>
+#include <o3tl/safeint.hxx>
 #include <o3tl/temporary.hxx>
 #include <oox/mathml/import.hxx>
 #include <xmloff/odffields.hxx>
@@ -148,7 +149,7 @@ static void lcl_handleDropdownField( const uno::Reference< beans::XPropertySet >
             rxFieldProps->setPropertyValue( "Items", uno::makeAny( sItems ) );
 
         sal_Int32 nResult = pFFDataHandler->getDropDownResult().toInt32();
-        if ( nResult )
+        if (nResult > 0 && o3tl::make_unsigned(nResult) < sItems.size())
             rxFieldProps->setPropertyValue( "SelectedItem", uno::makeAny( sItems[ nResult ] ) );
         if ( !pFFDataHandler->getHelpText().isEmpty() )
              rxFieldProps->setPropertyValue( "Help", uno::makeAny( pFFDataHandler->getHelpText() ) );
commit d0f3639a5a91ff69e5a0c8883cabb8558803ec85
Author:     Aron Budea <aron.budea at collabora.com>
AuthorDate: Wed Dec 9 18:39:54 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 11 10:56:12 2020 +0100

    tdf#138762: crash when trying to open sidebar w chart in Writer
    
    In Writer when in chart edit mode, and the chart is deselected,
    the object selection remains. Opening Properties sidebar at
    this point crashed. Calc and Impress were unaffected.
    
    Regression from b5fdb148fe87a90f3e586efcea7aa6ef865fa42a
    
    Change-Id: I356c3a42c41dd38e4739df27c72c6d67722b1dbc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107500
    Tested-by: Jenkins
    Reviewed-by: Aron Budea <aron.budea at collabora.com>
    (cherry picked from commit 7e5991dc695d1e590483615c2907811ce4117834)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107543
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 08606a83f9dc..68066f4f4918 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -611,10 +611,13 @@ void SidebarController::OpenThenToggleDeck (
     SwitchToDeck(rsDeckId);
 
     // Make sure the sidebar is wide enough to fit the requested content
-    sal_Int32 nRequestedWidth = (mpCurrentDeck->GetMinimalWidth() + TabBar::GetDefaultWidth())
-                                * mpTabBar->GetDPIScaleFactor();
-    if (mnSavedSidebarWidth < nRequestedWidth)
-        SetChildWindowWidth(nRequestedWidth);
+    if (mpCurrentDeck && mpTabBar)
+    {
+        sal_Int32 nRequestedWidth = (mpCurrentDeck->GetMinimalWidth() + TabBar::GetDefaultWidth())
+                                    * mpTabBar->GetDPIScaleFactor();
+        if (mnSavedSidebarWidth < nRequestedWidth)
+            SetChildWindowWidth(nRequestedWidth);
+    }
 
     collectUIInformation(rsDeckId);
 }
commit 2e6ecdfec95ac18a197cf31a67455cd103b73198
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Dec 10 13:14:18 2020 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Fri Dec 11 03:18:11 2020 +0100

    fix printing of 'margins in comment'
    
    mangled since...
    
    commit c200aa27ee4a0f5a89af6e970c2c22580029eded
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Thu May 21 15:54:15 2020 +0100
    
        remove Size arg from Window::Draw and depend on GetSizePixel
    
    which was a real monday-morning commit that bizarrely dropped drawing
    of the date/resolved widgets entirely and failed to notice that
    the PixelToLogic call in SwPostItMgr::DrawNotesForPage was originally
    called on the input pPostIt, not the output pDev
    
    Change-Id: I73b87f5889ef13018bcc43f97cd65169a3b77a65
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107534
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 9c3539f2e6d7..04c1f8332695 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -260,7 +260,7 @@ void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint
 
 void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFlags)
 {
-    Size aSz = pDev->PixelToLogic(GetSizePixel());
+    Size aSz = PixelToLogic(GetSizePixel());
 
     if (mpMetadataAuthor->IsVisible() )
     {
@@ -287,6 +287,7 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl
         aPos += rPt;
         vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
         mpMetadataDate->SetControlFont( aFont );
+        mpMetadataDate->Draw(pDev, aPos, nInFlags);
         mpMetadataDate->SetControlFont( aOrigFont );
     }
 
@@ -297,13 +298,11 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl
         aPos += rPt;
         vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetFieldFont() );
         mpMetadataResolved->SetControlFont( aFont );
+        mpMetadataResolved->Draw(pDev, aPos, nInFlags);
         mpMetadataResolved->SetControlFont( aOrigFont );
     }
 
-    Size aOrigSize(mpSidebarTextControl->GetSizePixel());
-    mpSidebarTextControl->SetSizePixel(aSz);
     mpSidebarTextControl->Draw(pDev, rPt, nInFlags);
-    mpSidebarTextControl->SetSizePixel(aOrigSize);
 
     const drawinglayer::geometry::ViewInformation2D aNewViewInfos;
     std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
@@ -319,6 +318,8 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl
     if (!mpVScrollbar->IsVisible())
         return;
 
+    // if there is a scrollbar shown, draw "..." to indicate the comment isn't
+    // completely shown
     vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
     Color aOrigBg( mpMetadataDate->GetControlBackground() );
     OUString sOrigText(mpMetadataDate->GetText());
@@ -330,7 +331,7 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl
     mpMetadataDate->SetControlFont( aFont );
     mpMetadataDate->SetControlBackground( Color(0xFFFFFF) );
     mpMetadataDate->SetText("...");
-    aOrigSize = mpMetadataDate->GetSizePixel();
+    Size aOrigSize = mpMetadataDate->GetSizePixel();
     mpMetadataDate->SetSizePixel(mpMenuButton->GetSizePixel());
     mpMetadataDate->Draw(pDev, aPos, nInFlags);
     mpMetadataDate->SetSizePixel(aOrigSize);
commit d4d320365cc84b45d6a39826a0d4a69360b8c7f7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 9 09:10:34 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:36:53 2020 +0100

    leaked_storage
    
    Change-Id: I462636907a7f16a69d2fae2529c6ffbbf925774b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107392
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx
index fa9d096606e6..7d3313aa4066 100644
--- a/vcl/unx/gtk3/a11y/gtk3atkaction.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atkaction.cxx
@@ -208,7 +208,7 @@ appendKeyStrokes(OStringBuffer& rBuffer, const uno::Sequence< awt::KeyStroke >&
             {
                 // The KeyCode approach did not work, probably a non ascii character
                 // let's hope that there is a character given in KeyChar.
-                rBuffer.append( OUStringToGChar( OUString( rKeyStroke.KeyChar ) ) );
+                rBuffer.append(OUStringToOString(OUString(rKeyStroke.KeyChar), RTL_TEXTENCODING_UTF8));
             }
         }
     }
commit c8d335f9bfa6a6fd0887171e2b51035dcbb42078
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Dec 9 20:38:40 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 10 15:35:46 2020 +0100

    tdf#138688 tdf#124646 sw: fix crash at pasting Calc data
    
    .. in a table before a numbered paragraph. Dispatcher
    calls of the workaround for tdf#124646 missed the temporary
    table in this case, selecting + copying nothing and after
    that trying to paste the same non-native Calc data again,
    resulting infinite recursion.
    
    Replacing FN_CHAR_LEFT with FN_LINE_UP solved the
    problem (FN_CHAR_LEFT selected the numbers of the
    numbered list instead of the temporary table).
    Fixing the fragile dispatcher calls, now we check
    the selection of the temporary table to avoid similar
    crashes.
    
    Unit tests are added for the fix, also for the
    original problem of tdf#124646 (avoid copying
    hidden rows from Calc, e.g. copying only visible
    result of a filtering).
    
    Regression from commit 0c3ac02d8a3c7ea50ae262daf134c28df5c8b343
    (tdf#124646 Don't paste hidden rows of Calc sheets into Writer tables).
    
    (Note: to check/show the fix of the crash manually, run the test with
    
    $ (cd sw && make -srj8 UITest_sw_table UITEST_TEST_NAME="sheetToTable.sheetToTable.test_tdf138688" SAL_USE_VCLPLUGIN=gen)
    
    adding
    
    import time
    time.sleep(5)
    
    to the called function of sheetToTable.py)
    
    Change-Id: I7b90af8219d6fd00b75d91f7c92fff5744373cc6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107508
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 7720f8cf22718415adb3db2304916581f864f884)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107487
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py
new file mode 100644
index 000000000000..d14529d4af9e
--- /dev/null
+++ b/sw/qa/uitest/table/sheetToTable.py
@@ -0,0 +1,107 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+from uitest.uihelper.calc import enter_text_to_cell
+import org.libreoffice.unotest
+import pathlib
+
+def get_url_for_data_file(file_name):
+    return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+#Calc sheet to Writer table
+
+class sheetToTable(UITestCase):
+    def test_sheet_to_table_without_hidden_rows(self):
+        calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods"))
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        self.xUITest.executeCommand(".uno:SelectAll")
+        self.xUITest.executeCommand(".uno:Copy")
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+        self.ui_test.close_doc()
+        writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
+        document = self.ui_test.get_component()
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        self.xUITest.executeCommand(".uno:Paste")
+        #verify (don't copy hidden cells)
+        self.assertEqual(document.TextTables.getCount(), 1)
+        table = document.getTextTables()[0]
+        # This was 3 (copied hidden row)
+        self.assertEqual(len(table.getRows()), 2)
+        self.assertEqual(table.getCellByName("A1").getString(), "1")
+        # This was "2 (hidden)" (copied hidden row)
+        self.assertEqual(table.getCellByName("A2").getString(), "3")
+        self.ui_test.close_doc()
+
+    def test_tdf138688(self):
+        calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods"))
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        self.xUITest.executeCommand(".uno:SelectAll")
+        self.xUITest.executeCommand(".uno:Copy")
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+        self.ui_test.close_doc()
+        writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
+        document = self.ui_test.get_component()
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+
+        # set numbering in the paragraph after the table
+        self.xUITest.executeCommand(".uno:GoDown")
+        self.xUITest.executeCommand(".uno:GoDown")
+        self.xUITest.executeCommand(".uno:DefaultNumbering")
+        self.xUITest.executeCommand(".uno:GoUp")
+        self.xUITest.executeCommand(".uno:GoUp")
+
+        #verify (this was a freezing/crash)
+        self.xUITest.executeCommand(".uno:Paste")
+
+        #verify also tdf#124646 (don't copy hidden cells)
+        self.assertEqual(document.TextTables.getCount(), 1)
+        table = document.getTextTables()[0]
+        # This was 3 (copied hidden row)
+        self.assertEqual(len(table.getRows()), 2)
+        self.assertEqual(table.getCellByName("A1").getString(), "1")
+        # This was "2 (hidden)" (copied hidden row)
+        self.assertEqual(table.getCellByName("A2").getString(), "3")
+        self.ui_test.close_doc()
+
+    def test_tdf129083(self):
+        calc_doc = self.ui_test.create_doc_in_start_center("calc")
+
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+
+        enter_text_to_cell(gridwin, "A1", "Test 1")
+        enter_text_to_cell(gridwin, "A2", "Test 2")
+        enter_text_to_cell(gridwin, "A3", "Test 3")
+        enter_text_to_cell(gridwin, "A4", "Test 4")
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+        self.xUITest.executeCommand(".uno:Copy")
+
+        self.ui_test.close_doc()
+
+        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf129083.odt"))
+        document = self.ui_test.get_component()
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+
+        self.xUITest.executeCommand(".uno:Paste")
+
+        self.assertEqual(document.TextTables.getCount(), 1)
+        table = document.getTextTables()[0]
+        self.assertEqual(len(table.getRows()), 4)
+        self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
+        self.assertEqual(table.getCellByName("A2").getString(), "Test 2")
+        self.assertEqual(table.getCellByName("A3").getString(), "Test 3")
+        self.assertEqual(table.getCellByName("A4").getString(), "Test 4")
+        self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests/data/hiddenRow.ods b/sw/qa/uitest/writer_tests/data/hiddenRow.ods
new file mode 100644
index 000000000000..8b5d98a182fb
Binary files /dev/null and b/sw/qa/uitest/writer_tests/data/hiddenRow.ods differ
diff --git a/sw/qa/uitest/writer_tests/data/tdf129083.odt b/sw/qa/uitest/writer_tests/data/tdf129083.odt
new file mode 100644
index 000000000000..3de65273e8a1
Binary files /dev/null and b/sw/qa/uitest/writer_tests/data/tdf129083.odt differ
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 27ac5dbbef58..6c07f242f6a5 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1464,11 +1464,20 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt
             if ( SwTransferable::PasteData( rData, rSh, EXCHG_OUT_ACTION_INSERT_STRING, nActionFlags, SotClipboardFormatId::HTML,
                                         nDestination, false, false, nullptr, 0, false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable) )
             {
-                pDispatch->Execute(FN_CHAR_LEFT, SfxCallMode::SYNCHRON);
-                pDispatch->Execute(FN_TABLE_SELECT_ALL, SfxCallMode::SYNCHRON);
-                pDispatch->Execute(SID_COPY, SfxCallMode::SYNCHRON);
+                bool bFoundTemporaryTable = false;
+                pDispatch->Execute(FN_LINE_UP, SfxCallMode::SYNCHRON);
+                if (rSh.GetDoc()->IsIdxInTable(rSh.GetCursor()->GetNode()) != nullptr)
+                {
+                    bFoundTemporaryTable = true;
+                    pDispatch->Execute(FN_TABLE_SELECT_ALL, SfxCallMode::SYNCHRON);
+                    pDispatch->Execute(SID_COPY, SfxCallMode::SYNCHRON);
+                }
                 for(sal_uInt32 a = 0; a < 1 + (nLevel * 2); a++)
                     pDispatch->Execute(SID_UNDO, SfxCallMode::SYNCHRON);
+                // clipboard content hasn't changed (limit potential infinite
+                // recursion with the same non-native table, as was in tdf#138688)
+                if (!bFoundTemporaryTable)
+                    return false;
                 if (ePasteTable == PasteTableType::PASTE_TABLE)
                     pDispatch->Execute(FN_PASTE_NESTED_TABLE, SfxCallMode::SYNCHRON);
                 else if (ePasteTable == PasteTableType::PASTE_ROW)
commit 9700c6ecc6a488247b5c504577d3599ac54d497e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 9 09:36:00 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:35:03 2020 +0100

    unref pSubMenuModel at the end of the scope
    
    Change-Id: Ia427c736f989de38f30c455aeed0f43811a456b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107475
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/vcl/unx/gtk3/gtk3gtksalmenu.cxx b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
index 262187f16658..6e47e4eae91a 100644
--- a/vcl/unx/gtk3/gtk3gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtk3gtksalmenu.cxx
@@ -325,7 +325,7 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
                 pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section( pLOMenu, nSection, nItemPos );
             }
 
-            g_object_unref( pSubMenuModel );
+            assert(pSubMenuModel);
 
             if (bRecurse || bNonMenuChangedToMenu)
             {
@@ -334,6 +334,8 @@ void GtkSalMenu::ImplUpdate(bool bRecurse, bool bRemoveDisabledEntries)
                 pSubmenu->SetActionGroup( G_ACTION_GROUP( pActionGroup ) );
                 pSubmenu->ImplUpdate(true, bRemoveDisabledEntries);
             }
+
+            g_object_unref( pSubMenuModel );
         }
 
         g_free( aNativeCommand );
commit cce4ed9dbb9c6189b07795213aa8731baf22cd2f
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Nov 19 22:04:21 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:29:16 2020 +0100

    Allow --enable-macosx-sandbox without the codesigning identities
    
    For cases where you just want "make test-install" to construct an app
    bundle that you will manipulate and then sign separately.
    
    Change-Id: Iad805618f74ec783ebc013a664f928511b388383
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106185
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106260
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107252
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/Makefile.in b/Makefile.in
index 6af416b8a2f9..cc08afb4a5e8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -348,7 +348,6 @@ ifeq ($(OS_FOR_BUILD),WNT)
 	cd $(SRCDIR)/instsetoo_native && $(MAKE) LIBO_TEST_INSTALL=TRUE $(GMAKE_OPTIONS)
 else
 	@$(SRCDIR)/solenv/bin/ooinstall $(TESTINSTALLDIR)
-ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
 #
 # Create Resources/*.lproj directories for languages supported by macOS
 	set -x; for lang in ca cs da de el en es fi fr hr hu id it ja ko ms nl no pl pt pt_PT ro ru sk sv th tr uk vi zh_CN zh_TW; do \
@@ -377,6 +376,7 @@ ifneq ($(ENABLE_MACOSX_SANDBOX),)
 	rm $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app/Contents/MacOS/unoinfo
 endif
 #
+ifneq ($(MACOSX_CODESIGNING_IDENTITY),)
 # Then use the macosx-codesign-app-bundle script
 	@$(SRCDIR)/solenv/bin/macosx-codesign-app-bundle $(TESTINSTALLDIR)/$(PRODUCTNAME_WITHOUT_SPACES).app
 endif
diff --git a/configure.ac b/configure.ac
index 8006a535baad..b5c6c049b406 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3094,11 +3094,9 @@ if test $_os = Darwin; then
 
     AC_MSG_CHECKING([whether to sandbox the application])
 
-    if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
-        AC_MSG_ERROR([macOS sandboxing requires code signing])
-    elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
+    if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
-    elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
+    elif test "$enable_macosx_sandbox" = yes; then
         ENABLE_MACOSX_SANDBOX=TRUE
         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
         AC_MSG_RESULT([yes])
commit 992c1de725dd7590f63044ce2f1c5337fd271d9a
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Nov 20 01:02:02 2020 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:25:59 2020 +0100

    Check first if there is such a "bin" directory before attempting to use it
    
    In the test-install target in Makefile.in we remove the "bin" folder
    of the LibreOfficePython framework.
    
    Change-Id: Idf3d440c4f9465f21b5dcae60d4fc5ac21965dd8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106284
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106398
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107251
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/solenv/bin/macosx-codesign-app-bundle b/solenv/bin/macosx-codesign-app-bundle
index 2353032e3a8a..8aa725745327 100755
--- a/solenv/bin/macosx-codesign-app-bundle
+++ b/solenv/bin/macosx-codesign-app-bundle
@@ -99,10 +99,12 @@ while read framework; do
         if test ! -L "$version" -a -d "$version"; then
 	    # Assume the framework has a XML (and not binary) Info.plist
 	    id=`grep -A 1 '<key>CFBundleIdentifier</key>' $version/Resources/Info.plist | tail -1 | sed -e 's,.*<string>,,' -e 's,</string>.*,,'`
-            # files in bin are not covered by signing the framework...
-            for scriptorexecutable in $(find $version/bin/ -type f); do
-                codesign --verbose --options=runtime --force --identifier=$id --sign "$MACOSX_CODESIGNING_IDENTITY" "$scriptorexecutable" >> "/tmp/codesign_${fn}.log" 2>&1
-            done
+	    if test -d $version/bin; then
+		# files in bin are not covered by signing the framework...
+		for scriptorexecutable in $(find $version/bin/ -type f); do
+		    codesign --verbose --options=runtime --force --identifier=$id --sign "$MACOSX_CODESIGNING_IDENTITY" "$scriptorexecutable" >> "/tmp/codesign_${fn}.log" 2>&1
+		done
+	    fi
             codesign --verbose --force --identifier=$id --sign "$MACOSX_CODESIGNING_IDENTITY" "$version" >> "/tmp/codesign_${fn}.log" 2>&1
 	    if [ "$?" != "0" ] ; then
 		exit 1
commit 5a98daf9f6e6bec4ccaead5df256f8f1cd9c1b15
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 9 09:11:58 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:23:43 2020 +0100

    uninit_member
    
    Change-Id: Idd42a139dabf74ee20afa8b6fb3c9ec25c7b0b19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107390
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index b4e91dcec5f0..27ac5dbbef58 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -244,7 +244,9 @@ SwTransferable::SwTransferable( SwWrtShell& rSh )
     : m_pWrtShell( &rSh ),
     m_pCreatorView( nullptr ),
     m_pOrigGraphic( nullptr ),
-    m_eBufferType( TransferBufferType::NONE )
+    m_eBufferType( TransferBufferType::NONE ),
+    m_bOldIdle(false),
+    m_bCleanUp(false)
 {
     rSh.GetView().AddTransferable(*this);
     SwDocShell* pDShell = rSh.GetDoc()->GetDocShell();
commit f9b1ce7a2afeb5d26fb7901eedc40212269156dd
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 9 09:49:40 2020 +0000
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:22:54 2020 +0100

    passed_freed_arg: InsertObjectAtView returns false if pObj was deleted
    
    Change-Id: Ife8049e0426659f9b83504f1aced52b62159554b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107477
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index c4ae7621a60c..cc856512ae21 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -995,12 +995,13 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                             nOptions |= SdrInsertFlags::DONTMARK;
                     }
 
-                    InsertObjectAtView( pObj, *pPV, nOptions );
+                    // bInserted of false means that pObj has been deleted
+                    bool bInserted = InsertObjectAtView( pObj, *pPV, nOptions );
 
-                    if( pImageMap )
+                    if (bInserted && pImageMap)
                         pObj->AppendUserData( std::unique_ptr<SdrObjUserData>(new SvxIMapInfo( *pImageMap )) );
 
-                    if (pObj->IsChart())
+                    if (bInserted && pObj->IsChart())
                     {
                         bool bDisableDataTableDialog = false;
                         svt::EmbeddedObjectRef::TryRunningState( xObj );
commit 4c2c161018165b7484233547fea1511c84b3ffe3
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Fri Nov 27 17:38:46 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Dec 10 15:21:06 2020 +0100

    Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308
    
     This is a combination of 4 commits.
    
    Resolves: tdf#136272 convert DBL_MAX to 1.7976931348623157e+308
    
    ... and the 4 subsequent nextafters to appropriate strings.
    
    An interim workaround to not write the out-of-range string
    1.79769313486232e+308 until we have a proper rounding.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106717
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 4713c19e2b79341dc27e66d4c6449497db1e73d8)
    
    Consistently use RTL_CONSTASCII_LENGTH(), tdf#136272 follow-up
    
    The mix with SAL_N_ELEMENTS() was confusing and even wrong in one
    case.
    
    Ife73342b0efc01ed4e76e217d372fc32500c9b2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106764
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 1a0f9a9c56e7b7952b813b3efd34f9be6c853957)
    
    Fix comment
    
    I2ae6e3cadc0f182c4798e5d33b0c7f07fbcbbff6
    (cherry picked from commit b8404ae521a9c2d183d4e076a7884627ba353e4b)
    
    Typo in rounded digit string, tdf#138360 follow-up
    
    Ic436d3e9f0c93cb36c5e4377519f2aeb6b7fbd5f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107034
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit d8e0b1c81ffa16be8aae2231bcd3c02e8c01cf88)
    
    Change-Id: I5f98a7f0a8e0421fd024a8cc37cc6f3a198d02d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106686
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 9c32cff30f2f..bd9d2c8a601f 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -274,6 +274,84 @@ void doubleToString(typename T::String ** pResult,
         return;
     }
 
+    // Unfortunately the old rounding below writes 1.79769313486232e+308 for
+    // DBL_MAX and 4 subsequent nextafter(...,0).
+    static const double fB1 = std::nextafter( DBL_MAX, 0);
+    static const double fB2 = std::nextafter( fB1, 0);
+    static const double fB3 = std::nextafter( fB2, 0);
+    static const double fB4 = std::nextafter( fB3, 0);
+    if ((fValue >= fB4) && eFormat != rtl_math_StringFormat_F)
+    {
+        // 1.7976931348623157e+308 instead of rounded 1.79769313486232e+308
+        // that can't be converted back as out of range. For rounded values if
+        // they exceed range they should not be written to exchange strings or
+        // file formats.
+
+        // Writing pDig up to decimals(-1,-2) then appending one digit from
+        // pRou xor one or two digits from pSlot[].
+        constexpr char pDig[] = "7976931348623157";
+        constexpr char pRou[] = "8087931359623267";     // the only up-carry is 80
+        static_assert(SAL_N_ELEMENTS(pDig) == SAL_N_ELEMENTS(pRou), "digit count mismatch");
+        constexpr sal_Int32 nDig2 = RTL_CONSTASCII_LENGTH(pRou) - 2;
+        sal_Int32 nCapacity = RTL_CONSTASCII_LENGTH(pRou) + 8;  // + "-1.E+308"
+        const char pSlot[5][2][3] =
+        { // rounded, not
+            "67", "57",     // DBL_MAX
+            "65", "55",
+            "53", "53",
+            "51", "51",
+            "59", "49",
+        };
+
+        if (!pResultCapacity)
+        {
+            pResultCapacity = &nCapacity;
+            T::createBuffer(pResult, pResultCapacity);
+            nResultOffset = 0;
+        }
+
+        if (bSign)
+            T::appendAscii(pResult, pResultCapacity, &nResultOffset,
+                           RTL_CONSTASCII_STRINGPARAM("-"));
+
+        nDecPlaces = std::clamp<sal_Int32>( nDecPlaces, 0, RTL_CONSTASCII_LENGTH(pRou));
+        if (nDecPlaces == 0)
+        {
+            T::appendAscii(pResult, pResultCapacity, &nResultOffset,
+                           RTL_CONSTASCII_STRINGPARAM("2"));
+        }
+        else
+        {
+            T::appendAscii(pResult, pResultCapacity, &nResultOffset,
+                           RTL_CONSTASCII_STRINGPARAM("1"));
+            T::appendChars(pResult, pResultCapacity, &nResultOffset, &cDecSeparator, 1);
+            if (nDecPlaces <= 2)
+            {
+                T::appendAscii(pResult, pResultCapacity, &nResultOffset, pRou, nDecPlaces);
+            }
+            else if (nDecPlaces <= nDig2)
+            {
+                T::appendAscii(pResult, pResultCapacity, &nResultOffset, pDig, nDecPlaces - 1);
+                T::appendAscii(pResult, pResultCapacity, &nResultOffset, pRou + nDecPlaces - 1, 1);
+            }
+            else
+            {
+                const sal_Int32 nDec = nDecPlaces - nDig2;
+                nDecPlaces -= nDec;
+                // nDec-1 is also offset into slot, rounded(1-1=0) or not(2-1=1)
+                const size_t nSlot = ((fValue < fB3) ? 4 : ((fValue < fB2) ? 3
+                            : ((fValue < fB1) ? 2 : ((fValue < DBL_MAX) ? 1 : 0))));
+
+                T::appendAscii(pResult, pResultCapacity, &nResultOffset, pDig, nDecPlaces);
+                T::appendAscii(pResult, pResultCapacity, &nResultOffset, pSlot[nSlot][nDec-1], nDec);
+            }
+        }
+        T::appendAscii(pResult, pResultCapacity, &nResultOffset,
+                       RTL_CONSTASCII_STRINGPARAM("E+308"));
+
+        return;
+    }
+
     // Use integer representation for integer values that fit into the
     // mantissa (1.((2^53)-1)) with a precision of 1 for highest accuracy.
     const sal_Int64 kMaxInt = (static_cast< sal_Int64 >(1) << 53) - 1;
commit 5fc2c93e69ddb2ab6b8061c1f23fa500224c4fa6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 4 12:58:20 2020 +0000
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 10 12:57:51 2020 +0100

    disable tests that don't work without pdfium
    
    we're probably past the end of the road on --disable-pdfium
    
    Change-Id: Id91ea6c77bbdb3ecf609a7ffd16a278eb3b17e91
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107223
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 7659fe9485c5..68738134cc36 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <config_features.h>
+
 #include <com/sun/star/xml/crypto/SEInitializer.hpp>
 #include <com/sun/star/security/DocumentSignatureInformation.hpp>
 
@@ -414,6 +416,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testBadCertP1)
         = verify(m_directories.getURLFromSrc(DATA_DIRECTORY) + "bad-cert-p1.pdf", 1,
                  /*rExpectedSubFilter=*/OString());
     CPPUNIT_ASSERT(!aInfos.empty());

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list