include/formula/funcutl.hxx              |    5 
 sc/source/ui/app/scmod.cxx               |   36 +-
 sc/source/ui/inc/crnrdlg.hxx             |   69 ++--
 sc/source/ui/inc/reffact.hxx             |    2 
 sc/source/ui/miscdlgs/crnrdlg.cxx        |  493 +++++++++++++++----------------
 sc/source/ui/view/reffact.cxx            |    4 
 sc/source/ui/view/tabview3.cxx           |   16 -
 sc/source/ui/view/tabvwsh4.cxx           |   15 
 sc/source/ui/view/tabvwshc.cxx           |   11 
 sc/uiconfig/scalc/ui/namerangesdialog.ui |   64 +++-
 solenv/sanitizers/ui/modules/scalc.suppr |    4 
 11 files changed, 395 insertions(+), 324 deletions(-)

New commits:
commit dd5fbb68ebaa8b8be8b6a4a97a8aedbf22d5714f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Apr 11 21:19:28 2019 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Apr 12 14:53:02 2019 +0200

    weld ScColRowNameRangesDlg
    
    Change-Id: I976fb892f8ac1dedb0c2c3110dce17c1211de238
    Reviewed-on: https://gerrit.libreoffice.org/70652
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
index d7734d8fd68d..22e46ecc81c1 100644
--- a/include/formula/funcutl.hxx
+++ b/include/formula/funcutl.hxx
@@ -147,6 +147,11 @@ public:
         xEntry->select_region(rSelection.Min(), rSelection.Max());
     }
 
+    void SetCursorAtLast()
+    {
+        xEntry->set_position(-1);
+    }
+
     Selection GetSelection() const
     {
         int nStartPos, nEndPos;
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 7235c02076fb..09c7bbd63027 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1605,11 +1605,19 @@ bool ScModule::IsTableLocked()
         SfxChildWindow* pChildWnd = lcl_GetChildWinFromAnyView( m_nCurRefDlgId 
);
         if ( pChildWnd )
         {
-            IAnyRefDialog* 
pRefDlg(dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()));
-            assert(pRefDlg);
-            if(pRefDlg)
+            if (pChildWnd->GetWindow())
+            {
+                IAnyRefDialog* 
pRefDlg(dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()));
+                assert(pRefDlg);
+                if (pRefDlg)
+                    bLocked = pRefDlg->IsTableLocked();
+            }
+            if (pChildWnd->GetController())
             {
-                bLocked = pRefDlg->IsTableLocked();
+                IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
+                assert(pRefDlg);
+                if (pRefDlg)
+                    bLocked = pRefDlg->IsTableLocked();
             }
         }
         else
@@ -1764,11 +1772,23 @@ void ScModule::AddRefEntry()
         OSL_ENSURE( pChildWnd, "NoChildWin" );
         if ( pChildWnd )
         {
-            IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
-            assert(pRefDlg);
-            if(pRefDlg)
+            if (pChildWnd->GetWindow())
             {
-                pRefDlg->AddRefEntry();
+                IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
+                assert(pRefDlg);
+                if (pRefDlg)
+                {
+                    pRefDlg->AddRefEntry();
+                }
+            }
+            if (pChildWnd->GetController())
+            {
+                IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
+                assert(pRefDlg);
+                if (pRefDlg)
+                {
+                    pRefDlg->AddRefEntry();
+                }
             }
         }
     }
diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx
index 95222a9b5379..948724e08e84 100644
--- a/sc/source/ui/inc/crnrdlg.hxx
+++ b/sc/source/ui/inc/crnrdlg.hxx
@@ -29,35 +29,20 @@
 class ScViewData;
 class ScDocument;
 
-class ScColRowNameRangesDlg : public ScAnyRefDlg
+class ScColRowNameRangesDlg : public ScAnyRefDlgController
 {
 public:
-                    ScColRowNameRangesDlg( SfxBindings* pB, SfxChildWindow* 
pCW, vcl::Window* pParent,
-                                 ScViewData*    ptrViewData );
-                    virtual ~ScColRowNameRangesDlg() override;
-    virtual void    dispose() override;
+    ScColRowNameRangesDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* 
pParent,
+                          ScViewData* ptrViewData);
+    virtual ~ScColRowNameRangesDlg() override;
 
     virtual void    SetReference( const ScRange& rRef, ScDocument* pDoc ) 
override;
 
     virtual bool    IsRefInputMode() const override;
     virtual void    SetActive() override;
-    virtual bool    Close() override;
+    virtual void    Close() override;
 
 private:
-    VclPtr<ListBox>         pLbRange;
-
-    VclPtr<formula::RefEdit>        pEdAssign;
-    VclPtr<formula::RefButton>      pRbAssign;
-    VclPtr<RadioButton>     pBtnColHead;
-    VclPtr<RadioButton>     pBtnRowHead;
-    VclPtr<formula::RefEdit>        pEdAssign2;
-    VclPtr<formula::RefButton>      pRbAssign2;
-
-    VclPtr<OKButton>        pBtnOk;
-    VclPtr<CancelButton>    pBtnCancel;
-    VclPtr<PushButton>      pBtnAdd;
-    VclPtr<PushButton>      pBtnRemove;
-
     ScRange         theCurArea;
     ScRange         theCurData;
 
@@ -68,25 +53,45 @@ private:
     NameRangeMap    aRangeMap;
     ScViewData* const     pViewData;
     ScDocument*     pDoc;
-    VclPtr<formula::RefEdit>       pEdActive;
     bool            bDlgLostFocus;
 
+    formula::WeldRefEdit* m_pEdActive;
+    std::unique_ptr<weld::TreeView> m_xLbRange;
+
+    std::unique_ptr<formula::WeldRefEdit> m_xEdAssign;
+    std::unique_ptr<formula::WeldRefButton> m_xRbAssign;
+    std::unique_ptr<weld::RadioButton> m_xBtnColHead;
+    std::unique_ptr<weld::RadioButton> m_xBtnRowHead;
+    std::unique_ptr<formula::WeldRefEdit> m_xEdAssign2;
+    std::unique_ptr<formula::WeldRefButton> m_xRbAssign2;
+
+    std::unique_ptr<weld::Button> m_xBtnOk;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
+    std::unique_ptr<weld::Button> m_xBtnAdd;
+    std::unique_ptr<weld::Button> m_xBtnRemove;
+
+    std::unique_ptr<weld::Frame> m_xRangeFrame;
+    std::unique_ptr<weld::Label> m_xRangeFT;
+    std::unique_ptr<weld::Label> m_xDataFT;
+
     void Init               ();
     void UpdateNames        ();
     void UpdateRangeData    ( const ScRange& rRange, bool bColName );
     void SetColRowData( const ScRange& rLabelRange, bool bRef=false);
     void AdjustColRowData( const ScRange& rDataRange, bool bRef=false);
-    DECL_LINK( CancelBtnHdl, Button*, void );
-    DECL_LINK( OkBtnHdl, Button*, void );
-    DECL_LINK( AddBtnHdl, Button*, void );
-    DECL_LINK( RemoveBtnHdl, Button*, void );
-    DECL_LINK( Range1SelectHdl, ListBox&, void );
-    DECL_LINK( Range1DataModifyHdl, Edit&, void );
-    DECL_LINK( ColClickHdl, Button*, void );
-    DECL_LINK( RowClickHdl, Button*, void );
-    DECL_LINK( Range2DataModifyHdl, Edit&, void );
-    DECL_LINK( GetFocusHdl, Control&, void );
-    DECL_LINK( LoseFocusHdl, Control&, void );
+    DECL_LINK( CancelBtnHdl, weld::Button&, void );
+    DECL_LINK( OkBtnHdl, weld::Button&, void );
+    DECL_LINK( AddBtnHdl, weld::Button&, void );
+    DECL_LINK( RemoveBtnHdl, weld::Button&, void );
+    DECL_LINK( Range1SelectHdl, weld::TreeView&, void );
+    DECL_LINK( Range1DataModifyHdl, formula::WeldRefEdit&, void );
+    DECL_LINK( ColClickHdl, weld::Button&, void );
+    DECL_LINK( RowClickHdl, weld::Button&, void );
+    DECL_LINK( Range2DataModifyHdl, formula::WeldRefEdit&, void );
+    DECL_LINK( GetEditFocusHdl, formula::WeldRefEdit&, void );
+    DECL_LINK( LoseEditFocusHdl, formula::WeldRefEdit&, void );
+    DECL_LINK( GetButtonFocusHdl, formula::WeldRefButton&, void );
+    DECL_LINK( LoseButtonFocusHdl, formula::WeldRefButton&, void );
 };
 
 #endif // INCLUDED_SC_SOURCE_UI_INC_CRNRDLG_HXX
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index 444abd3b1362..ce462942f5de 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -56,7 +56,7 @@ DECL_WRAPPER_WITHID(ScSpecialFilterDlgWrapper)
 DECL_WRAPPER_WITHID_CONTROLLER(ScDbNameDlgWrapper)
 DECL_WRAPPER_WITHID(ScConsolidateDlgWrapper)
 DECL_WRAPPER_WITHID_CONTROLLER(ScPrintAreasDlgWrapper)
-DECL_WRAPPER_WITHID(ScColRowNameRangesDlgWrapper)
+DECL_WRAPPER_WITHID_CONTROLLER(ScColRowNameRangesDlgWrapper)
 DECL_WRAPPER_WITHID(ScFormulaDlgWrapper)
 DECL_WRAPPER_WITHID(ScHighlightChgDlgWrapper)
 DECL_WRAPPER_WITHID(ScCondFormatDlgWrapper)
diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx 
b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 4f0b8c552167..6de7b6941cdc 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -58,34 +58,33 @@ const sal_uLong nEntryDataDelim = 2;
 // note: some of the initialisation is done in Init
 ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB,
                                 SfxChildWindow* pCW,
-                                vcl::Window* pParent,
+                                weld::Window* pParent,
                                 ScViewData* ptrViewData )
 
-    :   ScAnyRefDlg ( pB, pCW, pParent, "NameRangesDialog" , 
"modules/scalc/ui/namerangesdialog.ui" ),
-
-        pViewData       ( ptrViewData ),
-        pDoc            ( ptrViewData->GetDocument() ),
-
-        pEdActive       ( nullptr ),
-        bDlgLostFocus   ( false )
+    : ScAnyRefDlgController(pB, pCW, pParent, 
"modules/scalc/ui/namerangesdialog.ui", "NameRangesDialog")
+    , pViewData(ptrViewData)
+    , pDoc(ptrViewData->GetDocument())
+    , bDlgLostFocus(false)
+    , m_pEdActive(nullptr)
+    , m_xLbRange(m_xBuilder->weld_tree_view("range"))
+    , m_xEdAssign(new formula::WeldRefEdit(m_xBuilder->weld_entry("edassign")))
+    , m_xRbAssign(new 
formula::WeldRefButton(m_xBuilder->weld_button("rbassign")))
+    , m_xBtnColHead(m_xBuilder->weld_radio_button("colhead"))
+    , m_xBtnRowHead(m_xBuilder->weld_radio_button("rowhead"))
+    , m_xEdAssign2(new 
formula::WeldRefEdit(m_xBuilder->weld_entry("edassign2")))
+    , m_xRbAssign2(new 
formula::WeldRefButton(m_xBuilder->weld_button("rbassign2")))
+    , m_xBtnOk(m_xBuilder->weld_button("ok"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
+    , m_xBtnAdd(m_xBuilder->weld_button("add"))
+    , m_xBtnRemove(m_xBuilder->weld_button("delete"))
+    , m_xRangeFrame(m_xBuilder->weld_frame("rangeframe"))
+    , m_xRangeFT(m_xRangeFrame->weld_label_widget())
+    , m_xDataFT(m_xBuilder->weld_label("datarange"))
 {
-    get(pLbRange,"range");
-
-    get(pEdAssign,"edassign");
-    get(pRbAssign,"rbassign");
-    pRbAssign->SetReferences(this, pEdAssign);
-    pEdAssign->SetReferences(this, 
get<VclFrame>("rangeframe")->get_label_widget());
-    get(pBtnColHead,"colhead");
-    get(pBtnRowHead,"rowhead");
-    get(pEdAssign2,"edassign2");
-    get(pRbAssign2,"rbassign2");
-    pRbAssign2->SetReferences(this, pEdAssign2);
-    pEdAssign2->SetReferences(this, get<FixedText>("datarange"));
-
-    get(pBtnOk,"ok");
-    get(pBtnCancel,"cancel");
-    get(pBtnAdd,"add");
-    get(pBtnRemove,"delete");
+    m_xRbAssign->SetReferences(this, m_xEdAssign.get());
+    m_xEdAssign->SetReferences(this, m_xRangeFT.get());
+    m_xRbAssign2->SetReferences(this, m_xEdAssign2.get());
+    m_xEdAssign2->SetReferences(this, m_xDataFT.get());
 
     xColNameRanges = pDoc->GetColNameRanges()->Clone();
     xRowNameRanges = pDoc->GetRowNameRanges()->Clone();
@@ -94,54 +93,38 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* 
pB,
 
 ScColRowNameRangesDlg::~ScColRowNameRangesDlg()
 {
-    disposeOnce();
-}
-
-void ScColRowNameRangesDlg::dispose()
-{
-    pLbRange.clear();
-    pEdAssign.clear();
-    pRbAssign.clear();
-    pBtnColHead.clear();
-    pBtnRowHead.clear();
-    pEdAssign2.clear();
-    pRbAssign2.clear();
-    pBtnOk.clear();
-    pBtnCancel.clear();
-    pBtnAdd.clear();
-    pBtnRemove.clear();
-    pEdActive.clear();
-    ScAnyRefDlg::dispose();
 }
 
 // initialises event handlers and start parameters in the dialog
 void ScColRowNameRangesDlg::Init()
 {
-    pBtnOk->SetClickHdl      ( LINK( this, ScColRowNameRangesDlg, OkBtnHdl ) );
-    pBtnCancel->SetClickHdl  ( LINK( this, ScColRowNameRangesDlg, CancelBtnHdl 
) );
-    pBtnAdd->SetClickHdl     ( LINK( this, ScColRowNameRangesDlg, AddBtnHdl ) 
);
-    pBtnRemove->SetClickHdl  ( LINK( this, ScColRowNameRangesDlg, RemoveBtnHdl 
) );
-    pLbRange->SetSelectHdl   ( LINK( this, ScColRowNameRangesDlg, 
Range1SelectHdl ) );
-    pEdAssign->SetModifyHdl  ( LINK( this, ScColRowNameRangesDlg, 
Range1DataModifyHdl ) );
-    pBtnColHead->SetClickHdl ( LINK( this, ScColRowNameRangesDlg, ColClickHdl 
) );
-    pBtnRowHead->SetClickHdl ( LINK( this, ScColRowNameRangesDlg, RowClickHdl 
) );
-    pEdAssign2->SetModifyHdl ( LINK( this, ScColRowNameRangesDlg, 
Range2DataModifyHdl ) );
-
-    Link<Control&,void> aLink = LINK( this, ScColRowNameRangesDlg, GetFocusHdl 
);
-    pEdAssign->SetGetFocusHdl( aLink );
-    pRbAssign->SetGetFocusHdl( aLink );
-    pEdAssign2->SetGetFocusHdl( aLink );
-    pRbAssign2->SetGetFocusHdl( aLink );
-
-    aLink = LINK( this, ScColRowNameRangesDlg, LoseFocusHdl );
-    pEdAssign->SetLoseFocusHdl( aLink );
-    pRbAssign->SetLoseFocusHdl( aLink );
-    pEdAssign2->SetLoseFocusHdl( aLink );
-    pRbAssign2->SetLoseFocusHdl( aLink );
-
-    pLbRange->SetDropDownLineCount(10);
-
-    pEdActive = pEdAssign;
+    m_xBtnOk->connect_clicked      ( LINK( this, ScColRowNameRangesDlg, 
OkBtnHdl ) );
+    m_xBtnCancel->connect_clicked  ( LINK( this, ScColRowNameRangesDlg, 
CancelBtnHdl ) );
+    m_xBtnAdd->connect_clicked     ( LINK( this, ScColRowNameRangesDlg, 
AddBtnHdl ) );
+    m_xBtnRemove->connect_clicked  ( LINK( this, ScColRowNameRangesDlg, 
RemoveBtnHdl ) );
+    m_xLbRange->connect_changed( LINK( this, ScColRowNameRangesDlg, 
Range1SelectHdl ) );
+    m_xEdAssign->SetModifyHdl  ( LINK( this, ScColRowNameRangesDlg, 
Range1DataModifyHdl ) );
+    m_xBtnColHead->connect_clicked ( LINK( this, ScColRowNameRangesDlg, 
ColClickHdl ) );
+    m_xBtnRowHead->connect_clicked ( LINK( this, ScColRowNameRangesDlg, 
RowClickHdl ) );
+    m_xEdAssign2->SetModifyHdl ( LINK( this, ScColRowNameRangesDlg, 
Range2DataModifyHdl ) );
+
+    Link<formula::WeldRefEdit&,void> aEditLink = LINK( this, 
ScColRowNameRangesDlg, GetEditFocusHdl );
+    m_xEdAssign->SetGetFocusHdl( aEditLink );
+    m_xEdAssign2->SetGetFocusHdl( aEditLink );
+
+    Link<formula::WeldRefButton&,void> aButtonLink = LINK( this, 
ScColRowNameRangesDlg, GetButtonFocusHdl );
+    m_xRbAssign->SetGetFocusHdl( aButtonLink );
+    m_xRbAssign2->SetGetFocusHdl( aButtonLink );
+
+    aEditLink = LINK( this, ScColRowNameRangesDlg, LoseEditFocusHdl );
+    m_xEdAssign->SetLoseFocusHdl( aEditLink );
+    m_xEdAssign2->SetLoseFocusHdl( aEditLink );
+
+    aButtonLink = LINK( this, ScColRowNameRangesDlg, LoseButtonFocusHdl );
+    m_xRbAssign2->SetLoseFocusHdl( aButtonLink );
+    m_xRbAssign->SetLoseFocusHdl( aButtonLink );
+
+    m_pEdActive = m_xEdAssign.get();
 
     UpdateNames();
 
@@ -159,20 +142,19 @@ void ScColRowNameRangesDlg::Init()
     }
     else
     {
-        pBtnColHead->Check();
-        pBtnRowHead->Check( false );
-        pEdAssign->SetText( EMPTY_OUSTRING );
-        pEdAssign2->SetText( EMPTY_OUSTRING );
+        m_xBtnColHead->set_active(true);
+        m_xBtnRowHead->set_active(false);
+        m_xEdAssign->SetText( EMPTY_OUSTRING );
+        m_xEdAssign2->SetText( EMPTY_OUSTRING );
     }
 
-    pLbRange->SetBorderStyle( WindowBorderStyle::MONO );
-    pBtnColHead->Enable();
-    pBtnRowHead->Enable();
-    pEdAssign->Enable();
-    pEdAssign->GrabFocus();
-    pRbAssign->Enable();
+    m_xBtnColHead->set_sensitive(true);
+    m_xBtnRowHead->set_sensitive(true);
+    m_xEdAssign->GetWidget()->set_sensitive(true);
+    m_xEdAssign->GrabFocus();
+    m_xRbAssign->GetWidget()->set_sensitive(true);
 
-    Range1SelectHdl( *pLbRange );
+    Range1SelectHdl( *m_xLbRange );
 }
 
 // set data range of a labeled range to default values and set the
@@ -187,8 +169,8 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& 
rLabelRange, bool bRef
     SCROW nRow2 = theCurArea.aEnd.Row();
     if ( (static_cast<SCCOLROW>(nCol2 - nCol1) >= nRow2 - nRow1) || (nCol1 == 
0 && nCol2 == MAXCOL) )
     {   // Column headers and the limiting case of the whole sheet
-        pBtnColHead->Check();
-        pBtnRowHead->Check( false );
+        m_xBtnColHead->set_active(true);
+        m_xBtnRowHead->set_active(false);
         if ( nRow2 == MAXROW  )
         {
             if ( nRow1 == 0 )
@@ -207,8 +189,8 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& 
rLabelRange, bool bRef
     }
     else
     {   // Column headers
-        pBtnRowHead->Check();
-        pBtnColHead->Check( false );
+        m_xBtnRowHead->set_active(true);
+        m_xBtnColHead->set_active(false);
         if ( nCol2 == MAXCOL )
         {   // Header at the right, data to the left
             theCurData.aStart.SetCol( 0 );
@@ -226,17 +208,17 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& 
rLabelRange, bool bRef
         OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, 
eConv));
 
         if(bRef)
-            pEdAssign->SetRefString( aStr );
+            m_xEdAssign->SetRefString( aStr );
         else
-            pEdAssign->SetText( aStr );
+            m_xEdAssign->SetText( aStr );
 
-        pEdAssign->SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) );
+        m_xEdAssign->SetCursorAtLast();
         aStr = theCurData.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv);
 
         if(bRef)
-            pEdAssign2->SetRefString( aStr );
+            m_xEdAssign2->SetRefString( aStr );
         else
-            pEdAssign2->SetText( aStr );
+            m_xEdAssign2->SetText( aStr );
     }
     else
     {
@@ -244,19 +226,19 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& 
rLabelRange, bool bRef
 
         if(bRef)
         {
-            pEdAssign->SetRefString( EMPTY_OUSTRING );
-            pEdAssign2->SetRefString( EMPTY_OUSTRING );
+            m_xEdAssign->SetRefString( EMPTY_OUSTRING );
+            m_xEdAssign2->SetRefString( EMPTY_OUSTRING );
         }
         else
         {
-            pEdAssign->SetText( EMPTY_OUSTRING );
-            pEdAssign2->SetText( EMPTY_OUSTRING );
+            m_xEdAssign->SetText( EMPTY_OUSTRING );
+            m_xEdAssign2->SetText( EMPTY_OUSTRING );
         }
 
-        pBtnColHead->Disable();
-        pBtnRowHead->Disable();
-        pEdAssign2->Disable();
-        pRbAssign2->Disable();
+        m_xBtnColHead->set_sensitive(false);
+        m_xBtnRowHead->set_sensitive(false);
+        m_xEdAssign2->GetWidget()->set_sensitive(false);
+        m_xRbAssign2->GetWidget()->set_sensitive(false);
     }
 }
 
@@ -264,7 +246,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& 
rLabelRange, bool bRef
 void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool 
bRef)
 {
     theCurData = rDataRange;
-    if ( pBtnColHead->IsChecked() )
+    if ( m_xBtnColHead->get_active() )
     {   // Data range is the same columns as the header
         theCurData.aStart.SetCol( theCurArea.aStart.Col() );
         theCurData.aEnd.SetCol( theCurArea.aEnd.Col() );
@@ -313,36 +295,36 @@ void ScColRowNameRangesDlg::AdjustColRowData( const 
ScRange& rDataRange, bool bR
     OUString aStr(theCurData.Format(ScRefFlags::RANGE_ABS_3D, pDoc, 
pDoc->GetAddressConvention()));
 
     if(bRef)
-        pEdAssign2->SetRefString( aStr );
+        m_xEdAssign2->SetRefString( aStr );
     else
-        pEdAssign2->SetText( aStr );
+        m_xEdAssign2->SetText( aStr );
 
-    pEdAssign2->SetSelection( Selection( SELECTION_MAX, SELECTION_MAX ) );
+    m_xEdAssign2->SetCursorAtLast();
 }
 
 // Set the reference to a cell range selected with the mouse and update
 // the selection form element
 void ScColRowNameRangesDlg::SetReference( const ScRange& rRef, ScDocument* /* 
pDoc */ )
 {
-    if ( pEdActive )
+    if ( m_pEdActive )
     {
         if ( rRef.aStart != rRef.aEnd )
-            RefInputStart( pEdActive );
+            RefInputStart( m_pEdActive );
 
-        if ( pEdActive == pEdAssign )
+        if (m_pEdActive == m_xEdAssign.get())
             SetColRowData( rRef, true );
         else
             AdjustColRowData( rRef, true );
-        pBtnColHead->Enable();
-        pBtnRowHead->Enable();
-        pBtnAdd->Enable();
-        pBtnRemove->Disable();
+        m_xBtnColHead->set_sensitive(true);
+        m_xBtnRowHead->set_sensitive(true);
+        m_xBtnAdd->set_sensitive(true);
+        m_xBtnRemove->set_sensitive(false);
     }
 }
 
-bool ScColRowNameRangesDlg::Close()
+void ScColRowNameRangesDlg::Close()
 {
-    return DoClose( ScColRowNameRangesDlgWrapper::GetChildWindowId() );
+    DoClose( ScColRowNameRangesDlgWrapper::GetChildWindowId() );
 }
 
 void ScColRowNameRangesDlg::SetActive()
@@ -350,27 +332,27 @@ void ScColRowNameRangesDlg::SetActive()
     if ( bDlgLostFocus )
     {
         bDlgLostFocus = false;
-        if( pEdActive )
-            pEdActive->GrabFocus();
+        if( m_pEdActive )
+            m_pEdActive->GrabFocus();
     }
     else
-        GrabFocus();
+        m_xDialog->grab_focus();
 
-    if( pEdActive == pEdAssign )
-        Range1DataModifyHdl( *pEdAssign );
-    else if( pEdActive == pEdAssign2 )
-        Range2DataModifyHdl( *pEdAssign2 );
+    if( m_pEdActive == m_xEdAssign.get() )
+        Range1DataModifyHdl( *m_xEdAssign );
+    else if( m_pEdActive == m_xEdAssign2.get() )
+        Range2DataModifyHdl( *m_xEdAssign2 );
 
     RefInputDone();
 }
 
 void ScColRowNameRangesDlg::UpdateNames()
 {
-    pLbRange->SetUpdateMode( false );
+    m_xLbRange->freeze();
 
-    pLbRange->Clear();
+    m_xLbRange->clear();
     aRangeMap.clear();
-    pEdAssign->SetText( EMPTY_OUSTRING );
+    m_xEdAssign->SetText( EMPTY_OUSTRING );
 
     size_t nCount, j;
 
@@ -388,8 +370,7 @@ void ScColRowNameRangesDlg::UpdateNames()
     aString = strDelim;
     aString += ScResId( STR_COLUMN );
     aString += strDelim;
-    sal_Int32 nPos = pLbRange->InsertEntry( aString );
-    pLbRange->SetEntryData( nPos, reinterpret_cast<void*>(nEntryDataDelim) );
+    m_xLbRange->append(OUString::number(nEntryDataDelim), aString);
     if ( (nCount = xColNameRanges->size()) > 0 )
     {
         std::vector<const ScRangePair*> 
aSortArray(xColNameRanges->CreateNameSortedArray(
@@ -423,16 +404,14 @@ void ScColRowNameRangesDlg::UpdateNames()
 
             //@008 Add string to listbox
             OUString aInsStr = aString + strShow.makeStringAndClear();
-            nPos = pLbRange->InsertEntry( aInsStr );
             aRangeMap.emplace( aInsStr, aRange );
-            pLbRange->SetEntryData( nPos, 
reinterpret_cast<void*>(nEntryDataCol) );
+            m_xLbRange->append(OUString::number(nEntryDataDelim), aInsStr);
         }
     }
     aString = strDelim;
     aString += ScResId( STR_ROW );
     aString += strDelim;
-    nPos = pLbRange->InsertEntry( aString );
-    pLbRange->SetEntryData( nPos, reinterpret_cast<void*>(nEntryDataDelim) );
+    m_xLbRange->append(OUString::number(nEntryDataDelim), aString);
     if ( (nCount = xRowNameRanges->size()) > 0 )
     {
         std::vector<const ScRangePair*> 
aSortArray(xRowNameRanges->CreateNameSortedArray(
@@ -464,14 +443,12 @@ void ScColRowNameRangesDlg::UpdateNames()
             strShow.append("]");
 
             OUString aInsStr = aString + strShow.makeStringAndClear();
-            nPos = pLbRange->InsertEntry( aInsStr );
             aRangeMap.emplace( aInsStr, aRange );
-            pLbRange->SetEntryData( nPos, 
reinterpret_cast<void*>(nEntryDataRow) );
+            m_xLbRange->append(OUString::number(nEntryDataRow), aInsStr);
         }
     }
 
-    pLbRange->SetUpdateMode( true );
-    pLbRange->Invalidate();
+    m_xLbRange->thaw();
 }
 
 void ScColRowNameRangesDlg::UpdateRangeData( const ScRange& rRange, bool 
bColName )
@@ -488,38 +465,38 @@ void ScColRowNameRangesDlg::UpdateRangeData( const 
ScRange& rRange, bool bColNam
         const formula::FormulaGrammar::AddressConvention eConv = 
pDoc->GetAddressConvention();
         theCurArea = rRange;
         OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, 
eConv));
-        pEdAssign->SetText( aStr );
-        pBtnAdd->Disable();
-        pBtnRemove->Enable();
-        pBtnColHead->Check( bColName );
-        pBtnRowHead->Check( !bColName );
+        m_xEdAssign->SetText( aStr );
+        m_xBtnAdd->set_sensitive(false);
+        m_xBtnRemove->set_sensitive(true);
+        m_xBtnColHead->set_active(bColName);
+        m_xBtnRowHead->set_active(!bColName);
         theCurData = pPair->GetRange(1);
         aStr = theCurData.Format(ScRefFlags::RANGE_ABS_3D, pDoc, eConv);
-        pEdAssign2->SetText( aStr );
+        m_xEdAssign2->SetText( aStr );
     }
     else
     {
-        pBtnAdd->Enable();
-        pBtnRemove->Disable();
+        m_xBtnAdd->set_sensitive(true);
+        m_xBtnRemove->set_sensitive(false);
     }
-    pBtnColHead->Enable();
-    pBtnRowHead->Enable();
-    pEdAssign2->Enable();
-    pRbAssign2->Enable();
+    m_xBtnColHead->set_sensitive(true);
+    m_xBtnRowHead->set_sensitive(true);
+    m_xEdAssign2->GetWidget()->set_sensitive(true);
+    m_xRbAssign2->GetWidget()->set_sensitive(true);
 }
 
 bool ScColRowNameRangesDlg::IsRefInputMode() const
 {
-    return (pEdActive != nullptr);
+    return (m_pEdActive != nullptr);
 }
 
 // Handler:
 
 // handler called when OK is clicked, calls the add button handler before
 // passing the range lists to the document
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, OkBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, OkBtnHdl, weld::Button&, void)
 {
-    AddBtnHdl( nullptr );
+    AddBtnHdl(*m_xBtnAdd);
 
     // assign RangeLists to the references in the document
     pDoc->GetColNameRangesRef() = xColNameRanges;
@@ -530,19 +507,19 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, OkBtnHdl, Button*, 
void)
     pDocShell->PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), 
PaintPartFlags::Grid);
     pDocShell->SetDocumentModified();
 
-    Close();
+    response(RET_OK);
 }
 
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, CancelBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, CancelBtnHdl, weld::Button&, void)
 {
-    Close();
+    response(RET_CANCEL);
 }
 
 // handler called when add button clicked: set ranges and add to listbox
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, weld::Button&, void)
 {
-    OUString aNewArea( pEdAssign->GetText() );
-    OUString aNewData( pEdAssign2->GetText() );
+    OUString aNewArea( m_xEdAssign->GetText() );
+    OUString aNewData( m_xEdAssign2->GetText() );
 
     if ( !aNewArea.isEmpty() && !aNewData.isEmpty() )
     {
@@ -562,41 +539,40 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, 
Button*, void)
             {
                 xRowNameRanges->Remove( *pPair );
             }
-            if ( pBtnColHead->IsChecked() )
+            if ( m_xBtnColHead->get_active() )
                 xColNameRanges->Join( ScRangePair( theCurArea, theCurData ) );
             else
                 xRowNameRanges->Join( ScRangePair( theCurArea, theCurData ) );
 
             UpdateNames();
 
-            pEdAssign->GrabFocus();
-            pBtnAdd->Disable();
-            pBtnRemove->Disable();
-            pEdAssign->SetText( EMPTY_OUSTRING );
-            pBtnColHead->Check();
-            pBtnRowHead->Check( false );
-            pEdAssign2->SetText( EMPTY_OUSTRING );
+            m_xEdAssign->GrabFocus();
+            m_xBtnAdd->set_sensitive(false);
+            m_xBtnRemove->set_sensitive(false);
+            m_xEdAssign->SetText( EMPTY_OUSTRING );
+            m_xBtnColHead->set_active(true);
+            m_xBtnRowHead->set_active(false);
+            m_xEdAssign2->SetText( EMPTY_OUSTRING );
             theCurArea = ScRange();
             theCurData = theCurArea;
-            Range1SelectHdl( *pLbRange );
+            Range1SelectHdl( *m_xLbRange );
         }
         else
         {
-            ERRORBOX(GetFrameWeld(), ScResId(STR_INVALIDTABNAME));
+            ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDTABNAME));
             if ( !bOk1 )
-                pEdAssign->GrabFocus();
+                m_xEdAssign->GrabFocus();
             else
-                pEdAssign2->GrabFocus();
+                m_xEdAssign2->GrabFocus();
         }
     }
 }
 
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, weld::Button&, void)
 {
-    OUString aRangeStr = pLbRange->GetSelectedEntry();
-    sal_Int32 nSelectPos = pLbRange->GetSelectedEntryPos();
-    bool bColName =
-        (reinterpret_cast<sal_uLong>(pLbRange->GetEntryData( nSelectPos )) == 
nEntryDataCol);
+    OUString aRangeStr = m_xLbRange->get_selected_text();
+    sal_Int32 nSelectPos = m_xLbRange->get_selected_index();
+    bool bColName = nSelectPos != -1 && 
m_xLbRange->get_id(nSelectPos).toInt32() == nEntryDataCol;
     NameRangeMap::const_iterator itr = aRangeMap.find(aRangeStr);
     if (itr == aRangeMap.end())
         return;
@@ -615,7 +591,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, 
Button*, void)
                             + aRangeStr
                             + aStrDelMsg.getToken( 1, '#' );
 
-        if (RET_YES == QUERYBOX(GetFrameWeld(), aMsg))
+        if (RET_YES == QUERYBOX(m_xDialog.get(), aMsg))
         {
             if ( bColName )
                 xColNameRanges->Remove( *pPair );
@@ -623,7 +599,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, 
Button*, void)
                 xRowNameRanges->Remove( *pPair );
 
             UpdateNames();
-            const sal_Int32 nCnt = pLbRange->GetEntryCount();
+            const sal_Int32 nCnt = m_xLbRange->n_children();
             if ( nSelectPos >= nCnt )
             {
                 if ( nCnt )
@@ -631,96 +607,93 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, 
Button*, void)
                 else
                     nSelectPos = 0;
             }
-            pLbRange->SelectEntryPos( nSelectPos );
-            if ( nSelectPos &&
-                    reinterpret_cast<sal_uLong>(pLbRange->GetEntryData( 
nSelectPos )) == nEntryDataDelim )
-                pLbRange->SelectEntryPos( --nSelectPos );    // ---Row---
-
-            pLbRange->GrabFocus();
-            pBtnAdd->Disable();
-            pBtnRemove->Disable();
-            pEdAssign->SetText( EMPTY_OUSTRING );
+            m_xLbRange->select(nSelectPos);
+            if (nSelectPos && m_xLbRange->get_id(nSelectPos).toInt32() == 
nEntryDataDelim)
+                m_xLbRange->select( --nSelectPos );    // ---Row---
+
+            m_xLbRange->grab_focus();
+            m_xBtnAdd->set_sensitive(false);
+            m_xBtnRemove->set_sensitive(false);
+            m_xEdAssign->SetText( EMPTY_OUSTRING );
             theCurArea = theCurData = ScRange();
-            pBtnColHead->Check();
-            pBtnRowHead->Check( false );
-            pEdAssign2->SetText( EMPTY_OUSTRING );
-            Range1SelectHdl( *pLbRange );
+            m_xBtnColHead->set_active(true);
+            m_xBtnRowHead->set_active(false);
+            m_xEdAssign2->SetText( EMPTY_OUSTRING );
+            Range1SelectHdl( *m_xLbRange );
         }
     }
 }
 
 // handler called when a row in the listbox is selected, updates form input 
fields
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1SelectHdl, ListBox&, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1SelectHdl, weld::TreeView&, void)
 {
-    sal_Int32 nSelectPos = pLbRange->GetSelectedEntryPos();
-    const sal_Int32 nCnt = pLbRange->GetEntryCount();
+    sal_Int32 nSelectPos = m_xLbRange->get_selected_index();
+    const sal_Int32 nCnt = m_xLbRange->n_children();
     sal_uInt16 nMoves = 0;
-    while ( nSelectPos < nCnt
-            && reinterpret_cast<sal_uLong>(pLbRange->GetEntryData( nSelectPos 
)) == nEntryDataDelim )
+    while (nSelectPos != -1 && nSelectPos < nCnt && 
m_xLbRange->get_id(nSelectPos).toInt32() == nEntryDataDelim)
     {   // skip Delimiter
         ++nMoves;
-        pLbRange->SelectEntryPos( ++nSelectPos );
+        m_xLbRange->select( ++nSelectPos );
     }
-    OUString aRangeStr = pLbRange->GetSelectedEntry();
+    OUString aRangeStr = m_xLbRange->get_selected_text();
     if ( nMoves )
     {
         if ( nSelectPos > 1 && nSelectPos >= nCnt )
         {   // if entries exist before the " --- Row --- " Delimiter then
             // do not stop at the delimiter
             nSelectPos = nCnt - 2;
-            pLbRange->SelectEntryPos( nSelectPos );
-            aRangeStr = pLbRange->GetSelectedEntry();
+            m_xLbRange->select( nSelectPos );
+            aRangeStr = m_xLbRange->get_selected_text();
         }
         else if ( nSelectPos > 2 && nSelectPos < nCnt && !aRangeStr.isEmpty()
-                  && aRangeStr == pEdAssign->GetText() )
+                  && aRangeStr == m_xEdAssign->GetText() )
         {   // move upwards instead of below to the previous position
             nSelectPos -= 2;
-            pLbRange->SelectEntryPos( nSelectPos );
-            aRangeStr = pLbRange->GetSelectedEntry();
+            m_xLbRange->select( nSelectPos );
+            aRangeStr = m_xLbRange->get_selected_text();
         }
     }
     NameRangeMap::const_iterator itr = aRangeMap.find(aRangeStr);
     if ( itr != aRangeMap.end() )
     {
-        bool bColName =
-            (reinterpret_cast<sal_uLong>(pLbRange->GetEntryData( nSelectPos )) 
== nEntryDataCol);
+        bool bColName = m_xLbRange->get_id(nSelectPos).toInt32() == 
nEntryDataCol;
         UpdateRangeData( itr->second, bColName );
-        pBtnAdd->Disable();
-        pBtnRemove->Enable();
+        m_xBtnAdd->set_sensitive(false);
+        m_xBtnRemove->set_sensitive(true);
     }
     else
     {
-        if ( !pEdAssign->GetText().isEmpty() )
+        if ( !m_xEdAssign->GetText().isEmpty() )
         {
-            if ( !pEdAssign2->GetText().isEmpty() )
-                pBtnAdd->Enable();
+            if ( !m_xEdAssign2->GetText().isEmpty() )
+                m_xBtnAdd->set_sensitive(true);
             else
-                pBtnAdd->Disable();
-            pBtnColHead->Enable();
-            pBtnRowHead->Enable();
-            pEdAssign2->Enable();
-            pRbAssign2->Enable();
+                m_xBtnAdd->set_sensitive(false);
+            m_xBtnColHead->set_sensitive(true);
+            m_xBtnRowHead->set_sensitive(true);
+            m_xEdAssign2->GetWidget()->set_sensitive(true);
+            m_xRbAssign2->GetWidget()->set_sensitive(true);
         }
         else
         {
-            pBtnAdd->Disable();
-            pBtnColHead->Disable();
-            pBtnRowHead->Disable();
-            pEdAssign2->Disable();
-            pRbAssign2->Disable();
+            m_xBtnAdd->set_sensitive(false);
+            m_xBtnColHead->set_sensitive(false);
+            m_xBtnRowHead->set_sensitive(false);
+            m_xEdAssign2->GetWidget()->set_sensitive(false);
+            m_xRbAssign2->GetWidget()->set_sensitive(false);
         }
-        pBtnRemove->Disable();
-        pEdAssign->GrabFocus();
+        m_xBtnRemove->set_sensitive(false);
+        m_xEdAssign->GrabFocus();
     }
 
-    pEdAssign->Enable();
-    pRbAssign->Enable();
+    m_xEdAssign->GetWidget()->set_sensitive(true);
+    m_xRbAssign->GetWidget()->set_sensitive(true);
 }
 
 // handler called when the label range has changed
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1DataModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1DataModifyHdl, 
formula::WeldRefEdit&, void)
 {
-    OUString aNewArea( pEdAssign->GetText() );
+    OUString aNewArea( m_xEdAssign->GetText() );
     bool bValid = false;
     if (!aNewArea.isEmpty() && pDoc)
     {
@@ -733,56 +706,54 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, 
Range1DataModifyHdl, Edit&, void)
     }
     if ( bValid )
     {
-        pBtnAdd->Enable();
-        pBtnColHead->Enable();
-        pBtnRowHead->Enable();
-        pEdAssign2->Enable();
-        pRbAssign2->Enable();
+        m_xBtnAdd->set_sensitive(true);
+        m_xBtnColHead->set_sensitive(true);
+        m_xBtnRowHead->set_sensitive(true);
+        m_xEdAssign2->GetWidget()->set_sensitive(true);
+        m_xRbAssign2->GetWidget()->set_sensitive(true);
     }
     else
     {
-        pBtnAdd->Disable();
-        pBtnColHead->Disable();
-        pBtnRowHead->Disable();
-        pEdAssign2->Disable();
-        pRbAssign2->Disable();
+        m_xBtnAdd->set_sensitive(false);
+        m_xBtnColHead->set_sensitive(false);
+        m_xBtnRowHead->set_sensitive(false);
+        m_xEdAssign2->GetWidget()->set_sensitive(false);
+        m_xRbAssign2->GetWidget()->set_sensitive(false);
     }
-    pBtnRemove->Disable();
+    m_xBtnRemove->set_sensitive(false);
 }
 
 // handler called when the data range has changed
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, 
formula::WeldRefEdit&, void)
 {
-    OUString aNewData( pEdAssign2->GetText() );
+    OUString aNewData( m_xEdAssign2->GetText() );
     if ( !aNewData.isEmpty() )
     {
         ScRange aRange;
         if ( (aRange.ParseAny(aNewData, pDoc, pDoc->GetAddressConvention() ) & 
ScRefFlags::VALID) == ScRefFlags::VALID)
         {
             AdjustColRowData( aRange );
-            pBtnAdd->Enable();
+            m_xBtnAdd->set_sensitive(true);
         }
         else
-            pBtnAdd->Disable();
+            m_xBtnAdd->set_sensitive(false);
     }
     else
     {
-        pBtnAdd->Disable();
+        m_xBtnAdd->set_sensitive(false);
     }
 }
 
 // handler for the radio button for columns, adjust ranges
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, Button*, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, weld::Button&, void)
 {
-    if ( !pBtnColHead->GetSavedValue() )
+    if (m_xBtnColHead->get_active())
     {
-        pBtnColHead->Check();
-        pBtnRowHead->Check( false );
         if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == MAXROW )
         {
             theCurArea.aEnd.SetRow( MAXROW - 1 );
             OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, 
pDoc->GetAddressConvention()));
-            pEdAssign->SetText( aStr );
+            m_xEdAssign->SetText( aStr );
         }
         ScRange aRange( theCurData );
         aRange.aStart.SetRow( std::min( 
static_cast<long>(theCurArea.aEnd.Row() + 1), long(MAXROW) ) );
@@ -792,17 +763,15 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, 
Button*, void)
 }
 
 // handler for the radio button for columns, adjust range
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, Button*, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, weld::Button&, void)
 {
-    if ( !pBtnRowHead->GetSavedValue() )
+    if (m_xBtnRowHead->get_active())
     {
-        pBtnRowHead->Check();
-        pBtnColHead->Check( false );
         if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == MAXCOL )
         {
             theCurArea.aEnd.SetCol( MAXCOL - 1 );
             OUString aStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, 
pDoc->GetAddressConvention()));
-            pEdAssign->SetText( aStr );
+            m_xEdAssign->SetText( aStr );
         }
         ScRange aRange( theCurData );
         aRange.aStart.SetCol( static_cast<SCCOL>(std::min( 
static_cast<long>(theCurArea.aEnd.Col() + 1), long(MAXCOL) )) );
@@ -811,22 +780,40 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, 
Button*, void)
     }
 }
 
-IMPL_LINK( ScColRowNameRangesDlg, GetFocusHdl, Control&, rCtrl, void )
+IMPL_LINK( ScColRowNameRangesDlg, GetEditFocusHdl, formula::WeldRefEdit&, 
rCtrl, void )
 {
-    if( (&rCtrl == static_cast<Control*>(pEdAssign)) || (&rCtrl == 
static_cast<Control*>(pRbAssign)) )
-        pEdActive = pEdAssign;
-    else if( (&rCtrl == static_cast<Control*>(pEdAssign2)) || (&rCtrl == 
static_cast<Control*>(pRbAssign2)) )
-        pEdActive = pEdAssign2;
+    if (&rCtrl == m_xEdAssign.get())
+        m_pEdActive = m_xEdAssign.get();
+    else if (&rCtrl == m_xEdAssign2.get())
+        m_pEdActive = m_xEdAssign2.get();
     else
-        pEdActive = nullptr;
+        m_pEdActive = nullptr;
+
+    if( m_pEdActive )
+        m_pEdActive->SelectAll();
+}
 
-    if( pEdActive )
-        pEdActive->SetSelection( Selection( 0, SELECTION_MAX ) );
+IMPL_LINK( ScColRowNameRangesDlg, GetButtonFocusHdl, formula::WeldRefButton&, 
rCtrl, void )
+{
+    if (&rCtrl == m_xRbAssign.get())
+        m_pEdActive = m_xEdAssign.get();
+    else if (&rCtrl == m_xRbAssign2.get())
+        m_pEdActive = m_xEdAssign2.get();
+    else
+        m_pEdActive = nullptr;
+
+    if( m_pEdActive )
+        m_pEdActive->SelectAll();
+}
+
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, LoseEditFocusHdl, 
formula::WeldRefEdit&, void)
+{
+    bDlgLostFocus = !m_xDialog->has_toplevel_focus();
 }
 
-IMPL_LINK_NOARG(ScColRowNameRangesDlg, LoseFocusHdl, Control&, void)
+IMPL_LINK_NOARG(ScColRowNameRangesDlg, LoseButtonFocusHdl, 
formula::WeldRefButton&, void)
 {
-    bDlgLostFocus = !IsActive();
+    bDlgLostFocus = !m_xDialog->has_toplevel_focus();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index d0831495e9c5..1337c719a589 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -44,7 +44,7 @@ SFX_IMPL_MODELESSDIALOG_WITHID(ScSpecialFilterDlgWrapper, 
SID_SPECIAL_FILTER )
 SFX_IMPL_CHILDWINDOW_WITHID(ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScConsolidateDlgWrapper, 
SID_OPENDLG_CONSOLIDATE )
 SFX_IMPL_CHILDWINDOW_WITHID(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA 
)
-SFX_IMPL_MODELESSDIALOG_WITHID(ScColRowNameRangesDlgWrapper, 
SID_DEFINE_COLROWNAMERANGES )
+SFX_IMPL_CHILDWINDOW_WITHID(ScColRowNameRangesDlgWrapper, 
SID_DEFINE_COLROWNAMERANGES )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
@@ -141,7 +141,7 @@ IMPL_CHILD_CTOR( ScSpecialFilterDlgWrapper, 
SID_SPECIAL_FILTER )
 
 IMPL_CONTROLLER_CHILD_CTOR( ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
 
-IMPL_CHILD_CTOR( ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
+IMPL_CONTROLLER_CHILD_CTOR( ScColRowNameRangesDlgWrapper, 
SID_DEFINE_COLROWNAMERANGES )
 
 IMPL_CHILD_CTOR( ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE )
 
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d003f32d6aa8..4e94cabc67df 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1989,10 +1989,20 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool 
bExtendSelection, bool bSa
             sal_uInt16 nCurRefDlgId=pScMod->GetCurRefDlgId();
             SfxViewFrame* pViewFrm = aViewData.GetViewShell()->GetViewFrame();
             SfxChildWindow* pChildWnd = pViewFrm->GetChildWindow( nCurRefDlgId 
);
-            IAnyRefDialog* pRefDlg = pChildWnd ? 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow()) : nullptr;
-            if (pRefDlg)
+            if (pChildWnd)
             {
-                pRefDlg->ViewShellChanged();
+                if (pChildWnd->GetWindow())
+                {
+                    IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
+                    if (pRefDlg)
+                        pRefDlg->ViewShellChanged();
+                }
+                if (pChildWnd->GetController())
+                {
+                    IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
+                    if (pRefDlg)
+                        pRefDlg->ViewShellChanged();
+                }
             }
         }
 
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index e7397c77beb7..e9d46a3a76ae 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -199,11 +199,18 @@ void ScTabViewShell::Activate(bool bMDI)
             SfxChildWindow* pChildWnd = pThisFrame->GetChildWindow( 
nModRefDlgId );
             if ( pChildWnd )
             {
-                IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
-                assert(pRefDlg);
-                if(pRefDlg)
+                if (pChildWnd->GetWindow())
                 {
-                    pRefDlg->ViewShellChanged();
+                    IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetWindow());
+                    assert(pRefDlg);
+                    if (pRefDlg)
+                        pRefDlg->ViewShellChanged();
+                }
+                if (pChildWnd->GetController())
+                {
+                    IAnyRefDialog* pRefDlg = 
dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
+                    if (pRefDlg)
+                        pRefDlg->ViewShellChanged();
                 }
             }
         }
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 02177d27864e..71181450a3d0 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -144,12 +144,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
 
     switch( nSlotId )
     {
-        case SID_DEFINE_COLROWNAMERANGES:
-        {
-            pResult = VclPtr<ScColRowNameRangesDlg>::Create( pB, pCW, pParent, 
&GetViewData() );
-        }
-        break;
-
         case SID_OPENDLG_CONSOLIDATE:
         {
             SfxItemSet aArgSet( GetPool(),
@@ -491,7 +485,10 @@ std::unique_ptr<SfxModelessDialogController> 
ScTabViewShell::CreateRefDialogCont
         }
         case SID_OPENDLG_EDIT_PRINTAREA:
             xResult.reset(new ScPrintAreasDlg(pB, pCW, pParent));
-        break;
+            break;
+        case SID_DEFINE_COLROWNAMERANGES:
+            xResult.reset(new ScColRowNameRangesDlg(pB, pCW, pParent, 
&GetViewData()));
+            break;
     }
 
     if (xResult)
diff --git a/sc/uiconfig/scalc/ui/namerangesdialog.ui 
b/sc/uiconfig/scalc/ui/namerangesdialog.ui
index 667ed4afd5cb..f38611ba974b 100644
--- a/sc/uiconfig/scalc/ui/namerangesdialog.ui
+++ b/sc/uiconfig/scalc/ui/namerangesdialog.ui
@@ -1,14 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkDialog" id="NameRangesDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" 
context="namerangesdialog|NameRangesDialog">Define Label Range</property>
     <property name="resizable">False</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -105,10 +117,11 @@
                         <property name="hexpand">True</property>
                         <property name="column_spacing">12</property>
                         <child>
-                          <object class="foruilo-RefEdit" id="edassign">
+                          <object class="GtkEntry" id="edassign">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
@@ -116,7 +129,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="foruilo-RefButton" id="rbassign">
+                          <object class="GtkButton" id="rbassign">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
@@ -152,7 +165,6 @@
                             <property name="xalign">0</property>
                             <property name="active">True</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">rowhead</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
@@ -168,7 +180,6 @@
                             <property name="hexpand">True</property>
                             <property name="use_underline">True</property>
                             <property name="xalign">0</property>
-                            <property name="active">True</property>
                             <property name="draw_indicator">True</property>
                             <property name="group">colhead</property>
                           </object>
@@ -187,10 +198,10 @@
                       <object class="GtkLabel" id="datarange">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" 
context="namerangesdialog|datarange">For _data range</property>
                         <property name="use_underline">True</property>
                         <property name="mnemonic_widget">edassign2</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -204,10 +215,11 @@
                         <property name="hexpand">True</property>
                         <property name="column_spacing">12</property>
                         <child>
-                          <object class="foruilo-RefEdit" id="edassign2">
+                          <object class="GtkEntry" id="edassign2">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="hexpand">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
@@ -215,7 +227,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="foruilo-RefButton" id="rbassign2">
+                          <object class="GtkButton" id="rbassign2">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
@@ -276,14 +288,40 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkTreeView" id="range: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="show_expanders">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection" 
id="treeview-selection1"/>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkTreeView" id="range">
+                            <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="rules_hint">True</property>
+                            <property name="search_column">0</property>
+                            <property name="show_expanders">False</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection"/>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" 
id="treeviewcolumn3">
+                                <property name="resizable">True</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <object class="GtkCellRendererText" 
id="cellrenderer3"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
                         </child>
                       </object>
                       <packing>
diff --git a/solenv/sanitizers/ui/modules/scalc.suppr 
b/solenv/sanitizers/ui/modules/scalc.suppr
index ebe0e9afbe88..18d4c20f2231 100644
--- a/solenv/sanitizers/ui/modules/scalc.suppr
+++ b/solenv/sanitizers/ui/modules/scalc.suppr
@@ -111,7 +111,9 @@ 
sc/uiconfig/scalc/ui/imoptdialog.ui://svxlo-SvxTextEncodingBox[@id='charsetlist:
 sc/uiconfig/scalc/ui/insertsheet.ui://GtkLabel[@id='path'] orphan-label
 sc/uiconfig/scalc/ui/insertsheet.ui://GtkTreeViewColumn[@id='treeviewcolumn1'] 
no-labelled-by
 sc/uiconfig/scalc/ui/integerdialog.ui://GtkSpinButton[@id='value'] 
no-labelled-by
-sc/uiconfig/scalc/ui/namerangesdialog.ui://foruilo-RefEdit[@id='edassign'] 
no-labelled-by
+sc/uiconfig/scalc/ui/namerangesdialog.ui://GtkEntry[@id='edassign'] 
no-labelled-by
+sc/uiconfig/scalc/ui/namerangesdialog.ui://GtkButton[@id='rbassign'] 
button-no-label
+sc/uiconfig/scalc/ui/namerangesdialog.ui://GtkButton[@id='rbassign2'] 
button-no-label
 sc/uiconfig/scalc/ui/notebookbar_groups.ui://GtkLabel[@id='filegrouplabel'] 
orphan-label
 
sc/uiconfig/scalc/ui/notebookbar_groups.ui://GtkLabel[@id='clipboardgrouplabel']
 orphan-label
 
sc/uiconfig/scalc/ui/notebookbar_groups.ui://svtlo-FontNameBox[@id='fontnamelist']
 no-labelled-by
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to