[Libreoffice-commits] core.git: sc/source sc/uiconfig vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Mar 10 19:19:05 UTC 2019


 sc/source/ui/dbgui/tpsubt.cxx           |  207 ++++++++++++++------------------
 sc/source/ui/inc/tpsubt.hxx             |   26 ++--
 sc/uiconfig/scalc/ui/subtotalgrppage.ui |  103 +++++++++++++--
 vcl/source/treelist/uiobject.cxx        |   10 -
 4 files changed, 200 insertions(+), 146 deletions(-)

New commits:
commit 57ab849c35ef96bac401893333af5f1e8139263d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 9 20:11:25 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Mar 10 20:18:43 2019 +0100

    weld ScTpSubTotalGroup
    
    Change-Id: Icab13fec62ac69305550fa860700f883ffaaf1f9
    Reviewed-on: https://gerrit.libreoffice.org/68983
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 94f6f95cbb83..cecfad8d77fe 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -35,38 +35,31 @@
 
 // Subtotals group tabpage:
 
-ScTpSubTotalGroup::ScTpSubTotalGroup( vcl::Window* pParent,
-                                      const SfxItemSet& rArgSet )
-        :   SfxTabPage      ( pParent,
-                              "SubTotalGrpPage", "modules/scalc/ui/subtotalgrppage.ui",
-                              &rArgSet ),
-            aStrNone        ( ScResId( SCSTR_NONE ) ),
-            aStrColumn      ( ScResId( SCSTR_COLUMN ) ),
-            pViewData       ( nullptr ),
-            pDoc            ( nullptr ),
-            nWhichSubTotals ( rArgSet.GetPool()->GetWhich( SID_SUBTOTALS ) ),
-            rSubTotalData   ( static_cast<const ScSubTotalItem&>(
-                              rArgSet.Get( nWhichSubTotals )).
-                                GetSubTotalData() ),
-            nFieldCount     ( 0 )
+ScTpSubTotalGroup::ScTpSubTotalGroup(TabPageParent pParent, const SfxItemSet& rArgSet)
+    : SfxTabPage(pParent, "modules/scalc/ui/subtotalgrppage.ui", "SubTotalGrpPage", &rArgSet)
+    , aStrNone(ScResId(SCSTR_NONE))
+    , aStrColumn(ScResId(SCSTR_COLUMN))
+    , pViewData(nullptr)
+    , pDoc(nullptr)
+    , nWhichSubTotals(rArgSet.GetPool()->GetWhich(SID_SUBTOTALS))
+    , rSubTotalData(static_cast<const ScSubTotalItem&>(rArgSet.Get(nWhichSubTotals)).GetSubTotalData())
+    , nFieldCount(0)
+    , mxLbGroup(m_xBuilder->weld_combo_box("group_by"))
+    , mxLbColumns(m_xBuilder->weld_tree_view("columns"))
+    , mxLbFunctions(m_xBuilder->weld_tree_view("functions"))
 {
-    get(mpLbGroup, "group_by");
-    get(mpLbColumns, "columns");
-    get(mpLbFunctions, "functions");
-
     for (size_t i = 0; i < SAL_N_ELEMENTS(SCSTR_SUBTOTALS); ++i)
-        mpLbFunctions->InsertEntry(ScResId(SCSTR_SUBTOTALS[i]));
+        mxLbFunctions->append_text(ScResId(SCSTR_SUBTOTALS[i]));
 
-    long nHeight = mpLbColumns->GetTextHeight() * 14;
-    mpLbColumns->set_height_request(nHeight);
-    mpLbFunctions->set_height_request(nHeight);
+    auto nHeight = mxLbColumns->get_height_rows(14);
+    mxLbColumns->set_size_request(-1, nHeight);
+    mxLbFunctions->set_size_request(-1, nHeight);
 
-    // Font is correctly initialized by SvTreeListBox ctor
-    mpLbColumns->SetSelectionMode( SelectionMode::Single );
-    mpLbColumns->SetDragDropMode( DragDropMode::NONE );
-    mpLbColumns->SetSpaceBetweenEntries( 0 );
+    std::vector<int> aWidths;
+    aWidths.push_back(mxLbColumns->get_checkbox_column_width());
+    mxLbColumns->set_column_fixed_widths(aWidths);
 
-    Init ();
+    Init();
 }
 
 ScTpSubTotalGroup::~ScTpSubTotalGroup()
@@ -74,26 +67,6 @@ ScTpSubTotalGroup::~ScTpSubTotalGroup()
     disposeOnce();
 }
 
-void ScTpSubTotalGroup::dispose()
-{
-    sal_uLong  nCount = mpLbColumns->GetEntryCount();
-
-    if ( nCount > 0 )
-    {
-        for ( sal_uLong i=0; i<nCount; i++ )
-        {
-            sal_uInt16* pData = static_cast<sal_uInt16*>(mpLbColumns->GetEntryData( i ));
-            OSL_ENSURE( pData, "EntryData not found" );
-
-            delete pData;
-        }
-    }
-    mpLbGroup.clear();
-    mpLbColumns.clear();
-    mpLbFunctions.clear();
-    SfxTabPage::dispose();
-}
-
 void ScTpSubTotalGroup::Init()
 {
     const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>(
@@ -104,10 +77,10 @@ void ScTpSubTotalGroup::Init()
 
     OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-(" );
 
-    mpLbGroup->SetSelectHdl       ( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
-    mpLbColumns->SetSelectHdl     ( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl ) );
-    mpLbColumns->SetCheckButtonHdl( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
-    mpLbFunctions->SetSelectHdl   ( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
+    mxLbGroup->connect_changed( LINK( this, ScTpSubTotalGroup, SelectListBoxHdl ) );
+    mxLbColumns->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl ) );
+    mxLbColumns->connect_toggled( LINK( this, ScTpSubTotalGroup, CheckHdl ) );
+    mxLbFunctions->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl) );
 
     nFieldArr[0] = 0;
     FillListBoxes();
@@ -126,12 +99,12 @@ bool ScTpSubTotalGroup::DoReset( sal_uInt16             nGroupNo,
         nGroupIdx = nGroupNo-1;
 
     // first we have to clear the listboxes...
-    for ( sal_uLong nLbEntry = 0; nLbEntry < mpLbColumns->GetEntryCount(); ++nLbEntry )
+    for (int nLbEntry = 0, nCount = mxLbColumns->n_children(); nLbEntry < nCount; ++nLbEntry)
     {
-        mpLbColumns->CheckEntryPos( nLbEntry, false );
-        *static_cast<sal_uInt16*>(mpLbColumns->GetEntryData( nLbEntry )) = 0;
+        mxLbColumns->set_toggle(nLbEntry, false, 0);
+        mxLbColumns->set_id(nLbEntry, "0");
     }
-    mpLbFunctions->SelectEntryPos( 0 );
+    mxLbFunctions->select(0);
 
     ScSubTotalParam theSubTotalData( static_cast<const ScSubTotalItem&>(
                                       rArgSet.Get( nWhichSubTotals )).
@@ -144,48 +117,61 @@ bool ScTpSubTotalGroup::DoReset( sal_uInt16             nGroupNo,
         SCCOL*          pSubTotals  = theSubTotalData.pSubTotals[nGroupIdx];
         ScSubTotalFunc* pFunctions  = theSubTotalData.pFunctions[nGroupIdx];
 
-        mpLbGroup->SelectEntryPos( GetFieldSelPos( nField )+1 );
+        mxLbGroup->set_active( GetFieldSelPos( nField )+1 );
 
         sal_uInt16 nFirstChecked = 0;
         for ( sal_uInt16 i=0; i<nSubTotals; i++ )
         {
             sal_uInt16  nCheckPos = GetFieldSelPos( pSubTotals[i] );
-            sal_uInt16* pFunction = static_cast<sal_uInt16*>(mpLbColumns->GetEntryData( nCheckPos ));
 
-            mpLbColumns->CheckEntryPos( nCheckPos );
-            *pFunction = FuncToLbPos( pFunctions[i] );
+            mxLbColumns->set_toggle(nCheckPos, true, 0);
+            mxLbColumns->set_id(nCheckPos, OUString::number(FuncToLbPos(pFunctions[i])));
 
             if (i == 0 || nCheckPos < nFirstChecked)
                 nFirstChecked = nCheckPos;
         }
         // Select the first checked field from the top.
-        mpLbColumns->SelectEntryPos(nFirstChecked);
+        mxLbColumns->select(nFirstChecked);
     }
     else
     {
-        mpLbGroup->SelectEntryPos( (nGroupNo == 1) ? 1 : 0 );
-        mpLbColumns->SelectEntryPos( 0 );
-        mpLbFunctions->SelectEntryPos( 0 );
+        mxLbGroup->set_active( (nGroupNo == 1) ? 1 : 0 );
+        mxLbColumns->select( 0 );
+        mxLbFunctions->select( 0 );
     }
 
     return true;
 }
 
+namespace
+{
+    int GetCheckedEntryCount(weld::TreeView& rTreeView)
+    {
+        int nRet = 0;
+        for (sal_Int32 i=0, nEntryCount = rTreeView.n_children(); i < nEntryCount; ++i)
+        {
+            if (rTreeView.get_toggle(i, 0))
+                ++nRet;
+        }
+        return nRet;
+    }
+}
+
 bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16       nGroupNo,
                                        SfxItemSet&  rArgSet  )
 {
     sal_uInt16 nGroupIdx = 0;
 
     OSL_ENSURE( (nGroupNo<=3) && (nGroupNo>0), "Invalid group" );
-    OSL_ENSURE(    (mpLbGroup->GetEntryCount() > 0)
-                && (mpLbColumns->GetEntryCount() > 0)
-                && (mpLbFunctions->GetEntryCount() > 0),
+    OSL_ENSURE(    (mxLbGroup->get_count() > 0)
+                && (mxLbColumns->n_children() > 0)
+                && (mxLbFunctions->n_children() > 0),
                 "Non-initialized Lists" );
 
     if (  (nGroupNo > 3) || (nGroupNo == 0)
-        || (mpLbGroup->GetEntryCount() == 0)
-        || (mpLbColumns->GetEntryCount() == 0)
-        || (mpLbFunctions->GetEntryCount() == 0)
+        || (mxLbGroup->get_count() == 0)
+        || (mxLbColumns->n_children() == 0)
+        || (mxLbFunctions->n_children() == 0)
        )
         return false;
     else
@@ -202,9 +188,9 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16       nGroupNo,
 
     std::unique_ptr<ScSubTotalFunc[]> pFunctions;
     std::unique_ptr<SCCOL[]>          pSubTotals;
-    const sal_Int32 nGroup      = mpLbGroup->GetSelectedEntryPos();
-    const sal_Int32 nEntryCount = mpLbColumns->GetEntryCount();
-    const sal_Int32 nCheckCount = mpLbColumns->GetCheckedEntryCount();
+    const sal_Int32 nGroup      = mxLbGroup->get_active();
+    const sal_Int32 nEntryCount = mxLbColumns->n_children();
+    const sal_Int32 nCheckCount = GetCheckedEntryCount(*mxLbColumns);
 
     theSubTotalData.nCol1                   = rSubTotalData.nCol1;
     theSubTotalData.nRow1                   = rSubTotalData.nRow1;
@@ -224,11 +210,11 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16       nGroupNo,
 
         for ( sal_Int32 i=0, nCheck=0; i<nEntryCount; i++ )
         {
-            if ( mpLbColumns->IsChecked( i ) )
+            if (mxLbColumns->get_toggle(i, 0))
             {
                 OSL_ENSURE( nCheck <= nCheckCount,
                             "Range error :-(" );
-                nFunction = *static_cast<sal_uInt16*>(mpLbColumns->GetEntryData( i ));
+                nFunction = mxLbColumns->get_id(i).toUInt32();
                 pSubTotals[nCheck] = nFieldArr[i];
                 pFunctions[nCheck] = LbPosToFunc( nFunction );
                 nCheck++;
@@ -259,9 +245,9 @@ void ScTpSubTotalGroup::FillListBoxes()
         SCCOL   col;
         OUString  aFieldName;
 
-        mpLbGroup->Clear();
-        mpLbColumns->Clear();
-        mpLbGroup->InsertEntry( aStrNone, 0 );
+        mxLbGroup->clear();
+        mxLbColumns->clear();
+        mxLbGroup->insert_text(0, aStrNone );
 
         sal_uInt16 i=0;
         for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
@@ -272,9 +258,11 @@ void ScTpSubTotalGroup::FillListBoxes()
                 aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, "%1", ScColToAlpha( col ));
             }
             nFieldArr[i] = col;
-            mpLbGroup->InsertEntry( aFieldName, i+1 );
-            mpLbColumns->InsertEntry( aFieldName, i );
-            mpLbColumns->SetEntryData( i, new sal_uInt16(0) );
+            mxLbGroup->insert_text(i+1, aFieldName);
+            mxLbColumns->insert(i);
+            mxLbColumns->set_toggle(i, false, 0);
+            mxLbColumns->set_text(i, aFieldName, 1);
+            mxLbColumns->set_id(i, "0");
             i++;
         }
         // subsequent initialization of the constant:
@@ -345,51 +333,40 @@ sal_uInt16 ScTpSubTotalGroup::FuncToLbPos( ScSubTotalFunc eFunc )
 
 // Handler:
 
-IMPL_LINK( ScTpSubTotalGroup, SelectTreeListBoxHdl, SvTreeListBox*, pLb, void )
+IMPL_LINK(ScTpSubTotalGroup, SelectTreeListBoxHdl, weld::TreeView&, rLb, void)
 {
-    SelectHdl(pLb);
+    SelectHdl(&rLb);
 }
-IMPL_LINK( ScTpSubTotalGroup, SelectListBoxHdl, ListBox&, rLb, void )
+
+IMPL_LINK(ScTpSubTotalGroup, SelectListBoxHdl, weld::ComboBox&, rLb, void)
 {
     SelectHdl(&rLb);
 }
-void ScTpSubTotalGroup::SelectHdl(const void *pLb)
+
+void ScTpSubTotalGroup::SelectHdl(const weld::Widget *pLb)
 {
-    if (   (mpLbColumns->GetEntryCount() > 0)
-        && (mpLbColumns->GetSelectionCount() > 0) )
+    const sal_Int32 nColumn = mxLbColumns->get_selected_index();
+    if (nColumn != -1)
     {
-        const sal_Int32 nFunction   = mpLbFunctions->GetSelectedEntryPos();
-        const sal_Int32 nColumn     = mpLbColumns->GetSelectedEntryPos();
-        sal_uInt16*     pFunction   = static_cast<sal_uInt16*>(mpLbColumns->GetEntryData( nColumn ));
+        const sal_Int32 nFunction   = mxLbFunctions->get_selected_index();
+        sal_uInt16      nOldFunction  = mxLbColumns->get_id(nColumn).toUInt32();
 
-        OSL_ENSURE( pFunction, "EntryData not found!" );
-        if ( !pFunction )
-            return;
-
-        if ( pLb == mpLbColumns )
+        if ( pLb == mxLbColumns.get() )
         {
-            mpLbFunctions->SelectEntryPos( *pFunction );
+            mxLbFunctions->select(nOldFunction);
         }
-        else if ( pLb == mpLbFunctions )
+        else if ( pLb == mxLbFunctions.get() )
         {
-            *pFunction = static_cast<sal_uInt16>(nFunction);
-            mpLbColumns->CheckEntryPos( nColumn );
+            mxLbColumns->set_id(nColumn, OUString::number(nFunction));
+            mxLbColumns->set_toggle(nColumn, true, 0);
         }
     }
 }
 
-IMPL_LINK( ScTpSubTotalGroup, CheckHdl, SvTreeListBox*, pLb, void )
+IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const row_col&, rRowCol, void )
 {
-    if ( pLb == mpLbColumns )
-    {
-        SvTreeListEntry* pEntry = mpLbColumns->GetHdlEntry();
-
-        if ( pEntry )
-        {
-            mpLbColumns->SelectEntryPos( static_cast<sal_uInt16>(mpLbColumns->GetModel()->GetAbsPos( pEntry )) );
-            SelectHdl( pLb );
-        }
-    }
+    mxLbColumns->select(rRowCol.first);
+    SelectHdl(mxLbColumns.get());
 }
 
 // Derived Group TabPages:
@@ -397,30 +374,30 @@ IMPL_LINK( ScTpSubTotalGroup, CheckHdl, SvTreeListBox*, pLb, void )
 VclPtr<SfxTabPage> ScTpSubTotalGroup1::Create( TabPageParent pParent,
                                                  const SfxItemSet*  rArgSet )
 {
-    return VclPtr<ScTpSubTotalGroup1>::Create( pParent.pParent, *rArgSet );
+    return VclPtr<ScTpSubTotalGroup1>::Create( pParent, *rArgSet );
 }
 
 VclPtr<SfxTabPage> ScTpSubTotalGroup2::Create( TabPageParent pParent,
                                        const SfxItemSet*    rArgSet )
 {
-    return VclPtr<ScTpSubTotalGroup2>::Create( pParent.pParent, *rArgSet );
+    return VclPtr<ScTpSubTotalGroup2>::Create( pParent, *rArgSet );
 }
 
 VclPtr<SfxTabPage> ScTpSubTotalGroup3::Create( TabPageParent pParent,
                                        const SfxItemSet*    rArgSet )
 {
-    return VclPtr<ScTpSubTotalGroup3>::Create( pParent.pParent, *rArgSet );
+    return VclPtr<ScTpSubTotalGroup3>::Create( pParent, *rArgSet );
 }
 
-ScTpSubTotalGroup1::ScTpSubTotalGroup1( vcl::Window* pParent, const SfxItemSet& rArgSet ) :
+ScTpSubTotalGroup1::ScTpSubTotalGroup1( TabPageParent pParent, const SfxItemSet& rArgSet ) :
     ScTpSubTotalGroup( pParent, rArgSet )
 {}
 
-ScTpSubTotalGroup2::ScTpSubTotalGroup2( vcl::Window* pParent, const SfxItemSet& rArgSet ) :
+ScTpSubTotalGroup2::ScTpSubTotalGroup2( TabPageParent pParent, const SfxItemSet& rArgSet ) :
     ScTpSubTotalGroup( pParent, rArgSet )
 {}
 
-ScTpSubTotalGroup3::ScTpSubTotalGroup3( vcl::Window* pParent, const SfxItemSet& rArgSet ) :
+ScTpSubTotalGroup3::ScTpSubTotalGroup3( TabPageParent pParent, const SfxItemSet& rArgSet ) :
     ScTpSubTotalGroup( pParent, rArgSet )
 {}
 
diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx
index 60f94a85c573..8711ba358e7f 100644
--- a/sc/source/ui/inc/tpsubt.hxx
+++ b/sc/source/ui/inc/tpsubt.hxx
@@ -35,21 +35,16 @@ struct ScSubTotalParam;
 class ScTpSubTotalGroup : public SfxTabPage
 {
 protected:
-    ScTpSubTotalGroup( vcl::Window* pParent,
-                       const SfxItemSet& rArgSet );
+    ScTpSubTotalGroup(TabPageParent pParent, const SfxItemSet& rArgSet);
 
 public:
     virtual ~ScTpSubTotalGroup() override;
-    virtual void dispose() override;
 
     bool            DoReset         ( sal_uInt16            nGroupNo,
                                       const SfxItemSet& rArgSet  );
     bool            DoFillItemSet   ( sal_uInt16        nGroupNo,
                                       SfxItemSet&   rArgSet  );
 protected:
-    VclPtr<ListBox>        mpLbGroup;
-    VclPtr<SvxCheckListBox> mpLbColumns;
-    VclPtr<ListBox>         mpLbFunctions;
     const OUString    aStrNone;
     const OUString    aStrColumn;
 
@@ -61,6 +56,10 @@ protected:
     SCCOL                   nFieldArr[SC_MAXFIELDS];
     sal_uInt16              nFieldCount;
 
+    std::unique_ptr<weld::ComboBox> mxLbGroup;
+    std::unique_ptr<weld::TreeView> mxLbColumns;
+    std::unique_ptr<weld::TreeView> mxLbFunctions;
+
 private:
     void            Init            ();
     void            FillListBoxes   ();
@@ -69,16 +68,17 @@ private:
     sal_uInt16          GetFieldSelPos  ( SCCOL nField );
 
     // Handler ------------------------
-    DECL_LINK( SelectListBoxHdl, ListBox&, void );
-    DECL_LINK( SelectTreeListBoxHdl, SvTreeListBox*, void );
-    DECL_LINK( CheckHdl, SvTreeListBox*, void );
-    void SelectHdl(const void *);
+    DECL_LINK( SelectListBoxHdl, weld::ComboBox&, void );
+    DECL_LINK( SelectTreeListBoxHdl, weld::TreeView&, void );
+    typedef std::pair<int, int> row_col;
+    DECL_LINK(CheckHdl, const row_col&, void);
+    void SelectHdl(const weld::Widget*);
 };
 
 class ScTpSubTotalGroup1 final : public ScTpSubTotalGroup
 {
     friend class VclPtr<ScTpSubTotalGroup1>;
-    ScTpSubTotalGroup1( vcl::Window*              pParent,
+    ScTpSubTotalGroup1( TabPageParent pParent,
                         const SfxItemSet&    rArgSet );
 
 public:
@@ -93,7 +93,7 @@ public:
 class ScTpSubTotalGroup2 final : public ScTpSubTotalGroup
 {
     friend class VclPtr<ScTpSubTotalGroup2>;
-    ScTpSubTotalGroup2( vcl::Window*              pParent,
+    ScTpSubTotalGroup2( TabPageParent pParent,
                         const SfxItemSet&    rArgSet );
 
 public:
@@ -108,7 +108,7 @@ public:
 class ScTpSubTotalGroup3 final : public ScTpSubTotalGroup
 {
     friend class VclPtr<ScTpSubTotalGroup3>;
-    ScTpSubTotalGroup3( vcl::Window*              pParent,
+    ScTpSubTotalGroup3( TabPageParent pParent,
                         const SfxItemSet&    rArgSet );
 
 public:
diff --git a/sc/uiconfig/scalc/ui/subtotalgrppage.ui b/sc/uiconfig/scalc/ui/subtotalgrppage.ui
index add6750d55d0..b75f3d67cc2e 100644
--- a/sc/uiconfig/scalc/ui/subtotalgrppage.ui
+++ b/sc/uiconfig/scalc/ui/subtotalgrppage.ui
@@ -2,9 +2,23 @@
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
   <requires lib="LibreOffice" version="1.0"/>
+  <object class="GtkTreeStore" id="liststore2">
+    <columns>
+      <!-- column-name check1 -->
+      <column type="gboolean"/>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+      <!-- column-name checkvis1 -->
+      <column type="gboolean"/>
+    </columns>
+  </object>
   <object class="GtkTreeStore" id="liststore1">
     <columns>
-      <!-- column-name gchararray1 -->
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
       <column type="gchararray"/>
     </columns>
   </object>
@@ -35,7 +49,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkComboBox" id="group_by">
+          <object class="GtkComboBoxText" id="group_by">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
           </object>
@@ -67,7 +81,7 @@
             <property name="halign">start</property>
             <property name="label" translatable="yes" context="subtotalgrppage|label2">Calculate subtotals for:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">columns:border</property>
+            <property name="mnemonic_widget">columns</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -83,7 +97,7 @@
             <property name="halign">start</property>
             <property name="label" translatable="yes" context="subtotalgrppage|label3">Use function:</property>
             <property name="use_underline">True</property>
-            <property name="mnemonic_widget">functions:border</property>
+            <property name="mnemonic_widget">functions</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
@@ -93,13 +107,53 @@
           </packing>
         </child>
         <child>
-          <object class="svxcorelo-SvxCheckListBox" id="columns:border">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
-            <child internal-child="selection">
-              <object class="GtkTreeSelection" id="Check List Box-selection1"/>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkTreeView" id="columns">
+                <property name="width_request">-1</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore2</property>
+                <property name="headers_visible">False</property>
+                <property name="search_column">1</property>
+                <property name="show_expanders">False</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                    <property name="resizable">True</property>
+                    <property name="spacing">6</property>
+                    <property name="alignment">0.5</property>
+                    <child>
+                      <object class="GtkCellRendererToggle" id="cellrenderer5"/>
+                      <attributes>
+                        <attribute name="visible">3</attribute>
+                        <attribute name="active">0</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                      <attributes>
+                        <attribute name="text">1</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
             </child>
           </object>
           <packing>
@@ -110,16 +164,39 @@
           </packing>
         </child>
         <child>
-          <object class="GtkTreeView" id="functions:border">
+          <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="model">liststore1</property>
-            <property name="search_column">0</property>
-            <property name="show_expanders">False</property>
-            <child internal-child="selection">
-              <object class="GtkTreeSelection" id="treeview-selection2"/>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkTreeView" id="functions">
+                <property name="width_request">-1</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="model">liststore1</property>
+                <property name="headers_visible">False</property>
+                <property name="search_column">0</property>
+                <property name="show_expanders">False</property>
+                <child internal-child="selection">
+                  <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+                </child>
+                <child>
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                      <attributes>
+                        <attribute name="text">1</attribute>
+                      </attributes>
+                    </child>
+                  </object>
+                </child>
+              </object>
             </child>
           </object>
           <packing>
diff --git a/vcl/source/treelist/uiobject.cxx b/vcl/source/treelist/uiobject.cxx
index dcb120058352..9b3d62dfcdfc 100644
--- a/vcl/source/treelist/uiobject.cxx
+++ b/vcl/source/treelist/uiobject.cxx
@@ -8,8 +8,10 @@
  */
 
 #include <memory>
+#include <vcl/svlbitm.hxx>
 #include <vcl/uitest/uiobject.hxx>
 #include <vcl/treelistbox.hxx>
+#include <vcl/treelistentry.hxx>
 
 TreeListUIObject::TreeListUIObject(const VclPtr<SvTreeListBox>& xTreeList):
     WindowUIObject(xTreeList),
@@ -128,12 +130,10 @@ void TreeListEntryUIObject::execute(const OUString& rAction, const StringMap& /*
     }
     else if (rAction == "CLICK")
     {
-        if (!isCheckBoxList(mxTreeList))
+        SvLBoxButton* pItem = static_cast<SvLBoxButton*>(mpEntry->GetFirstItem(SvLBoxItemType::Button));
+        if (!pItem)
             return;
-        SvButtonState eState = mxTreeList->GetCheckButtonState(mpEntry);
-        eState = eState == SvButtonState::Checked ? SvButtonState::Unchecked : SvButtonState::Checked;
-        mxTreeList->SetCheckButtonState(mpEntry, eState);
-        mxTreeList->CheckButtonHdl();
+        pItem->ClickHdl(mpEntry);
     }
 }
 


More information about the Libreoffice-commits mailing list