compilerplugins/clang/moveparam.cxx           |    6 
 include/svx/itemwin.hxx                       |    7 
 include/svx/sidebar/LineWidthPopup.hxx        |   15 -
 solenv/clang-format/excludelist               |    2 
 svx/Library_svx.mk                            |    1 
 svx/source/sidebar/line/LineWidthPopup.cxx    |  223 ++++++++++++++++-----
 svx/source/sidebar/line/LineWidthValueSet.cxx |  168 ----------------
 svx/source/sidebar/line/LineWidthValueSet.hxx |   55 -----
 svx/source/tbxctrls/linectrl.cxx              |  264 +++++++++++++++++---------
 svx/uiconfig/ui/floatinglineend.ui            |   38 ++-
 svx/uiconfig/ui/floatinglineproperty.ui       |   34 ++-
 svx/uiconfig/ui/floatinglinestyle.ui          |   38 ++-
 12 files changed, 430 insertions(+), 421 deletions(-)

New commits:
commit 006f8ba214d939c2d35ddc97b2ce4d2b88c05e4e
Author:     Parth Raiyani <[email protected]>
AuthorDate: Fri Aug 22 19:08:41 2025 +0530
Commit:     Szymon Kłos <[email protected]>
CommitDate: Sun Sep 14 15:25:22 2025 +0200

    Replaces ValueSet with IconView for line width selection
    
    - Updated the UI layout to use GtkIconView with better configuration 
options.
    - Simplified logic for filling and updating the selection view.
    - Added tooltip support
    - Removed obsolete code related to ValueSet including LineWidthValueSet
    - Fixed potential LibreOffice Kit crash by disabling unnecessary tooltip 
for popup dialog in Libreoffit Kit
    
    Change-Id: I23be48e9931ede35675ff4ed79a3ce9114badbb8
    Signed-off-by: Parth Raiyani <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189966
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>

diff --git a/compilerplugins/clang/moveparam.cxx 
b/compilerplugins/clang/moveparam.cxx
index dc7a84b4d64d..93484ef60b5f 100644
--- a/compilerplugins/clang/moveparam.cxx
+++ b/compilerplugins/clang/moveparam.cxx
@@ -90,12 +90,6 @@ bool MoveParam::VisitCXXOperatorCallExpr(const 
CXXOperatorCallExpr* callExpr)
     if (!loplugin::TypeCheck(parmVarDecl->getType()).LvalueReference().Const())
         return true;
 
-    StringRef aFileName = getFilenameOfLocation(
-        
compiler.getSourceManager().getSpellingLoc(parmVarDecl->getBeginLoc()));
-    if (loplugin::hasPathnamePrefix(aFileName,
-                                    SRCDIR 
"/svx/source/sidebar/line/LineWidthValueSet.cxx"))
-        return true;
-
     report(DiagnosticsEngine::Warning, "rather use move && param1", 
callExpr->getBeginLoc());
 
     return true;
diff --git a/include/svx/sidebar/LineWidthPopup.hxx 
b/include/svx/sidebar/LineWidthPopup.hxx
index 262f3540941b..d8e84ffa0f1d 100644
--- a/include/svx/sidebar/LineWidthPopup.hxx
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -26,12 +26,9 @@
 #include <svtools/toolbarmenu.hxx>
 #include <array>
 
-class ValueSet;
-
 namespace svx::sidebar
 {
 class LinePropertyPanelBase;
-class LineWidthValueSet;
 
 class LineWidthPopup final : public WeldToolbarPopup
 {
@@ -57,11 +54,17 @@ private:
     Image m_aIMGCusGray;
 
     std::unique_ptr<weld::MetricSpinButton> m_xMFWidth;
-    std::unique_ptr<LineWidthValueSet> m_xVSWidth;
-    std::unique_ptr<weld::CustomWeld> m_xVSWidthWin;
+    std::unique_ptr<weld::IconView> m_xIVWidth;
+    Size aPreviewSize;
 
-    DECL_LINK(VSSelectHdl, ValueSet*, void);
+    DECL_LINK(ItemActivatedHdl, weld::IconView&, bool);
+    DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
     DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void);
+
+    VclPtr<VirtualDevice> CreateLinePreview(sal_uInt16 nLineWidth, const 
OUString& rText);
+    VclPtr<VirtualDevice> CreateCustomPreview(const Image& rImage, const 
OUString& rText,
+                                              bool bEnabled);
+    void PopulateIconView();
 };
 
 } // end of namespace svx::sidebar
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 2a99f09fcc7c..1d2d798658aa 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -11602,8 +11602,6 @@ svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
 svx/source/sidebar/line/LinePropertyPanel.cxx
 svx/source/sidebar/line/LinePropertyPanel.hxx
 svx/source/sidebar/line/LinePropertyPanelBase.cxx
-svx/source/sidebar/line/LineWidthValueSet.cxx
-svx/source/sidebar/line/LineWidthValueSet.hxx
 svx/source/sidebar/media/MediaPlaybackPanel.cxx
 svx/source/sidebar/media/MediaPlaybackPanel.hxx
 svx/source/sidebar/nbdtmg.cxx
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index 9ba2b77f6aaa..f4e4c7fe644d 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -244,7 +244,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
     svx/source/sidebar/graphic/GraphicPropertyPanel \
     svx/source/sidebar/line/LinePropertyPanel \
     svx/source/sidebar/line/LinePropertyPanelBase \
-    svx/source/sidebar/line/LineWidthValueSet \
     svx/source/sidebar/line/LineWidthPopup \
     $(call 
gb_Helper_optional,AVMEDIA,svx/source/sidebar/media/MediaPlaybackPanel) \
     svx/source/sidebar/possize/PosSizePropertyPanel \
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx 
b/svx/source/sidebar/line/LineWidthPopup.cxx
index bce334b6dc93..803714ba4310 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -26,8 +26,10 @@
 #include <unotools/viewoptions.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
-#include "LineWidthValueSet.hxx"
 #include <bitmaps.hlst>
+#include <comphelper/lok.hxx>
+#include <vcl/virdev.hxx>
+#include <i18nlangtag/mslangid.hxx>
 
 namespace svx::sidebar
 {
@@ -43,11 +45,9 @@ LineWidthPopup::LineWidthPopup(weld::Widget* pParent, 
LinePropertyPanelBase& rPa
     , m_aIMGCus(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM)
     , m_aIMGCusGray(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM_GRAY)
     , m_xMFWidth(m_xBuilder->weld_metric_spin_button(u"spin"_ustr, 
FieldUnit::POINT))
-    , m_xVSWidth(new LineWidthValueSet())
-    , m_xVSWidthWin(new weld::CustomWeld(*m_xBuilder, u"lineset"_ustr, 
*m_xVSWidth))
+    , m_xIVWidth(m_xBuilder->weld_icon_view(u"line_iconview"_ustr))
+    , aPreviewSize(300, 20)
 {
-    m_xVSWidth->SetStyle(m_xVSWidth->GetStyle() | WB_3DLOOK | 
WB_NO_DIRECTSELECT);
-
     maStrUnits[0] = "0.5";
     maStrUnits[1] = "0.8";
     maStrUnits[2] = "1.0";
@@ -68,39 +68,63 @@ LineWidthPopup::LineWidthPopup(weld::Widget* pParent, 
LinePropertyPanelBase& rPa
         maStrUnits[i] += m_sPt;
     }
 
-    for (sal_uInt16 i = 1; i <= 9; ++i)
-    {
-        m_xVSWidth->InsertItem(i);
-        m_xVSWidth->SetItemText(i, maStrUnits[i - 1]);
-    }
+    PopulateIconView();
 
-    m_xVSWidth->SetUnit(maStrUnits);
-    m_xVSWidth->SetItemData(1, reinterpret_cast<void*>(5));
-    m_xVSWidth->SetItemData(2, reinterpret_cast<void*>(8));
-    m_xVSWidth->SetItemData(3, reinterpret_cast<void*>(10));
-    m_xVSWidth->SetItemData(4, reinterpret_cast<void*>(15));
-    m_xVSWidth->SetItemData(5, reinterpret_cast<void*>(23));
-    m_xVSWidth->SetItemData(6, reinterpret_cast<void*>(30));
-    m_xVSWidth->SetItemData(7, reinterpret_cast<void*>(45));
-    m_xVSWidth->SetItemData(8, reinterpret_cast<void*>(60));
-    m_xVSWidth->SetImage(m_aIMGCusGray);
+    m_xIVWidth->connect_item_activated(LINK(this, LineWidthPopup, 
ItemActivatedHdl));
 
-    m_xVSWidth->SetSelItem(0);
+    // Avoid LibreOffice Kit crash: tooltip handlers cause segfault during 
JSDialog
+    // serialization when popup widgets are destroyed/recreated during 
character formatting resets.
+    // Tooltip event binding is not needed for LibreOffice Kit
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        m_xIVWidth->connect_query_tooltip(LINK(this, LineWidthPopup, 
QueryTooltipHdl));
+    }
 
-    m_xVSWidth->SetSelectHdl(LINK(this, LineWidthPopup, VSSelectHdl));
     m_xMFWidth->connect_value_changed(LINK(this, LineWidthPopup, MFModifyHdl));
 }
 
 LineWidthPopup::~LineWidthPopup() {}
 
-IMPL_LINK_NOARG(LineWidthPopup, VSSelectHdl, ValueSet*, void)
+IMPL_LINK_NOARG(LineWidthPopup, ItemActivatedHdl, weld::IconView&, bool)
 {
-    sal_uInt16 iPos = m_xVSWidth->GetSelectedItemId();
+    OUString sSelectedId = m_xIVWidth->get_selected_id();
+    if (sSelectedId.isEmpty())
+        return false;
+
+    sal_uInt32 iPos = sSelectedId.toUInt32();
+
     if (iPos >= 1 && iPos <= 8)
     {
-        sal_IntPtr nVal = OutputDevice::LogicToLogic(
-            reinterpret_cast<sal_IntPtr>(m_xVSWidth->GetItemData(iPos)), 
MapUnit::MapPoint,
-            m_eMapUnit);
+        sal_IntPtr nVal = 0;
+        switch (iPos - 1)
+        {
+            case 0:
+                nVal = 5;
+                break; // 0.5pt
+            case 1:
+                nVal = 8;
+                break; // 0.8pt
+            case 2:
+                nVal = 10;
+                break; // 1.0pt
+            case 3:
+                nVal = 15;
+                break; // 1.5pt
+            case 4:
+                nVal = 23;
+                break; // 2.3pt
+            case 5:
+                nVal = 30;
+                break; // 3.0pt
+            case 6:
+                nVal = 45;
+                break; // 4.5pt
+            case 7:
+                nVal = 60;
+                break; // 6.0pt
+        }
+
+        nVal = OutputDevice::LogicToLogic(nVal, MapUnit::MapPoint, m_eMapUnit);
         nVal = m_xMFWidth->denormalize(nVal);
         XLineWidthItem aWidthItem(nVal);
         m_rParent.setLineWidth(aWidthItem);
@@ -119,12 +143,6 @@ IMPL_LINK_NOARG(LineWidthPopup, VSSelectHdl, ValueSet*, 
void)
             m_rParent.setLineWidth(aWidthItem);
             m_rParent.SetWidth(nVal);
         }
-        else
-        {
-            m_xVSWidth->SetNoSelection(); //add , set no selection and keep 
the last select item
-            m_xVSWidth->SetFormat();
-            m_xVSWidth->Invalidate();
-        }
         //modify end
     }
 
@@ -132,16 +150,14 @@ IMPL_LINK_NOARG(LineWidthPopup, VSSelectHdl, ValueSet*, 
void)
     {
         m_rParent.EndLineWidthPopup();
     }
+
+    return true;
 }
 
 IMPL_LINK_NOARG(LineWidthPopup, MFModifyHdl, weld::MetricSpinButton&, void)
 {
-    if (m_xVSWidth->GetSelItem())
-    {
-        m_xVSWidth->SetSelItem(0);
-        m_xVSWidth->SetFormat();
-        m_xVSWidth->Invalidate();
-    }
+    m_xIVWidth->unselect_all();
+
     tools::Long nTmp = 
static_cast<tools::Long>(m_xMFWidth->get_value(FieldUnit::NONE));
     tools::Long nVal = OutputDevice::LogicToLogic(nTmp, MapUnit::MapPoint, 
m_eMapUnit);
     sal_Int32 nNewWidth = static_cast<short>(m_xMFWidth->denormalize(nVal));
@@ -149,11 +165,24 @@ IMPL_LINK_NOARG(LineWidthPopup, MFModifyHdl, 
weld::MetricSpinButton&, void)
     m_rParent.setLineWidth(aWidthItem);
 }
 
+IMPL_LINK(LineWidthPopup, QueryTooltipHdl, const weld::TreeIter&, rIter, 
OUString)
+{
+    OUString sId = m_xIVWidth->get_id(rIter);
+    sal_uInt16 iPos = sId.toUInt32();
+    if (iPos >= 1 && iPos <= 8)
+        return maStrUnits[iPos - 1];
+    else if (iPos == 9)
+        return m_bCustom ? 
(OUString::number(static_cast<double>(m_nCustomWidth) / 10) + m_sPt)
+                         : maStrUnits[8];
+    return OUString();
+}
+
 void LineWidthPopup::SetWidthSelect(tools::Long lValue, bool bValuable, 
MapUnit eMapUnit)
 {
     m_bVSFocus = true;
-    m_xVSWidth->SetSelItem(0);
+    m_xIVWidth->unselect_all();
     m_eMapUnit = eMapUnit;
+
     SvtViewOptions aWinOpt(EViewType::Window, u"PopupPanel_LineWidth"_ustr);
     if (aWinOpt.Exists())
     {
@@ -165,18 +194,19 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, 
bool bValuable, MapUnit
         OUString aWinData(aTmp);
         m_nCustomWidth = aWinData.toInt32();
         m_bCustom = true;
-        m_xVSWidth->SetImage(m_aIMGCus);
-        m_xVSWidth->SetCusEnable(true);
 
         OUString aStrTip = 
OUString::number(static_cast<double>(m_nCustomWidth) / 10) + m_sPt;
-        m_xVSWidth->SetItemText(9, aStrTip);
+        VclPtr<VirtualDevice> aCustomVDev = CreateCustomPreview(m_aIMGCus, 
aStrTip, true);
+        m_xIVWidth->set_image(8, aCustomVDev);
+        m_xIVWidth->set_text(8, aStrTip);
     }
     else
     {
         m_bCustom = false;
-        m_xVSWidth->SetImage(m_aIMGCusGray);
-        m_xVSWidth->SetCusEnable(false);
-        m_xVSWidth->SetItemText(9, maStrUnits[8]);
+        VclPtr<VirtualDevice> aCustomVDev
+            = CreateCustomPreview(m_aIMGCusGray, maStrUnits[8], false);
+        m_xIVWidth->set_image(8, aCustomVDev);
+        m_xIVWidth->set_text(8, maStrUnits[8]);
     }
 
     if (bValuable)
@@ -196,7 +226,7 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, 
bool bValuable, MapUnit
     {
         if (strCurrValue == maStrUnits[i])
         {
-            m_xVSWidth->SetSelItem(i + 1);
+            m_xIVWidth->select(i);
             break;
         }
     }
@@ -204,21 +234,110 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, 
bool bValuable, MapUnit
     if (i >= 8)
     {
         m_bVSFocus = false;
-        m_xVSWidth->SetSelItem(0);
+        m_xIVWidth->unselect_all();
     }
-
-    m_xVSWidth->SetFormat();
-    m_xVSWidth->Invalidate();
 }
 
 void LineWidthPopup::GrabFocus()
 {
     if (m_bVSFocus)
-        m_xVSWidth->GrabFocus();
+        m_xIVWidth->grab_focus();
     else
         m_xMFWidth->grab_focus();
 }
 
+VclPtr<VirtualDevice> LineWidthPopup::CreateLinePreview(sal_uInt16 nLineWidth,
+                                                        const OUString& rText)
+{
+    VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
+    pVDev->SetOutputSizePixel(aPreviewSize);
+
+    // Set background
+    const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
+    pVDev->SetFillColor(rStyleSettings.GetWindowColor());
+
+    // Set font
+    vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS,
+                                                 
MsLangId::getConfiguredSystemLanguage(),
+                                                 
GetDefaultFontFlags::OnlyOne));
+    Size aFontSize = aFont.GetFontSize();
+    aFontSize.setHeight(aPreviewSize.Height() * 3 / 5);
+    aFont.SetFontSize(aFontSize);
+    aFont.SetColor(rStyleSettings.GetFieldTextColor());
+    pVDev->SetFont(aFont);
+
+    // Draw text
+    Point aTextStart(aPreviewSize.Width() * 7 / 9, aPreviewSize.Height() / 6);
+    pVDev->DrawText(aTextStart, rText);
+
+    // Draw line with specified width
+    pVDev->SetLineColor(rStyleSettings.GetFieldTextColor());
+    Point aLineStart(5, (aPreviewSize.Height() - nLineWidth) / 2);
+    Point aLineEnd(aPreviewSize.Width() * 7 / 9 - 10, (aPreviewSize.Height() - 
nLineWidth) / 2);
+
+    for (sal_uInt16 i = 1; i <= nLineWidth; i++)
+    {
+        pVDev->DrawLine(aLineStart, aLineEnd);
+        aLineStart.AdjustY(1);
+        aLineEnd.AdjustY(1);
+    }
+
+    return pVDev;
+}
+
+VclPtr<VirtualDevice> LineWidthPopup::CreateCustomPreview(const Image& rImage,
+                                                          const OUString& 
rText, bool bEnabled)
+{
+    VclPtr<VirtualDevice> pVDev = VclPtr<VirtualDevice>::Create();
+    pVDev->SetOutputSizePixel(aPreviewSize);
+
+    const StyleSettings& rStyleSettings = 
Application::GetSettings().GetStyleSettings();
+    pVDev->SetFillColor(rStyleSettings.GetWindowColor());
+
+    // Draw image
+    Point aImgStart(5, (aPreviewSize.Height() - 23) / 2);
+    pVDev->DrawImage(aImgStart, rImage);
+
+    // Set font and color
+    vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS,
+                                                 
MsLangId::getConfiguredSystemLanguage(),
+                                                 
GetDefaultFontFlags::OnlyOne));
+    Size aFontSize = aFont.GetFontSize();
+    aFontSize.setHeight(aPreviewSize.Height() * 3 / 5);
+    aFont.SetFontSize(aFontSize);
+
+    if (bEnabled)
+        aFont.SetColor(rStyleSettings.GetFieldTextColor());
+    else
+        aFont.SetColor(rStyleSettings.GetDisableColor());
+
+    pVDev->SetFont(aFont);
+
+    // Draw text
+    tools::Rectangle aStrRect(Point(rImage.GetSizePixel().Width() + 20, 
aPreviewSize.Height() / 6),
+                              Size(aPreviewSize.Width() - 
rImage.GetSizePixel().Width() - 25,
+                                   aPreviewSize.Height() - 
aPreviewSize.Height() / 3));
+    pVDev->DrawText(aStrRect, rText, DrawTextFlags::EndEllipsis);
+
+    return pVDev;
+}
+
+void LineWidthPopup::PopulateIconView()
+{
+    m_xIVWidth->clear();
+
+    for (sal_uInt16 i = 1; i <= 8; ++i)
+    {
+        OUString sId = OUString::number(i);
+        VclPtr<VirtualDevice> aPreview = CreateLinePreview(i, maStrUnits[i - 
1]);
+        m_xIVWidth->insert(-1, &maStrUnits[i - 1], &sId, aPreview, nullptr);
+    }
+
+    OUString sCustomId = OUString::number(9);
+    VclPtr<VirtualDevice> aCustomPreview = CreateCustomPreview(m_aIMGCusGray, 
maStrUnits[8], false);
+    m_xIVWidth->insert(-1, &maStrUnits[8], &sCustomId, aCustomPreview, 
nullptr);
+}
+
 } // end of namespace svx::sidebar
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LineWidthValueSet.cxx 
b/svx/source/sidebar/line/LineWidthValueSet.cxx
deleted file mode 100644
index 21e80c00034f..000000000000
--- a/svx/source/sidebar/line/LineWidthValueSet.cxx
+++ /dev/null
@@ -1,168 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include "LineWidthValueSet.hxx"
-
-#include <i18nlangtag/mslangid.hxx>
-#include <vcl/event.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/svapp.hxx>
-
-namespace svx::sidebar {
-
-LineWidthValueSet::LineWidthValueSet()
-    : ValueSet(nullptr)
-    , nSelItem(0)
-    , bCusEnable(false)
-{
-}
-
-void LineWidthValueSet::Resize()
-{
-    SetColCount();
-    SetLineCount(9);
-    ValueSet::Resize();
-}
-
-LineWidthValueSet::~LineWidthValueSet()
-{
-}
-
-void LineWidthValueSet::SetUnit(std::array<OUString,9> const & strUnits)
-{
-    maStrUnits = strUnits;
-}
-
-void LineWidthValueSet::SetSelItem(sal_uInt16 nSel)
-{
-    nSelItem = nSel;
-    if(nSel == 0)
-    {
-        SelectItem(1); // ,false); // 'false' nut supported by AOO
-        SetNoSelection();
-    }
-    else
-    {
-        SelectItem(nSelItem);
-        GrabFocus();
-    }
-}
-
-void LineWidthValueSet::SetImage(const Image& img)
-{
-    imgCus = img;
-}
-
-void LineWidthValueSet::SetCusEnable(bool bEnable)
-{
-    bCusEnable = bEnable;
-}
-
-void  LineWidthValueSet::UserDraw( const UserDrawEvent& rUDEvt )
-{
-    tools::Rectangle aRect = rUDEvt.GetRect();
-    vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
-    sal_uInt16  nItemId = rUDEvt.GetItemId();
-
-    tools::Long nRectHeight = aRect.GetHeight();
-    tools::Long nRectWidth = aRect.GetWidth();
-    Point aBLPos = aRect.TopLeft();
-
-    //const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-    //Color aBackColor(0,0,200);
-    //const Color aTextColor = rStyleSettings.GetFieldTextColor();
-    pDev->Push(vcl::PushFlags::FONT | vcl::PushFlags::LINECOLOR | 
vcl::PushFlags::FILLCOLOR);
-
-    vcl::Font aFont(OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, 
MsLangId::getConfiguredSystemLanguage(), GetDefaultFontFlags::OnlyOne));
-    Size aSize = aFont.GetFontSize();
-    aSize.setHeight( nRectHeight*3/5 );
-    aFont.SetFontSize( aSize );
-
-    Point aLineStart(aBLPos.X() + 5,            aBLPos.Y() + ( nRectHeight - 
nItemId )/2);
-    Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 10, aBLPos.Y() + ( 
nRectHeight - nItemId )/2);
-    if (nItemId == 9)
-    {
-        Point aImgStart(aBLPos.X() + 5,         aBLPos.Y() + ( nRectHeight - 
23 ) / 2);
-        pDev->DrawImage(aImgStart, imgCus);
-
-        tools::Rectangle aStrRect = aRect;
-        aStrRect.AdjustTop(nRectHeight/6 );
-        aStrRect.AdjustBottom( -(nRectHeight/6) );
-        aStrRect.AdjustLeft(imgCus.GetSizePixel().Width() + 20 );
-        if(bCusEnable)
-            
aFont.SetColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor());
-        else
-            
aFont.SetColor(Application::GetSettings().GetStyleSettings().GetDisableColor());
-
-        pDev->SetFont(aFont);
-        pDev->DrawText(aStrRect, maStrUnits[ nItemId - 1 ], 
DrawTextFlags::EndEllipsis);
-    }
-    else
-    {
-        if( nSelItem ==  nItemId )
-        {
-            tools::Rectangle aBackRect = aRect;
-            aBackRect.AdjustTop(3 );
-            aBackRect.AdjustBottom( -2 );
-            pDev->SetFillColor(Color(50,107,197));
-            pDev->DrawRect(aBackRect);
-        }
-        else
-        {
-            pDev->SetFillColor( COL_TRANSPARENT );
-            pDev->DrawRect(aRect);
-        }
-
-        //draw text
-        if(nSelItem ==  nItemId )
-            aFont.SetColor(COL_WHITE);
-        else
-            
aFont.SetColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor());
-        pDev->SetFont(aFont);
-        Point aStart(aBLPos.X() + nRectWidth * 7 / 9 , aBLPos.Y() + 
nRectHeight/6);
-        pDev->DrawText(aStart, maStrUnits[ nItemId - 1 ]);  //can't set 
DrawTextFlags::EndEllipsis here ,or the text will disappear
-
-        //draw line
-        if( nSelItem ==  nItemId )
-            pDev->SetLineColor(COL_WHITE);
-        else
-            
pDev->SetLineColor(Application::GetSettings().GetStyleSettings().GetFieldTextColor());
-
-        for(sal_uInt16 i = 1; i <= nItemId; i++)
-        {
-            pDev->DrawLine(aLineStart,aLineEnd );
-            aLineStart.setY(aLineStart.getY() + 1);
-            aLineEnd.setY  (aLineEnd.getY() + 1);
-        }
-    }
-
-    Invalidate( aRect );
-    pDev->Pop();
-}
-
-void LineWidthValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea)
-{
-    ValueSet::SetDrawingArea(pDrawingArea);
-    Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(80, 12 * 9), 
MapMode(MapUnit::MapAppFont)));
-    pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
-    SetOutputSizePixel(aSize);
-}
-
-} // end of namespace svx::sidebar
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sidebar/line/LineWidthValueSet.hxx 
b/svx/source/sidebar/line/LineWidthValueSet.hxx
deleted file mode 100644
index 225e706a6d6e..000000000000
--- a/svx/source/sidebar/line/LineWidthValueSet.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHVALUESET_HXX
-#define INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHVALUESET_HXX
-
-#include <svtools/valueset.hxx>
-#include <vcl/image.hxx>
-#include <array>
-
-namespace svx::sidebar {
-
-class LineWidthValueSet final : public ValueSet
-{
-public:
-    explicit LineWidthValueSet();
-    virtual ~LineWidthValueSet() override;
-
-    void SetUnit(std::array<OUString,9> const & strUnits);
-    void SetSelItem(sal_uInt16 nSel);
-    sal_uInt16 GetSelItem() const { return nSelItem;}
-    void SetImage(const Image& img);
-    void SetCusEnable(bool bEnable);
-
-    virtual void    UserDraw( const UserDrawEvent& rUDEvt ) override;
-    virtual void    Resize() override;
-    virtual void    SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
-
-private:
-    sal_uInt16          nSelItem;
-    std::array<OUString,9> maStrUnits;
-    Image           imgCus;
-    bool            bCusEnable;
-};
-
-} // end of namespace svx::sidebar
-
-#endif // INCLUDED_SVX_SOURCE_SIDEBAR_LINE_LINEWIDTHVALUESET_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/floatinglineproperty.ui 
b/svx/uiconfig/ui/floatinglineproperty.ui
index 9fd191aa51bd..50b54976c60b 100644
--- a/svx/uiconfig/ui/floatinglineproperty.ui
+++ b/svx/uiconfig/ui/floatinglineproperty.ui
@@ -2,6 +2,14 @@
 <!-- Generated with glade 3.22.1 -->
 <interface domain="svx">
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name pixbuf -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkPopover" id="FloatingLineProperty">
     <property name="can_focus">False</property>
     <property name="no_show_all">True</property>
@@ -16,27 +24,29 @@
         <property name="vexpand">True</property>
         <property name="row_spacing">6</property>
         <child>
-          <object class="GtkScrolledWindow" id="valuesetwin">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
             <property name="hscrollbar_policy">never</property>
             <property name="vscrollbar_policy">never</property>
+            <property name="height-request">240</property>
             <property name="shadow_type">in</property>
             <child>
-              <object class="GtkViewport">
+              <object class="GtkIconView" id="line_iconview">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <object class="GtkDrawingArea" id="lineset">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | 
GDK_STRUCTURE_MASK</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                  </object>
-                </child>
+                <property name="can-focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore1</property>
+                <property name="pixbuf-column">0</property>
+                <property name="selection-mode">single</property>
+                <property name="activate-on-single-click">True</property>
+                <property name="item-padding">2</property>
+                <property name="row-spacing">2</property>
+                <property name="column-spacing">2</property>
+                <property name="margin">2</property>
               </object>
             </child>
           </object>
commit 82bd7fdedb6e8f2de630a127412967c5897a32ac
Author:     Parth Raiyani <[email protected]>
AuthorDate: Wed Aug 20 17:35:04 2025 +0530
Commit:     Szymon Kłos <[email protected]>
CommitDate: Sun Sep 14 15:25:15 2025 +0200

    Replaces ValueSet with IconView for line style selection
    
    - Updates the UI layout to use GtkIconView with better configuration 
options.
    - Simplifies logic for filling and updating the selection view.
    - Adds support for tooltips and single-click activation.
    - Removes obsolete code related to ValueSet, including custom sizing logic.
    
    Change-Id: Ie8ba152b12440593d86bbdde156c4132445c8d72
    Signed-off-by: Parth Raiyani <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189881
    Reviewed-by: Szymon Kłos <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/svx/itemwin.hxx b/include/svx/itemwin.hxx
index 5d434d1ae9b8..bcaa4005af51 100644
--- a/include/svx/itemwin.hxx
+++ b/include/svx/itemwin.hxx
@@ -25,19 +25,18 @@
 #include <vcl/customweld.hxx>
 
 class SfxObjectShell;
-class ValueSet;
 class SvxLineStyleToolBoxControl;
 
 class SvxLineBox final : public WeldToolbarPopup
 {
     rtl::Reference<SvxLineStyleToolBoxControl> mxControl;
-    std::unique_ptr<ValueSet> mxLineStyleSet;
-    std::unique_ptr<weld::CustomWeld> mxLineStyleSetWin;
+    std::unique_ptr<weld::IconView> mxLineStyleIV;
 
     void FillControl();
     void Fill(const XDashListRef& pList);
 
-    DECL_LINK(SelectHdl, ValueSet*, void);
+    DECL_LINK(ItemActivatedHdl, weld::IconView&, bool);
+    DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
 
     virtual void GrabFocus() override;
 
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 1bce54a29d45..b0067fef018c 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -26,7 +26,6 @@
 
 #include <svtools/toolbarmenu.hxx>
 #include <svtools/popupwindowcontroller.hxx>
-#include <svtools/valueset.hxx>
 
 #include <svx/strings.hrc>
 #include <svx/svxids.hrc>
@@ -56,7 +55,6 @@ using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star;
 
 // For End Line Controller
-#define MAX_LINES 12
 
 SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( const 
css::uno::Reference<css::uno::XComponentContext>& rContext )
     : svt::PopupWindowController( rContext, nullptr, OUString() )
@@ -548,21 +546,27 @@ 
com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation(
 SvxLineBox::SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* 
pParent, int nInitialIndex)
     : WeldToolbarPopup(pControl->getFrameInterface(), pParent, 
u"svx/ui/floatinglinestyle.ui"_ustr, u"FloatingLineStyle"_ustr)
     , mxControl(pControl)
-    , mxLineStyleSet(new 
ValueSet(m_xBuilder->weld_scrolled_window(u"valuesetwin"_ustr, true)))
-    , mxLineStyleSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, 
*mxLineStyleSet))
+    , 
mxLineStyleIV(m_xBuilder->weld_icon_view(u"floating_line_style_iconview"_ustr))
 {
-    mxLineStyleSet->SetStyle(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | 
WB_NO_DIRECTSELECT);
-
     FillControl();
 
-    mxLineStyleSet->SelectItem(nInitialIndex + 1);
+    if (nInitialIndex >= 0)
+        mxLineStyleIV->select(nInitialIndex);
+
+    mxLineStyleIV->connect_item_activated( LINK( this, SvxLineBox, 
ItemActivatedHdl ) );
 
-    mxLineStyleSet->SetSelectHdl( LINK( this, SvxLineBox, SelectHdl ) );
+    // Avoid LibreOffice Kit crash: tooltip handlers cause segfault during 
JSDialog
+    // serialization when popup widgets are destroyed/recreated during 
character formatting resets.
+    // Tooltip event binding is not needed for LibreOffice Kit
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        mxLineStyleIV->connect_query_tooltip(LINK(this, SvxLineBox, 
QueryTooltipHdl));
+    }
 }
 
 void SvxLineBox::GrabFocus()
 {
-    mxLineStyleSet->GrabFocus();
+    mxLineStyleIV->grab_focus();
 }
 
 SvxLineBox::~SvxLineBox()
@@ -573,18 +577,24 @@ SvxLineBox::~SvxLineBox()
 
 void SvxLineBox::Fill( const XDashListRef &pList )
 {
-    mxLineStyleSet->Clear();
+    mxLineStyleIV->clear();
 
     if( !pList.is() )
         return;
 
     // entry for 'none'
-    mxLineStyleSet->InsertItem(1, Image(), pList->GetStringForUiNoLine());
+    ScopedVclPtrInstance< VirtualDevice > pVDEmpty;
+    
pVDEmpty->SetOutputSizePixel(pList->GetBitmapForUISolidLine().GetSizePixel(), 
false);
+    pVDEmpty->Erase(); // Uses default white background
+    mxLineStyleIV->append(u"1"_ustr, pList->GetStringForUiNoLine(), 
pVDEmpty.get());
 
     // entry for solid line
-    const auto& rBmp = pList->GetBitmapForUISolidLine();
+    ScopedVclPtrInstance< VirtualDevice > pVDSolid;
+    const BitmapEx& rBmp = pList->GetBitmapForUISolidLine();
     Size aBmpSize = rBmp.GetSizePixel();
-    mxLineStyleSet->InsertItem(2, Image(rBmp), 
pList->GetStringForUiSolidLine());
+    pVDSolid->SetOutputSizePixel(aBmpSize, false);
+    pVDSolid->DrawBitmapEx(Point(), rBmp);
+    mxLineStyleIV->append(u"2"_ustr, pList->GetStringForUiSolidLine(), 
pVDSolid.get());
 
     // entries for dashed lines
     tools::Long nCount = pList->Count();
@@ -593,32 +603,24 @@ void SvxLineBox::Fill( const XDashListRef &pList )
         const XDashEntry* pEntry = pList->GetDash(i);
         const BitmapEx aBitmap = pList->GetUiBitmap(i);
 
-        mxLineStyleSet->InsertItem(i + 3, Image(aBitmap), pEntry->GetName());
-    }
-
-    sal_uInt16 nLines = std::min( static_cast<sal_uInt16>(nCount + 2), 
sal_uInt16(MAX_LINES) );
-    mxLineStyleSet->SetLineCount(nLines);
-
-    WinBits nBits = mxLineStyleSet->GetStyle();
-    if ( nLines == mxLineStyleSet->GetItemCount() )
-        nBits &= ~WB_VSCROLL;
-    else
-        nBits |= WB_VSCROLL;
-    mxLineStyleSet->SetStyle( nBits );
+        ScopedVclPtrInstance< VirtualDevice > pVDDash;
+        Size aDashSize = aBitmap.GetSizePixel();
+        pVDDash->SetOutputSizePixel(aDashSize, false);
+        pVDDash->DrawBitmapEx(Point(), aBitmap);
 
-    Size aSize(aBmpSize);
-    aSize.AdjustWidth(6);
-    aSize.AdjustHeight(6);
-    aSize = mxLineStyleSet->CalcWindowSizePixel(aSize);
-    mxLineStyleSet->GetDrawingArea()->set_size_request(aSize.Width(), 
aSize.Height());
-    mxLineStyleSet->SetOutputSizePixel(aSize);
+        mxLineStyleIV->append(OUString::number(i + 3), pEntry->GetName(), 
pVDDash.get());
+    }
 }
 
-IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void)
+IMPL_LINK_NOARG(SvxLineBox, ItemActivatedHdl, weld::IconView&, bool)
 {
+    OUString sId = mxLineStyleIV->get_selected_id();
+    if (sId.isEmpty())
+        return false;
+
     drawing::LineStyle eXLS;
-    sal_Int32 nPos = mxLineStyleSet->GetSelectedItemId();
-    --nPos; // ids start at 1, get the pos of the id
+    sal_Int32 nPos = sId.toUInt32();
+    --nPos; // Convert from 1-based ID to 0-based position
 
     switch ( nPos )
     {
@@ -668,6 +670,53 @@ IMPL_LINK_NOARG(SvxLineBox, SelectHdl, ValueSet*, void)
     mxControl->dispatchLineStyleCommand(u".uno:XLineStyle"_ustr, aArgs);
 
     mxControl->EndPopupMode();
+
+    return true;
+}
+
+IMPL_LINK(SvxLineBox, QueryTooltipHdl, const weld::TreeIter&, rIter, OUString)
+{
+    OUString sId = mxLineStyleIV->get_id(rIter);
+    if (sId.isEmpty())
+        return OUString();
+
+    sal_Int32 nPos = sId.toUInt32();
+    --nPos; // Convert from 1-based ID to 0-based position
+
+    SfxObjectShell* pSh = SfxObjectShell::Current();
+    if (!pSh)
+        return OUString();
+
+    const SvxDashListItem* pItem = pSh->GetItem(SID_DASH_LIST);
+    if (!pItem)
+        return OUString();
+
+    XDashListRef pList = pItem->GetDashList();
+    if (!pList.is())
+        return OUString();
+
+    switch (nPos)
+    {
+        case 0:
+            return pList->GetStringForUiNoLine();
+        case 1:
+            return pList->GetStringForUiSolidLine();
+        default:
+        {
+            tools::Long nDashIndex = nPos - 2;
+            if (nDashIndex >= 0 && nDashIndex < pList->Count())
+            {
+                const XDashEntry* pEntry = pList->GetDash(nDashIndex);
+                if (pEntry)
+                {
+                    return pEntry->GetName();
+                }
+            }
+            break;
+        }
+    }
+
+    return OUString();
 }
 
 void SvxLineBox::FillControl()
diff --git a/svx/uiconfig/ui/floatinglinestyle.ui 
b/svx/uiconfig/ui/floatinglinestyle.ui
index fcecff19e962..9f394c2f7a74 100644
--- a/svx/uiconfig/ui/floatinglinestyle.ui
+++ b/svx/uiconfig/ui/floatinglinestyle.ui
@@ -2,6 +2,14 @@
 <!-- Generated with glade 3.22.1 -->
 <interface domain="svx">
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name pixbuf -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkPopover" id="FloatingLineStyle">
     <property name="can_focus">False</property>
     <property name="no_show_all">True</property>
@@ -14,27 +22,29 @@
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkScrolledWindow" id="valuesetwin">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <property name="hscrollbar_policy">never</property>
-            <property name="vscrollbar_policy">never</property>
+            <property name="hscrollbar-policy">never</property>
+            <property name="vscrollbar-policy">always</property>
             <property name="shadow_type">in</property>
+            <property name="height-request">264</property>
             <child>
-              <object class="GtkViewport">
+              <object class="GtkIconView" id="floating_line_style_iconview">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <object class="GtkDrawingArea" id="valueset">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | 
GDK_STRUCTURE_MASK</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                  </object>
-                </child>
+                <property name="can-focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore1</property>
+                <property name="pixbuf-column">0</property>
+                <property name="selection-mode">single</property>
+                <property name="activate-on-single-click">True</property>
+                <property name="item-padding">2</property>
+                <property name="row-spacing">2</property>
+                <property name="column-spacing">2</property>
+                <property name="margin">2</property>
               </object>
             </child>
           </object>
commit b9bc7d9e2304fd26e415df224c43884efe80c5e6
Author:     Parth Raiyani <[email protected]>
AuthorDate: Tue Aug 19 16:37:57 2025 +0530
Commit:     Szymon Kłos <[email protected]>
CommitDate: Sun Sep 14 15:25:08 2025 +0200

    Replaces ValueSet with IconView for line end selection
    
    - Updates the UI layout to use GtkIconView with better configuration 
options.
    - Simplifies logic for filling and updating the selection view.
    - Adds support for tooltips and single-click activation.
    - Removes obsolete code related to ValueSet, including custom sizing logic.
    
    Change-Id: I2bb486cc4e062fcfaec5c478958337b4af59c47b
    Signed-off-by: Parth Raiyani <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189880
    Reviewed-by: Szymon Kłos <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 617bdb8f8fbc..1bce54a29d45 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -247,18 +247,16 @@ class SvxLineEndWindow final : public WeldToolbarPopup
 private:
     XLineEndListRef mpLineEndList;
     rtl::Reference<SvxLineEndToolBoxControl> mxControl;
-    std::unique_ptr<ValueSet> mxLineEndSet;
-    std::unique_ptr<weld::CustomWeld> mxLineEndSetWin;
-    sal_uInt16 mnLines;
+    std::unique_ptr<weld::IconView> mxLineEndIV;
     Size maBmpSize;
 
-    DECL_LINK( SelectHdl, ValueSet*, void );
-    void FillValueSet();
-    void SetSize();
+    DECL_LINK( ItemActivatedHdl, weld::IconView&, bool );
+    DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
+    void FillIconView();
 
     virtual void GrabFocus() override
     {
-        mxLineEndSet->GrabFocus();
+        mxLineEndIV->grab_focus();
     }
 
 public:
@@ -268,17 +266,12 @@ public:
 
 }
 
-constexpr sal_uInt16 gnCols = 2;
-
 SvxLineEndWindow::SvxLineEndWindow(SvxLineEndToolBoxControl* pControl, 
weld::Widget* pParent)
     : WeldToolbarPopup(pControl->getFrameInterface(), pParent, 
u"svx/ui/floatinglineend.ui"_ustr, u"FloatingLineEnd"_ustr)
     , mxControl(pControl)
-    , mxLineEndSet(new 
ValueSet(m_xBuilder->weld_scrolled_window(u"valuesetwin"_ustr, true)))
-    , mxLineEndSetWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, 
*mxLineEndSet))
-    , mnLines(12)
+    , 
mxLineEndIV(m_xBuilder->weld_icon_view(u"floating_line_end_iconview"_ustr))
 {
-    mxLineEndSet->SetStyle(mxLineEndSet->GetStyle() | WB_ITEMBORDER | 
WB_3DLOOK | WB_NO_DIRECTSELECT);
-    mxLineEndSet->SetHelpId(HID_POPUP_LINEEND_CTRL);
+    mxLineEndIV->set_help_id(HID_POPUP_LINEEND_CTRL);
     m_xTopLevel->set_help_id(HID_POPUP_LINEEND);
 
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
@@ -290,20 +283,32 @@ 
SvxLineEndWindow::SvxLineEndWindow(SvxLineEndToolBoxControl* pControl, weld::Wid
     }
     DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
 
-    mxLineEndSet->SetSelectHdl( LINK( this, SvxLineEndWindow, SelectHdl ) );
-    mxLineEndSet->SetColCount( gnCols );
+    mxLineEndIV->connect_item_activated( LINK( this, SvxLineEndWindow, 
ItemActivatedHdl ) );
 
-    // ValueSet fill with entries of LineEndList
-    FillValueSet();
+    // Avoid LibreOffice Kit crash: tooltip handlers cause segfault during 
JSDialog
+    // serialization when popup widgets are destroyed/recreated during 
character formatting resets.
+    // Tooltip event binding is not needed for LibreOffice Kit
+    if (!comphelper::LibreOfficeKit::isActive())
+    {
+        mxLineEndIV->connect_query_tooltip(LINK(this, SvxLineEndWindow, 
QueryTooltipHdl));
+    }
+
+    // IconView fill with entries of LineEndList
+    FillIconView();
 
     AddStatusListener( u".uno:LineEndListState"_ustr);
 }
 
-IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
+IMPL_LINK_NOARG(SvxLineEndWindow, ItemActivatedHdl, weld::IconView&, bool)
 {
     std::unique_ptr<XLineEndItem> pLineEndItem;
     std::unique_ptr<XLineStartItem> pLineStartItem;
-    sal_uInt16 nId = mxLineEndSet->GetSelectedItemId();
+
+    OUString sId = mxLineEndIV->get_selected_id();
+    if (sId.isEmpty())
+        return false;
+
+    sal_uInt32 nId = sId.toUInt32();
 
     if( nId == 1 )
     {
@@ -342,14 +347,54 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, 
void)
     /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() 
call.
         This instance may be deleted in the meantime (i.e. when a dialog is 
opened
         while in Dispatch()), accessing members will crash in this case. */
-    mxLineEndSet->SetNoSelection();
+    mxLineEndIV->unselect_all();
 
     mxControl->dispatchCommand(mxControl->getCommandURL(), aArgs);
 
     mxControl->EndPopupMode();
+
+    return true;
+}
+
+IMPL_LINK(SvxLineEndWindow, QueryTooltipHdl, const weld::TreeIter&, rIter, 
OUString)
+{
+    OUString sId = mxLineEndIV->get_id(rIter);
+    if (sId.isEmpty())
+        return OUString();
+
+    sal_uInt16 nId = sId.toUInt32();
+
+    if (nId == 1 || nId == 2)
+    {
+        return SvxResId(RID_SVXSTR_NONE);
+    }
+
+    if (!mpLineEndList.is())
+        return OUString();
+
+    tools::Long nEntryIndex;
+    if (nId % 2) // beginning of line
+    {
+        nEntryIndex = (nId - 1) / 2 - 1;
+    }
+    else // end of line
+    {
+        nEntryIndex = nId / 2 - 2;
+    }
+
+    if (nEntryIndex >= 0 && nEntryIndex < mpLineEndList->Count())
+    {
+        const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(nEntryIndex);
+        if (pEntry)
+        {
+            return pEntry->GetName();
+        }
+    }
+
+    return OUString();
 }
 
-void SvxLineEndWindow::FillValueSet()
+void SvxLineEndWindow::FillIconView()
 {
     if( !mpLineEndList.is() )
         return;
@@ -375,8 +420,18 @@ void SvxLineEndWindow::FillValueSet()
     Point aPt1( maBmpSize.Width(), 0 );
 
     pVD->DrawBitmapEx( Point(), aBmp );
-    mxLineEndSet->InsertItem(1, Image(pVD->GetBitmapEx(aPt0, maBmpSize)), 
pEntry->GetName());
-    mxLineEndSet->InsertItem(2, Image(pVD->GetBitmapEx(aPt1, maBmpSize)), 
pEntry->GetName());
+
+    // First half (left side)
+    ScopedVclPtrInstance< VirtualDevice > pVD1;
+    pVD1->SetOutputSizePixel( maBmpSize, false );
+    pVD1->DrawBitmapEx( Point(), pVD->GetBitmapEx(aPt0, maBmpSize) );
+    mxLineEndIV->append(u"1"_ustr, pEntry->GetName(), pVD1.get());
+
+    // Second half (right side)
+    ScopedVclPtrInstance< VirtualDevice > pVD2;
+    pVD2->SetOutputSizePixel( maBmpSize, false );
+    pVD2->DrawBitmapEx( Point(), pVD->GetBitmapEx(aPt1, maBmpSize) );
+    mxLineEndIV->append(u"2"_ustr, pEntry->GetName(), pVD2.get());
 
     mpLineEndList->Remove(nCount);
 
@@ -388,15 +443,19 @@ void SvxLineEndWindow::FillValueSet()
         OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
 
         pVD->DrawBitmapEx( aPt0, aBmp );
-        mxLineEndSet->InsertItem(static_cast<sal_uInt16>((i+1)*2L+1),
-                Image(pVD->GetBitmapEx(aPt0, maBmpSize)), pEntry->GetName());
-        mxLineEndSet->InsertItem(static_cast<sal_uInt16>((i+2)*2L),
-                Image(pVD->GetBitmapEx(aPt1, maBmpSize)), pEntry->GetName());
-    }
-    mnLines = std::min( static_cast<sal_uInt16>(nCount + 1), 
sal_uInt16(MAX_LINES) );
-    mxLineEndSet->SetLineCount( mnLines );
 
-    SetSize();
+        // Left half for line start
+        ScopedVclPtrInstance< VirtualDevice > pVDStart;
+        pVDStart->SetOutputSizePixel( maBmpSize, false );
+        pVDStart->DrawBitmapEx( Point(), pVD->GetBitmapEx(aPt0, maBmpSize) );
+        mxLineEndIV->append(OUString::number((i+1)*2L+1), pEntry->GetName(), 
pVDStart.get());
+
+        // Right half for line end
+        ScopedVclPtrInstance< VirtualDevice > pVDEnd;
+        pVDEnd->SetOutputSizePixel( maBmpSize, false );
+        pVDEnd->DrawBitmapEx( Point(), pVD->GetBitmapEx(aPt1, maBmpSize) );
+        mxLineEndIV->append(OUString::number((i+2)*2L), pEntry->GetName(), 
pVDEnd.get());
+    }
 }
 
 void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& 
rEvent )
@@ -411,31 +470,11 @@ void SvxLineEndWindow::statusChanged( const 
css::frame::FeatureStateEvent& rEven
         mpLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
         DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
 
-        mxLineEndSet->Clear();
-        FillValueSet();
+        mxLineEndIV->clear();
+        FillIconView();
     }
 }
 
-void SvxLineEndWindow::SetSize()
-{
-    sal_uInt16 nItemCount = mxLineEndSet->GetItemCount();
-    sal_uInt16 nMaxLines  = nItemCount / gnCols;
-
-    WinBits nBits = mxLineEndSet->GetStyle();
-    if ( mnLines == nMaxLines )
-        nBits &= ~WB_VSCROLL;
-    else
-        nBits |= WB_VSCROLL;
-    mxLineEndSet->SetStyle( nBits );
-
-    Size aSize( maBmpSize );
-    aSize.AdjustWidth(6 );
-    aSize.AdjustHeight(6 );
-    aSize = mxLineEndSet->CalcWindowSizePixel( aSize );
-    mxLineEndSet->GetDrawingArea()->set_size_request(aSize.Width(), 
aSize.Height());
-    mxLineEndSet->SetOutputSizePixel(aSize);
-}
-
 SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( const 
css::uno::Reference<css::uno::XComponentContext>& rContext )
     : svt::PopupWindowController( rContext, nullptr, OUString() )
 {
diff --git a/svx/uiconfig/ui/floatinglineend.ui 
b/svx/uiconfig/ui/floatinglineend.ui
index a83a2eb5c3f1..039edc17b62f 100644
--- a/svx/uiconfig/ui/floatinglineend.ui
+++ b/svx/uiconfig/ui/floatinglineend.ui
@@ -2,6 +2,14 @@
 <!-- Generated with glade 3.22.1 -->
 <interface domain="svx">
   <requires lib="gtk+" version="3.20"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name pixbuf -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkPopover" id="FloatingLineEnd">
     <property name="can_focus">False</property>
     <property name="no_show_all">True</property>
@@ -14,26 +22,30 @@
         <property name="orientation">vertical</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkScrolledWindow" id="valuesetwin">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <property name="hscrollbar_policy">never</property>
+            <property name="hscrollbar-policy">never</property>
+            <property name="vscrollbar-policy">always</property>
             <property name="shadow_type">in</property>
+            <property name="height-request">264</property>
             <child>
-              <object class="GtkViewport">
+              <object class="GtkIconView" id="floating_line_end_iconview">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <child>
-                  <object class="GtkDrawingArea" id="valueset">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | 
GDK_STRUCTURE_MASK</property>
-                    <property name="hexpand">True</property>
-                    <property name="vexpand">True</property>
-                  </object>
-                </child>
+                <property name="can-focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore1</property>
+                <property name="pixbuf-column">0</property>
+                <property name="columns">2</property>
+                <property name="selection-mode">single</property>
+                <property name="activate-on-single-click">True</property>
+                <property name="item-padding">2</property>
+                <property name="row-spacing">2</property>
+                <property name="column-spacing">2</property>
+                <property name="margin">2</property>
               </object>
             </child>
           </object>

Reply via email to