cui/source/inc/border.hxx                            |    6 +
 cui/source/tabpages/border.cxx                       |   64 +++++++++++++++++--
 cui/uiconfig/ui/borderpage.ui                        |   46 +++++++++++--
 editeng/source/rtf/rtfitem.cxx                       |    4 -
 include/editeng/borderline.hxx                       |   23 +++---
 sc/source/core/data/stlpool.cxx                      |    2 
 sc/source/core/tool/autoform.cxx                     |    2 
 sc/source/filter/html/htmlpars.cxx                   |    4 -
 sc/source/filter/lotus/lotattr.cxx                   |    6 -
 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx |   18 ++---
 sc/source/ui/sidebar/CellBorderStyleControl.cxx      |   12 ++-
 sc/source/ui/sidebar/CellLineStyleControl.cxx        |   57 ++++++++--------
 svx/source/tbxctrls/tbcontrl.cxx                     |    6 -
 sw/source/core/doc/DocumentStylePoolManager.cxx      |    2 
 sw/source/core/doc/tblafmt.cxx                       |    2 
 sw/source/core/docnode/ndtbl.cxx                     |    3 
 sw/source/core/edit/autofmt.cxx                      |   24 +++----
 sw/source/filter/html/htmltab.cxx                    |    8 --
 sw/source/filter/html/htmltabw.cxx                   |    4 -
 sw/source/filter/html/svxcss1.cxx                    |    6 -
 sw/source/filter/html/swhtml.cxx                     |    4 -
 sw/source/filter/ww8/rtfattributeoutput.cxx          |    2 
 sw/source/filter/ww8/ww8atr.cxx                      |    2 
 sw/source/filter/xml/xmlithlp.cxx                    |    9 +-
 sw/source/uibase/shells/frmsh.cxx                    |    2 
 sw/source/uibase/shells/tabsh.cxx                    |    2 
 26 files changed, 204 insertions(+), 116 deletions(-)

New commits:
commit 837f43f5c0e3456eb30afe51f8248e6e6c93308f
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Sep 27 11:59:54 2021 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Sun Dec 5 12:03:15 2021 +0100

    tdf#48622 Add new border line width defaults
    
    * Hairline (0.05pt)
    * Very thin (0.5pt)
    * Thin (0.75pt)
    * Medium (1.5pt)
    * Thick (2.25pt)
    * Extra thick (4.5pt)
    
    This unifies the default border line widths throughout the program.
    
    Users can still set any line width they want by chosing "Custom" in the 
"Border" tabpage.
    
    Also, existing documents won't be changed. The new defaults are just for 
newly added borders.
    
    Change-Id: I7af85dc189a688a749812824508c33c7814b50f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122683
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <[email protected]>
    (cherry picked from commit 41b99644e8913dd4797775f4931382e93fa12a00)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126056
    Tested-by: Thorsten Behrens <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index f00bcac95b82..639c7493ab38 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -74,7 +74,23 @@ const sal_uInt16 SvxBorderTabPage::pRanges[] =
     0
 };
 
-const std::vector<int> SvxBorderTabPage::m_aLineWidths = { 75, 200, 400, -1 };
+namespace
+{
+int lcl_twipsToPt(sal_Int64 nTwips)
+{
+    return MetricField::ConvertDoubleValue(nTwips, 0, FieldUnit::TWIP, 
MapUnit::MapPoint) * 100;
+}
+}
+
+const std::vector<int> SvxBorderTabPage::m_aLineWidths = {
+    lcl_twipsToPt(SvxBorderLineWidth::Hairline),
+    lcl_twipsToPt(SvxBorderLineWidth::VeryThin),
+    lcl_twipsToPt(SvxBorderLineWidth::Thin),
+    lcl_twipsToPt(SvxBorderLineWidth::Medium),
+    lcl_twipsToPt(SvxBorderLineWidth::Thick),
+    lcl_twipsToPt(SvxBorderLineWidth::ExtraThick),
+    -1
+};
 
 static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton& rField)
 {
diff --git a/cui/uiconfig/ui/borderpage.ui b/cui/uiconfig/ui/borderpage.ui
index d26ecdd339e7..9aea90aa306e 100644
--- a/cui/uiconfig/ui/borderpage.ui
+++ b/cui/uiconfig/ui/borderpage.ui
@@ -270,9 +270,12 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <items>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Hairline</item>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Very thin</item>
                           <item translatable="yes" 
context="borderpage|linewidthlb">Thin</item>
                           <item translatable="yes" 
context="borderpage|linewidthlb">Medium</item>
                           <item translatable="yes" 
context="borderpage|linewidthlb">Thick</item>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Extra thick</item>
                           <item translatable="yes" 
context="borderpage|linewidthlb">Custom</item>
                         </items>
                       </object>
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 345c0da1b754..dbdbd5f0cdd0 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1392,7 +1392,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, 
SfxItemSet& rSet,
         aAttr.reset(static_cast<SvxBoxItem*>(pItem->Clone()));
     }
 
-    SvxBorderLine aBrd( nullptr, DEF_LINE_WIDTH_0 );  // Simple plain line
+    SvxBorderLine aBrd( nullptr, SvxBorderLineWidth::Hairline );
     bool bContinue = true;
     int nBorderTyp = 0;
 
@@ -1460,7 +1460,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, 
SfxItemSet& rSet,
         case RTF_BRDRHAIR:      // hairline border
             {
                 aBrd.SetBorderLineStyle( SvxBorderLineStyle::SOLID);
-                aBrd.SetWidth( DEF_LINE_WIDTH_0 );
+                aBrd.SetWidth( SvxBorderLineWidth::Hairline );
             }
             break;
         case RTF_BRDRDB:        // Double border
diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx
index 64d7f2c5c3cb..5b3b20574483 100644
--- a/include/editeng/borderline.hxx
+++ b/include/editeng/borderline.hxx
@@ -29,16 +29,19 @@
 
 class IntlWrapper;
 
-// Line defaults in twips (former Writer defaults):
-
-#define DEF_LINE_WIDTH_0        1
-#define DEF_LINE_WIDTH_1        20
-#define DEF_LINE_WIDTH_2        50
-#define DEF_LINE_WIDTH_3        80
-#define DEF_LINE_WIDTH_4        100
-#define DEF_LINE_WIDTH_5        10
-#define DEF_LINE_WIDTH_6        5   // 0.25pt
-
+// Line width defaults in twips
+// Thin matches Excel's default values
+// See tdf#48622 for the discussion leading to these defaults.
+class SvxBorderLineWidth
+{
+public:
+    static const sal_Int16 Hairline = 1; // 0.05pt
+    static const sal_Int16 VeryThin = 10; // 0.5pt
+    static const sal_Int16 Thin = 15; // 0.75pt
+    static const sal_Int16 Medium = 30; // 1.5pt
+    static const sal_Int16 Thick = 45; // 2.25pt
+    static const sal_Int16 ExtraThick = 90; // 4.5pt
+};
 
 // Abstracts over values from css::table::BorderLineStyle
 enum class SvxBorderLineStyle : sal_Int16
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 2a701c1b26e8..e815baecf83c 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -220,7 +220,7 @@ void ScStyleSheetPool::CreateStandardStyles()
     std::unique_ptr<ScPageHFItem> pHeaderItem(new ScPageHFItem( 
ATTR_PAGE_HEADERRIGHT ));
     std::unique_ptr<ScPageHFItem> pFooterItem(new ScPageHFItem( 
ATTR_PAGE_FOOTERRIGHT ));
     ScStyleSheet*   pSheet          = nullptr;
-    ::editeng::SvxBorderLine    aBorderLine     ( &aColBlack, DEF_LINE_WIDTH_2 
);
+    ::editeng::SvxBorderLine    aBorderLine     ( &aColBlack, 
SvxBorderLineWidth::Medium );
     SvxBoxItem      aBoxItem        ( ATTR_BORDER );
     SvxBoxInfoItem  aBoxInfoItem    ( ATTR_BORDER_INNER );
 
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 254db1f14d6b..7376df23e631 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -700,7 +700,7 @@ ScAutoFormat::ScAutoFormat() :
 
     //  black thin border
     Color aBlack( COL_BLACK );
-    ::editeng::SvxBorderLine aLine( &aBlack, DEF_LINE_WIDTH_0 );
+    ::editeng::SvxBorderLine aLine( &aBlack, SvxBorderLineWidth::VeryThin );
     SvxBoxItem aBox( ATTR_BORDER );
     aBox.SetLine(&aLine, SvxBoxItemLine::LEFT);
     aBox.SetLine(&aLine, SvxBoxItemLine::TOP);
diff --git a/sc/source/filter/html/htmlpars.cxx 
b/sc/source/filter/html/htmlpars.cxx
index ae46949e4b21..51e4acefc21a 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2224,8 +2224,8 @@ void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, 
const ScAddress& rFirstPos
     {
         const SCCOL nLastCol = maSize.mnCols - 1;
         const SCROW nLastRow = maSize.mnRows - 1;
-        const long nOuterLine = DEF_LINE_WIDTH_2;
-        const long nInnerLine = DEF_LINE_WIDTH_0;
+        const long nOuterLine = SvxBorderLineWidth::Medium;
+        const long nInnerLine = SvxBorderLineWidth::Hairline;
         SvxBorderLine aOuterLine(nullptr, nOuterLine, 
SvxBorderLineStyle::SOLID);
         SvxBorderLine aInnerLine(nullptr, nInnerLine, 
SvxBorderLineStyle::SOLID);
         SvxBoxItem aBorderItem( ATTR_BORDER );
diff --git a/sc/source/filter/lotus/lotattr.cxx 
b/sc/source/filter/lotus/lotattr.cxx
index dd7725b40ec2..eff0efe6e5fc 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -151,12 +151,12 @@ void LotAttrCache::LotusToScBorderLine( sal_uInt8 nLine, 
::editeng::SvxBorderLin
     switch ( nLine )
     {
         case 0: aBL.SetBorderLineStyle(SvxBorderLineStyle::NONE); break;
-        case 1: aBL.SetWidth( DEF_LINE_WIDTH_1 ); break;
-        case 2: aBL.SetWidth( DEF_LINE_WIDTH_2 ); break;
+        case 1: aBL.SetWidth( SvxBorderLineWidth::Thin ); break;
+        case 2: aBL.SetWidth( SvxBorderLineWidth::Medium ); break;
         case 3:
         {
             aBL.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE_THIN);
-            aBL.SetWidth( DEF_LINE_WIDTH_1 );
+            aBL.SetWidth( SvxBorderLineWidth::Thin );
         }
         break;
     }
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx 
b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index d46275768db6..3069d5cf5e32 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -366,23 +366,23 @@ void CellAppearancePropertyPanel::SetStyleIcon()
     const sal_uInt16 nIdBorderLineStyle = mpTBLineStyle->GetItemId( 
UNO_LINESTYLE );
 
     //FIXME: update for new line border possibilities
-    if(mnOutWidth == DEF_LINE_WIDTH_0 && mnInWidth == 0 && mnDistance == 0)    
//1
+    if(mnOutWidth == SvxBorderLineWidth::Hairline && mnInWidth == 0 && 
mnDistance == 0)    //1
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle1);
-    else if(mnOutWidth == DEF_LINE_WIDTH_2 && mnInWidth == 0 && mnDistance == 
0) //2
+    else if(mnOutWidth == SvxBorderLineWidth::Medium && mnInWidth == 0 && 
mnDistance == 0) //2
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle2);
-    else if(mnOutWidth == DEF_LINE_WIDTH_3 && mnInWidth == 0 && mnDistance == 
0) //3
+    else if(mnOutWidth == SvxBorderLineWidth::Thick && mnInWidth == 0 && 
mnDistance == 0) //3
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle3);
-    else if(mnOutWidth == DEF_LINE_WIDTH_4 && mnInWidth == 0 && mnDistance == 
0) //4
+    else if(mnOutWidth == SvxBorderLineWidth::ExtraThick && mnInWidth == 0 && 
mnDistance == 0) //4
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle4);
-    else if(mnOutWidth == DEF_LINE_WIDTH_0 && mnInWidth == DEF_LINE_WIDTH_0 && 
mnDistance == DEF_LINE_WIDTH_1) //5
+    else if(mnOutWidth == SvxBorderLineWidth::Hairline && mnInWidth == 
SvxBorderLineWidth::Hairline && mnDistance == SvxBorderLineWidth::Thin) //5
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle5);
-    else if(mnOutWidth == DEF_LINE_WIDTH_0 && mnInWidth == DEF_LINE_WIDTH_0 && 
mnDistance == DEF_LINE_WIDTH_2) //6
+    else if(mnOutWidth == SvxBorderLineWidth::Hairline && mnInWidth == 
SvxBorderLineWidth::Hairline && mnDistance == SvxBorderLineWidth::Medium) //6
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle6);
-    else if(mnOutWidth == DEF_LINE_WIDTH_1 && mnInWidth == DEF_LINE_WIDTH_2 && 
mnDistance == DEF_LINE_WIDTH_1) //7
+    else if(mnOutWidth == SvxBorderLineWidth::Thin && mnInWidth == 
SvxBorderLineWidth::Medium && mnDistance == SvxBorderLineWidth::Thin) //7
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle7);
-    else if(mnOutWidth == DEF_LINE_WIDTH_2 && mnInWidth == DEF_LINE_WIDTH_0 && 
mnDistance == DEF_LINE_WIDTH_2) //8
+    else if(mnOutWidth == SvxBorderLineWidth::Medium && mnInWidth == 
SvxBorderLineWidth::Hairline && mnDistance == SvxBorderLineWidth::Medium) //8
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle8);
-    else if(mnOutWidth == DEF_LINE_WIDTH_2 && mnInWidth == DEF_LINE_WIDTH_2 && 
mnDistance == DEF_LINE_WIDTH_2) //9
+    else if(mnOutWidth == SvxBorderLineWidth::Medium && mnInWidth == 
SvxBorderLineWidth::Medium && mnDistance == SvxBorderLineWidth::Medium) //9
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle9);
     else
         mpTBLineStyle->SetItemImage(nIdBorderLineStyle, maIMGLineStyle1);
diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx 
b/sc/source/ui/sidebar/CellBorderStyleControl.cxx
index 48bc135173a0..1e4f177bec98 100644
--- a/sc/source/ui/sidebar/CellBorderStyleControl.cxx
+++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx
@@ -108,7 +108,7 @@ IMPL_LINK(CellBorderStylePopup, TB1SelectHdl, ToolBox*, 
pToolBox, void)
     }
     else if (nId == maTBBorder1->GetItemId("thickbox"))
     {
-        theDefLine.SetWidth(DEF_LINE_WIDTH_2);
+        theDefLine.SetWidth(SvxBorderLineWidth::Thick);
         pLeft = pRight = pTop = pBottom = &theDefLine;
         nValidFlags |= FRM_VALID_OUTER;
     }
@@ -236,25 +236,27 @@ IMPL_LINK(CellBorderStylePopup, TB3SelectHdl, ToolBox *, 
pToolBox, void)
 
     if (nId == maTBBorder3->GetItemId("thickbottom"))
     {
-        pBottom.reset(new editeng::SvxBorderLine(nullptr, DEF_LINE_WIDTH_2 ));
+        pBottom.reset(new editeng::SvxBorderLine(nullptr, 
SvxBorderLineWidth::Thick));
         nValidFlags |= FRM_VALID_BOTTOM;
     }
     else if (nId == maTBBorder3->GetItemId("doublebottom"))
     {
         pBottom.reset(new editeng::SvxBorderLine(nullptr));
-        pBottom->GuessLinesWidths(SvxBorderLineStyle::DOUBLE, 
DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1);
+        pBottom->GuessLinesWidths(SvxBorderLineStyle::DOUBLE, 
SvxBorderLineWidth::Hairline,
+                                  SvxBorderLineWidth::Hairline, 
SvxBorderLineWidth::Thin);
         nValidFlags |= FRM_VALID_BOTTOM;
     }
     else if (nId == maTBBorder3->GetItemId("topthickbottom"))
     {
-        pBottom.reset(new editeng::SvxBorderLine(nullptr, DEF_LINE_WIDTH_2 ));
+        pBottom.reset(new editeng::SvxBorderLine(nullptr, 
SvxBorderLineWidth::Thick));
         pTop.reset(new editeng::SvxBorderLine(nullptr, 1));
         nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
     }
     else if (nId == maTBBorder3->GetItemId("topdoublebottom"))
     {
         pBottom.reset(new editeng::SvxBorderLine(nullptr));
-        pBottom->GuessLinesWidths(SvxBorderLineStyle::DOUBLE, 
DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1);
+        pBottom->GuessLinesWidths(SvxBorderLineStyle::DOUBLE, 
SvxBorderLineWidth::Hairline,
+                                  SvxBorderLineWidth::Hairline, 
SvxBorderLineWidth::Thin);
         pTop.reset(new editeng::SvxBorderLine(nullptr, 1));
         nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
     }
diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx 
b/sc/source/ui/sidebar/CellLineStyleControl.cxx
index 8c9092f33fb4..c5da14c298d4 100644
--- a/sc/source/ui/sidebar/CellLineStyleControl.cxx
+++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx
@@ -113,45 +113,45 @@ IMPL_LINK(CellLineStylePopup, VSSelectHdl, ValueSet*, 
pControl, void)
         switch(iPos)
         {
             case 1:
-                n1 = DEF_LINE_WIDTH_0;
+                n1 = SvxBorderLineWidth::Hairline;
                 break;
             case 2:
-                n1 = DEF_LINE_WIDTH_2;
+                n1 = SvxBorderLineWidth::Medium;
                 break;
             case 3:
-                n1 = DEF_LINE_WIDTH_3;
+                n1 = SvxBorderLineWidth::Thick;
                 break;
             case 4:
-                n1 = DEF_LINE_WIDTH_4;
+                n1 = SvxBorderLineWidth::ExtraThick;
                 break;
             case 5:
-                n1 = DEF_LINE_WIDTH_0;
-                n2 = DEF_LINE_WIDTH_0;
-                n3 = DEF_LINE_WIDTH_1;
+                n1 = SvxBorderLineWidth::Hairline;
+                n2 = SvxBorderLineWidth::Hairline;
+                n3 = SvxBorderLineWidth::Medium;
                 nStyle = SvxBorderLineStyle::DOUBLE;
                 break;
             case 6:
-                n1 = DEF_LINE_WIDTH_0;
-                n2 = DEF_LINE_WIDTH_0;
-                n3 = DEF_LINE_WIDTH_2;
+                n1 = SvxBorderLineWidth::Hairline;
+                n2 = SvxBorderLineWidth::Hairline;
+                n3 = SvxBorderLineWidth::Thick;
                 nStyle = SvxBorderLineStyle::DOUBLE;
                 break;
             case 7:
-                n1 = DEF_LINE_WIDTH_1;
-                n2 = DEF_LINE_WIDTH_2;
-                n3 = DEF_LINE_WIDTH_1;
+                n1 = SvxBorderLineWidth::Thin;
+                n2 = SvxBorderLineWidth::Medium;
+                n3 = SvxBorderLineWidth::Thin;
                 nStyle = SvxBorderLineStyle::DOUBLE;
                 break;
             case 8:
-                n1 = DEF_LINE_WIDTH_2;
-                n2 = DEF_LINE_WIDTH_0;
-                n3 = DEF_LINE_WIDTH_2;
+                n1 = SvxBorderLineWidth::Medium;
+                n2 = SvxBorderLineWidth::Hairline;
+                n3 = SvxBorderLineWidth::Medium;
                 nStyle = SvxBorderLineStyle::DOUBLE;
                 break;
             case 9:
-                n1 = DEF_LINE_WIDTH_2;
-                n2 = DEF_LINE_WIDTH_2;
-                n3 = DEF_LINE_WIDTH_2;
+                n1 = SvxBorderLineWidth::Medium;
+                n2 = SvxBorderLineWidth::Medium;
+                n3 = SvxBorderLineWidth::Medium;
                 nStyle = SvxBorderLineStyle::DOUBLE;
                 break;
             default:
@@ -184,42 +184,43 @@ void CellLineStylePopup::SetLineStyleSelect(sal_uInt16 
out, sal_uInt16 in, sal_u
 
     //FIXME: fully for new border line possibilities
 
-    if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0)  //1
+    if(out == SvxBorderLineWidth::Hairline && in == 0 && dis == 0)  //1
     {
         maCellLineStyleValueSet->SetSelItem(1);
     }
-    else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2
+    else if(out == SvxBorderLineWidth::Medium && in == 0 && dis == 0) //2
     {
         maCellLineStyleValueSet->SetSelItem(2);
     }
-    else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3
+    else if(out == SvxBorderLineWidth::Thick && in == 0 && dis == 0) //3
     {
         maCellLineStyleValueSet->SetSelItem(3);
     }
-    else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4
+    else if(out == SvxBorderLineWidth::ExtraThick && in == 0 && dis == 0) //4
     {
         maCellLineStyleValueSet->SetSelItem(4);
     }
-    else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == 
DEF_LINE_WIDTH_1) //5
+    else if(out == SvxBorderLineWidth::Hairline && in == 
SvxBorderLineWidth::Hairline && dis == SvxBorderLineWidth::Thin) //5
     {
         maCellLineStyleValueSet->SetSelItem(5);
     }
-    else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == 
DEF_LINE_WIDTH_2) //6
+    else if(out == SvxBorderLineWidth::Hairline && in == 
SvxBorderLineWidth::Hairline && dis == SvxBorderLineWidth::Medium) //6
     {
         maCellLineStyleValueSet->SetSelItem(6);
     }
-    else if(out == DEF_LINE_WIDTH_1 && in == DEF_LINE_WIDTH_2 && dis == 
DEF_LINE_WIDTH_1) //7
+    else if(out == SvxBorderLineWidth::Thin && in == 
SvxBorderLineWidth::Medium && dis == SvxBorderLineWidth::Thin) //7
     {
         maCellLineStyleValueSet->SetSelItem(7);
     }
-    else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_0 && dis == 
DEF_LINE_WIDTH_2) //8
+    else if(out == SvxBorderLineWidth::Medium && in == 
SvxBorderLineWidth::Hairline && dis == SvxBorderLineWidth::Medium) //8
     {
         maCellLineStyleValueSet->SetSelItem(8);
     }
-    else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_2 && dis == 
DEF_LINE_WIDTH_2) //9
+    else if(out == SvxBorderLineWidth::Medium && in == 
SvxBorderLineWidth::Medium && dis == SvxBorderLineWidth::Medium) //9
     {
         maCellLineStyleValueSet->SetSelItem(9);
     }
+
     else
     {
         maCellLineStyleValueSet->SetSelItem(0);
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 7fc12c76a47d..b0ef5cbc7047 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2462,8 +2462,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, 
ValueSet*, void)
     sal_uInt16           nModifier = aFrameSet->GetModifier();
     FrmValidFlags        nValidFlags = FrmValidFlags::NONE;
 
-    theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(),
-            DEF_LINE_WIDTH_0);
+    theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(), 
SvxBorderLineWidth::Hairline);
+
     switch ( nSel )
     {
         case 1: nValidFlags |= FrmValidFlags::AllMask;
@@ -2773,7 +2773,7 @@ IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl, ListBox&, 
void)
     {
         SvxBorderLine aTmp;
         aTmp.SetBorderLineStyle( nStyle );
-        aTmp.SetWidth( 20 ); // TODO Make it depend on a width field
+        aTmp.SetWidth( SvxBorderLineWidth::Thin ); // TODO Make it depend on a 
width field
         aLineItem.SetLine( &aTmp );
     }
     else
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx 
b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 767af3a22010..b5bb128629e6 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1588,7 +1588,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( 
sal_uInt16 nId )
                 aSet.Put( SwFormatHoriOrient( 0, 
text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) );
                 aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, 
text::RelOrientation::PRINT_AREA ) );
                 Color aCol( COL_BLACK );
-                SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
+                SvxBorderLine aLine( &aCol, SvxBorderLineWidth::Hairline );
                 SvxBoxItem aBox( RES_BOX );
                 aBox.SetLine( &aLine, SvxBoxItemLine::TOP );
                 aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM );
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 35e626a0f5a1..3ff7ef02b6d0 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -1021,7 +1021,7 @@ SwTableAutoFormatTable::SwTableAutoFormatTable()
     SvxBoxItem aBox( RES_BOX );
 
     aBox.SetAllDistances(55);
-    SvxBorderLine aLn( &aColor, DEF_LINE_WIDTH_5 );
+    SvxBorderLine aLn( &aColor, SvxBorderLineWidth::VeryThin );
     aBox.SetLine( &aLn, SvxBoxItemLine::LEFT );
     aBox.SetLine( &aLn, SvxBoxItemLine::BOTTOM );
 
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 15a49729ce51..728a0a28e503 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -114,11 +114,10 @@ static void lcl_SetDfltBoxAttr( SwFrameFormat& rFormat, 
sal_uInt8 nId )
 
     const bool bHTML = 
rFormat.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE);
     Color aCol( bHTML ? COL_GRAY : COL_BLACK );
-    SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
+    SvxBorderLine aLine( &aCol, SvxBorderLineWidth::Hairline );
     if ( bHTML )
     {
         aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
-        aLine.SetWidth( DEF_LINE_WIDTH_0 );
     }
     SvxBoxItem aBox(RES_BOX);
     aBox.SetAllDistances(55);
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index cb905187faed..c07cf4ceb18b 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -571,29 +571,29 @@ bool SwAutoFormat::DoUnderline()
         editeng::SvxBorderLine aLine;
         switch( eState )
         {
-        case 1:         // single, 0.05 pt
+        case 1:         // single, hairline
             aLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
-            aLine.SetWidth( DEF_LINE_WIDTH_0 );
+            aLine.SetWidth( SvxBorderLineWidth::Hairline );
             break;
-        case 2:         // single, 1.0 pt
+        case 2:         // single, thin
             aLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
-            aLine.SetWidth( DEF_LINE_WIDTH_1 );
+            aLine.SetWidth( SvxBorderLineWidth::Thin );
             break;
-        case 3:         // double, 1.0 pt
+        case 3:         // double, thin
             aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
-            aLine.SetWidth( DEF_LINE_WIDTH_1 );
+            aLine.SetWidth( SvxBorderLineWidth::Thin );
             break;
-        case 4:         // double (thick/thin), 4.0 pt
+        case 4:         // double, thick/thin
             aLine.SetBorderLineStyle(SvxBorderLineStyle::THICKTHIN_SMALLGAP);
-            aLine.SetWidth( DEF_LINE_WIDTH_3  );
+            aLine.SetWidth( SvxBorderLineWidth::Thick  );
             break;
-        case 5:         // double (thin/thick), 4.0 pt
+        case 5:         // double, thin/thick
             aLine.SetBorderLineStyle(SvxBorderLineStyle::THINTHICK_SMALLGAP);
-            aLine.SetWidth( DEF_LINE_WIDTH_3 );
+            aLine.SetWidth( SvxBorderLineWidth::Thick );
             break;
-        case 6:         // double, 2.5 pt
+        case 6:         // double, medium
             aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
-            aLine.SetWidth( DEF_LINE_WIDTH_2 );
+            aLine.SetWidth( SvxBorderLineWidth::Medium );
             break;
         }
         SfxItemSet aSet(m_pDoc->GetAttrPool(),
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 670ed3ae7aeb..f0edba59c107 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -971,14 +971,8 @@ void HTMLTable::InitCtor(const HTMLTableOptions& rOptions)
     m_aRightBorderLine = m_aLeftBorderLine;
 
     if( rOptions.nCellSpacing != 0 )
-    {
         m_aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
-        m_aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
-    }
-    else
-    {
-        m_aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
-    }
+    m_aBorderLine.SetWidth(SvxBorderLineWidth::Hairline);
     m_aBorderLine.SetColor( rBorderColor );
 
     if( m_nCellPadding )
diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index 577a9f5c7b11..18ad069e605b 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -811,9 +811,9 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 
         OutTableCells( rWrt, pRow2->GetCells(), pRow2->GetBackground() );
         if( !m_nCellSpacing && nRow < m_aRows.size()-1 && pRow2->bBottomBorder 
&&
-            pRow2->nBottomBorder > DEF_LINE_WIDTH_1 )
+            pRow2->nBottomBorder > SvxBorderLineWidth::Hairline )
         {
-            for( auto nCnt = (pRow2->nBottomBorder / DEF_LINE_WIDTH_1) - 1; 
nCnt; --nCnt )
+            for( auto nCnt = (pRow2->nBottomBorder / 
SvxBorderLineWidth::Hairline) - 1; nCnt; --nCnt )
             {
                 rWrt.OutNewLine();
                 HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rWrt.GetNamespace() + 
OOO_STRING_SVTOOLS_HTML_tablerow );
diff --git a/sw/source/filter/html/svxcss1.cxx 
b/sw/source/filter/html/svxcss1.cxx
index c1a6f7312d30..e570d1a92c54 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -244,9 +244,9 @@ static CSS1PropertyEnum const aBulletStyleTable[] =
 
 static sal_uInt16 const aBorderWidths[] =
 {
-    DEF_LINE_WIDTH_0,
-    DEF_LINE_WIDTH_5,
-    DEF_LINE_WIDTH_1
+    SvxBorderLineWidth::Hairline,
+    SvxBorderLineWidth::VeryThin,
+    SvxBorderLineWidth::Thin
 };
 
 #undef SBORDER_ENTRY
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 3f72a8a044e3..1a08be28684a 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -5305,12 +5305,12 @@ void SwHTMLParser::InsertHorzRule()
         }
         else if( bNoShade )
         {
-            aBorderLine.SetWidth( DEF_LINE_WIDTH_2 );
+            aBorderLine.SetWidth( SvxBorderLineWidth::Medium );
         }
         else
         {
             aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
-            aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
+            aBorderLine.SetWidth(SvxBorderLineWidth::Hairline);
         }
 
         SvxBoxItem aBoxItem(RES_BOX);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 6313472bf728..cebf1ffcf430 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -109,7 +109,7 @@ static OString OutTBLBorderLine(RtfExport const& rExport, 
const editeng::SvxBord
         {
             case SvxBorderLineStyle::SOLID:
             {
-                if (DEF_LINE_WIDTH_0 == pLine->GetWidth())
+                if (SvxBorderLineWidth::Hairline == pLine->GetWidth())
                     aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRHAIR);
                 else
                     aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRS);
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 5868928c5bf6..2cd9466715ce 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4322,7 +4322,7 @@ WW8_BRCVer9 WW8Export::TranslateBorderLine(const 
SvxBorderLine& rLine,
         {
             case SvxBorderLineStyle::SOLID:
                 {
-                    if ( rLine.GetWidth( ) == DEF_LINE_WIDTH_0 )
+                    if ( rLine.GetWidth( ) == SvxBorderLineWidth::Hairline )
                         brcType = 5;
                     else
                         brcType = 1;
diff --git a/sw/source/filter/xml/xmlithlp.cxx 
b/sw/source/filter/xml/xmlithlp.cxx
index 6dc8f3830e77..f3d8df67e1e6 100644
--- a/sw/source/filter/xml/xmlithlp.cxx
+++ b/sw/source/filter/xml/xmlithlp.cxx
@@ -73,11 +73,10 @@ const struct SvXMLEnumMapEntry<sal_uInt16> 
psXML_NamedBorderWidths[] =
 };
 // mapping tables to map external xml input to internal box line widths
 
-const sal_uInt16 aBorderWidths[] =
-{
-        DEF_LINE_WIDTH_0,
-        DEF_LINE_WIDTH_5,
-        DEF_LINE_WIDTH_1,
+const sal_uInt16 aBorderWidths[] = {
+    SvxBorderLineWidth::Hairline,
+    SvxBorderLineWidth::VeryThin,
+    SvxBorderLineWidth::Thin
 };
 
 bool sw_frmitems_parseXMLBorder( const OUString& rValue,
diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index 32036351a5ee..ba6e91f12ec1 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1123,7 +1123,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
                     {
                         aBorderLine.SetBorderLineStyle(
                                 SvxBorderLineStyle::SOLID);
-                        aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
+                        aBorderLine.SetWidth( SvxBorderLineWidth::Hairline );
                     }
                     //Set distance only if the request is received from the 
controller.
 
diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 073fe280c924..da77b89e4189 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -530,7 +530,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
             if(aBorderLine.GetOutWidth() == 0)
             {
                 aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
-                aBorderLine.SetWidth( DEF_LINE_WIDTH_5 );
+                aBorderLine.SetWidth( SvxBorderLineWidth::VeryThin );
             }
 
             if( aBox->GetTop() != nullptr )
commit 823c717cdc9b6f7af4f21d1cd4b3939429b64427
Author:     Vasily Melenchuk <[email protected]>
AuthorDate: Tue Apr 27 13:34:23 2021 +0300
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Sun Dec 5 12:02:58 2021 +0100

    tdf#48622 add border line thickness predefined values in UI
    
    According to multiple reports border line width selection will be
    more intuitive with some predefined values. Here is an implementation
    of this proposal: line width can be selected from combobox from
    predefined values (thin, medium, thick and custom). Classical spinner
    is right now hidden unless custom line width is selected.
    
    Change-Id: I87a6237335b79a5f5b63e109360e1ea8f12ae071
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114709
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <[email protected]>
    (cherry picked from commit 089c7d05fde13251eb8cd8daaf7627b6bb0072f9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126055
    Tested-by: Thorsten Behrens <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index a138620017e1..6a56f02a1296 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -77,6 +77,7 @@ private:
 class SvxBorderTabPage : public SfxTabPage
 {
     static const sal_uInt16 pRanges[];
+    static const std::vector<int> m_aLineWidths;
 
 public:
     SvxBorderTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rCoreAttrs);
@@ -128,6 +129,7 @@ private:
 
     std::unique_ptr<SvtLineListBox> m_xLbLineStyle;
     std::unique_ptr<ColorListBox> m_xLbLineColor;
+    std::unique_ptr<weld::ComboBox> m_xLineWidthLB;
     std::unique_ptr<weld::MetricSpinButton> m_xLineWidthMF;
 
     std::unique_ptr<weld::Container> m_xSpacingFrame;
@@ -165,9 +167,10 @@ private:
     DECL_LINK(SelSdwHdl_Impl, SvtValueSet*, void);
     DECL_LINK(LinesChanged_Impl, LinkParamNone*, void);
     DECL_LINK(ModifyDistanceHdl_Impl, weld::MetricSpinButton&, void);
-    DECL_LINK(ModifyWidthHdl_Impl, weld::MetricSpinButton&, void);
     DECL_LINK(SyncHdl_Impl, weld::ToggleButton&, void);
     DECL_LINK(RemoveAdjacentCellBorderHdl_Impl, weld::ToggleButton&, void);
+    DECL_LINK(ModifyWidthLBHdl_Impl, weld::ComboBox&, void);
+    DECL_LINK(ModifyWidthMFHdl_Impl, weld::MetricSpinButton&, void);
 
     sal_uInt16          GetPresetImageId(sal_uInt16 nValueSetIdx) const;
     const char*         GetPresetStringId(sal_uInt16 nValueSetIdx) const;
@@ -175,6 +178,7 @@ private:
     void                FillPresetVS();
     void                FillShadowVS();
     void                FillValueSets();
+    void                SetLineWidth(sal_Int64 nWidth);
 
     // Filler
     void                FillLineListBox_Impl();
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 5ded87ea6659..f00bcac95b82 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -74,6 +74,8 @@ const sal_uInt16 SvxBorderTabPage::pRanges[] =
     0
 };
 
+const std::vector<int> SvxBorderTabPage::m_aLineWidths = { 75, 200, 400, -1 };
+
 static void lcl_SetDecimalDigitsTo1(weld::MetricSpinButton& rField)
 {
     auto nMin = rField.denormalize(rField.get_min(FieldUnit::TWIP));
@@ -288,6 +290,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, 
weld::DialogControlle
     , m_xFrameSelWin(new weld::CustomWeld(*m_xBuilder, "framesel", 
m_aFrameSel))
     , m_xLbLineStyle(new 
SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb")))
     , m_xLbLineColor(new 
ColorListBox(m_xBuilder->weld_menu_button("linecolorlb"), 
pController->getDialog()))
+    , m_xLineWidthLB(m_xBuilder->weld_combo_box("linewidthlb"))
     , m_xLineWidthMF(m_xBuilder->weld_metric_spin_button("linewidthmf", 
FieldUnit::POINT))
     , m_xSpacingFrame(m_xBuilder->weld_container("spacing"))
     , m_xLeftFT(m_xBuilder->weld_label("leftft"))
@@ -411,7 +414,7 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* pPage, 
weld::DialogControlle
     {
         // The caller specifies default line width.  Honor it.
         const SfxInt64Item* p = static_cast<const SfxInt64Item*>(pItem);
-        m_xLineWidthMF->set_value(p->GetValue(), FieldUnit::POINT);
+        SetLineWidth(p->GetValue());
     }
 
     // set metric
@@ -511,13 +514,17 @@ SvxBorderTabPage::SvxBorderTabPage(weld::Container* 
pPage, weld::DialogControlle
     m_aFrameSel.SetSelectHdl(LINK(this, SvxBorderTabPage, LinesChanged_Impl));
     m_xLbLineStyle->SetSelectHdl( LINK( this, SvxBorderTabPage, 
SelStyleHdl_Impl ) );
     m_xLbLineColor->SetSelectHdl( LINK( this, SvxBorderTabPage, SelColHdl_Impl 
) );
-    m_xLineWidthMF->connect_value_changed( LINK( this, SvxBorderTabPage, 
ModifyWidthHdl_Impl ) );
+    m_xLineWidthLB->connect_changed(LINK(this, SvxBorderTabPage, 
ModifyWidthLBHdl_Impl));
+    m_xLineWidthMF->connect_value_changed(LINK(this, SvxBorderTabPage, 
ModifyWidthMFHdl_Impl));
     m_xWndPresets->SetSelectHdl( LINK( this, SvxBorderTabPage, SelPreHdl_Impl 
) );
     m_xWndShadows->SetSelectHdl( LINK( this, SvxBorderTabPage, SelSdwHdl_Impl 
) );
 
     FillValueSets();
     FillLineListBox_Impl();
 
+    // Reapply line width: probably one of prefefined values should be selected
+    SetLineWidth(m_xLineWidthMF->get_value(FieldUnit::NONE));
+
     // connections
     if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_PARA_GRABBAG), &pItem))
     {
@@ -774,7 +781,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet )
             sal_Int64 nWidthPt =  
static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
                         sal_Int64( nWidth ), m_xLineWidthMF->get_digits(),
                         MapUnit::MapTwip, FieldUnit::POINT ));
-            m_xLineWidthMF->set_value(nWidthPt, FieldUnit::POINT);
+            SetLineWidth(nWidthPt);
             m_xLbLineStyle->SetWidth(nWidth);
 
             // then set the style
@@ -1192,7 +1199,17 @@ IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, 
ColorListBox&, rColorBox, void)
     m_aFrameSel.SetColorToSelection(aColor);
 }
 
-IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, 
weld::MetricSpinButton&, void)
+IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthLBHdl_Impl, weld::ComboBox&, void)
+{
+    sal_Int32 nPos = m_xLineWidthLB->get_active();
+
+    SetLineWidth(m_aLineWidths[nPos]);
+
+    // Call the spinner handler to trigger all related modifications
+    ModifyWidthMFHdl_Impl(*m_xLineWidthMF);
+}
+
+IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthMFHdl_Impl, 
weld::MetricSpinButton&, void)
 {
     sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE);
     nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
@@ -1229,7 +1246,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, 
SvtLineListBox&, void)
             m_xLineWidthMF->get_digits(),
             MapUnit::MapTwip,
             FieldUnit::POINT));
-        m_xLineWidthMF->set_value(nNewWidthPt, FieldUnit::POINT);
+        SetLineWidth(nNewWidthPt);
     }
 
     // set value inside style box
@@ -1356,6 +1373,27 @@ void SvxBorderTabPage::FillValueSets()
     FillShadowVS();
 }
 
+void SvxBorderTabPage::SetLineWidth( sal_Int64 nWidth )
+{
+    if ( nWidth >= 0 )
+        m_xLineWidthMF->set_value( nWidth, FieldUnit::POINT );
+
+    auto it = std::find_if( m_aLineWidths.begin(), m_aLineWidths.end(),
+                            [nWidth](const int val) -> bool { return val == 
nWidth; } );
+
+    if ( it != m_aLineWidths.end() && *it >= 0 )
+    {
+        // Select predefined value in combobox
+        m_xLineWidthMF->hide();
+        m_xLineWidthLB->set_active(std::distance(m_aLineWidths.begin(), it));
+    }
+    else
+    {
+        // This is not one of predefined values. Show spinner
+        m_xLineWidthLB->set_active(m_aLineWidths.size()-1);
+        m_xLineWidthMF->show();
+    }
+}
 
 static Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
 {
diff --git a/cui/uiconfig/ui/borderpage.ui b/cui/uiconfig/ui/borderpage.ui
index 0f7c6f625985..d26ecdd339e7 100644
--- a/cui/uiconfig/ui/borderpage.ui
+++ b/cui/uiconfig/ui/borderpage.ui
@@ -258,14 +258,43 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkSpinButton" id="linewidthmf">
+                  <object class="GtkGrid" id="gridlinewidth">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="halign">start</property>
-                    <property name="activates_default">True</property>
-                    <property name="adjustment">adjustment1</property>
-                    <property name="digits">2</property>
-                    <property name="value">0.05</property>
+                    <property name="can_focus">False</property>
+                    <property name="row_spacing">0</property>
+                    <property name="column_spacing">6</property>
+                    <property name="margin-start">0</property>
+                    <property name="margin-top">0</property>
+                    <child>
+                      <object class="GtkComboBoxText" id="linewidthlb">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <items>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Thin</item>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Medium</item>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Thick</item>
+                          <item translatable="yes" 
context="borderpage|linewidthlb">Custom</item>
+                        </items>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSpinButton" id="linewidthmf">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="halign">start</property>
+                        <property name="activates_default">True</property>
+                        <property name="adjustment">adjustment1</property>
+                        <property name="digits">2</property>
+                        <property name="truncate-multiline">True</property>
+                        <property name="value">0.05</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>

Reply via email to