[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 18 commits - avmedia/source canvas/source chart2/source chart2/uiconfig cppcanvas/source drawinglayer/source filter/source include/svx include/vcl sc/qa sc/source sd/qa sd/source sd/uiconfig sfx2/source solenv/gbuild starmath/source svx/source sw/qa sw/source sw/uiconfig vcl/source vcl/unx writerfilter/source

Ayhan Yalçınsoy (via logerrit) logerrit at kemper.freedesktop.org
Thu May 6 14:40:59 UTC 2021


 avmedia/source/framework/MediaControlBase.cxx              |    2 
 canvas/source/cairo/cairo_canvashelper.cxx                 |   14 +-
 chart2/source/controller/dialogs/res_BarGeometry.cxx       |    3 
 chart2/uiconfig/ui/tp_ChartType.ui                         |   11 +
 cppcanvas/source/mtfrenderer/implrenderer.cxx              |    8 -
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   82 ++++++++++---
 filter/source/graphicfilter/idxf/dxfvec.cxx                |    6 
 include/svx/xdash.hxx                                      |   22 +--
 include/vcl/lineinfo.hxx                                   |   26 ++--
 sc/qa/extras/macros-test.cxx                               |   36 +++++
 sc/qa/extras/testdocuments/tdf90278.xls                    |binary
 sc/source/ui/vba/vbaborders.cxx                            |    2 
 sd/qa/unit/export-tests-ooxml2.cxx                         |    6 
 sd/qa/unit/uiimpress.cxx                                   |   24 ---
 sd/source/ui/annotations/annotationmanager.cxx             |    7 -
 sd/uiconfig/simpress/ui/sidebarslidebackground.ui          |   22 +--
 sfx2/source/dialog/backingwindow.cxx                       |    8 +
 sfx2/source/dialog/mgetempl.cxx                            |    1 
 solenv/gbuild/platform/com_MSC_defs.mk                     |    2 
 starmath/source/edit.cxx                                   |    4 
 svx/source/xoutdev/xattr.cxx                               |   12 -
 sw/qa/extras/layout/data/tdf138782.docx                    |binary
 sw/qa/extras/layout/layout2.cxx                            |   16 ++
 sw/source/core/inc/layact.hxx                              |   23 ++-
 sw/source/core/layout/layact.cxx                           |   60 +++++----
 sw/source/core/view/viewsh.cxx                             |    1 
 sw/uiconfig/sglobal/popupmenu/table.xml                    |    1 
 sw/uiconfig/sweb/popupmenu/table.xml                       |    1 
 sw/uiconfig/swform/popupmenu/table.xml                     |    1 
 sw/uiconfig/swriter/popupmenu/table.xml                    |    1 
 sw/uiconfig/swxform/popupmenu/table.xml                    |    1 
 vcl/source/gdi/lineinfo.cxx                                |   55 +++++---
 vcl/source/outdev/polyline.cxx                             |    8 -
 vcl/unx/gtk3/gtk3gtkframe.cxx                              |   20 ++-
 vcl/unx/gtk3/gtk3gtkinst.cxx                               |   24 ++-
 writerfilter/source/dmapper/DomainMapper.cxx               |    5 
 writerfilter/source/filter/WriterFilter.cxx                |    1 
 37 files changed, 336 insertions(+), 180 deletions(-)

New commits:
commit 2761de9cdcb68fb514e656d5c7b7ac03bac71db8
Author:     Ayhan Yalçınsoy <ayhanyalcinsoy at pisilinux.org>
AuthorDate: Sun May 2 09:26:32 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:12 2021 +0200

    tdf#140296: Added Edit Fields(context menu) inside of tables
    
    Change-Id: I22b6a179c1575171315d9eb40cd4895c35d77b6f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114986
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
    (cherry picked from commit 1cf47d932580a58a7855fe29ac39d17cdd79ae01)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115091
    Reviewed-by: Ayhan Yalçınsoy <ayhanyalcinsoy at pisilinux.org>
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/uiconfig/sglobal/popupmenu/table.xml b/sw/uiconfig/sglobal/popupmenu/table.xml
index 179790220325..242511168051 100644
--- a/sw/uiconfig/sglobal/popupmenu/table.xml
+++ b/sw/uiconfig/sglobal/popupmenu/table.xml
@@ -123,6 +123,7 @@
   </menu:menu>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+  <menu:menuitem menu:id=".uno:FieldDialog"/>
   <menu:menuitem menu:id=".uno:AcceptTrackedChange"/>
   <menu:menuitem menu:id=".uno:RejectTrackedChange"/>
   <menu:menuitem menu:id=".uno:NextTrackedChange"/>
diff --git a/sw/uiconfig/sweb/popupmenu/table.xml b/sw/uiconfig/sweb/popupmenu/table.xml
index 179790220325..242511168051 100644
--- a/sw/uiconfig/sweb/popupmenu/table.xml
+++ b/sw/uiconfig/sweb/popupmenu/table.xml
@@ -123,6 +123,7 @@
   </menu:menu>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+  <menu:menuitem menu:id=".uno:FieldDialog"/>
   <menu:menuitem menu:id=".uno:AcceptTrackedChange"/>
   <menu:menuitem menu:id=".uno:RejectTrackedChange"/>
   <menu:menuitem menu:id=".uno:NextTrackedChange"/>
diff --git a/sw/uiconfig/swform/popupmenu/table.xml b/sw/uiconfig/swform/popupmenu/table.xml
index 179790220325..242511168051 100644
--- a/sw/uiconfig/swform/popupmenu/table.xml
+++ b/sw/uiconfig/swform/popupmenu/table.xml
@@ -123,6 +123,7 @@
   </menu:menu>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+  <menu:menuitem menu:id=".uno:FieldDialog"/>
   <menu:menuitem menu:id=".uno:AcceptTrackedChange"/>
   <menu:menuitem menu:id=".uno:RejectTrackedChange"/>
   <menu:menuitem menu:id=".uno:NextTrackedChange"/>
diff --git a/sw/uiconfig/swriter/popupmenu/table.xml b/sw/uiconfig/swriter/popupmenu/table.xml
index 0e0ff18fecb4..0f6f1138746b 100644
--- a/sw/uiconfig/swriter/popupmenu/table.xml
+++ b/sw/uiconfig/swriter/popupmenu/table.xml
@@ -126,6 +126,7 @@
   </menu:menu>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+  <menu:menuitem menu:id=".uno:FieldDialog"/>
   <menu:menuitem menu:id=".uno:AcceptTrackedChange"/>
   <menu:menuitem menu:id=".uno:RejectTrackedChange"/>
   <menu:menuitem menu:id=".uno:NextTrackedChange"/>
diff --git a/sw/uiconfig/swxform/popupmenu/table.xml b/sw/uiconfig/swxform/popupmenu/table.xml
index 179790220325..242511168051 100644
--- a/sw/uiconfig/swxform/popupmenu/table.xml
+++ b/sw/uiconfig/swxform/popupmenu/table.xml
@@ -123,6 +123,7 @@
   </menu:menu>
   <menu:menuseparator/>
   <menu:menuitem menu:id=".uno:InsertAnnotation"/>
+  <menu:menuitem menu:id=".uno:FieldDialog"/>
   <menu:menuitem menu:id=".uno:AcceptTrackedChange"/>
   <menu:menuitem menu:id=".uno:RejectTrackedChange"/>
   <menu:menuitem menu:id=".uno:NextTrackedChange"/>
commit f50b91ef3546d673ecf3763e0407738c7082180a
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed May 5 14:20:01 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:11 2021 +0200

    scale stroked line properly in cairocanvas
    
    - Line width should be scaled by the scaled vector, not just its X
    component (see VclMetafileProcessor2D::getTransformedLineWidth()).
    - Lenths of dashes should not be scaled by the scaled line width,
    but by the scaling.
    Testcase document sd/qa/unit/data/pptx/tdf134053_dashdot.pptx .
    
    Change-Id: I4116f82e91620f5612f5e4e187468508f683b93e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115147
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 3a1d150eb99b5875e6e86117029a72e4c87b0547)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115089
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 7d4cdba478f4..08066c27537f 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -914,10 +914,12 @@ namespace cairocanvas
             useStates( viewState, renderState, true );
 
             cairo_matrix_t aMatrix;
-            double w = strokeAttributes.StrokeWidth, h = 0;
             cairo_get_matrix( mpCairo.get(), &aMatrix );
-            cairo_matrix_transform_distance( &aMatrix, &w, &h );
-            cairo_set_line_width( mpCairo.get(), w );
+            double scaleFactorX = 1;
+            double scaleFactorY = 0;
+            cairo_matrix_transform_distance( &aMatrix, &scaleFactorX, &scaleFactorY );
+            double scaleFactor = basegfx::B2DVector( scaleFactorX, scaleFactorY ).getLength();
+            cairo_set_line_width( mpCairo.get(), strokeAttributes.StrokeWidth * scaleFactor );
 
             cairo_set_miter_limit( mpCairo.get(), strokeAttributes.MiterLimit );
 
@@ -953,14 +955,14 @@ namespace cairocanvas
                     break;
             }
 
-            //tdf#103026 If the w scaling is 0, then all dashes become zero so
+            //tdf#103026 If the scaling is 0, then all dashes become zero so
             //cairo will set the cairo_t status to CAIRO_STATUS_INVALID_DASH
             //and no further drawing will occur
-            if (strokeAttributes.DashArray.hasElements() && w > 0.0)
+            if (strokeAttributes.DashArray.hasElements() && scaleFactor > 0.0)
             {
                 auto aDashArray(comphelper::sequenceToContainer<std::vector<double>>(strokeAttributes.DashArray));
                 for (auto& rDash : aDashArray)
-                    rDash *= w;
+                    rDash *= scaleFactor;
                 cairo_set_dash(mpCairo.get(), aDashArray.data(), aDashArray.size(), 0);
             }
 
commit 88adf23d03a86c5f752ecbf33066d935b723b0de
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue May 4 21:25:29 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:11 2021 +0200

    transform by vector length, not just X
    
    I missed this one in b71d9a6d15cfb8a50afdea5ac064f40d84c561f8.
    
    Change-Id: Ibbfd6ed1e064030a6a2818df94d7d61dd2b92caa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115088
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index b04d7a997cd3..0aecf685097b 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -106,7 +106,7 @@ namespace
     {
         const ::basegfx::B2DSize aWidth( rLineInfo.GetWidth(), 0 );
         o_rStrokeAttributes.StrokeWidth =
-            (rParms.mrStates.getState().mapModeTransform * aWidth).getX();
+            (rParms.mrStates.getState().mapModeTransform * aWidth).getLength();
 
         // setup reasonable defaults
         o_rStrokeAttributes.MiterLimit   = 15.0; // 1.0 was no good default; GDI+'s limit is 10.0, our's is 15.0
commit 1f3260175c94081bdd1789d0abcb595b8f876dfd
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Fri Apr 30 16:41:19 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:10 2021 +0200

    fix dashed line info conversion for metafile (tdf#136957)
    
    My previous change had two problems:
    - It didn't handle correctly the case when something repeated,
      such as dash-dot-dot.
    - The rounding when setting lengths was a left-over from my first
      attempt when LineInfo used integers and not floats.
    
    Change-Id: I914241590b1ddec22df04c05dfe65e76e921ee52
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114940
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit 565824df07913f47851804daed9efa28a4a95e9d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115039
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index f518663707c4..86cdb63686d0 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1591,40 +1591,67 @@ void VclMetafileProcessor2D::processPolygonStrokePrimitive2D(
             {
                 aHairLinePolyPolygon.append(rBasePolygon);
             }
-            else if (rStroke.getDotDashArray().size() == 2)
-            {
-                aHairLinePolyPolygon.append(rBasePolygon);
-                // This will be used by setupStrokeAttributes() in cppcanvas.
-                aLineInfo.SetStyle(LineStyle::Dash);
-                aLineInfo.SetDashCount(1);
-                aLineInfo.SetDashLen(
-                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[0])));
-                aLineInfo.SetDistance(
-                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[1])));
-            }
-            else if (rStroke.getDotDashArray().size() == 4
-                     && rStroke.getDotDashArray()[1] == rStroke.getDotDashArray()[3])
-            {
-                aHairLinePolyPolygon.append(rBasePolygon);
-                // This will be used by setupStrokeAttributes() in cppcanvas.
-                aLineInfo.SetStyle(LineStyle::Dash);
-                aLineInfo.SetDashCount(1);
-                aLineInfo.SetDashLen(
-                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[0])));
-                aLineInfo.SetDistance(
-                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[1])));
-                aLineInfo.SetDotCount(1);
-                aLineInfo.SetDotLen(
-                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[2])));
-            }
             else
             {
-                // LineInfo can hold only limited info about dashing, apply dashing manually
-                // if LineInfo cannot describe it. That should not happen though.
-                SAL_WARN("drawinglayer", "dotdash array cannot be converted to LineInfo");
-                basegfx::utils::applyLineDashing(rBasePolygon, rStroke.getDotDashArray(),
-                                                 &aHairLinePolyPolygon, nullptr,
-                                                 rStroke.getFullDotDashLen());
+                bool done = false;
+                const std::vector<double>& array = rStroke.getDotDashArray();
+                // The dotdash array should generally have the form
+                // (<dashLen> <distance>)+ (<dotLen> <distance>)*
+                // (where (,),+ and * have their regex meaning).
+                // Find out what the lengths and their counts are.
+                if (!array.empty() && array.size() % 2 == 0)
+                {
+                    double dashLen = array[0];
+                    double distance = array[1];
+                    int dashCount = 1;
+                    double dotLen = 0;
+                    int dotCount = 0;
+                    size_t pos = 2;
+                    while (pos + 2 <= array.size())
+                    {
+                        if (array[pos] != dashLen || array[pos + 1] != distance)
+                            break;
+                        ++dashCount;
+                        pos += 2;
+                    }
+                    if (pos + 2 <= array.size() && array[pos + 1] == distance)
+                    {
+                        dotLen = array[pos];
+                        ++dotCount;
+                        pos += 2;
+                        while (pos + 2 <= array.size())
+                        {
+                            if (array[pos] != dotLen || array[pos + 1] != distance)
+                                break;
+                            ++dotCount;
+                            pos += 2;
+                        }
+                    }
+                    if (array.size() == pos)
+                    {
+                        aHairLinePolyPolygon.append(rBasePolygon);
+                        // This will be used by setupStrokeAttributes() in cppcanvas.
+                        aLineInfo.SetStyle(LineStyle::Dash);
+                        aLineInfo.SetDashCount(dashCount);
+                        aLineInfo.SetDashLen(getTransformedLineWidth(dashLen));
+                        aLineInfo.SetDistance(getTransformedLineWidth(distance));
+                        if (dotCount != 0)
+                        {
+                            aLineInfo.SetDotCount(dotCount);
+                            aLineInfo.SetDotLen(getTransformedLineWidth(dotLen));
+                        }
+                        done = true;
+                    }
+                }
+                if (!done)
+                {
+                    // LineInfo can hold only limited info about dashing, apply dashing manually
+                    // if LineInfo cannot describe it. That should not happen though.
+                    SAL_WARN("drawinglayer", "dotdash array cannot be converted to LineInfo");
+                    basegfx::utils::applyLineDashing(rBasePolygon, rStroke.getDotDashArray(),
+                                                     &aHairLinePolyPolygon, nullptr,
+                                                     rStroke.getFullDotDashLen());
+                }
             }
             aHairLinePolyPolygon.transform(maCurrentTransformation);
 
commit ca29019ed56b970327ae3c5c215b5db52ff30444
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Apr 27 11:44:48 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:10 2021 +0200

    do not apply line dashing in drawinglayer (tdf#136957)
    
    basegfx::utils::applyLineDashing() is not as good as the actual
    VCL backend dashing, and there are some rounding errors because of
    all the canvas transformation matrices or whatever, which leads
    to the drawing problem. So use LineInfo to carry the dashing
    information.
    As a part of this change, also make LineInfo use doubles instead
    of ints. The use of transformation matrices means that the values
    may be fractional and less than one.
    
    Change-Id: Ia5ac7d266cab344b7137052c81fbd96c1ce28003
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114710
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit b71d9a6d15cfb8a50afdea5ac064f40d84c561f8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115038
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index eea91a021e6b..b04d7a997cd3 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -161,13 +161,13 @@ namespace
         // interpret dash info only if explicitly enabled as
         // style
         const ::basegfx::B2DSize aDistance( rLineInfo.GetDistance(), 0 );
-        const double nDistance( (rState.mapModeTransform * aDistance).getX() );
+        const double nDistance( (rState.mapModeTransform * aDistance).getLength() );
 
         const ::basegfx::B2DSize aDashLen( rLineInfo.GetDashLen(), 0 );
-        const double nDashLen( (rState.mapModeTransform * aDashLen).getX() );
+        const double nDashLen( (rState.mapModeTransform * aDashLen).getLength() );
 
         const ::basegfx::B2DSize aDotLen( rLineInfo.GetDotLen(), 0 );
-        const double nDotLen( (rState.mapModeTransform * aDotLen).getX() );
+        const double nDotLen( (rState.mapModeTransform * aDotLen).getLength() );
 
         const sal_Int32 nNumArryEntries( 2*rLineInfo.GetDashCount() +
                                          2*rLineInfo.GetDotCount() );
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 526f00518910..f518663707c4 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1574,31 +1574,60 @@ void VclMetafileProcessor2D::processPolygonStrokePrimitive2D(
         if (basegfx::fTools::more(rLine.getWidth(), 0.0))
         {
             const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute();
-            basegfx::B2DPolyPolygon aHairLinePolyPolygon;
 
+            const basegfx::BColor aHairlineColor(
+                maBColorModifierStack.getModifiedColor(rLine.getColor()));
+            mpOutputDevice->SetLineColor(Color(aHairlineColor));
+            mpOutputDevice->SetFillColor();
+
+            // use the transformed line width
+            LineInfo aLineInfo(LineStyle::Solid,
+                               basegfx::fround(getTransformedLineWidth(rLine.getWidth())));
+            aLineInfo.SetLineJoin(rLine.getLineJoin());
+            aLineInfo.SetLineCap(rLine.getLineCap());
+
+            basegfx::B2DPolyPolygon aHairLinePolyPolygon;
             if (0.0 == rStroke.getFullDotDashLen())
             {
                 aHairLinePolyPolygon.append(rBasePolygon);
             }
+            else if (rStroke.getDotDashArray().size() == 2)
+            {
+                aHairLinePolyPolygon.append(rBasePolygon);
+                // This will be used by setupStrokeAttributes() in cppcanvas.
+                aLineInfo.SetStyle(LineStyle::Dash);
+                aLineInfo.SetDashCount(1);
+                aLineInfo.SetDashLen(
+                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[0])));
+                aLineInfo.SetDistance(
+                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[1])));
+            }
+            else if (rStroke.getDotDashArray().size() == 4
+                     && rStroke.getDotDashArray()[1] == rStroke.getDotDashArray()[3])
+            {
+                aHairLinePolyPolygon.append(rBasePolygon);
+                // This will be used by setupStrokeAttributes() in cppcanvas.
+                aLineInfo.SetStyle(LineStyle::Dash);
+                aLineInfo.SetDashCount(1);
+                aLineInfo.SetDashLen(
+                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[0])));
+                aLineInfo.SetDistance(
+                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[1])));
+                aLineInfo.SetDotCount(1);
+                aLineInfo.SetDotLen(
+                    basegfx::fround(getTransformedLineWidth(rStroke.getDotDashArray()[2])));
+            }
             else
             {
+                // LineInfo can hold only limited info about dashing, apply dashing manually
+                // if LineInfo cannot describe it. That should not happen though.
+                SAL_WARN("drawinglayer", "dotdash array cannot be converted to LineInfo");
                 basegfx::utils::applyLineDashing(rBasePolygon, rStroke.getDotDashArray(),
                                                  &aHairLinePolyPolygon, nullptr,
                                                  rStroke.getFullDotDashLen());
             }
-
-            const basegfx::BColor aHairlineColor(
-                maBColorModifierStack.getModifiedColor(rLine.getColor()));
-            mpOutputDevice->SetLineColor(Color(aHairlineColor));
-            mpOutputDevice->SetFillColor();
             aHairLinePolyPolygon.transform(maCurrentTransformation);
 
-            // use the transformed line width
-            LineInfo aLineInfo(LineStyle::Solid,
-                               basegfx::fround(getTransformedLineWidth(rLine.getWidth())));
-            aLineInfo.SetLineJoin(rLine.getLineJoin());
-            aLineInfo.SetLineCap(rLine.getLineCap());
-
             for (sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
             {
                 const basegfx::B2DPolygon& aCandidate(aHairLinePolyPolygon.getB2DPolygon(a));
diff --git a/filter/source/graphicfilter/idxf/dxfvec.cxx b/filter/source/graphicfilter/idxf/dxfvec.cxx
index fb1ff647d591..58b4d1f6e200 100644
--- a/filter/source/graphicfilter/idxf/dxfvec.cxx
+++ b/filter/source/graphicfilter/idxf/dxfvec.cxx
@@ -207,10 +207,10 @@ LineInfo DXFTransform::Transform(const DXFLineInfo& aDXFLineInfo) const
     aLineInfo.SetStyle( aDXFLineInfo.eStyle );
     aLineInfo.SetWidth( 0 );
     aLineInfo.SetDashCount( static_cast< sal_uInt16 >( aDXFLineInfo.nDashCount ) );
-    aLineInfo.SetDashLen( static_cast<sal_Int32>(aDXFLineInfo.fDashLen * scale + 0.5) );
+    aLineInfo.SetDashLen( aDXFLineInfo.fDashLen * scale );
     aLineInfo.SetDotCount( static_cast< sal_uInt16 >( aDXFLineInfo.nDotCount ) );
-    aLineInfo.SetDotLen( static_cast<sal_Int32>(aDXFLineInfo.fDotLen * scale + 0.5) );
-    aLineInfo.SetDistance( static_cast<sal_Int32>(aDXFLineInfo.fDistance * scale + 0.5) );
+    aLineInfo.SetDotLen( aDXFLineInfo.fDotLen * scale );
+    aLineInfo.SetDistance( aDXFLineInfo.fDistance * scale );
 
     if ( aLineInfo.GetDashCount() > 0 && aLineInfo.GetDashLen() == 0 )
         aLineInfo.SetDashLen(1);
diff --git a/include/svx/xdash.hxx b/include/svx/xdash.hxx
index e1fca6b67f14..e789830e2736 100644
--- a/include/svx/xdash.hxx
+++ b/include/svx/xdash.hxx
@@ -31,32 +31,32 @@
 class SVXCORE_DLLPUBLIC XDash final
 {
     css::drawing::DashStyle  eDash;
-    sal_uInt32               nDotLen;
     sal_uInt16               nDots;
     sal_uInt16               nDashes;
-    sal_uInt32               nDashLen;
-    sal_uInt32               nDistance;
+    double                   nDotLen;
+    double                   nDashLen;
+    double                   nDistance;
 
 public:
           XDash(css::drawing::DashStyle eDash = css::drawing::DashStyle_RECT,
-                sal_uInt16 nDots = 1, sal_uInt32 nDotLen = 20,
-                sal_uInt16 nDashes = 1, sal_uInt32 nDashLen = 20, sal_uInt32 nDistance = 20);
+                sal_uInt16 nDots = 1, double nDotLen = 20,
+                sal_uInt16 nDashes = 1, double nDashLen = 20, double nDistance = 20);
 
     bool operator==(const XDash& rDash) const;
 
     void SetDashStyle(css::drawing::DashStyle eNewStyle) { eDash = eNewStyle; }
     void SetDots(sal_uInt16 nNewDots)                    { nDots = nNewDots; }
-    void SetDotLen(sal_uInt32 nNewDotLen)                { nDotLen = nNewDotLen; }
+    void SetDotLen(double nNewDotLen)                    { nDotLen = nNewDotLen; }
     void SetDashes(sal_uInt16 nNewDashes)                { nDashes = nNewDashes; }
-    void SetDashLen(sal_uInt32 nNewDashLen)              { nDashLen = nNewDashLen; }
-    void SetDistance(sal_uInt32 nNewDistance)            { nDistance = nNewDistance; }
+    void SetDashLen(double nNewDashLen)                  { nDashLen = nNewDashLen; }
+    void SetDistance(double nNewDistance)                { nDistance = nNewDistance; }
 
     css::drawing::DashStyle  GetDashStyle() const        { return eDash; }
     sal_uInt16               GetDots() const             { return nDots; }
-    sal_uInt32               GetDotLen() const           { return nDotLen; }
+    double                   GetDotLen() const           { return nDotLen; }
     sal_uInt16               GetDashes() const           { return nDashes; }
-    sal_uInt32               GetDashLen() const          { return nDashLen; }
-    sal_uInt32               GetDistance() const         { return nDistance; }
+    double                   GetDashLen() const          { return nDashLen; }
+    double                   GetDistance() const         { return nDistance; }
 
     // XDash is translated into an array of doubles which describe the lengths of the
     // dashes, dots and empty passages. It returns the complete length of the full DashDot
diff --git a/include/vcl/lineinfo.hxx b/include/vcl/lineinfo.hxx
index 09cc074075a2..73ed0d3a5771 100644
--- a/include/vcl/lineinfo.hxx
+++ b/include/vcl/lineinfo.hxx
@@ -32,10 +32,10 @@ namespace basegfx { class B2DPolyPolygon; }
 
 struct ImplLineInfo
 {
-    sal_Int32               mnWidth;
-    sal_Int32               mnDashLen;
-    sal_Int32               mnDotLen;
-    sal_Int32               mnDistance;
+    double                  mnWidth;
+    double                  mnDashLen;
+    double                  mnDotLen;
+    double                  mnDistance;
 
     basegfx::B2DLineJoin    meLineJoin;
     css::drawing::LineCap   meLineCap;
@@ -53,7 +53,7 @@ struct ImplLineInfo
 class VCL_DLLPUBLIC LineInfo
 {
 public:
-                    LineInfo( LineStyle eLineStyle = LineStyle::Solid, sal_Int32 nWidth = 0 );
+                    LineInfo( LineStyle eLineStyle = LineStyle::Solid, double nWidth = 0 );
                     LineInfo( const LineInfo& rLineInfo );
                     LineInfo( LineInfo&& rLineInfo );
                     ~LineInfo();
@@ -66,23 +66,23 @@ public:
     void            SetStyle( LineStyle eStyle );
     LineStyle       GetStyle() const { return mpImplLineInfo->meStyle; }
 
-    void            SetWidth( sal_Int32 nWidth );
-    sal_Int32       GetWidth() const { return mpImplLineInfo->mnWidth; }
+    void            SetWidth( double nWidth );
+    double          GetWidth() const { return mpImplLineInfo->mnWidth; }
 
     void            SetDashCount( sal_uInt16 nDashCount );
     sal_uInt16      GetDashCount() const { return mpImplLineInfo->mnDashCount; }
 
-    void            SetDashLen( sal_Int32 nDashLen );
-    sal_Int32       GetDashLen() const { return mpImplLineInfo->mnDashLen; }
+    void            SetDashLen( double nDashLen );
+    double          GetDashLen() const { return mpImplLineInfo->mnDashLen; }
 
     void            SetDotCount( sal_uInt16 nDotCount );
     sal_uInt16      GetDotCount() const { return mpImplLineInfo->mnDotCount; }
 
-    void            SetDotLen( sal_Int32 nDotLen );
-    sal_Int32       GetDotLen() const { return mpImplLineInfo->mnDotLen; }
+    void            SetDotLen( double nDotLen );
+    double          GetDotLen() const { return mpImplLineInfo->mnDotLen; }
 
-    void            SetDistance( sal_Int32 nDistance );
-    sal_Int32       GetDistance() const { return mpImplLineInfo->mnDistance; }
+    void            SetDistance( double nDistance );
+    double          GetDistance() const { return mpImplLineInfo->mnDistance; }
 
     void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
     basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 0b4778eebbd8..14033035ce56 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -2781,10 +2781,10 @@ void SdOOXMLExportTest2::testTdf126741()
 
     CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_DASH, rStyleItem.GetValue());
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), rDashItem.GetDashValue().GetDots());
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(800), rDashItem.GetDashValue().GetDotLen());
+    CPPUNIT_ASSERT_EQUAL(800.0, rDashItem.GetDashValue().GetDotLen());
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), rDashItem.GetDashValue().GetDashes());
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(100), rDashItem.GetDashValue().GetDashLen());
-    CPPUNIT_ASSERT_EQUAL(sal_uInt32(300), rDashItem.GetDashValue().GetDistance());
+    CPPUNIT_ASSERT_EQUAL(100.0, rDashItem.GetDashValue().GetDashLen());
+    CPPUNIT_ASSERT_EQUAL(300.0, rDashItem.GetDashValue().GetDistance());
 
     xDocShRef->DoClose();
 }
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index fbd23a24eda0..fe1a7412adf2 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -28,6 +28,7 @@
 #include <svx/xfillit0.hxx>
 #include <svx/xflclit.hxx>
 #include <svx/xflgrit.hxx>
+#include <svx/xlndsit.hxx>
 #include <svl/stritem.hxx>
 #include <undo/undomanager.hxx>
 #include <vcl/scheduler.hxx>
@@ -357,27 +358,12 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf134053)
     SdrObject* pShape = pActualPage->GetObj(0);
     CPPUNIT_ASSERT_MESSAGE("No Shape", pShape);
 
-    // Break line into single dash and dot objects
-    SdrView* pView = pViewShell->GetView();
-    pView->MarkObj(pShape, pView->GetSdrPageView());
-    dispatchCommand(mxComponent, ".uno:ConvertIntoMetafile", {});
-    dispatchCommand(mxComponent, ".uno:Break", {});
-
-    // Measure the rendered length of dash, dot and distance
-    SdrObject* pDash = pActualPage->GetObj(0);
-    const tools::Rectangle& rBoundDashRect = pDash->GetCurrentBoundRect();
-    const double fDashLength(rBoundDashRect.GetWidth());
-    SdrObject* pDot = pActualPage->GetObj(1);
-    const tools::Rectangle& rBoundDotRect = pDot->GetCurrentBoundRect();
-    const double fDotLength(rBoundDotRect.GetWidth());
-    const double fDistance(rBoundDotRect.Left() - rBoundDashRect.Right());
+    XDash dash = pShape->GetMergedItem(XATTR_LINEDASH).GetDashValue();
 
     // Because 0% is not possible as dash length (as of June 2020) 1% is used in the fix.
-    // For that a larger delta is here allowed to the ideal value than needed for
-    // rounding errors.
-    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Distance", 2117, fDistance, 12);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Dot length", 706, fDotLength, 12);
-    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Dash length", 2822, fDashLength, 12);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Distance", 399.0, dash.GetDistance());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Dot length", 301.0, dash.GetDotLen());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Dash length", 1.0, dash.GetDashLen());
 }
 
 CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSpellOnlineParameter)
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 4929430bb17a..38040f72e460 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -416,12 +416,12 @@ sal_uInt16 XLineStyleItem::GetValueCount() const
     return 3;
 }
 
-XDash::XDash(css::drawing::DashStyle eTheDash, sal_uInt16 nTheDots, sal_uInt32 nTheDotLen,
-             sal_uInt16 nTheDashes, sal_uInt32 nTheDashLen, sal_uInt32 nTheDistance) :
+XDash::XDash(css::drawing::DashStyle eTheDash, sal_uInt16 nTheDots, double nTheDotLen,
+             sal_uInt16 nTheDashes, double nTheDashLen, double nTheDistance) :
     eDash(eTheDash),
-    nDotLen(nTheDotLen),
     nDots(nTheDots),
     nDashes(nTheDashes),
+    nDotLen(nTheDotLen),
     nDashLen(nTheDashLen),
     nDistance(nTheDistance)
 {
@@ -449,9 +449,9 @@ double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double
     rDotDashArray.resize( nNumDotDashArray, 0.0 );
     sal_uInt16 a;
     sal_uInt16 nIns(0);
-    double fDashDotDistance = static_cast<double>(GetDistance());
-    double fSingleDashLen = static_cast<double>(GetDashLen());
-    double fSingleDotLen = static_cast<double>(GetDotLen());
+    double fDashDotDistance = GetDistance();
+    double fSingleDashLen = GetDashLen();
+    double fSingleDotLen = GetDotLen();
 
     if (fLineWidth == 0.0)
         fLineWidth = SMALLEST_DASH_WIDTH;
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index 9490a0383133..b6619406737b 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -53,7 +53,7 @@ inline bool ImplLineInfo::operator==( const ImplLineInfo& rB ) const
 }
 
 
-LineInfo::LineInfo( LineStyle eStyle, sal_Int32 nWidth ) : mpImplLineInfo()
+LineInfo::LineInfo( LineStyle eStyle, double nWidth ) : mpImplLineInfo()
 {
     mpImplLineInfo->meStyle = eStyle;
     mpImplLineInfo->mnWidth = nWidth;
@@ -79,7 +79,7 @@ void LineInfo::SetStyle( LineStyle eStyle )
     mpImplLineInfo->meStyle = eStyle;
 }
 
-void LineInfo::SetWidth( sal_Int32 nWidth )
+void LineInfo::SetWidth( double nWidth )
 {
     mpImplLineInfo->mnWidth = nWidth;
 }
@@ -89,7 +89,7 @@ void LineInfo::SetDashCount( sal_uInt16 nDashCount )
     mpImplLineInfo->mnDashCount = nDashCount;
 }
 
-void LineInfo::SetDashLen( sal_Int32 nDashLen )
+void LineInfo::SetDashLen( double nDashLen )
 {
     mpImplLineInfo->mnDashLen = nDashLen;
 }
@@ -99,31 +99,24 @@ void LineInfo::SetDotCount( sal_uInt16 nDotCount )
     mpImplLineInfo->mnDotCount = nDotCount;
 }
 
-void LineInfo::SetDotLen( sal_Int32 nDotLen )
+void LineInfo::SetDotLen( double nDotLen )
 {
     mpImplLineInfo->mnDotLen = nDotLen;
 }
 
-void LineInfo::SetDistance( sal_Int32 nDistance )
+void LineInfo::SetDistance( double nDistance )
 {
     mpImplLineInfo->mnDistance = nDistance;
 }
 
 void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin)
 {
-
-    if(eLineJoin != mpImplLineInfo->meLineJoin)
-    {
-        mpImplLineInfo->meLineJoin = eLineJoin;
-    }
+    mpImplLineInfo->meLineJoin = eLineJoin;
 }
 
 void LineInfo::SetLineCap(css::drawing::LineCap eLineCap)
 {
-    if(eLineCap != mpImplLineInfo->meLineCap)
-    {
-        mpImplLineInfo->meLineCap = eLineCap;
-    }
+    mpImplLineInfo->meLineCap = eLineCap;
 }
 
 bool LineInfo::IsDefault() const
@@ -139,7 +132,8 @@ SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo )
     sal_uInt16          nTmp16(0);
     sal_Int32       nTmp32(0);
 
-    rIStm.ReadUInt16( nTmp16 ); rLineInfo.mpImplLineInfo->meStyle = static_cast<LineStyle>(nTmp16);
+    rIStm.ReadUInt16( nTmp16 );
+    rLineInfo.mpImplLineInfo->meStyle = static_cast<LineStyle>(nTmp16);
     rIStm.ReadInt32( nTmp32 );
     rLineInfo.mpImplLineInfo->mnWidth = nTmp32;
 
@@ -157,13 +151,24 @@ SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo )
     if( aCompat.GetVersion() >= 3 )
     {
         // version 3
-        rIStm.ReadUInt16( nTmp16 ); rLineInfo.mpImplLineInfo->meLineJoin = static_cast<basegfx::B2DLineJoin>(nTmp16);
+        rIStm.ReadUInt16( nTmp16 );
+        rLineInfo.mpImplLineInfo->meLineJoin = static_cast<basegfx::B2DLineJoin>(nTmp16);
     }
 
     if( aCompat.GetVersion() >= 4 )
     {
         // version 4
-        rIStm.ReadUInt16( nTmp16 ); rLineInfo.mpImplLineInfo->meLineCap = static_cast<css::drawing::LineCap>(nTmp16);
+        rIStm.ReadUInt16( nTmp16 );
+        rLineInfo.mpImplLineInfo->meLineCap = static_cast<css::drawing::LineCap>(nTmp16);
+    }
+
+    if( aCompat.GetVersion() >= 5 )
+    {
+        // version 5
+        rIStm.ReadDouble( rLineInfo.mpImplLineInfo->mnWidth );
+        rIStm.ReadDouble( rLineInfo.mpImplLineInfo->mnDashLen );
+        rIStm.ReadDouble( rLineInfo.mpImplLineInfo->mnDotLen );
+        rIStm.ReadDouble( rLineInfo.mpImplLineInfo->mnDistance );
     }
 
     return rIStm;
@@ -171,18 +176,18 @@ SvStream& ReadLineInfo( SvStream& rIStm, LineInfo& rLineInfo )
 
 SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo )
 {
-    VersionCompat aCompat( rOStm, StreamMode::WRITE, 4 );
+    VersionCompat aCompat( rOStm, StreamMode::WRITE, 5 );
 
     // version 1
     rOStm.WriteUInt16( static_cast<sal_uInt16>(rLineInfo.mpImplLineInfo->meStyle) )
-         .WriteInt32( rLineInfo.mpImplLineInfo->mnWidth );
+         .WriteInt32( basegfx::fround( rLineInfo.mpImplLineInfo->mnWidth ));
 
     // since version2
     rOStm.WriteUInt16( rLineInfo.mpImplLineInfo->mnDashCount )
-         .WriteInt32( rLineInfo.mpImplLineInfo->mnDashLen );
+         .WriteInt32( basegfx::fround( rLineInfo.mpImplLineInfo->mnDashLen ));
     rOStm.WriteUInt16( rLineInfo.mpImplLineInfo->mnDotCount )
-         .WriteInt32( rLineInfo.mpImplLineInfo->mnDotLen );
-    rOStm.WriteInt32( rLineInfo.mpImplLineInfo->mnDistance );
+         .WriteInt32( basegfx::fround( rLineInfo.mpImplLineInfo->mnDotLen ));
+    rOStm.WriteInt32( basegfx::fround( rLineInfo.mpImplLineInfo->mnDistance ));
 
     // since version3
     rOStm.WriteUInt16( static_cast<sal_uInt16>(rLineInfo.mpImplLineInfo->meLineJoin) );
@@ -190,6 +195,12 @@ SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo )
     // since version4
     rOStm.WriteUInt16( static_cast<sal_uInt16>(rLineInfo.mpImplLineInfo->meLineCap) );
 
+    // since version5
+    rOStm.WriteDouble( rLineInfo.mpImplLineInfo->mnWidth );
+    rOStm.WriteDouble( rLineInfo.mpImplLineInfo->mnDashLen );
+    rOStm.WriteDouble( rLineInfo.mpImplLineInfo->mnDotLen );
+    rOStm.WriteDouble( rLineInfo.mpImplLineInfo->mnDistance );
+
     return rOStm;
 }
 
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index a79ebf74ab6f..b9a869a3a940 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -121,7 +121,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly, const LineInfo& rL
     {
         DrawPolyLine(
             rPoly.getB2DPolygon(),
-            static_cast< double >(rLineInfo.GetWidth()),
+            rLineInfo.GetWidth(),
             rLineInfo.GetLineJoin(),
             rLineInfo.GetLineCap(),
             basegfx::deg2rad(15.0) /* default fMiterMinimumAngle, value not available in LineInfo */);
@@ -146,7 +146,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
     {
         LineInfo aLineInfo;
         if( fLineWidth != 0.0 )
-            aLineInfo.SetWidth( static_cast<tools::Long>(fLineWidth+0.5) );
+            aLineInfo.SetWidth( fLineWidth );
 
         const tools::Polygon aToolsPolygon( rB2DPolygon );
         mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, aLineInfo ) );
@@ -233,7 +233,7 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& rB2DPolygon,
         const tools::Polygon aToolsPolygon( rB2DPolygon );
         LineInfo aLineInfo;
         if( fLineWidth != 0.0 )
-            aLineInfo.SetWidth( static_cast<tools::Long>(fLineWidth+0.5) );
+            aLineInfo.SetWidth( fLineWidth );
 
         drawPolyLine( aToolsPolygon, aLineInfo );
     }
@@ -307,7 +307,7 @@ bool OutputDevice::DrawPolyLineDirect(
         {
             LineInfo aLineInfo;
             if( fLineWidth != 0.0 )
-                aLineInfo.SetWidth( static_cast<tools::Long>(fLineWidth+0.5) );
+                aLineInfo.SetWidth( fLineWidth );
             // Transport known information, might be needed
             aLineInfo.SetLineJoin(eLineJoin);
             aLineInfo.SetLineCap(eLineCap);
commit 8abf1dca16a86ee43fd30786926c9e1556841a9e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 29 14:17:40 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:09 2021 +0200

    tdf#141963 put focus in vcl parent during Function key processing
    
    Change-Id: Ib63567c9ce208cb7dd522a1bce9d99fa44a72554
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114884
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index f0c9d9fd3155..8637acd77684 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -94,6 +94,12 @@ sal_uInt16 GtkSalFrame::GetMouseModCode( guint state )
     return nCode;
 }
 
+// KEY_F26 is the last function key known to keycodes.hxx
+static bool IsFunctionKeyVal(guint keyval)
+{
+    return keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26;
+}
+
 sal_uInt16 GtkSalFrame::GetKeyCode(guint keyval)
 {
     sal_uInt16 nCode = 0;
@@ -105,8 +111,7 @@ sal_uInt16 GtkSalFrame::GetKeyCode(guint keyval)
         nCode = KEY_A + (keyval-GDK_KEY_A );
     else if( keyval >= GDK_KEY_a && keyval <= GDK_KEY_z )
         nCode = KEY_A + (keyval-GDK_KEY_a );
-    else if( keyval >= GDK_KEY_F1 && keyval <= GDK_KEY_F26 )
-    // KEY_F26 is the last function key known to keycodes.hxx
+    else if (IsFunctionKeyVal(keyval))
     {
         switch( keyval )
         {
@@ -3259,10 +3264,13 @@ gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointe
             if (bHandled)
                 return true;
 
-            // Is focus inside a full-app InterimItemWindow? In which case find
-            // that InterimItemWindow and send unconsumed keystrokes to it to
-            // support ctrl-q etc shortcuts
-            if (pThis->IsCycleFocusOutDisallowed())
+            // Is focus inside an InterimItemWindow? In which case find that
+            // InterimItemWindow and send unconsumed keystrokes to it to
+            // support ctrl-q etc shortcuts. Only bother to search for the
+            // InterimItemWindow if it is a toplevel that fills its frame, or
+            // the keystroke is sufficiently special its worth passing on,
+            // e.g. F6 to switch between task-panels or F5 to close a navigator
+            if (pThis->IsCycleFocusOutDisallowed() || IsFunctionKeyVal(pEvent->keyval))
             {
                 GtkWidget* pSearch = pFocusWindow;
                 while (pSearch)
commit 15a9ae5575ebbbe57c110ba39b3701c62af612c6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 5 10:51:16 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:09 2021 +0200

    Resolves: tdf#142049 expand widget to use unused extra space
    
    also includes...
    
    Related: tdf#142049 restore some elements default visibility in the ui
    
    these defaulted to not visible before...
    
    commit ec548bce309d965a25e807ae79432114926e06f3
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Mon Oct 15 11:14:02 2018 +0100
    
        weld ChartTypeDialog and SchLayoutTabPage
    
        Change-Id: I101c56b855d0bdc43559ca4561d298fa4ad92572
        Reviewed-on: https://gerrit.libreoffice.org/61797
    
    Change-Id: I7ff6aa4feeccd790b6176cb60b6adb9b21db0f63
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115136
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx
index da48f4ca608a..182d391aac33 100644
--- a/chart2/source/controller/dialogs/res_BarGeometry.cxx
+++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx
@@ -29,7 +29,8 @@ BarGeometryResources::BarGeometryResources(weld::Builder* pBuilder)
 {
     for (size_t i = 0; i < SAL_N_ELEMENTS(CHART_TYPE); ++i)
         m_xLB_Geometry->append_text(SchResId(CHART_TYPE[i]));
-    m_xLB_Geometry->set_size_request(-1, m_xLB_Geometry->get_height_rows(4));
+    m_xLB_Geometry->set_size_request(-1,
+                                     m_xLB_Geometry->get_height_rows(SAL_N_ELEMENTS(CHART_TYPE)));
 }
 
 void BarGeometryResources::connect_changed(const Link<weld::TreeView&, void>& rLink)
diff --git a/chart2/uiconfig/ui/tp_ChartType.ui b/chart2/uiconfig/ui/tp_ChartType.ui
index 503ab73290fd..1a4ad6c4b04f 100644
--- a/chart2/uiconfig/ui/tp_ChartType.ui
+++ b/chart2/uiconfig/ui/tp_ChartType.ui
@@ -75,7 +75,7 @@
                 <property name="row_spacing">6</property>
                 <child>
                   <object class="GtkScrolledWindow" id="subtypewin">
-                    <property name="visible">True</property>
+                    <property name="visible">False</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="hscrollbar_policy">never</property>
@@ -87,7 +87,7 @@
                         <property name="can_focus">True</property>
                         <child>
                           <object class="GtkDrawingArea" id="subtype">
-                            <property name="visible">True</property>
+                            <property name="visible">False</property>
                             <property name="can_focus">True</property>
                             <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
                             <property name="hexpand">True</property>
@@ -111,6 +111,8 @@
                   <object class="GtkGrid" id="3dblock">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
                     <property name="row_spacing">3</property>
                     <child>
                       <!-- n-columns=1 n-rows=1 -->
@@ -193,6 +195,7 @@
                           <object class="GtkTreeView" id="shape">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
                             <property name="vexpand">True</property>
                             <property name="model">liststore1</property>
                             <property name="headers_visible">False</property>
@@ -469,14 +472,14 @@
             </child>
             <child>
               <object class="GtkScrolledWindow">
-                <property name="visible">True</property>
+                <property name="visible">False</property>
                 <property name="can_focus">False</property>
                 <property name="vexpand">True</property>
                 <property name="hscrollbar_policy">never</property>
                 <property name="shadow_type">in</property>
                 <child>
                   <object class="GtkTreeView" id="charttype">
-                    <property name="visible">True</property>
+                    <property name="visible">False</property>
                     <property name="can_focus">True</property>
                     <property name="vexpand">True</property>
                     <property name="model">liststore2</property>
commit 19a3021c2254522fd5f2a4d6eb6362048b5036b4
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Mon Dec 14 19:45:22 2020 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:09 2021 +0200

    rhbz#1957034 crash in embedded videos
    
    Related tdf#138888: fix assertion on avmedia/MediaControlBase
    
    Assertion when trying to insert a video in Impress, see bt:
    https://bugs.documentfoundation.org/attachment.cgi?id=168161
    
    According to https://en.cppreference.com/w/cpp/algorithm/clamp
    "behavior is undefined if the value of lo is greater than hi"
    
    Regression from:
    commit 36b3b357fe2a882db6a5f5a006239e16200fb847
    Author: Noel <noelgrandin at gmail.com>
    Date:   Thu Nov 12 16:10:56 2020 +0200
    
        replace std::min(std::max()) with std::clamp
    
    Change-Id: Idf33eb6c662b60174678f990f98aefc72edec2a6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107722
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit f4e496af66bc6a779f600158cc42b986d654f143)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115078
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/avmedia/source/framework/MediaControlBase.cxx b/avmedia/source/framework/MediaControlBase.cxx
index 005c409fccb4..0ab60b6ac9f3 100644
--- a/avmedia/source/framework/MediaControlBase.cxx
+++ b/avmedia/source/framework/MediaControlBase.cxx
@@ -64,7 +64,7 @@ void MediaControlBase::UpdateVolumeSlider( MediaItem const & aMediaItem )
     {
         mxVolumeSlider->set_sensitive(true);
         const sal_Int32 nVolumeDB = aMediaItem.getVolumeDB();
-        mxVolumeSlider->set_value( std::clamp( nVolumeDB, sal_Int32(0), AVMEDIA_DB_RANGE ) );
+        mxVolumeSlider->set_value( std::clamp( nVolumeDB, AVMEDIA_DB_RANGE, sal_Int32(0)) );
     }
 }
 
commit dc12911be2234b9bb530e2064f5b913798bdcae1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 21:04:40 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:08 2021 +0200

    rhbz#1956977 crash on switch from active comment to slide sorter
    
    Change-Id: I2b5a5cb8b0631971b775a70d96f2cbf0c118c090
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115076
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Jenkins

diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index f3d3dea3603c..628681977bb5 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -948,10 +948,13 @@ IMPL_LINK_NOARG(AnnotationManagerImpl, UpdateTagsHdl, void*, void)
 
 void AnnotationManagerImpl::CreateTags()
 {
-
     if( !(mxCurrentPage.is() && mpDoc) )
         return;
 
+    auto xViewShell = mrBase.GetMainViewShell();
+    if (!xViewShell)
+        return;
+
     try
     {
         int nIndex = 1;
@@ -964,7 +967,7 @@ void AnnotationManagerImpl::CreateTags()
         {
             Reference< XAnnotation > xAnnotation( xEnum->nextElement() );
             Color aColor( GetColorLight( mpDoc->GetAnnotationAuthorIndex( xAnnotation->getAuthor() ) ) );
-            rtl::Reference< AnnotationTag > xTag( new AnnotationTag( *this, *mrBase.GetMainViewShell()->GetView(), xAnnotation, aColor, nIndex++, maFont ) );
+            rtl::Reference< AnnotationTag > xTag( new AnnotationTag( *this, *xViewShell->GetView(), xAnnotation, aColor, nIndex++, maFont ) );
             maTagVector.push_back(xTag);
 
             if( xAnnotation == mxSelectedAnnotation )
commit cfc3832e81280123931d8fb8785cbed8bc8f797e
Author:     Katarina Behrens <bubli at bubli.org>
AuthorDate: Tue May 4 10:06:26 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:08 2021 +0200

    tdf#139329: Shift widgets down and make hatch&bitmap list visible
    
    regression from commit cbe86ee37018dc4bf04783ecf70fef2863e61ad7
    which inserted additional gradient colour picker but didn't
    adjust the positions of widgets below accordingly so in effect
    there were 2 widgets at position y=4
    
    Sad that neither glade nor our own code detects this condition and
    e.g. asserts or warns this is the case
    
    Change-Id: I4c635eeb8b740765542631a5f0319bfe1a5d94d0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115056
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <bubli at bubli.org>
    (cherry picked from commit c46a231b987b92bd866b415d1a0ba0d3a26a2457)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115074
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
index 11141c29f827..9f5cd9958174 100644
--- a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
+++ b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
@@ -116,7 +116,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">10</property>
+            <property name="top_attach">11</property>
           </packing>
         </child>
         <child>
@@ -127,7 +127,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">8</property>
+            <property name="top_attach">9</property>
           </packing>
         </child>
         <child>
@@ -139,7 +139,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">8</property>
+            <property name="top_attach">9</property>
           </packing>
         </child>
         <child>
@@ -152,7 +152,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">6</property>
+            <property name="top_attach">7</property>
           </packing>
         </child>
         <child>
@@ -197,7 +197,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">4</property>
+            <property name="top_attach">5</property>
           </packing>
         </child>
         <child>
@@ -216,7 +216,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">5</property>
+            <property name="top_attach">6</property>
           </packing>
         </child>
         <child>
@@ -232,7 +232,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">9</property>
+            <property name="top_attach">10</property>
           </packing>
         </child>
         <child>
@@ -294,7 +294,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">11</property>
+            <property name="top_attach">12</property>
           </packing>
         </child>
         <child>
@@ -304,7 +304,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">7</property>
+            <property name="top_attach">8</property>
           </packing>
         </child>
         <child>
@@ -318,7 +318,7 @@
           </object>
           <packing>
             <property name="left_attach">0</property>
-            <property name="top_attach">7</property>
+            <property name="top_attach">8</property>
           </packing>
         </child>
         <child>
@@ -329,7 +329,7 @@
           </object>
           <packing>
             <property name="left_attach">1</property>
-            <property name="top_attach">12</property>
+            <property name="top_attach">13</property>
           </packing>
         </child>
         <child>
commit 0ecbe0f1205b28b94de26252464cc5ae67d219f3
Author:     Attila Bakos (NISZ) <bakos.attilakaroly at nisz.hu>
AuthorDate: Thu Apr 22 13:26:58 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:07 2021 +0200

    tdf#138782 DOCX import: fix frame positions of old docs
    
    by limiting AddFrameOffsets compatibility option
    for docs created by MSO 2010 or older.
    
    Likely regression from commit 355d25eac764713f4d52eac801ade6e2ff1deab0
    (n#779627: added quite some compat options from the ww8
    filter on writerfilter).
    
    This patch fixes several bugs, which were
    collected as duplicates by Gábor Kelemen.
    
    Change-Id: I106e90c4bf00bb0b6a8986615cb3ad9c4828d5b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114476
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 5812fb81013cc124a9b6a0b9912a34cc715fc495)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115077
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf138782.docx b/sw/qa/extras/layout/data/tdf138782.docx
new file mode 100644
index 000000000000..8bad2ae1b8c4
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf138782.docx differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index f0fb593df6a9..9894ceac418c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -2654,6 +2654,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137185)
     // Before the patch it failed, because the text appeared 2 times on each other.
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138782)
+{
+    CPPUNIT_ASSERT(createDoc("tdf138782.docx"));
+    auto pXml = parseLayoutDump();
+    CPPUNIT_ASSERT(pXml);
+
+    // Without the fix it failed because the 3rd shape was outside the page:
+    // - Expected less than: 13327
+    // - Actual  : 14469
+
+    CPPUNIT_ASSERT_LESS(
+        getXPath(pXml, "/root/page/infos/bounds", "right").toInt32(),
+        getXPath(pXml, "/root/page/body/txt[8]/anchored/SwAnchoredDrawObject/bounds", "right")
+            .toInt32());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135035)
 {
     createDoc("tdf135035.docx");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ea3657d94dc2..5e4cbdf5cc3f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -249,6 +249,11 @@ DomainMapper::~DomainMapper()
             aGrabBag.update(aProperties);
             xDocProps->setPropertyValue("InteropGrabBag", uno::Any(aGrabBag.getAsConstPropertyValueList()));
         }
+
+        // tdf#138782: for docs created in MS Word 2010 and older (compatibilityMode <= 14)
+        m_pImpl->SetDocumentSettingsProperty(
+            "AddFrameOffsets",
+            uno::Any(14 >= m_pImpl->GetSettingsTable()->GetWordCompatibilityMode()));
     }
     catch( const uno::Exception& ) {}
 
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 0f0fcdb63391..d866981dd438 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -304,7 +304,6 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo
     uno::Reference<beans::XPropertySet> xSettings(
         xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
 
-    xSettings->setPropertyValue("AddFrameOffsets", uno::makeAny(true));
     xSettings->setPropertyValue("AddVerticalFrameOffsets", uno::makeAny(true));
     xSettings->setPropertyValue("UseOldNumbering", uno::makeAny(false));
     xSettings->setPropertyValue("IgnoreFirstLineIndentInNumbering", uno::makeAny(false));
commit 26ff8af4466914f4c5fbea3d48984ed540e532fe
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 10:08:08 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:07 2021 +0200

    tdf#142017 set default focus widget
    
    Change-Id: I5befe345d9c6ec499efdc1cf8305513ee8a53690
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114931
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 4ab0c2d2523c..eae174748abd 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -124,6 +124,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(weld::Container* pPage, weld::D
         m_xName->set_can_focus(true);
         m_xName->set_editable(true);
         m_xName->set_sensitive(true);
+        m_xName->grab_focus(); // tdf#142017 default to focus within the page, not in notebook tab
     }
     else
     {
commit ecf1daba53ea6283332ebc471dd24a98d88485c0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 12:05:28 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:06 2021 +0200

    Resolves: tdf#141857 update background to current theme
    
    Change-Id: I1004bd9944f382ca66e48575b81170cf3314845f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115073
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 01d8923978c8..1a2834bffe0d 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -103,7 +103,13 @@ public:
 
     virtual void StyleUpdated() override
     {
-        const bool bIsDark = Application::GetSettings().GetStyleSettings().GetDialogColor().IsDark();
+        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
+        // tdf#141857 update background to current theme
+        OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
+        rDevice.SetBackground(Wallpaper(rStyleSettings.GetWindowColor()));
+
+        const bool bIsDark = rStyleSettings.GetDialogColor().IsDark();
         if (bIsDark != mbIsDark)
             LoadImageForWidth(GetOutputSizePixel().Width());
         weld::CustomWidgetController::StyleUpdated();
commit 03479165377d3b5e226122bbcb28f56357c6efc1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 11:44:49 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:06 2021 +0200

    Related: tdf#141857 send style-updated after app settings are updated
    
    so the libreoffice settings are updated before the widget updates,
    otherwise the app settings are the old settings when the widget updates
    
    Change-Id: Id32dd55a1e5102cc707d6ee74eddfae2247e105a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115072
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8f80dd122a62..6cc773e0aca2 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -13612,7 +13612,6 @@ private:
     std::unique_ptr<IMHandler> m_xIMHandler;
     cairo_surface_t* m_pSurface;
     gulong m_nDrawSignalId;
-    gulong m_nStyleUpdatedSignalId;
     gulong m_nQueryTooltip;
     gulong m_nPopupMenu;
     gulong m_nScrollEvent;
@@ -13657,12 +13656,6 @@ private:
         m_pSurface = get_underlying_cairo_surface(*m_xDevice);
         GtkInstanceWidget::signal_size_allocate(nWidth, nHeight);
     }
-    static void signalStyleUpdated(GtkWidget*, gpointer widget)
-    {
-        GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
-        SolarMutexGuard aGuard;
-        return pThis->signal_style_updated();
-    }
     void signal_style_updated()
     {
         m_aStyleUpdatedHdl.Call(*this);
@@ -13723,6 +13716,7 @@ private:
         GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
         return pThis->signal_scroll(pEvent);
     }
+    DECL_LINK(SettingsChangedHdl, VclSimpleEvent&, void);
 public:
     GtkInstanceDrawingArea(GtkDrawingArea* pDrawingArea, GtkInstanceBuilder* pBuilder, const a11yref& rA11y, bool bTakeOwnership)
         : GtkInstanceWidget(GTK_WIDGET(pDrawingArea), pBuilder, bTakeOwnership)
@@ -13732,7 +13726,6 @@ public:
         , m_xDevice(DeviceFormat::DEFAULT)
         , m_pSurface(nullptr)
         , m_nDrawSignalId(g_signal_connect(m_pDrawingArea, "draw", G_CALLBACK(signalDraw), this))
-        , m_nStyleUpdatedSignalId(g_signal_connect(m_pDrawingArea,"style-updated", G_CALLBACK(signalStyleUpdated), this))
         , m_nQueryTooltip(g_signal_connect(m_pDrawingArea, "query-tooltip", G_CALLBACK(signalQueryTooltip), this))
         , m_nPopupMenu(g_signal_connect(m_pDrawingArea, "popup-menu", G_CALLBACK(signalPopupMenu), this))
         , m_nScrollEvent(g_signal_connect(m_pDrawingArea, "scroll-event", G_CALLBACK(signalScroll), this))
@@ -13740,6 +13733,8 @@ public:
         gtk_widget_set_has_tooltip(m_pWidget, true);
         g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this);
         m_xDevice->EnableRTL(get_direction());
+
+        Application::AddEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl));
     }
 
     AtkObject* GetAtkObject(AtkObject* pDefaultAccessible)
@@ -13877,6 +13872,8 @@ public:
 
     virtual ~GtkInstanceDrawingArea() override
     {
+        Application::RemoveEventListener(LINK(this, GtkInstanceDrawingArea, SettingsChangedHdl));
+
         g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
         if (m_pAccessible)
             g_object_unref(m_pAccessible);
@@ -13886,7 +13883,6 @@ public:
         g_signal_handler_disconnect(m_pDrawingArea, m_nScrollEvent);
         g_signal_handler_disconnect(m_pDrawingArea, m_nPopupMenu);
         g_signal_handler_disconnect(m_pDrawingArea, m_nQueryTooltip);
-        g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId);
         g_signal_handler_disconnect(m_pDrawingArea, m_nDrawSignalId);
     }
 
@@ -13908,6 +13904,16 @@ public:
     }
 };
 
+IMPL_LINK(GtkInstanceDrawingArea, SettingsChangedHdl, VclSimpleEvent&, rEvent, void)
+{
+    if (rEvent.GetId() != VclEventId::ApplicationDataChanged)
+        return;
+
+    DataChangedEvent* pData = static_cast<DataChangedEvent*>(static_cast<VclWindowEvent&>(rEvent).GetData());
+    if (pData->GetType() == DataChangedEventType::SETTINGS)
+        signal_style_updated();
+}
+
 class IMHandler
 {
 private:
commit 262b1612180f2420e7a461df0eca1c6cb6a7ce43
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 4 09:15:25 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:05 2021 +0200

    tdf#141930 document set as unmodified if editengine didn't modify on keyevent
    
    this appears to have always happened for cursor keys, and since
    
    commit 0154f04e8c64df937b793c73ac58d553637f324f
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Wed Feb 24 14:32:21 2021 +0000
    
        Resolves: rhbz#1931423 start update timer in IM events as well as keyevents
    
    also happens on Input Engine events which don't cause changes
    
    Change-Id: Ic5cdd9ef4f1bed1cc2b2c17fc847f196a9c6e23a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114930
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 99ce7c008622..152c269b1cc4 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -513,8 +513,8 @@ void SmEditWindow::UserPossiblyChangedText()
     // cursor travelling and such things...
     SmDocShell *pDocShell = GetDoc();
     EditEngine *pEditEngine = GetEditEngine();
-    if (pDocShell && pEditEngine)
-        pDocShell->SetModified(pEditEngine->IsModified());
+    if (pDocShell && pEditEngine && pEditEngine->IsModified())
+        pDocShell->SetModified(true);
     aModifyIdle.Start();
 }
 
commit 75cb50e5675d46a104ccd932642404e1badc1ad6
Author:     Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
AuthorDate: Sat May 1 10:40:58 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:05 2021 +0200

    avoid windres preprocessor quoting-messups with current cygwin
    
    apparently fresh installs of cygwin behave differently with the windres
    command's quoting and treats --preprocessor='cpp foo bar' as a single file
    "cpp foo bar" to run instead of running "cpp" with the arguments "foo"
    and "bar".
    (-D and -I options are passed to the preprocessor automatically, so no
    need to prefix those with --preprocessor-arg)
    
    Change-Id: I711e968206f0769ff07152ebb9572e8b71c30cec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114965
    Tested-by: Jenkins
    Reviewed-by: Georgy Litvinov <git at litvinovg.pro>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 07f1ec0af02a9ab6c1bf6e6478092ee50495afa7)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114971
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 892faf76931b..de856cf79cc6 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -367,6 +367,6 @@ gb_WIN_GPG_WINDRES_target := $(if $(filter INTEL,$(CPUNAME)),pe-i386,pe-x86-64)
 gb_WIN_GPG_platform_switches := --build=$(BUILD_PLATFORM) --host=$(subst cygwin,mingw32,$(HOST_PLATFORM))
 gb_WIN_GPG_cross_setup_exports = export REAL_BUILD_CC="$(filter-out -%,$(CC_FOR_BUILD))" REAL_BUILD_CC_FLAGS="$(filter -%,$(CC_FOR_BUILD))" \
     && export CC_FOR_BUILD="$(call gb_Executable_get_target_for_build,gcc-wrapper) $(if $(verbose),--wrapper-print-cmdline) --wrapper-env-prefix=REAL_BUILD_ $(SOLARINC) -L$(subst ;, -L,$(ILIB_FOR_BUILD))" \
-    && export RC='windres -O COFF --target=$(gb_WIN_GPG_WINDRES_target) --preprocessor='\''$(call gb_Executable_get_target_for_build,cpp) -+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'\'
+    && export RC='windres -O COFF --target=$(gb_WIN_GPG_WINDRES_target) --preprocessor=$(call gb_Executable_get_target_for_build,cpp) --preprocessor-arg=-+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'
 
 # vim: set noet sw=4:
commit a17f58aacc0dc1865fadc04279ad3e0abcbf353a
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Sat May 1 23:43:58 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:05 2021 +0200

    tdf#90278 - Set the vba border to the default border
    
    The default border width in calc is 0.75[pt] * 1/72[inch] * 2.54[cm/inch]
    = 0.0264[cm] set in 2f527738ea4f8e93acafdd7f0ae06de1678cfdd8 which
    contradicts the border setting of OOLineThin used in order to parse vba
    borders. The latter was set to 1.00[pt] * 1/72[inch] * 2.54[cm/inch] =
    0.0352[cm]. This mismatch leads to an exception when the corresponding
    weight of a cell is parsed.
    
    Change-Id: I945d8aecdf31e5ad76d0d04e76eaaf4668e3d8ea
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114980
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heinisch at yahoo.de>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115035

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index fce7684e53a4..9322a3eab7cd 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -13,6 +13,7 @@
 #include <sal/log.hxx>
 #include <unotools/tempfile.hxx>
 #include <vcl/svapp.hxx>
+#include <editeng/borderline.hxx>
 
 #include <docsh.hxx>
 #include <document.hxx>
@@ -53,6 +54,7 @@ public:
     void testTdf71271();
     void testTdf43003();
     void testTdf138646();
+    void testTdf90278();
 
     CPPUNIT_TEST_SUITE(ScMacrosTest);
     CPPUNIT_TEST(testStarBasic);
@@ -72,6 +74,7 @@ public:
     CPPUNIT_TEST(testTdf71271);
     CPPUNIT_TEST(testTdf43003);
     CPPUNIT_TEST(testTdf138646);
+    CPPUNIT_TEST(testTdf90278);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -912,6 +915,39 @@ void ScMacrosTest::testTdf138646()
     pDocSh->DoClose();
 }
 
+void ScMacrosTest::testTdf90278()
+{
+    OUString aFileName;
+    createFileURL(u"tdf90278.xls", aFileName);
+    auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
+    CPPUNIT_ASSERT(xComponent);
+
+    SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent);
+    CPPUNIT_ASSERT(pFoundShell);
+
+    ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell);
+    CPPUNIT_ASSERT(xDocSh);
+
+    Any aRet;
+    Sequence<sal_Int16> aOutParamIndex;
+    Sequence<Any> aOutParam;
+    Sequence<uno::Any> aParams;
+
+    // Without the fix in place, changing the border weight
+    // would cause a Basic exception/error in the following script.
+    SfxObjectShell::CallXScript(
+        xComponent,
+        "vnd.sun.Star.script:VBAProject.Module1.BorderWeight?language=Basic&location=document",
+        aParams, aRet, aOutParamIndex, aOutParam);
+
+    // Check the border weight of the corresponding cell in the test document
+    sal_Int32 aReturnValue;
+    aRet >>= aReturnValue;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aReturnValue);
+
+    xDocSh->DoClose();
+}
+
 ScMacrosTest::ScMacrosTest()
       : UnoApiTest("/sc/qa/extras/testdocuments")
 {
diff --git a/sc/qa/extras/testdocuments/tdf90278.xls b/sc/qa/extras/testdocuments/tdf90278.xls
new file mode 100644
index 000000000000..2d794555666d
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf90278.xls differ
diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx
index 97034dec7a0b..7db67fa3eefb 100644
--- a/sc/source/ui/vba/vbaborders.cxx
+++ b/sc/source/ui/vba/vbaborders.cxx
@@ -45,7 +45,7 @@ const sal_Int16 supportedIndexTable[] = {  XlBordersIndex::xlEdgeLeft, XlBorders
 const char sTableBorder[] = "TableBorder";
 
 //  Equiv widths in 1/100 mm
-const sal_Int32 OOLineThin = 35;
+const sal_Int32 OOLineThin = 26;
 const sal_Int32 OOLineMedium = 88;
 const sal_Int32 OOLineThick = 141;
 const sal_Int32 OOLineHairline = 2;
commit db11e9f63563071daf555da227c9de961093ff2e
Author:     Luke Deller <luke at deller.id.au>
AuthorDate: Fri Apr 9 09:08:37 2021 +1000
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu May 6 16:40:04 2021 +0200

    tdf#141556 Fix 100% CPU usage in Writer idle loop
    
    Do not interrupt the idle layout processing unnecessarily, because if it
    is continually interrupted before making enough progress then it will
    keep resuming at the same page, never finishing, constantly using CPU.
    
    This is achieved with two changes:
    
     - Revert "tdf#123583 use TaskStopwatch for Writer Idle loop"
       (commit 383032c50a3e3354f04200ce984a47ab9d2c5c67) which
       introduced a stopwatch timer to interrupt idle processing every 50ms.
       This reversion restores the previous behaviour where idle processing
       is interrupted only when there is an input event.
    
     - Filter out TIMER events so that they do not interrupt the idle loop;
       this fixes both tdf#123583 and tdf#141556
    
    Conflicts:
            sw/source/core/inc/layact.hxx
            sw/source/core/layout/layact.cxx
    
    Change-Id: Ic989631e5f32199209d64b66b72059253fc0167a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113825
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 0fedac18214a6025401c4c426466a5166553e8ec)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114944

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index 433d4b70e59a..71484e00da5f 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -22,7 +22,6 @@
 #include <sal/config.h>
 
 #include <vcl/inputtypes.hxx>
-#include <vcl/TaskStopwatch.hxx>
 #include <tools/color.hxx>
 
 #include <ctime>
@@ -57,7 +56,6 @@ class SwLayAction
 {
     SwRootFrame  *m_pRoot;
     SwViewShellImp  *m_pImp; // here the action logs in and off
-    TaskStopwatch* m_pWatch;
 
     // For the sake of optimization, so that the tables stick a bit better to
     // the Cursor when hitting return/backspace in front of one.
@@ -76,6 +74,7 @@ class SwLayAction
     std::clock_t m_nStartTicks;      // The Action's starting time; if too much time passes the
                                 // WaitCursor can be enabled via CheckWaitCursor()
 
+    VclInputFlags m_nInputType;   // Which input should terminate processing
     sal_uInt16 m_nEndPage;        // StatBar control
     sal_uInt16 m_nCheckPageNum;   // CheckPageDesc() was delayed if != USHRT_MAX
                                 // check from this page onwards
@@ -85,8 +84,9 @@ class SwLayAction
     bool m_bCalcLayout;    // Complete reformatting?
     bool m_bAgain;         // For the automatically repeated Action if Pages are deleted
     bool m_bNextCycle;     // Reset on the first invalid Page
+    bool m_bInput;         // For terminating processing on input
+    bool m_bIdle;          // True if the LayAction was triggered by the Idler
     bool m_bReschedule;    // Call Reschedule depending on Progress?
-    bool m_bInterrupt;     // For termination the layouting
     bool m_bCheckPages;    // Run CheckPageDescs() or delay it
     bool m_bUpdateExpFields; // Is set if, after Formatting, we need to do another round for ExpField
     bool m_bBrowseActionStop; // Terminate Action early (as per bInput) and leave the rest to the Idler
@@ -124,26 +124,33 @@ class SwLayAction
 
     bool RemoveEmptyBrowserPages();
 
+    inline void CheckIdleEnd();
+
 public:
-    SwLayAction(SwRootFrame *pRt, SwViewShellImp *pImp, TaskStopwatch* pWatch = nullptr);
+    SwLayAction( SwRootFrame *pRt, SwViewShellImp *pImp );
     ~SwLayAction();
 
+    void SetIdle            ( bool bNew )   { m_bIdle = bNew; }
     void SetCheckPages      ( bool bNew )   { m_bCheckPages = bNew; }
     void SetBrowseActionStop( bool bNew )   { m_bBrowseActionStop = bNew; }
     void SetNextCycle       ( bool bNew )   { m_bNextCycle = bNew; }
 
     bool IsWaitAllowed()        const       { return m_bWaitAllowed; }
     bool IsNextCycle()          const       { return m_bNextCycle; }
+    bool IsInput()              const       { return m_bInput; }
     bool IsPaint()              const       { return m_bPaint; }
+    bool IsIdle()               const       { return m_bIdle;  }
     bool IsReschedule()         const       { return m_bReschedule;  }
-    bool IsIdle()               const       { return m_pWatch != nullptr; }
-    bool IsPaintExtraData()     const       { return m_bPaintExtraData; }
-    bool IsInterrupt();
+    bool IsPaintExtraData()     const       { return m_bPaintExtraData;}
+    bool IsInterrupt()          const       { return IsInput(); }
+
+    VclInputFlags GetInputType()    const { return m_nInputType; }
 
     // adjusting Action to the wanted behaviour
     void SetPaint       ( bool bNew )   { m_bPaint = bNew; }
     void SetComplete    ( bool bNew )   { m_bComplete = bNew; }
     void SetStatBar     ( bool bNew );
+    void SetInputType   ( VclInputFlags nNew ) { m_nInputType = nNew; }
     void SetCalcLayout  ( bool bNew )   { m_bCalcLayout = bNew; }
     void SetReschedule  ( bool bNew )   { m_bReschedule = bNew; }
     void SetWaitAllowed ( bool bNew )   { m_bWaitAllowed = bNew; }
@@ -180,7 +187,6 @@ public:
 
 class SwLayIdle
 {
-    TaskStopwatch m_aWatch;
     SwRootFrame *m_pRoot;
     SwViewShellImp  *m_pImp;           // The Idler registers and deregisters here
     SwContentNode *m_pContentNode;    // The current cursor position is saved here
@@ -192,7 +198,6 @@ class SwLayIdle
     void ShowIdle( Color eName );
 #endif
 
-    bool IsInterrupt();
     enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, SMART_TAGS };
     bool DoIdleJob_( const SwContentFrame*, IdleJobType );
     bool DoIdleJob( IdleJobType, bool bVisAreaOnly );
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index a46a94ff8cd5..bf4a6df98c4b 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -39,6 +39,7 @@
 #include <sfx2/event.hxx>
 
 #include <ftnidx.hxx>
+#include <vcl/svapp.hxx>
 #include <editeng/opaqitem.hxx>
 #include <SwSmartTagMgr.hxx>
 #include <sal/log.hxx>
@@ -89,6 +90,13 @@ void SwLayAction::CheckWaitCursor()
     }
 }
 
+// Time over already?
+inline void SwLayAction::CheckIdleEnd()
+{
+    if ( !IsInput() )
+        m_bInput = bool(GetInputType()) && Application::AnyInput( GetInputType() );
+}
+
 void SwLayAction::SetStatBar( bool bNew )
 {
     if ( bNew )
@@ -246,13 +254,13 @@ void SwLayAction::PaintContent( const SwContentFrame *pCnt,
         pCnt->ResetRetouche();
 }
 
-SwLayAction::SwLayAction(SwRootFrame *pRt, SwViewShellImp *pI, TaskStopwatch* pWatch)
-    : m_pRoot(pRt),
+SwLayAction::SwLayAction( SwRootFrame *pRt, SwViewShellImp *pI ) :
+    m_pRoot( pRt ),
     m_pImp( pI ),
-    m_pWatch(pWatch),
     m_pOptTab( nullptr ),
     m_nPreInvaPage( USHRT_MAX ),
     m_nStartTicks( std::clock() ),
+    m_nInputType( VclInputFlags::NONE ),
     m_nEndPage( USHRT_MAX ),
     m_nCheckPageNum( USHRT_MAX ),
     m_pCurPage( nullptr ),
@@ -261,7 +269,7 @@ SwLayAction::SwLayAction(SwRootFrame *pRt, SwViewShellImp *pI, TaskStopwatch* pW
 {
     m_bPaintExtraData = ::IsExtraData( m_pImp->GetShell()->GetDoc() );
     m_bPaint = m_bComplete = m_bWaitAllowed = m_bCheckPages = true;
-    m_bInterrupt = m_bAgain = m_bNextCycle = m_bCalcLayout = m_bReschedule =
+    m_bInput = m_bAgain = m_bNextCycle = m_bCalcLayout = m_bIdle = m_bReschedule =
     m_bUpdateExpFields = m_bBrowseActionStop = m_bActionInProgress = false;
     // init new flag <mbFormatContentOnInterrupt>.
     mbFormatContentOnInterrupt = false;
@@ -276,18 +284,14 @@ SwLayAction::~SwLayAction()
     m_pImp->m_pLayAction = nullptr;      // unregister
 }
 
-bool SwLayAction::IsInterrupt()
-{
-    return m_bInterrupt || (m_pWatch && m_pWatch->exceededRuntime());
-}
-
 void SwLayAction::Reset()
 {
     m_pOptTab = nullptr;
     m_nStartTicks = std::clock();
+    m_nInputType = VclInputFlags::NONE;
     m_nEndPage = m_nPreInvaPage = m_nCheckPageNum = USHRT_MAX;
     m_bPaint = m_bComplete = m_bWaitAllowed = m_bCheckPages = true;
-    m_bInterrupt = m_bAgain = m_bNextCycle = m_bCalcLayout = m_bReschedule =
+    m_bInput = m_bAgain = m_bNextCycle = m_bCalcLayout = m_bIdle = m_bReschedule =
     m_bUpdateExpFields = m_bBrowseActionStop = false;
     m_pCurPage = nullptr;
 }
@@ -447,7 +451,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
     IDocumentLayoutAccess& rLayoutAccess = m_pRoot->GetFormat()->getIDocumentLayoutAccess();
     bool bNoLoop = pPage && SwLayouter::StartLoopControl( m_pRoot->GetFormat()->GetDoc(), pPage );
     sal_uInt16 nPercentPageNum = 0;
-    while ((!IsInterrupt() && pPage) || (m_nCheckPageNum != USHRT_MAX))
+    while ( (pPage && !IsInterrupt()) || m_nCheckPageNum != USHRT_MAX )
     {
         // note: this is the only place that consumes and resets m_nCheckPageNum
         if ((IsInterrupt() || !pPage) && m_nCheckPageNum != USHRT_MAX)
@@ -571,7 +575,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
                             pPage->InvalidateFlyLayout();
                             pPage->InvalidateFlyContent();
                             if ( IsBrowseActionStop() )
-                                m_bInterrupt = true;
+                                m_bInput = true;
                         }
                     }
                     if( bNoLoop )
@@ -589,8 +593,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
                 pPage->ValidateFlyLayout();
                 pPage->ValidateFlyContent();
             }
-
-            if (!IsInterrupt())
+            if ( !IsInterrupt() )
             {
                 SetNextCycle( false );
 
@@ -631,8 +634,8 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
                 if( bNoLoop )
                     rLayoutAccess.GetLayouter()->LoopControl( pPage );
             }
+            CheckIdleEnd();
         }
-
         if ( !pPage && !IsInterrupt() &&
              (m_pRoot->IsSuperfluous() || m_pRoot->IsAssertFlyPages()) )
         {
@@ -658,7 +661,6 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
                 pPage = static_cast<SwPageFrame*>(pPage->GetNext());
         }
     }
-
     if ( IsInterrupt() && pPage )
     {
         // If we have input, we don't want to format content anymore, but
@@ -687,7 +689,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
             pPg = pPg ? static_cast<SwPageFrame*>(pPg->GetPrev()) : pPage;
 
         // set flag for interrupt content formatting
-        mbFormatContentOnInterrupt = IsInterrupt();
+        mbFormatContentOnInterrupt = IsInput();
         tools::Long nBottom = rVis.Bottom();
         // #i42586# - format current page, if idle action is active
         // This is an optimization for the case that the interrupt is created by
@@ -781,6 +783,7 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext)
 
 bool SwLayAction::TurboAction_( const SwContentFrame *pCnt )
 {
+
     const SwPageFrame *pPage = nullptr;
     if ( !pCnt->isFrameAreaDefinitionValid() || pCnt->IsCompletePaint() || pCnt->IsRetouche() )
     {
@@ -841,7 +844,10 @@ bool SwLayAction::TurboAction()
     if ( m_pRoot->GetTurbo() )
     {
         if ( !TurboAction_( m_pRoot->GetTurbo() ) )
+        {
+            CheckIdleEnd();
             bRet = false;
+        }
         m_pRoot->ResetTurbo();
     }
     else
@@ -1718,6 +1724,7 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
             // paragraph has been processed.
             if (!pTab || !bInValid)
             {
+                CheckIdleEnd();
                 // consider interrupt formatting.
                 if ( ( IsInterrupt() && !mbFormatContentOnInterrupt ) ||
                      ( !bBrowse && pPage->IsInvalidLayout() ) ||
@@ -1810,6 +1817,7 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
                 PaintContent( pContent, pPage, pContent->getFrameArea(), pContent->getFrameArea().Bottom());
             if ( IsIdle() )
             {
+                CheckIdleEnd();
                 // consider interrupt formatting.
                 if ( IsInterrupt() && !mbFormatContentOnInterrupt )
                     return false;
@@ -1905,6 +1913,7 @@ void SwLayAction::FormatFlyContent( const SwFlyFrame *pFly )
         // If there's input, we interrupt processing.
         if ( !pFly->IsFlyInContentFrame() )
         {
+            CheckIdleEnd();
             // consider interrupt formatting.
             if ( IsInterrupt() && !mbFormatContentOnInterrupt )
                 return;
@@ -1914,11 +1923,6 @@ void SwLayAction::FormatFlyContent( const SwFlyFrame *pFly )
     CheckWaitCursor();
 }
 
-bool SwLayIdle::IsInterrupt()
-{
-    return m_aWatch.exceededRuntime();
-}
-
 bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
 {
     OSL_ENSURE( pCnt->IsTextFrame(), "NoText neighbour of Text" );
@@ -2003,7 +2007,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
                 m_bPageValid = m_bPageValid && (SwTextNode::WrongState::TODO != pTextNode->GetWrongDirty());
                 if ( aRepaint.HasArea() )
                     m_pImp->GetShell()->InvalidateWindows( aRepaint );
-                if (IsInterrupt())
+                if (Application::AnyInput(VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER)))
                     return true;
                 break;
             }
@@ -2011,7 +2015,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
                 const_cast<SwTextFrame*>(pTextFrame)->CollectAutoCmplWrds(*pTextNode, nPos);
                 // note: bPageValid remains true here even if the cursor
                 // position is skipped, so no PENDING state needed currently
-                if (IsInterrupt())
+                if (Application::AnyInput(VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER)))
                     return true;
                 break;
             case WORD_COUNT :
@@ -2019,7 +2023,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
                 const sal_Int32 nEnd = pTextNode->GetText().getLength();
                 SwDocStat aStat;
                 pTextNode->CountWords( aStat, 0, nEnd );
-                if (IsInterrupt())
+                if ( Application::AnyInput() )
                     return true;
                 break;
             }
@@ -2034,7 +2038,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, IdleJobType eJob )
                     // handle smarttag problems gracefully and provide diagnostics
                     TOOLS_WARN_EXCEPTION( "sw.core", "SMART_TAGS");
                 }
-                if (IsInterrupt())
+                if (Application::AnyInput(VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER)))
                     return true;
                 break;
             }
@@ -2225,7 +2229,9 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) :
 
         bool bInterrupt(false);
         {
-            SwLayAction aAction(m_pRoot, m_pImp, &m_aWatch);
+            SwLayAction aAction( m_pRoot, m_pImp );
+            aAction.SetInputType( VCL_INPUT_ANY & VclInputFlags(~VclInputFlags::TIMER) );
+            aAction.SetIdle( true );
             aAction.SetWaitAllowed( false );
             aAction.Action(m_pImp->GetShell()->GetOut());
             bInterrupt = aAction.IsInterrupt();
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index f99dd73c7b5e..2f4aee28b52b 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -283,6 +283,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
         aAction.SetComplete( false );
         if ( mnLockPaint )
             aAction.SetPaint( false );
+        aAction.SetInputType( VclInputFlags::KEYBOARD );
         aAction.Action(GetWin());
     }
 


More information about the Libreoffice-commits mailing list