extensions/source/propctrlr/browserline.cxx      |   13 ++++++++-----
 extensions/source/propctrlr/browserline.hxx      |    7 ++++---
 extensions/source/propctrlr/browserlistbox.cxx   |   17 +++++++++++------
 extensions/source/propctrlr/browserlistbox.hxx   |    2 +-
 extensions/uiconfig/spropctrlr/ui/browserpage.ui |   13 ++++++++-----
 5 files changed, 32 insertions(+), 20 deletions(-)

New commits:
commit e0afc39fa43cf577d8e67fc3bf48bffa45bb20b6
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Jan 20 14:56:04 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Jan 22 11:14:46 2026 +0100

    propctrlr: Switch OBrowserLine::m_pParent to reference
    
    Change-Id: I4312499ca8592fcd6f22fc186d11b24bcbd9ac04
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197673
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/extensions/source/propctrlr/browserline.cxx 
b/extensions/source/propctrlr/browserline.cxx
index a3eaa4882536..b2103316b583 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -49,17 +49,17 @@ using ::com::sun::star::graphic::XGraphic;
 
 namespace PropertyLineElement = 
::com::sun::star::inspection::PropertyLineElement;
 
-OBrowserLine::OBrowserLine(OUString aEntryName, weld::Grid* pParent, int 
nGridRowIndex,
+OBrowserLine::OBrowserLine(OUString aEntryName, weld::Grid& rParent, int 
nGridRowIndex,
                            weld::SizeGroup* pLabelGroup, weld::Container* 
pInitialControlParent)
     : m_sEntryName(std::move(aEntryName))
-    , m_xBuilder(Application::CreateBuilder(pParent, 
u"modules/spropctrlr/ui/browserline.ui"_ustr))
+    , m_xBuilder(Application::CreateBuilder(&rParent, 
u"modules/spropctrlr/ui/browserline.ui"_ustr))
     , m_xGrid(m_xBuilder->weld_grid(u"BrowserLine"_ustr))
     , m_xFtTitle(m_xBuilder->weld_label(u"label"_ustr))
     , m_xBrowseButton(m_xBuilder->weld_button(u"browse"_ustr))
     , m_xAdditionalBrowseButton(m_xBuilder->weld_button(u"morebrowse"_ustr))
     // controls start with this as their parent and need to be moved into 
m_xGrid
     , m_pInitialControlParent(pInitialControlParent)
-    , m_pParent(pParent)
+    , m_rParent(rParent)
     , m_pControlWindow(nullptr)
     , m_pBrowseButton(nullptr)
     , m_pAdditionalBrowseButton(nullptr)
@@ -69,8 +69,8 @@ OBrowserLine::OBrowserLine(OUString aEntryName, weld::Grid* 
pParent, int nGridRo
     , m_bIndentTitle(false)
     , m_bReadOnly(false)
 {
-    m_pParent->set_child_top_attach(*m_xGrid, nGridRowIndex);
-    m_pParent->set_child_left_attach(*m_xGrid, 0);
+    m_rParent.set_child_top_attach(*m_xGrid, nGridRowIndex);
+    m_rParent.set_child_left_attach(*m_xGrid, 0);
 
     pLabelGroup->add_widget(m_xFtTitle.get());
 }
@@ -79,7 +79,7 @@ OBrowserLine::~OBrowserLine()
 {
     implHideBrowseButton(true);
     implHideBrowseButton(false);
-    m_pParent->move(m_xGrid.get(), nullptr);
+    m_rParent.move(m_xGrid.get(), nullptr);
 }
 
 void OBrowserLine::IndentTitle(bool _bIndent)
diff --git a/extensions/source/propctrlr/browserline.hxx 
b/extensions/source/propctrlr/browserline.hxx
index 48578b5a2946..201d380fbc38 100644
--- a/extensions/source/propctrlr/browserline.hxx
+++ b/extensions/source/propctrlr/browserline.hxx
@@ -52,7 +52,7 @@ private:
     std::unique_ptr<weld::Button> m_xAdditionalBrowseButton;
     css::uno::Reference<css::inspection::XPropertyControl> m_xControl;
     weld::Container* m_pInitialControlParent;
-    weld::Grid* m_pParent;
+    weld::Grid& m_rParent;
     weld::Widget* m_pControlWindow;
     weld::Button* m_pBrowseButton;
     weld::Button* m_pAdditionalBrowseButton;
@@ -63,7 +63,7 @@ private:
     bool m_bReadOnly;
 
 public:
-    OBrowserLine(OUString aEntryName, weld::Grid* pParent, int nGridRowIndex,
+    OBrowserLine(OUString aEntryName, weld::Grid& rParent, int nGridRowIndex,
                  weld::SizeGroup* pLabelGroup, weld::Container* 
pInitialControlParent);
     ~OBrowserLine();
 
diff --git a/extensions/source/propctrlr/browserlistbox.cxx 
b/extensions/source/propctrlr/browserlistbox.cxx
index deb31e58be24..b714497f6a39 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -462,9 +462,9 @@ void OBrowserListBox::InsertEntry(const OLineDescriptor& 
rPropertyData, sal_uInt
     }
 
     // create a new line
-    BrowserLinePointer pBrowserLine = std::make_shared<OBrowserLine>(
-        rPropertyData.sName, m_xLinesPlayground.get(), nGridRowIndex, 
m_xSizeGroup.get(),
-        m_pInitialControlParent);
+    BrowserLinePointer pBrowserLine
+        = std::make_shared<OBrowserLine>(rPropertyData.sName, 
*m_xLinesPlayground, nGridRowIndex,
+                                         m_xSizeGroup.get(), 
m_pInitialControlParent);
 
     ListBoxLine aNewLine(rPropertyData.sName, pBrowserLine, 
rPropertyData.xPropertyHandler);
     ListBoxLines::size_type nInsertPos = _nPos;
commit 48710c235938866ad6fc93d2929141c200a0702a
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Jan 20 11:34:16 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Jan 22 11:14:37 2026 +0100

    tdf#130857 propctrlr: Use weld::Grid to hold OBrowserLine
    
    Switch the container that contains the OBrowserLine
    widgets from a weld::Box to a weld::Grid.
    
    This is in preparation of letting that Grid
    also take care of ensuring proper column widths
    instead of using a separate weld::SizeGroup
    (OBrowserListBox::m_xSizeGroup) in an upcoming
    commit.
    
    This will also help the qt weld implementation,
    which doesn't support weld::SizeGroup yet.)
    (See the assert in QtInstanceBuilder::create_size_group.)
    
    Change-Id: I113a1f55fb8236577ef0f8d62e67245d7e4d4acf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197672
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/extensions/source/propctrlr/browserline.cxx 
b/extensions/source/propctrlr/browserline.cxx
index eb18b2692f61..a3eaa4882536 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -49,8 +49,8 @@ using ::com::sun::star::graphic::XGraphic;
 
 namespace PropertyLineElement = 
::com::sun::star::inspection::PropertyLineElement;
 
-OBrowserLine::OBrowserLine(OUString aEntryName, weld::Box* pParent, 
weld::SizeGroup* pLabelGroup,
-                           weld::Container* pInitialControlParent)
+OBrowserLine::OBrowserLine(OUString aEntryName, weld::Grid* pParent, int 
nGridRowIndex,
+                           weld::SizeGroup* pLabelGroup, weld::Container* 
pInitialControlParent)
     : m_sEntryName(std::move(aEntryName))
     , m_xBuilder(Application::CreateBuilder(pParent, 
u"modules/spropctrlr/ui/browserline.ui"_ustr))
     , m_xGrid(m_xBuilder->weld_grid(u"BrowserLine"_ustr))
@@ -69,6 +69,9 @@ OBrowserLine::OBrowserLine(OUString aEntryName, weld::Box* 
pParent, weld::SizeGr
     , m_bIndentTitle(false)
     , m_bReadOnly(false)
 {
+    m_pParent->set_child_top_attach(*m_xGrid, nGridRowIndex);
+    m_pParent->set_child_left_attach(*m_xGrid, 0);
+
     pLabelGroup->add_widget(m_xFtTitle.get());
 }
 
diff --git a/extensions/source/propctrlr/browserline.hxx 
b/extensions/source/propctrlr/browserline.hxx
index 29e5dfa65c7d..48578b5a2946 100644
--- a/extensions/source/propctrlr/browserline.hxx
+++ b/extensions/source/propctrlr/browserline.hxx
@@ -52,7 +52,7 @@ private:
     std::unique_ptr<weld::Button> m_xAdditionalBrowseButton;
     css::uno::Reference<css::inspection::XPropertyControl> m_xControl;
     weld::Container* m_pInitialControlParent;
-    weld::Box* m_pParent;
+    weld::Grid* m_pParent;
     weld::Widget* m_pControlWindow;
     weld::Button* m_pBrowseButton;
     weld::Button* m_pAdditionalBrowseButton;
@@ -63,8 +63,8 @@ private:
     bool m_bReadOnly;
 
 public:
-    OBrowserLine(OUString aEntryName, weld::Box* pParent, weld::SizeGroup* 
pLabelGroup,
-                 weld::Container* pInitialControlParent);
+    OBrowserLine(OUString aEntryName, weld::Grid* pParent, int nGridRowIndex,
+                 weld::SizeGroup* pLabelGroup, weld::Container* 
pInitialControlParent);
     ~OBrowserLine();
 
     void setControl(const 
css::uno::Reference<css::inspection::XPropertyControl>& rxControl);
@@ -86,6 +86,7 @@ public:
     int GetRowHeight() const { return m_xGrid->get_preferred_size().Height(); }
     void Show(bool bFlag = true);
     void Hide();
+    weld::Grid& GetGrid() const { return *m_xGrid; }
 
     bool GrabFocus();
     void ShowBrowseButton(const OUString& rImageURL, bool bPrimary);
diff --git a/extensions/source/propctrlr/browserlistbox.cxx 
b/extensions/source/propctrlr/browserlistbox.cxx
index 42758f536f30..deb31e58be24 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -295,7 +295,7 @@ void 
PropertyControlContext_Impl::impl_processEvent_throw(const ::comphelper::An
 
 OBrowserListBox::OBrowserListBox(weld::Builder& rBuilder, weld::Container* 
pContainer)
     : m_xScrolledWindow(rBuilder.weld_scrolled_window(u"scrolledwindow"_ustr))
-    , m_xLinesPlayground(rBuilder.weld_box(u"playground"_ustr))
+    , m_xLinesPlayground(rBuilder.weld_grid(u"playground"_ustr))
     , m_xSizeGroup(rBuilder.create_size_group())
     , m_xHelpWindow(new InspectorHelpWindow(rBuilder))
     , m_pInitialControlParent(pContainer)
@@ -450,17 +450,22 @@ Reference<XPropertyControl> 
OBrowserListBox::GetPropertyControl(const OUString&
 
 void OBrowserListBox::InsertEntry(const OLineDescriptor& rPropertyData, 
sal_uInt16 _nPos)
 {
-    // create a new line
-    BrowserLinePointer pBrowserLine = std::make_shared<OBrowserLine>(
-        rPropertyData.sName, m_xLinesPlayground.get(), m_xSizeGroup.get(), 
m_pInitialControlParent);
-
+    // row index to insert the new line at the end of the grid
+    int nGridRowIndex = 0;
     for (auto const& line : m_aLines)
     {
         // check that the name is unique
         assert(line.aName != rPropertyData.sName && "already have another line 
for this name!");
-        (void)line;
+
+        nGridRowIndex = std::max(
+            nGridRowIndex, 
m_xLinesPlayground->get_child_top_attach(line.pLine->GetGrid()) + 1);
     }
 
+    // create a new line
+    BrowserLinePointer pBrowserLine = std::make_shared<OBrowserLine>(
+        rPropertyData.sName, m_xLinesPlayground.get(), nGridRowIndex, 
m_xSizeGroup.get(),
+        m_pInitialControlParent);
+
     ListBoxLine aNewLine(rPropertyData.sName, pBrowserLine, 
rPropertyData.xPropertyHandler);
     ListBoxLines::size_type nInsertPos = _nPos;
     if (_nPos >= m_aLines.size())
diff --git a/extensions/source/propctrlr/browserlistbox.hxx 
b/extensions/source/propctrlr/browserlistbox.hxx
index 0601e145a2f2..1c4c74a52c4d 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -64,7 +64,7 @@ typedef std::vector<ListBoxLine> ListBoxLines;
 class OBrowserListBox final : public IButtonClickListener
 {
     std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
-    std::unique_ptr<weld::Box> m_xLinesPlayground;
+    std::unique_ptr<weld::Grid> m_xLinesPlayground;
     std::unique_ptr<weld::SizeGroup> m_xSizeGroup;
     std::unique_ptr<InspectorHelpWindow> m_xHelpWindow;
     weld::Container* m_pInitialControlParent;
diff --git a/extensions/uiconfig/spropctrlr/ui/browserpage.ui 
b/extensions/uiconfig/spropctrlr/ui/browserpage.ui
index 21a801060d3b..9d3055915e0f 100644
--- a/extensions/uiconfig/spropctrlr/ui/browserpage.ui
+++ b/extensions/uiconfig/spropctrlr/ui/browserpage.ui
@@ -28,16 +28,19 @@
                 <property name="vexpand">True</property>
                 <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkBox" id="playground">
+                  <!-- n-columns=1 n-rows=1 -->
+                  <object class="GtkGrid" id="playground">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                     <property name="valign">start</property>
+                    <property name="margin-start">6</property>
+                    <property name="margin-end">6</property>
+                    <property name="margin-top">6</property>
+                    <property name="margin-bottom">6</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <property name="border-width">6</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
-                    <property name="homogeneous">True</property>
+                    <property name="row-spacing">6</property>
+                    <property name="row-homogeneous">True</property>
                     <child>
                       <placeholder/>
                     </child>

Reply via email to