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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 11 11:16:19 UTC 2019


 sc/source/ui/inc/namedefdlg.hxx          |   49 ++++----
 sc/source/ui/inc/reffact.hxx             |    2 
 sc/source/ui/inc/tabvwsh.hxx             |    3 
 sc/source/ui/namedlg/namedefdlg.cxx      |  173 +++++++++++++------------------
 sc/source/ui/namedlg/namedlg.cxx         |    2 
 sc/source/ui/view/reffact.cxx            |    4 
 sc/source/ui/view/tabvwshc.cxx           |   62 +++++------
 sc/uiconfig/scalc/ui/definename.ui       |   25 ++--
 solenv/sanitizers/ui/modules/scalc.suppr |    1 
 9 files changed, 153 insertions(+), 168 deletions(-)

New commits:
commit e9f2e6526c68045380b64e7579b07c6064be9c58
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 11 09:42:46 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 11 13:15:56 2019 +0200

    weld ScNameDefDlg
    
    Change-Id: Ic5e46a0a9f03733c8e151e6dff55b7b4a3fcda34
    Reviewed-on: https://gerrit.libreoffice.org/70588
    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/inc/namedefdlg.hxx b/sc/source/ui/inc/namedefdlg.hxx
index aa971727884c..aa9861cd278f 100644
--- a/sc/source/ui/inc/namedefdlg.hxx
+++ b/sc/source/ui/inc/namedefdlg.hxx
@@ -22,25 +22,9 @@ class ScDocument;
 class ScDocShell;
 class ScViewData;
 
-class ScNameDefDlg : public ScAnyRefDlg
+class ScNameDefDlg : public ScAnyRefDlgController
 {
 private:
-    VclPtr<Edit> m_pEdName;
-
-    VclPtr<formula::RefEdit> m_pEdRange;
-    VclPtr<formula::RefButton> m_pRbRange;
-
-    VclPtr<ListBox> m_pLbScope;
-
-    VclPtr<CheckBox> m_pBtnRowHeader;
-    VclPtr<CheckBox> m_pBtnColHeader;
-    VclPtr<CheckBox> m_pBtnPrintArea;
-    VclPtr<CheckBox> m_pBtnCriteria;
-
-    VclPtr<PushButton> m_pBtnAdd;
-    VclPtr<PushButton> m_pBtnCancel;
-    VclPtr<FixedText> m_pFtInfo;
-
     bool const mbUndo; //if true we need to add an undo action after creating a range name
     ScDocument* mpDoc;
     ScDocShell* mpDocShell;
@@ -58,33 +42,50 @@ private:
 
     std::map<OUString, ScRangeName*> maRangeMap;
 
+    std::unique_ptr<weld::Entry> m_xEdName;
+
+    std::unique_ptr<formula::WeldRefEdit> m_xEdRange;
+    std::unique_ptr<formula::WeldRefButton> m_xRbRange;
+
+    std::unique_ptr<weld::ComboBox> m_xLbScope;
+
+    std::unique_ptr<weld::CheckButton> m_xBtnRowHeader;
+    std::unique_ptr<weld::CheckButton> m_xBtnColHeader;
+    std::unique_ptr<weld::CheckButton> m_xBtnPrintArea;
+    std::unique_ptr<weld::CheckButton> m_xBtnCriteria;
+
+    std::unique_ptr<weld::Button> m_xBtnAdd;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
+    std::unique_ptr<weld::Label> m_xFtInfo;
+    std::unique_ptr<weld::Expander> m_xExpander;
+    std::unique_ptr<weld::Label> m_xFtRange;
+
     void CancelPushed();
     void AddPushed();
 
     bool IsNameValid();
     bool IsFormulaValid();
 
-    DECL_LINK( CancelBtnHdl, Button*, void );
-    DECL_LINK( AddBtnHdl, Button*, void );
-    DECL_LINK( NameModifyHdl, Edit&, void );
-    DECL_LINK( AssignGetFocusHdl, Control&, void );
+    DECL_LINK( CancelBtnHdl, weld::Button&, void );
+    DECL_LINK( AddBtnHdl, weld::Button&, void );
+    DECL_LINK( NameModifyHdl, weld::Entry&, void );
+    DECL_LINK( AssignGetFocusHdl, formula::WeldRefEdit&, void );
 
 protected:
     virtual void    RefInputDone( bool bForced = false ) override;
 
 public:
-    ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
+    ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
                     const ScViewData* pViewData, const std::map<OUString, ScRangeName*>& aRangeMap,
                     const ScAddress& aCursorPos, const bool bUndo);
 
     virtual ~ScNameDefDlg() override;
-    virtual void    dispose() 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;
 
     void GetNewData( OUString& rName, OUString& rScope );
 };
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index e6bf12c0feec..f41d5331b066 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -45,7 +45,7 @@
     };
 
 DECL_WRAPPER_WITHID_CONTROLLER(ScNameDlgWrapper)
-DECL_WRAPPER_WITHID(ScNameDefDlgWrapper)
+DECL_WRAPPER_WITHID_CONTROLLER(ScNameDefDlgWrapper)
 DECL_WRAPPER_WITHID(ScSolverDlgWrapper)
 DECL_WRAPPER_WITHID(ScOptSolverDlgWrapper)
 DECL_WRAPPER_WITHID(ScXMLSourceDlgWrapper)
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 4a2a142befef..266d816a78af 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -378,8 +378,7 @@ public:
     const   OUString DoAutoSum(bool& rRangeFinder, bool& rSubTotal);
 
     // ugly hack to call Define Names from Manage Names
-    void    SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
-    void    SwitchBetweenRefDialogControllers(SfxModelessDialogController* pDialog);
+    void    SwitchBetweenRefDialogs(SfxModelessDialogController* pDialog);
     // #i123629#
     bool    GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; }
     void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; }
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index 2b3e6ce45545..9eda9de45387 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -25,54 +25,54 @@
 #include <tabvwsh.hxx>
 #include <tokenarray.hxx>
 
-ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
+ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
         const ScViewData* pViewData, const std::map<OUString, ScRangeName*>& aRangeMap,
         const ScAddress& aCursorPos, const bool bUndo )
-    : ScAnyRefDlg( pB, pCW, pParent, "DefineNameDialog", "modules/scalc/ui/definename.ui" )
-    ,
-    mbUndo( bUndo ),
-    mpDoc( pViewData->GetDocument() ),
-    mpDocShell ( pViewData->GetDocShell() ),
-    maCursorPos( aCursorPos ),
-
-    maGlobalNameStr  ( ScResId(STR_GLOBAL_SCOPE) ),
-    maErrInvalidNameStr( ScResId(STR_ERR_NAME_INVALID)),
-    maErrInvalidNameCellRefStr( ScResId(STR_ERR_NAME_INVALID_CELL_REF)),
-    maErrNameInUse   ( ScResId(STR_ERR_NAME_EXISTS)),
-    maRangeMap( aRangeMap )
+    : ScAnyRefDlgController( pB, pCW, pParent, "modules/scalc/ui/definename.ui", "DefineNameDialog")
+    , mbUndo( bUndo )
+    , mpDoc( pViewData->GetDocument() )
+    , mpDocShell ( pViewData->GetDocShell() )
+    , maCursorPos( aCursorPos )
+    , maGlobalNameStr  ( ScResId(STR_GLOBAL_SCOPE) )
+    , maErrInvalidNameStr( ScResId(STR_ERR_NAME_INVALID))
+    , maErrInvalidNameCellRefStr( ScResId(STR_ERR_NAME_INVALID_CELL_REF))
+    , maErrNameInUse   ( ScResId(STR_ERR_NAME_EXISTS))
+    , maRangeMap( aRangeMap )
+    , m_xEdName(m_xBuilder->weld_entry("edit"))
+    , m_xEdRange(new formula::WeldRefEdit(m_xBuilder->weld_entry("range")))
+    , m_xRbRange(new formula::WeldRefButton(m_xBuilder->weld_button("refbutton")))
+    , m_xLbScope(m_xBuilder->weld_combo_box("scope"))
+    , m_xBtnRowHeader(m_xBuilder->weld_check_button("rowheader"))
+    , m_xBtnColHeader(m_xBuilder->weld_check_button("colheader"))
+    , m_xBtnPrintArea(m_xBuilder->weld_check_button("printarea"))
+    , m_xBtnCriteria(m_xBuilder->weld_check_button("filter"))
+    , m_xBtnAdd(m_xBuilder->weld_button("add"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
+    , m_xFtInfo(m_xBuilder->weld_label("label"))
+    , m_xExpander(m_xBuilder->weld_expander("more"))
+    , m_xFtRange(m_xBuilder->weld_label("label3"))
 {
-    get(m_pEdName, "edit");
-    get(m_pEdRange, "range");
-    m_pEdRange->SetReferences(this, m_pEdName);
-    get(m_pRbRange, "refbutton");
-    m_pRbRange->SetReferences(this, m_pEdRange);
-    get(m_pLbScope, "scope");
-    get(m_pBtnRowHeader, "rowheader");
-    get(m_pBtnColHeader, "colheader");
-    get(m_pBtnPrintArea, "printarea");
-    get(m_pBtnCriteria, "filter");
-    get(m_pBtnAdd, "add");
-    get(m_pBtnCancel, "cancel");
-    get(m_pFtInfo, "label");
-    maStrInfoDefault = m_pFtInfo->GetText();
+    m_xEdRange->SetReferences(this, m_xFtRange.get());
+    m_xRbRange->SetReferences(this, m_xEdRange.get());
+    maStrInfoDefault = m_xFtInfo->get_label();
 
     // Initialize scope list.
-    m_pLbScope->InsertEntry(maGlobalNameStr);
-    m_pLbScope->SelectEntryPos(0);
+    m_xLbScope->append_text(maGlobalNameStr);
+    m_xLbScope->set_active(0);
     SCTAB n = mpDoc->GetTableCount();
     for (SCTAB i = 0; i < n; ++i)
     {
         OUString aTabName;
         mpDoc->GetName(i, aTabName);
-        m_pLbScope->InsertEntry(aTabName);
+        m_xLbScope->append_text(aTabName);
     }
 
-    m_pBtnCancel->SetClickHdl( LINK( this, ScNameDefDlg, CancelBtnHdl));
-    m_pBtnAdd->SetClickHdl( LINK( this, ScNameDefDlg, AddBtnHdl ));
-    m_pEdName->SetModifyHdl( LINK( this, ScNameDefDlg, NameModifyHdl ));
-    m_pEdRange->SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) );
+    m_xBtnCancel->connect_clicked( LINK( this, ScNameDefDlg, CancelBtnHdl));
+    m_xBtnAdd->connect_clicked( LINK( this, ScNameDefDlg, AddBtnHdl ));
+    m_xEdName->connect_changed( LINK( this, ScNameDefDlg, NameModifyHdl ));
+    m_xEdRange->SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) );
 
-    m_pBtnAdd->Disable(); // empty name is invalid
+    m_xBtnAdd->set_sensitive(false); // empty name is invalid
 
     ScRange aRange;
 
@@ -80,38 +80,20 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* p
     OUString aAreaStr(aRange.Format(ScRefFlags::RANGE_ABS_3D, mpDoc,
             ScAddress::Details(mpDoc->GetAddressConvention(), 0, 0)));
 
-    m_pEdRange->SetText( aAreaStr );
+    m_xEdRange->SetText( aAreaStr );
 
-    Selection aCurSel = Selection( 0, SELECTION_MAX );
-    m_pEdName->GrabFocus();
-    m_pEdName->SetSelection( aCurSel );
+    m_xEdName->grab_focus();
+    m_xEdName->select_region(0, -1);
 }
 
 ScNameDefDlg::~ScNameDefDlg()
 {
-    disposeOnce();
-}
-
-void ScNameDefDlg::dispose()
-{
-    m_pEdName.clear();
-    m_pEdRange.clear();
-    m_pRbRange.clear();
-    m_pLbScope.clear();
-    m_pBtnRowHeader.clear();
-    m_pBtnColHeader.clear();
-    m_pBtnPrintArea.clear();
-    m_pBtnCriteria.clear();
-    m_pBtnAdd.clear();
-    m_pBtnCancel.clear();
-    m_pFtInfo.clear();
-    ScAnyRefDlg::dispose();
 }
 
 void ScNameDefDlg::CancelPushed()
 {
     if (mbUndo)
-        Close();
+        response(RET_CANCEL);
     else
     {
         ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
@@ -122,7 +104,7 @@ void ScNameDefDlg::CancelPushed()
 bool ScNameDefDlg::IsFormulaValid()
 {
     ScCompiler aComp( mpDoc, maCursorPos, mpDoc->GetGrammar());
-    std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_pEdRange->GetText());
+    std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdRange->GetText());
     if (pCode->GetCodeError() != FormulaError::NONE)
     {
         //TODO: info message
@@ -136,8 +118,8 @@ bool ScNameDefDlg::IsFormulaValid()
 
 bool ScNameDefDlg::IsNameValid()
 {
-    OUString aScope = m_pLbScope->GetSelectedEntry();
-    OUString aName = m_pEdName->GetText();
+    OUString aScope = m_xLbScope->get_active_text();
+    OUString aName = m_xEdName->get_text();
 
     ScRangeName* pRangeName = nullptr;
     if(aScope == maGlobalNameStr)
@@ -150,52 +132,52 @@ bool ScNameDefDlg::IsNameValid()
     }
 
     ScRangeData::IsNameValidType eType;
-    m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
+    m_xFtInfo->set_error(false);
     if ( aName.isEmpty() )
     {
-        m_pBtnAdd->Disable();
-        m_pFtInfo->SetText(maStrInfoDefault);
+        m_xBtnAdd->set_sensitive(false);
+        m_xFtInfo->set_label(maStrInfoDefault);
         return false;
     }
     else if ((eType = ScRangeData::IsNameValid( aName, mpDoc )) != ScRangeData::NAME_VALID)
     {
-        m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
+        m_xFtInfo->set_error(true);
         if (eType == ScRangeData::NAME_INVALID_BAD_STRING)
         {
-            m_pFtInfo->SetText(maErrInvalidNameStr);
+            m_xFtInfo->set_label(maErrInvalidNameStr);
         }
         else if (eType == ScRangeData::NAME_INVALID_CELL_REF)
         {
-            m_pFtInfo->SetText(maErrInvalidNameCellRefStr);
+            m_xFtInfo->set_label(maErrInvalidNameCellRefStr);
         }
-        m_pBtnAdd->Disable();
+        m_xBtnAdd->set_sensitive(false);
         return false;
     }
     else if (pRangeName->findByUpperName(ScGlobal::pCharClass->uppercase(aName)))
     {
-        m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
-        m_pFtInfo->SetText(maErrNameInUse);
-        m_pBtnAdd->Disable();
+        m_xFtInfo->set_error(true);
+        m_xFtInfo->set_label(maErrNameInUse);
+        m_xBtnAdd->set_sensitive(false);
         return false;
     }
 
     if (!IsFormulaValid())
     {
-        m_pFtInfo->SetControlBackground(GetSettings().GetStyleSettings().GetHighlightColor());
-        m_pBtnAdd->Disable();
+        m_xFtInfo->set_error(true);
+        m_xBtnAdd->set_sensitive(false);
         return false;
     }
 
-    m_pFtInfo->SetText(maStrInfoDefault);
-    m_pBtnAdd->Enable();
+    m_xFtInfo->set_label(maStrInfoDefault);
+    m_xBtnAdd->set_sensitive(true);
     return true;
 }
 
 void ScNameDefDlg::AddPushed()
 {
-    OUString aScope = m_pLbScope->GetSelectedEntry();
-    OUString aName = m_pEdName->GetText();
-    OUString aExpression = m_pEdRange->GetText();
+    OUString aScope = m_xLbScope->get_active_text();
+    OUString aName = m_xEdName->get_text();
+    OUString aExpression = m_xEdRange->GetText();
 
     if (aName.isEmpty())
     {
@@ -232,10 +214,10 @@ void ScNameDefDlg::AddPushed()
                     maCursorPos,
                     nType );
 
-            if ( m_pBtnRowHeader->IsChecked() ) nType |= ScRangeData::Type::RowHeader;
-            if ( m_pBtnColHeader->IsChecked() ) nType |= ScRangeData::Type::ColHeader;
-            if ( m_pBtnPrintArea->IsChecked() ) nType |= ScRangeData::Type::PrintArea;
-            if ( m_pBtnCriteria->IsChecked()  ) nType |= ScRangeData::Type::Criteria;
+            if ( m_xBtnRowHeader->get_active() ) nType |= ScRangeData::Type::RowHeader;
+            if ( m_xBtnColHeader->get_active() ) nType |= ScRangeData::Type::ColHeader;
+            if ( m_xBtnPrintArea->get_active() ) nType |= ScRangeData::Type::PrintArea;
+            if ( m_xBtnCriteria->get_active()  ) nType |= ScRangeData::Type::Criteria;
 
             pNewEntry->AddType(nType);
 
@@ -278,9 +260,8 @@ void ScNameDefDlg::AddPushed()
             else
             {
                 delete pNewEntry;
-                Selection aCurSel = Selection( 0, SELECTION_MAX );
-                m_pEdRange->GrabFocus();
-                m_pEdRange->SetSelection( aCurSel );
+                m_xEdRange->GrabFocus();
+                m_xEdRange->SelectAll();
             }
         }
     }
@@ -294,54 +275,54 @@ void ScNameDefDlg::GetNewData(OUString& rName, OUString& rScope)
 
 bool ScNameDefDlg::IsRefInputMode() const
 {
-    return m_pEdRange->IsEnabled();
+    return m_xEdRange->GetWidget()->get_sensitive();
 }
 
 void ScNameDefDlg::RefInputDone( bool bForced)
 {
-    ScAnyRefDlg::RefInputDone(bForced);
+    ScAnyRefDlgController::RefInputDone(bForced);
     IsNameValid();
 }
 
 void ScNameDefDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
 {
-    if ( m_pEdRange->IsEnabled() )
+    if (m_xEdRange->GetWidget()->get_sensitive())
     {
         if ( rRef.aStart != rRef.aEnd )
-            RefInputStart(m_pEdRange);
+            RefInputStart(m_xEdRange.get());
         OUString aRefStr(rRef.Format(ScRefFlags::RANGE_ABS_3D, pDocP,
                 ScAddress::Details(pDocP->GetAddressConvention(), 0, 0)));
-        m_pEdRange->SetRefString( aRefStr );
+        m_xEdRange->SetRefString( aRefStr );
     }
 }
 
-bool ScNameDefDlg::Close()
+void ScNameDefDlg::Close()
 {
-    return DoClose( ScNameDefDlgWrapper::GetChildWindowId() );
+    DoClose( ScNameDefDlgWrapper::GetChildWindowId() );
 }
 
 void ScNameDefDlg::SetActive()
 {
-    m_pEdRange->GrabFocus();
+    m_xEdRange->GrabFocus();
     RefInputDone();
 }
 
-IMPL_LINK_NOARG(ScNameDefDlg, CancelBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScNameDefDlg, CancelBtnHdl, weld::Button&, void)
 {
     CancelPushed();
 }
 
-IMPL_LINK_NOARG(ScNameDefDlg, AddBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScNameDefDlg, AddBtnHdl, weld::Button&, void)
 {
     AddPushed();
 };
 
-IMPL_LINK_NOARG(ScNameDefDlg, NameModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(ScNameDefDlg, NameModifyHdl, weld::Entry&, void)
 {
     IsNameValid();
 }
 
-IMPL_LINK_NOARG(ScNameDefDlg, AssignGetFocusHdl, Control&, void)
+IMPL_LINK_NOARG(ScNameDefDlg, AssignGetFocusHdl, formula::WeldRefEdit&, void)
 {
     IsNameValid();
 }
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index ddbddcf91c56..1ad1bf3a67b0 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -303,7 +303,7 @@ void ScNameDlg::AddPushed()
 {
     mbCloseWithoutUndo = true;
     ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
-    pViewSh->SwitchBetweenRefDialogControllers(this);
+    pViewSh->SwitchBetweenRefDialogs(this);
 }
 
 void ScNameDlg::SetEntry(const OUString& rName, const OUString& rScope)
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index ae17dd5da8d1..4522ab15d6fd 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -33,7 +33,7 @@
 #include <validate.hxx>
 
 SFX_IMPL_CHILDWINDOW_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
-SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
+SFX_IMPL_CHILDWINDOW_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
 SFX_IMPL_MODELESSDIALOG_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
@@ -123,7 +123,7 @@ namespace
 
 IMPL_CONTROLLER_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
 
-IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
+IMPL_CONTROLLER_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )
 
 IMPL_CHILD_CTOR( ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
 
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index dd9ea086f022..b06ebff57402 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -89,7 +89,7 @@ void ScTabViewShell::SetCurRefDlgId( sal_uInt16 nNew )
 }
 
 //ugly hack to call Define Name from Manage Names
-void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog)
+void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialogController* pDialog)
 {
    sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
    if( nSlotId == FID_ADD_NAME )
@@ -102,12 +102,7 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialog* pDialog)
 
         SC_MOD()->SetRefDialog( nId, pWnd == nullptr );
    }
-}
-
-void ScTabViewShell::SwitchBetweenRefDialogControllers(SfxModelessDialogController* pDialog)
-{
-   sal_uInt16 nSlotId = SC_MOD()->GetCurRefDlgId();
-   if (nSlotId == FID_DEFINE_NAME)
+   else if (nSlotId == FID_DEFINE_NAME)
    {
         mbInSwitch = true;
         static_cast<ScNameDlg*>(pDialog)->GetRangeNames(m_RangeMap);
@@ -149,32 +144,6 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
 
     switch( nSlotId )
     {
-        case FID_ADD_NAME:
-        {
-            if (!mbInSwitch)
-            {
-                std::map<OUString, ScRangeName*> aRangeMap;
-                pDoc->GetRangeNameMap(aRangeMap);
-                pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap,
-                                ScAddress( GetViewData().GetCurX(),
-                                            GetViewData().GetCurY(),
-                                            GetViewData().GetTabNo() ), true );
-            }
-            else
-            {
-                std::map<OUString, ScRangeName*> aRangeMap;
-                for (auto const& itr : m_RangeMap)
-                {
-                    aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr.first, itr.second.get()));
-                }
-                pResult = VclPtr<ScNameDefDlg>::Create( pB, pCW, pParent, &GetViewData(), aRangeMap,
-                                ScAddress( GetViewData().GetCurX(),
-                                            GetViewData().GetCurY(),
-                                            GetViewData().GetTabNo() ), false );
-            }
-        }
-        break;
-
         case SID_DEFINE_COLROWNAMERANGES:
         {
             pResult = VclPtr<ScColRowNameRangesDlg>::Create( pB, pCW, pParent, &GetViewData() );
@@ -433,6 +402,8 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
     if(pCW)
         pCW->SetHideNotDelete(true);
 
+    ScDocument* pDoc = GetViewData().GetDocument();
+
     switch( nSlotId )
     {
         case SID_CORRELATION_DIALOG:
@@ -503,6 +474,31 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
             }
             break;
         }
+        case FID_ADD_NAME:
+        {
+            if (!mbInSwitch)
+            {
+                std::map<OUString, ScRangeName*> aRangeMap;
+                pDoc->GetRangeNameMap(aRangeMap);
+                xResult.reset(new ScNameDefDlg(pB, pCW, pParent, &GetViewData(), aRangeMap,
+                                ScAddress(GetViewData().GetCurX(),
+                                          GetViewData().GetCurY(),
+                                          GetViewData().GetTabNo()), true));
+            }
+            else
+            {
+                std::map<OUString, ScRangeName*> aRangeMap;
+                for (auto const& itr : m_RangeMap)
+                {
+                    aRangeMap.insert(std::pair<OUString, ScRangeName*>(itr.first, itr.second.get()));
+                }
+                xResult.reset(new ScNameDefDlg(pB, pCW, pParent, &GetViewData(), aRangeMap,
+                                ScAddress(GetViewData().GetCurX(),
+                                          GetViewData().GetCurY(),
+                                          GetViewData().GetTabNo()), false));
+            }
+            break;
+        }
     }
 
     if (xResult)
diff --git a/sc/uiconfig/scalc/ui/definename.ui b/sc/uiconfig/scalc/ui/definename.ui
index 40d5f3e2db06..74a91c5072a8 100644
--- a/sc/uiconfig/scalc/ui/definename.ui
+++ b/sc/uiconfig/scalc/ui/definename.ui
@@ -1,13 +1,18 @@
 <?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="GtkDialog" id="DefineNameDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="definename|DefineNameDialog">Define Name</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>
@@ -85,10 +90,10 @@
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="definename|label2">Name:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">edit</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -99,10 +104,10 @@
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="definename|label3">Range or formula expression:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">range</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -113,10 +118,10 @@
                   <object class="GtkLabel" id="label4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="definename|label4">Scope:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">scope</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -127,6 +132,7 @@
                   <object class="GtkEntry" id="edit">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
+                    <property name="activates_default">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -139,10 +145,11 @@
                     <property name="can_focus">False</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="foruilo-RefEdit" id="range">
+                      <object class="GtkEntry" id="range">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
+                        <property name="activates_default">True</property>
                         <property name="width_chars">50</property>
                       </object>
                       <packing>
@@ -152,7 +159,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="foruilo-RefButton" id="refbutton">
+                      <object class="GtkButton" id="refbutton">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
@@ -184,8 +191,8 @@
                   <object class="GtkLabel" id="label">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="definename|label">Define the name and range or formula expression.</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -300,9 +307,9 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="-11">help</action-widget>
       <action-widget response="0">add</action-widget>
       <action-widget response="-6">cancel</action-widget>
-      <action-widget response="-11">help</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr
index df17d9b4110b..6efb4ac302d3 100644
--- a/solenv/sanitizers/ui/modules/scalc.suppr
+++ b/solenv/sanitizers/ui/modules/scalc.suppr
@@ -71,6 +71,7 @@ sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='Source'] orpha
 sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='Operations'] orphan-label
 sc/uiconfig/scalc/ui/definedatabaserangedialog.ui://GtkLabel[@id='invalid'] orphan-label
 sc/uiconfig/scalc/ui/definename.ui://GtkLabel[@id='label'] orphan-label
+sc/uiconfig/scalc/ui/definename.ui://GtkButton[@id='refbutton'] button-no-label
 sc/uiconfig/scalc/ui/deletecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label
 sc/uiconfig/scalc/ui/deletecolumnentry.ui:GtkGrid[@id='grid']/GtkBox/GtkGrid[@id='grid_details']/GtkLabel orphan-label
 sc/uiconfig/scalc/ui/deletecolumnentry.ui://GtkEntry[@id='ed_columns'] no-labelled-by


More information about the Libreoffice-commits mailing list