[Libreoffice-commits] core.git: 2 commits - extras/source formula/source formula/uiconfig include/formula include/vcl reportdesign/source sc/source solenv/bin solenv/sanitizers vcl/source vcl/unx xmlsecurity/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue May 7 11:08:44 UTC 2019


 extras/source/glade/libreoffice-catalog.xml.in     |   10 
 formula/source/ui/dlg/ControlHelper.hxx            |   82 -
 formula/source/ui/dlg/formula.cxx                  |  974 ++++++++++-----------
 formula/source/ui/dlg/funcpage.cxx                 |  173 +--
 formula/source/ui/dlg/funcpage.hxx                 |   45 
 formula/source/ui/dlg/funcutl.cxx                  |  243 +----
 formula/source/ui/dlg/parawin.cxx                  |  218 ++--
 formula/source/ui/dlg/parawin.hxx                  |   80 -
 formula/source/ui/dlg/structpg.cxx                 |  126 +-
 formula/source/ui/dlg/structpg.hxx                 |   40 
 formula/uiconfig/ui/formuladialog.ui               |  103 +-
 formula/uiconfig/ui/functionpage.ui                |   49 -
 formula/uiconfig/ui/parameter.ui                   |  489 ++++------
 formula/uiconfig/ui/structpage.ui                  |   51 -
 include/formula/formdata.hxx                       |    3 
 include/formula/formula.hxx                        |   33 
 include/formula/funcutl.hxx                        |    4 
 include/vcl/weld.hxx                               |    8 
 reportdesign/source/ui/dlg/Formula.cxx             |   15 
 reportdesign/source/ui/inc/Formula.hxx             |    3 
 reportdesign/source/ui/misc/UITools.cxx            |    9 
 sc/source/ui/formdlg/formula.cxx                   |   17 
 sc/source/ui/inc/formula.hxx                       |    9 
 sc/source/ui/view/reffact.cxx                      |    4 
 sc/source/ui/view/tabvwshc.cxx                     |   14 
 solenv/bin/native-code.py                          |    3 
 solenv/sanitizers/ui/formula.suppr                 |    2 
 vcl/source/app/salvtables.cxx                      |   28 
 vcl/unx/gtk3/gtk3gtkinst.cxx                       |  184 ++-
 xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui |    1 
 30 files changed, 1461 insertions(+), 1559 deletions(-)

New commits:
commit feecbabd01870ed83a04baa6cb13d7a8af832ac3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed May 1 15:46:06 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 7 13:08:13 2019 +0200

    weld FormulaDialog
    
    drop xFocusWin hack, I don't see what gain it gives
    
    Change-Id: I31952b5440797e6209ed1de6b546f1e4c0238d08
    Reviewed-on: https://gerrit.libreoffice.org/71675
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 50b8118b0b91..5cc174b9ab3a 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -287,9 +287,6 @@
     <glade-widget-class title="Edit" name="foruilo-ArgEdit"
                         generic-name="Edit" parent="GtkEntry"
                         icon-name="widget-gtk-textentry"/>
-    <glade-widget-class title="Edit Box" name="foruilo-EditBox"
-                        generic-name="Edit Box" parent="GtkTextView"
-                        icon-name="widget-gtk-textview"/>
 
     <glade-widget-class title="URL Entry" name="cuilo-SvxHyperURLBox"
                         generic-name="URL Entry" parent="GtkEntry"
@@ -399,13 +396,6 @@
                         generic-name="DriverListControl" parent="GtkEntry"
                         icon-name="widget-gtk-combobox"/>
 
-    <glade-widget-class title="Formula ListBox" name="foruilo-FormulaListBox"
-                        generic-name="Formula ListBox" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="Formula ListBox" name="foruilo-StructListBox"
-                        generic-name="Formula ListBox" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
-
     <glade-widget-class title="Statusbar" name="svxlo-StatusBar"
                         generic-name="Statusbar" parent="GtkStatusbar"
                         icon-name="widget-gtk-statusbar"/>
diff --git a/formula/source/ui/dlg/ControlHelper.hxx b/formula/source/ui/dlg/ControlHelper.hxx
index a5f975d64b65..8ec7d504279e 100644
--- a/formula/source/ui/dlg/ControlHelper.hxx
+++ b/formula/source/ui/dlg/ControlHelper.hxx
@@ -24,58 +24,28 @@
 namespace formula
 {
 
-// class EditBox
-class EditBox : public Control
-{
-private:
-
-    VclPtr<MultiLineEdit>  pMEdit;
-    Link<EditBox&,void>    aSelChangedLink;
-    Selection              aOldSel;
-
-    DECL_LINK(ChangedHdl, void *, void);
-
-protected:
-
-    virtual bool    PreNotify( NotifyEvent& rNEvt ) override;
-    virtual void    Resize() override;
-    virtual void    GetFocus() override;
-
-
-public:
-                    EditBox( vcl::Window* pParent, WinBits nBits );
-
-                    virtual ~EditBox() override;
-    virtual void    dispose() override;
-
-    MultiLineEdit*  GetEdit() {return pMEdit;}
-
-    void            SetSelChangedHdl( const Link<EditBox&,void>& rLink ) { aSelChangedLink = rLink; }
-
-    void            UpdateOldSel();
-};
-
+class ParaWin;
 
 // class ArgEdit
 
-class ArgEdit : public RefEdit
+class ArgEdit : public WeldRefEdit
 {
 public:
-            ArgEdit( vcl::Window* pParent, WinBits nBits );
-    virtual ~ArgEdit() override;
-    virtual void dispose() override;
+    ArgEdit(std::unique_ptr<weld::Entry> xControl);
 
-    void    Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
-                  ScrollBar& rArgSlider, sal_uInt16 nArgCount );
+    void    Init(ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
+                 weld::ScrolledWindow& rArgSlider,
+                 ParaWin& rParaWin, sal_uInt16 nArgCount);
 
 protected:
-    virtual void    KeyInput( const KeyEvent& rKEvt ) override;
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
 
 private:
-    VclPtr<ArgEdit>    pEdPrev;
-    VclPtr<ArgEdit>    pEdNext;
-    VclPtr<ScrollBar>  pSlider;
-    sal_uInt16      nArgs;
+    ArgEdit* pEdPrev;
+    ArgEdit* pEdNext;
+    weld::ScrolledWindow* pSlider;
+    ParaWin* pParaWin;
+    sal_uInt16 nArgs;
 };
 
 
@@ -89,24 +59,24 @@ private:
     Link<ArgInput&,void>          aEdFocusLink;
     Link<ArgInput&,void>          aEdModifyLink;
 
-    VclPtr<FixedText>      pFtArg;
-    VclPtr<PushButton>     pBtnFx;
-    VclPtr<ArgEdit>        pEdArg;
-    VclPtr<RefButton>      pRefBtn;
+    weld::Label*pFtArg;
+    weld::Button* pBtnFx;
+    ArgEdit* pEdArg;
+    WeldRefButton* pRefBtn;
 
-    DECL_LINK( FxBtnClickHdl, Button*, void );
-    DECL_LINK( FxBtnFocusHdl, Control&, void );
-    DECL_LINK( EdFocusHdl, Control&, void );
-    DECL_LINK( EdModifyHdl, Edit&, void );
+    DECL_LINK( FxBtnClickHdl, weld::Button&, void );
+    DECL_LINK( FxBtnFocusHdl, weld::Widget&, void );
+    DECL_LINK( EdFocusHdl, WeldRefEdit&, void );
+    DECL_LINK( EdModifyHdl, WeldRefEdit&, void );
 
 public:
 
     ArgInput();
 
-    void        InitArgInput (  FixedText*      pftArg,
-                                PushButton*    pbtnFx,
-                                ArgEdit*        pedArg,
-                                RefButton*  prefBtn);
+    void        InitArgInput(weld::Label* pftArg,
+                             weld::Button* pbtnFx,
+                             ArgEdit* pedArg,
+                             WeldRefButton* prefBtn);
 
     void        SetArgName(const OUString &aArg);
     OUString    GetArgName();
@@ -115,9 +85,9 @@ public:
     void        SetArgVal(const OUString &aVal);
     OUString    GetArgVal();
 
-    void        SetArgSelection (const Selection& rSel);
+    void        SelectAll();
 
-    ArgEdit*    GetArgEdPtr() {return pEdArg;}
+    ArgEdit*    GetArgEdPtr() { return pEdArg; }
 
 
     void            SetFxClickHdl( const Link<ArgInput&,void>& rLink ) { aFxClickLink = rLink; }
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index e7c5fede138d..73a8d30ed8ea 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -61,9 +61,6 @@
 #include <map>
 
 // For tab page
-#define TP_FUNCTION         1
-#define TP_STRUCT           2
-
 #define TOKEN_OPEN  0
 #define TOKEN_CLOSE 1
 #define TOKEN_SEP   2
@@ -75,9 +72,9 @@ using namespace ::com::sun::star;
 class FormulaDlg_Impl
 {
 public:
-    ::std::pair<RefButton*, RefEdit*>
+    static ::std::pair<RefButton*, RefEdit*>
         RefInputStartBefore( RefEdit* pEdit, RefButton* pButton );
-    static ::std::pair<WeldRefButton*, WeldRefEdit*>
+    ::std::pair<WeldRefButton*, WeldRefEdit*>
         RefInputStartBefore( WeldRefEdit* pEdit, WeldRefButton* pButton );
     void            RefInputStartAfter();
     void            RefInputDoneAfter( bool bForced );
@@ -88,8 +85,8 @@ public:
     sal_Int32       GetFunctionPos(sal_Int32 nPos);
     void            ClearAllParas();
 
-    void            MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, const FormulaToken* pFuncToken,
-                              const FormulaToken* _pToken, long Count );
+    void            MakeTree(StructPage* _pTree, weld::TreeIter* pParent, const FormulaToken* pFuncToken,
+                             const FormulaToken* _pToken, long Count);
     void            fillTree(StructPage* _pTree);
     void            UpdateTokenArray( const OUString& rStrExp);
     OUString        RepairFormula(const OUString& aFormula);
@@ -120,20 +117,22 @@ public:
     void            UpdateParaWin( const Selection& _rSelection, const OUString& _sRefStr);
 
     void            SetData( sal_Int32 nFStart, sal_Int32 nNextFStart, sal_Int32 nNextFEnd, sal_Int32& PrivStart, sal_Int32& PrivEnd);
-    void            PreNotify( NotifyEvent const & rNEvt );
 
-    RefEdit*        GetCurrRefEdit();
+    WeldRefEdit*    GetCurrRefEdit();
 
     const FormulaHelper& GetFormulaHelper() const { return m_aFormulaHelper;}
     void InitFormulaOpCodeMapper();
 
+    void UpdateOldSel();
+    void FormulaCursor();
+
     DECL_LINK( ModifyHdl, ParaWin&, void );
     DECL_LINK( FxHdl, ParaWin&, void );
 
-    DECL_LINK( MatrixHdl, Button*, void );
-    DECL_LINK( FormulaHdl, Edit&, void);
-    DECL_LINK( FormulaCursorHdl, EditBox&, void );
-    DECL_LINK( BtnHdl, Button*, void );
+    DECL_LINK( MatrixHdl, weld::Button&, void );
+    DECL_LINK( FormulaHdl, weld::TextView&, void);
+    DECL_LINK( FormulaCursorHdl, weld::TextView&, void );
+    DECL_LINK( BtnHdl, weld::Button&, void );
     DECL_LINK( DblClkHdl, FuncPage&, void );
     DECL_LINK( FuncSelHdl, FuncPage&, void );
     DECL_LINK( StructSelHdl, StructPage&, void );
@@ -148,44 +147,12 @@ public:
     mutable const sheet::FormulaOpCodeMapEntry*             m_pFunctionOpCodesEnd;
     ::std::map<const FormulaToken*, sheet::FormulaToken>    m_aTokenMap;
     IFormulaEditorHelper*                                   m_pHelper;
-    VclPtr<Dialog>          m_pParent;
-    VclPtr<TabControl>      m_pTabCtrl;
-    VclPtr<VclVBox>         m_pParaWinBox;
-    VclPtr<ParaWin>         m_pParaWin;
-    VclPtr<FixedText>       m_pFtHeadLine;
-    VclPtr<FixedText>       m_pFtFuncName;
-    VclPtr<FixedText>       m_pFtFuncDesc;
-
-    VclPtr<FixedText>       m_pFtEditName;
-
-    VclPtr<FixedText>       m_pFtResult;
-    VclPtr<Edit>            m_pWndResult;
-
-    VclPtr<FixedText>       m_pFtFormula;
-    VclPtr<EditBox>         m_pMEFormula;
-
-    VclPtr<CheckBox>        m_pBtnMatrix;
-    VclPtr<CancelButton>    m_pBtnCancel;
-
-    VclPtr<PushButton>      m_pBtnBackward;
-    VclPtr<PushButton>      m_pBtnForward;
-    VclPtr<OKButton>        m_pBtnEnd;
+    weld::Dialog&           m_rDialog;
+    weld::Builder&          m_rParent;
 
-    VclPtr<RefEdit>         m_pEdRef;
-    VclPtr<RefButton>       m_pRefBtn;
-
-    VclPtr<FixedText>       m_pFtFormResult;
-    VclPtr<Edit>            m_pWndFormResult;
-
-    VclPtr<RefEdit>         m_pTheRefEdit;
-    VclPtr<RefButton>       m_pTheRefButton;
-    VclPtr<FuncPage>        m_pFuncPage;
-    VclPtr<StructPage>      m_pStructPage;
     OUString                m_aOldFormula;
     bool                    m_bStructUpdate;
-    VclPtr<MultiLineEdit>   m_pMEdit;
     bool                    m_bUserMatrixFlag;
-    Idle                    m_aIdle;
 
     const OUString          m_aTitle1;
     const OUString          m_aTitle2;
@@ -194,7 +161,6 @@ public:
     OString                 m_aEditHelpId;
 
     OString                 m_aOldHelp;
-    bool                    m_bIsShutDown;
     bool                    m_bMakingTree;  // in method of constructing tree
 
     bool                    m_bEditFlag;
@@ -205,157 +171,172 @@ public:
 
     sal_Int32               m_nFuncExpStart;     ///< current formula position for treeview results
 
-    FormulaDlg_Impl(Dialog* pParent
-            , bool _bSupportFunctionResult
-            , bool _bSupportResult
-            , bool _bSupportMatrix
-            , IFormulaEditorHelper* _pHelper
-            , const IFunctionManager* _pFunctionMgr
-            , IControlReferenceHandler* _pDlg);
-    ~FormulaDlg_Impl();
+    int m_nSelectionStart;
+    int m_nSelectionEnd;
 
-};
+    WeldRefEdit* m_pTheRefEdit;
+    WeldRefButton* m_pTheRefButton;
+
+    std::unique_ptr<weld::Notebook> m_xTabCtrl;
+    std::unique_ptr<weld::Container> m_xParaWinBox;
+    std::unique_ptr<ParaWin> m_xParaWin;
+    std::unique_ptr<weld::Label> m_xFtHeadLine;
+    std::unique_ptr<weld::Label> m_xFtFuncName;
+    std::unique_ptr<weld::Label> m_xFtFuncDesc;
+
+    std::unique_ptr<weld::Label> m_xFtEditName;
+
+    std::unique_ptr<weld::Label> m_xFtResult;
+    std::unique_ptr<weld::Entry> m_xWndResult;
 
-FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
-                                        , bool _bSupportFunctionResult
-                                        , bool _bSupportResult
-                                        , bool _bSupportMatrix
-                                        , IFormulaEditorHelper* _pHelper
-                                        , const IFunctionManager* _pFunctionMgr
-                                        , IControlReferenceHandler* _pDlg)
-    :
-    m_pFunctionOpCodesEnd(nullptr),
-    m_pHelper       (_pHelper),
-    m_pParent       (pParent),
-    m_pTheRefEdit   (nullptr),
-    m_pTheRefButton (nullptr),
-    m_pMEdit        (nullptr),
-    m_bUserMatrixFlag(false),
-    m_aTitle1       ( ForResId( STR_TITLE1 ) ),
-    m_aTitle2       ( ForResId( STR_TITLE2 ) ),
-    m_aFormulaHelper(_pFunctionMgr),
-    m_bIsShutDown   (false),
-    m_bMakingTree   (false),
-    m_pFuncDesc     (nullptr),
-    m_nArgs         (0),
-    m_nFuncExpStart (0)
-{
-    pParent->get(m_pParaWinBox, "BOX");
-    pParent->get(m_pTabCtrl, "tabs");
-    pParent->get(m_pFtHeadLine, "headline");
-    pParent->get(m_pFtFuncName, "funcname");
-    pParent->get(m_pFtFuncDesc, "funcdesc");
-    pParent->get(m_pFtEditName, "editname");
-    pParent->get(m_pFtResult, "label2");
-    pParent->get(m_pWndResult, "result");
-    pParent->get(m_pFtFormula, "formula");
+    std::unique_ptr<weld::Label> m_xFtFormula;
+    std::unique_ptr<weld::TextView> m_xMEdit;
 
+    std::unique_ptr<weld::CheckButton> m_xBtnMatrix;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
+
+    std::unique_ptr<weld::Button> m_xBtnBackward;
+    std::unique_ptr<weld::Button> m_xBtnForward;
+    std::unique_ptr<weld::Button> m_xBtnEnd;
+
+    std::unique_ptr<weld::Label> m_xFtFormResult;
+    std::unique_ptr<weld::Entry> m_xWndFormResult;
+
+    std::unique_ptr<WeldRefEdit> m_xEdRef;
+    std::unique_ptr<WeldRefButton> m_xRefBtn;
+
+    std::unique_ptr<FuncPage> m_xFuncPage;
+    std::unique_ptr<StructPage> m_xStructPage;
+
+    FormulaDlg_Impl(weld::Dialog& rDialog,
+                    weld::Builder& rBuilder,
+                    bool _bSupportFunctionResult,
+                    bool _bSupportResult,
+                    bool _bSupportMatrix,
+                    IFormulaEditorHelper* _pHelper,
+                    const IFunctionManager* _pFunctionMgr,
+                    IControlReferenceHandler* _pDlg);
+    ~FormulaDlg_Impl();
+};
+
+FormulaDlg_Impl::FormulaDlg_Impl(weld::Dialog& rDialog,
+                                 weld::Builder& rBuilder,
+                                 bool _bSupportFunctionResult,
+                                 bool _bSupportResult,
+                                 bool _bSupportMatrix,
+                                 IFormulaEditorHelper* _pHelper,
+                                 const IFunctionManager* _pFunctionMgr,
+                                 IControlReferenceHandler* _pDlg)
+    : m_pFunctionOpCodesEnd(nullptr)
+    , m_pHelper(_pHelper)
+    , m_rDialog(rDialog)
+    , m_rParent(rBuilder)
+    , m_bUserMatrixFlag(false)
+    , m_aTitle1( ForResId( STR_TITLE1 ) )
+    , m_aTitle2( ForResId( STR_TITLE2 ) )
+    , m_aFormulaHelper(_pFunctionMgr)
+    , m_bMakingTree(false)
+    , m_pFuncDesc(nullptr)
+    , m_nArgs(0)
+    , m_nFuncExpStart(0)
+    , m_nSelectionStart(-1)
+    , m_nSelectionEnd(-1)
+    , m_pTheRefEdit(nullptr)
+    , m_pTheRefButton(nullptr)
+    , m_xTabCtrl(rBuilder.weld_notebook("tabs"))
+    , m_xParaWinBox(rBuilder.weld_container("BOX"))
+    , m_xFtHeadLine(rBuilder.weld_label("headline"))
+    , m_xFtFuncName(rBuilder.weld_label("funcname"))
+    , m_xFtFuncDesc(rBuilder.weld_label("funcdesc"))
+    , m_xFtEditName(rBuilder.weld_label("editname"))
+    , m_xFtResult(rBuilder.weld_label("label2"))
+    , m_xWndResult(rBuilder.weld_entry("result"))
+    , m_xFtFormula(rBuilder.weld_label("formula"))
+    , m_xMEdit(rBuilder.weld_text_view("ed_formula"))
+    , m_xBtnMatrix(rBuilder.weld_check_button("array"))
+    , m_xBtnCancel(rBuilder.weld_button("cancel"))
+    , m_xBtnBackward(rBuilder.weld_button("back"))
+    , m_xBtnForward(rBuilder.weld_button("next"))
+    , m_xBtnEnd(rBuilder.weld_button("ok"))
+    , m_xFtFormResult(rBuilder.weld_label("label1"))
+    , m_xWndFormResult(rBuilder.weld_entry("formula_result"))
+    , m_xEdRef(new WeldRefEdit(rBuilder.weld_entry("ED_REF")))
+    , m_xRefBtn(new WeldRefButton(rBuilder.weld_button("RB_REF")))
+{
     //Space for two lines of text
-    m_pFtHeadLine->SetText("X\nX\n");
-    long nHeight = m_pFtHeadLine->GetOptimalSize().Height();
-    m_pFtHeadLine->set_height_request(nHeight);
-    m_pFtHeadLine->SetText("");
-
-    m_pFtFuncName->SetText("X\nX\n");
-    nHeight = m_pFtFuncName->GetOptimalSize().Height();
-    m_pFtFuncName->set_height_request(nHeight);
-    m_pFtFuncDesc->set_height_request(nHeight);
-    m_pFtFuncName->SetText("");
-
-    pParent->get(m_pMEFormula, "ed_formula");
-    Size aSize(pParent->LogicToPixel(Size(203, 43), MapMode(MapUnit::MapAppFont)));
-    m_pMEFormula->set_height_request(aSize.Height());
-    m_pMEFormula->set_width_request(aSize.Width());
-    pParent->get(m_pBtnMatrix, "array");
-    pParent->get(m_pBtnCancel, "cancel");
-    pParent->get(m_pBtnBackward, "back");
-    pParent->get(m_pBtnForward, "next");
-    pParent->get(m_pBtnEnd, "ok");
-    pParent->get(m_pFtFormResult, "label1");
-    pParent->get(m_pWndFormResult, "formula_result");
-    pParent->get(m_pEdRef, "ED_REF");
-    m_pEdRef->SetReferences(_pDlg, m_pFtEditName);
-    pParent->get(m_pRefBtn, "RB_REF");
-    m_pRefBtn->SetReferences(_pDlg, m_pEdRef);
-
-    m_pParaWin = VclPtr<ParaWin>::Create(m_pParaWinBox, _pDlg);
-    m_pParaWin->Show();
-    m_pParaWinBox->Hide();
-    m_pFtEditName->Hide();
-    m_pEdRef->Hide();
-    m_pRefBtn->Hide();
-
-    m_pMEdit = m_pMEFormula->GetEdit();
-
-    m_pMEdit->SetAccessibleName(m_pFtFormula->GetText());
-
-    m_aEditHelpId = m_pMEdit->GetHelpId();
+    m_xFtHeadLine->set_label("X\nX\n");
+    auto nHeight = m_xFtHeadLine->get_preferred_size().Height();
+    m_xFtHeadLine->set_size_request(-1, nHeight);
+    m_xFtHeadLine->set_label("");
+
+    m_xFtFuncName->set_label("X\nX\n");
+    nHeight = m_xFtFuncName->get_preferred_size().Height();
+    m_xFtFuncName->set_size_request(-1, nHeight);
+    m_xFtFuncDesc->set_size_request(-1, nHeight);
+    m_xFtFuncName->set_label("");
+
+    m_xMEdit->set_size_request(m_xMEdit->get_approximate_digit_width() * 62,
+                               m_xMEdit->get_height_rows(5));
+
+    m_xEdRef->SetReferences(_pDlg, m_xFtEditName.get());
+    m_xRefBtn->SetReferences(_pDlg, m_xEdRef.get());
+
+    m_xParaWin.reset(new ParaWin(m_xParaWinBox.get(), _pDlg));
+    m_xParaWin->Show();
+    m_xParaWinBox->hide();
+    m_xFtEditName->hide();
+    m_xEdRef->GetWidget()->hide();
+    m_xRefBtn->GetWidget()->hide();
+
+    m_xMEdit->set_accessible_name(m_xFtFormula->get_label());
+
+    m_aEditHelpId = m_xMEdit->get_help_id();
 
     m_bEditFlag =false;
     m_bStructUpdate =true;
-    m_pParaWin->SetArgModifiedHdl( LINK( this, FormulaDlg_Impl, ModifyHdl ) );
-    m_pParaWin->SetFxHdl( LINK( this, FormulaDlg_Impl, FxHdl ) );
+    m_xParaWin->SetArgModifiedHdl( LINK( this, FormulaDlg_Impl, ModifyHdl ) );
+    m_xParaWin->SetFxHdl( LINK( this, FormulaDlg_Impl, FxHdl ) );
 
-    m_pFuncPage = VclPtr<FuncPage>::Create( m_pTabCtrl, _pFunctionMgr);
-    m_pStructPage = VclPtr<StructPage>::Create( m_pTabCtrl);
-    m_pFuncPage->Hide();
-    m_pStructPage->Hide();
-    m_pTabCtrl->SetTabPage( TP_FUNCTION, m_pFuncPage);
-    m_pTabCtrl->SetTabPage( TP_STRUCT, m_pStructPage);
+    m_xFuncPage.reset(new FuncPage(m_xTabCtrl->get_page("function"), _pFunctionMgr));
+    m_xStructPage.reset(new StructPage(m_xTabCtrl->get_page("struct")));
+    m_xTabCtrl->set_current_page("function");
 
-    m_aOldHelp = pParent->GetHelpId();                // HelpId from resource always for "Page 1"
+    m_aOldHelp = m_rDialog.get_help_id();                // HelpId from resource always for "Page 1"
 
-    m_pFtResult->Show( _bSupportResult );
-    m_pWndResult->Show( _bSupportResult );
+    m_xFtResult->set_visible( _bSupportResult );
+    m_xWndResult->set_visible( _bSupportResult );
 
-    m_pFtFormResult->Show( _bSupportFunctionResult );
-    m_pWndFormResult->Show( _bSupportFunctionResult );
+    m_xFtFormResult->set_visible( _bSupportFunctionResult );
+    m_xWndFormResult->set_visible( _bSupportFunctionResult );
 
     if ( _bSupportMatrix )
-        m_pBtnMatrix->SetClickHdl( LINK( this, FormulaDlg_Impl, MatrixHdl ) );
+        m_xBtnMatrix->connect_clicked( LINK( this, FormulaDlg_Impl, MatrixHdl ) );
     else
-        m_pBtnMatrix->Hide();
+        m_xBtnMatrix->hide();
 
-    m_pBtnCancel  ->SetClickHdl( LINK( this, FormulaDlg_Impl, BtnHdl ) );
-    m_pBtnEnd     ->SetClickHdl( LINK( this, FormulaDlg_Impl, BtnHdl ) );
-    m_pBtnForward ->SetClickHdl( LINK( this, FormulaDlg_Impl, BtnHdl ) );
-    m_pBtnBackward->SetClickHdl( LINK( this, FormulaDlg_Impl, BtnHdl ) );
+    m_xBtnCancel->connect_clicked( LINK( this, FormulaDlg_Impl, BtnHdl ) );
+    m_xBtnEnd->connect_clicked( LINK( this, FormulaDlg_Impl, BtnHdl ) );
+    m_xBtnForward->connect_clicked( LINK( this, FormulaDlg_Impl, BtnHdl ) );
+    m_xBtnBackward->connect_clicked( LINK( this, FormulaDlg_Impl, BtnHdl ) );
 
-    m_pFuncPage->SetDoubleClickHdl( LINK( this, FormulaDlg_Impl, DblClkHdl ) );
-    m_pFuncPage->SetSelectHdl( LINK( this, FormulaDlg_Impl, FuncSelHdl) );
-    m_pStructPage->SetSelectionHdl( LINK( this, FormulaDlg_Impl, StructSelHdl ) );
-    m_pMEdit->SetModifyHdl( LINK( this, FormulaDlg_Impl, FormulaHdl ) );
-    m_pMEFormula->SetSelChangedHdl( LINK( this, FormulaDlg_Impl, FormulaCursorHdl ) );
+    m_xFuncPage->SetDoubleClickHdl( LINK( this, FormulaDlg_Impl, DblClkHdl ) );
+    m_xFuncPage->SetSelectHdl( LINK( this, FormulaDlg_Impl, FuncSelHdl) );
+    m_xStructPage->SetSelectionHdl( LINK( this, FormulaDlg_Impl, StructSelHdl ) );
+    m_xMEdit->connect_changed( LINK( this, FormulaDlg_Impl, FormulaHdl ) );
+    m_xMEdit->connect_cursor_position( LINK( this, FormulaDlg_Impl, FormulaCursorHdl ) );
 
-    vcl::Font aFntLight = m_pFtFormula->GetFont();
-    aFntLight.SetTransparent( true );
+    vcl::Font aFntLight = m_xFtFormula->get_font();
     vcl::Font aFntBold = aFntLight;
     aFntBold.SetWeight( WEIGHT_BOLD );
 
-    m_pParaWin->SetArgumentFonts( aFntBold, aFntLight);
-
-    //  function description for choosing a function is no longer in a different color
-
-    m_pFtHeadLine->SetFont(aFntBold);
-    m_pFtFuncName->SetFont(aFntLight);
-    m_pFtFuncDesc->SetFont(aFntLight);
+    m_xParaWin->SetArgumentFonts( aFntBold, aFntLight);
 }
 
 FormulaDlg_Impl::~FormulaDlg_Impl()
 {
-    if (m_aIdle.IsActive())
-    {
-        m_aIdle.ClearInvokeHandler();
-        m_aIdle.Stop();
-    }
-    m_bIsShutDown = true; // Set it in order to PreNotify not to save GetFocus.
-
-    m_pTabCtrl->RemovePage(TP_FUNCTION);
-    m_pTabCtrl->RemovePage(TP_STRUCT);
+    m_xTabCtrl->remove_page("function");
+    m_xTabCtrl->remove_page("struct");
 
-    m_pStructPage.disposeAndClear();
-    m_pFuncPage.disposeAndClear();
-    m_pParaWin.disposeAndClear();
     DeleteArgs();
 }
 
@@ -363,37 +344,23 @@ void FormulaDlg_Impl::StoreFormEditData(FormEditData* pData)
 {
     if (pData) // it won't be destroyed via Close
     {
-        pData->SetFStart(m_pMEdit->GetSelection().Min());
-        pData->SetSelection(m_pMEdit->GetSelection());
+        int nStartPos, nEndPos;
+        m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+        if (nStartPos > nEndPos)
+            std::swap(nStartPos, nEndPos);
 
-        if (m_pTabCtrl->GetCurPageId() == TP_FUNCTION)
+        pData->SetFStart(nStartPos);
+        pData->SetSelection(Selection(nStartPos, nEndPos));
+
+        if (m_xTabCtrl->get_current_page_ident() == "function")
             pData->SetMode( FormulaDlgMode::Formula );
         else
             pData->SetMode( FormulaDlgMode::Edit );
-        pData->SetUndoStr(m_pMEdit->GetText());
-        pData->SetMatrixFlag(m_pBtnMatrix->IsChecked());
+        pData->SetUndoStr(m_xMEdit->get_text());
+        pData->SetMatrixFlag(m_xBtnMatrix->get_active());
     }
 }
 
-
-void FormulaDlg_Impl::PreNotify( NotifyEvent const & rNEvt )
-{
-    if (m_bIsShutDown)
-        return;
-    MouseNotifyEvent nSwitch = rNEvt.GetType();
-    if (nSwitch != MouseNotifyEvent::GETFOCUS)
-        return;
-    vcl::Window* pWin = rNEvt.GetWindow();
-    if (!pWin)
-        return;
-    if (m_aIdle.IsActive()) // will be destroyed via Close
-        return;
-    FormEditData* pData = m_pHelper->getFormEditData();
-    if (!pData)
-        return;
-    pData->SetFocusWindow(pWin);
-}
-
 void FormulaDlg_Impl::InitFormulaOpCodeMapper()
 {
     if ( m_xOpCodeMapper.is() )
@@ -426,7 +393,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
     const sal_Unicode sep = m_pHelper->getFunctionManager()->getSingleToken(IFunctionManager::eSep);
 
     sal_Int32 nFuncPos = SAL_MAX_INT32;
-    OUString  aFormString = m_aFormulaHelper.GetCharClass()->uppercase(m_pMEdit->GetText());
+    OUString  aFormString = m_aFormulaHelper.GetCharClass()->uppercase(m_xMEdit->get_text());
 
     const uno::Reference< sheet::XFormulaParser > xParser(m_pHelper->getFormulaParser());
     const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
@@ -450,7 +417,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
 
             if ( !m_bUserMatrixFlag && FormulaCompiler::IsMatrixFunction(static_cast<OpCode>(eOp)) )
             {
-                m_pBtnMatrix->Check();
+                m_xBtnMatrix->set_active(true);
             }
 
             if (eOp == m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::PUSH].Token.OpCode ||
@@ -508,7 +475,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
                 {
                     if ( nBracketCount < 1 )
                     {
-                        nFuncPos = m_pMEdit->GetText().getLength();
+                        nFuncPos = m_xMEdit->get_text().getLength();
                     }
                     else if ( !bFlag )
                     {
@@ -544,7 +511,7 @@ bool FormulaDlg_Impl::CalcValue( const OUString& rStrExp, OUString& rStrResult,
         bool bInput = Application::AnyInput( VclInputFlags::KEYBOARD );
         if ( !bInput )
         {
-            bResult = m_pHelper->calculateValue( rStrExp, rStrResult, bForceMatrixFormula || m_pBtnMatrix->IsChecked());
+            bResult = m_pHelper->calculateValue( rStrExp, rStrResult, bForceMatrixFormula || m_xBtnMatrix->get_active());
         }
         else
             bResult = false;
@@ -560,7 +527,7 @@ void FormulaDlg_Impl::UpdateValues( bool bForceRecalcStruct )
     bool bForceArray = false;
     // Only necessary if it's not a matrix formula anyway and matrix evaluation
     // is supported, i.e. the button is visible.
-    if (m_pBtnMatrix->IsVisible() && !m_pBtnMatrix->IsChecked())
+    if (m_xBtnMatrix->get_visible() && !m_xBtnMatrix->get_active())
     {
         std::unique_ptr<FormulaCompiler> pCompiler(m_pHelper->createCompiler(*m_pTokenArray));
         // In the case of the reportdesign dialog there is no currently active
@@ -586,20 +553,20 @@ void FormulaDlg_Impl::UpdateValues( bool bForceRecalcStruct )
 
     OUString aStrResult;
     if (m_pFuncDesc && CalcValue( m_pFuncDesc->getFormula( m_aArguments), aStrResult, bForceArray))
-        m_pWndResult->SetText( aStrResult );
+        m_xWndResult->set_text( aStrResult );
 
     if (m_bMakingTree)
         return;
 
     aStrResult.clear();
     if ( CalcValue( m_pHelper->getCurrentFormula(), aStrResult ) )
-        m_pWndFormResult->SetText( aStrResult );
+        m_xWndFormResult->set_text( aStrResult );
     else
     {
         aStrResult.clear();
-        m_pWndFormResult->SetText( aStrResult );
+        m_xWndFormResult->set_text( aStrResult );
     }
-    CalcStruct( m_pMEdit->GetText(), bForceRecalcStruct);
+    CalcStruct( m_xMEdit->get_text(), bForceRecalcStruct);
 }
 
 void FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStruct )
@@ -608,7 +575,7 @@ void FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStru
 
     if ( !rStrExp.isEmpty() && (bForceRecalcStruct || m_aOldFormula != rStrExp) && m_bStructUpdate)
     {
-        m_pStructPage->ClearStruct();
+        m_xStructPage->ClearStruct();
 
         OUString aString = rStrExp;
         if (rStrExp[nLength-1] == '(')
@@ -620,10 +587,10 @@ void FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStru
         OUString aStrResult;
 
         if ( CalcValue( aString, aStrResult ) )
-            m_pWndFormResult->SetText( aStrResult );
+            m_xWndFormResult->set_text(aStrResult);
 
         UpdateTokenArray(aString);
-        fillTree(m_pStructPage);
+        fillTree(m_xStructPage.get());
 
         m_aOldFormula = rStrExp;
         if (rStrExp[nLength-1] == '(')
@@ -631,9 +598,8 @@ void FormulaDlg_Impl::CalcStruct( const OUString& rStrExp, bool bForceRecalcStru
     }
 }
 
-
-void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, const FormulaToken* pFuncToken,
-        const FormulaToken* _pToken, long Count )
+void FormulaDlg_Impl::MakeTree(StructPage* _pTree, weld::TreeIter* pParent, const FormulaToken* pFuncToken,
+                               const FormulaToken* _pToken, long Count)
 {
     if ( _pToken != nullptr && Count > 0 )
     {
@@ -655,7 +621,8 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
 
             if ( nParas > 0 )
             {
-                SvTreeListEntry* pEntry;
+                std::unique_ptr<weld::TreeIter> xEntry;
+                weld::TreeIter* pEntry;
 
                 bool bCalcSubformula = false;
                 OUString aTest = _pTree->GetEntryText(pParent);
@@ -666,25 +633,29 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
                 }
                 else
                 {
+                    xEntry = m_xStructPage->GetTlbStruct().make_iterator();
+
                     if (eOp == ocBad)
                     {
-                        pEntry = _pTree->InsertEntry( aResult, pParent, STRUCT_ERROR, 0, _pToken);
+                        _pTree->InsertEntry(aResult, pParent, STRUCT_ERROR, 0, _pToken, *xEntry);
                     }
                     else if (!((SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP) ||
                                 (SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP)))
                     {
                         // Not a binary or unary operator.
                         bCalcSubformula = true;
-                        pEntry = _pTree->InsertEntry( aResult, pParent, STRUCT_FOLDER, 0, _pToken);
+                        _pTree->InsertEntry(aResult, pParent, STRUCT_FOLDER, 0, _pToken, *xEntry);
                     }
                     else
                     {
                         /* TODO: question remains, why not sub calculate operators? */
-                        pEntry = _pTree->InsertEntry( aResult, pParent, STRUCT_FOLDER, 0, _pToken);
+                        _pTree->InsertEntry(aResult, pParent, STRUCT_FOLDER, 0, _pToken, *xEntry);
                     }
+
+                    pEntry = xEntry.get();
                 }
 
-                MakeTree( _pTree, pEntry, _pToken, m_pTokenArrayIterator->PrevRPN(), nParas);
+                MakeTree(_pTree, pEntry, _pToken, m_pTokenArrayIterator->PrevRPN(), nParas);
 
                 if (bCalcSubformula)
                 {
@@ -704,9 +675,9 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
 
                     OUString aStr;
                     if (CalcValue( aFormula, aStr, _pToken->IsInForceArray()))
-                        m_pWndResult->SetText( aStr );
-                    aStr = m_pWndResult->GetText();
-                    m_pStructPage->GetTlbStruct()->SetEntryText( pEntry, aResult + " = " + aStr);
+                        m_xWndResult->set_text( aStr );
+                    aStr = m_xWndResult->get_text();
+                    m_xStructPage->GetTlbStruct().set_text(*pEntry, aResult + " = " + aStr);
                 }
 
                 --Count;
@@ -715,9 +686,10 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
             }
             else
             {
+                std::unique_ptr<weld::TreeIter> xEntry(m_xStructPage->GetTlbStruct().make_iterator());
                 if (eOp == ocBad)
                 {
-                    _pTree->InsertEntry( aResult, pParent, STRUCT_ERROR, 0, _pToken);
+                    _pTree->InsertEntry( aResult, pParent, STRUCT_ERROR, 0, _pToken, *xEntry);
                 }
                 else if (eOp == ocPush)
                 {
@@ -725,7 +697,7 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
                     // as array elements. Depending on parameter classification
                     // a scalar value (non-array context) is calculated first.
                     OUString aUnforcedResult;
-                    bool bForceMatrix = (!m_pBtnMatrix->IsChecked() &&
+                    bool bForceMatrix = (!m_xBtnMatrix->get_active() &&
                             (_pToken->GetType() == svDoubleRef || _pToken->GetType() == svExternalDoubleRef));
                     if (bForceMatrix && pFuncToken)
                     {
@@ -765,14 +737,14 @@ void FormulaDlg_Impl::MakeTree( StructPage* _pTree, SvTreeListEntry* pParent, co
                         // Cell is a formula, print subformula.
                         // With scalar values prints "A1:A3 = 2 {1;2;3}"
                         _pTree->InsertEntry( aResult + " = " + aUnforcedResult + aCellResult,
-                                pParent, STRUCT_END, 0, _pToken);
+                                pParent, STRUCT_END, 0, _pToken, *xEntry);
                     }
                     else
-                        _pTree->InsertEntry( aResult, pParent, STRUCT_END, 0, _pToken);
+                        _pTree->InsertEntry(aResult, pParent, STRUCT_END, 0, _pToken, *xEntry);
                 }
                 else
                 {
-                    _pTree->InsertEntry( aResult, pParent, STRUCT_END, 0, _pToken);
+                    _pTree->InsertEntry(aResult, pParent, STRUCT_END, 0, _pToken, *xEntry);
                 }
                 --Count;
                 MakeTree( _pTree, pParent, _pToken, m_pTokenArrayIterator->PrevRPN(), Count);
@@ -840,22 +812,21 @@ void FormulaDlg_Impl::FillDialog(bool bFlag)
     FillListboxes();
     if (bFlag)
     {
-        m_pBtnBackward->Enable(bPrev);
-        m_pBtnForward->Enable(bNext);
+        m_xBtnBackward->set_sensitive(bPrev);
+        m_xBtnForward->set_sensitive(bNext);
     }
 
     OUString aStrResult;
 
     if ( CalcValue( m_pHelper->getCurrentFormula(), aStrResult ) )
-        m_pWndFormResult->SetText( aStrResult );
+        m_xWndFormResult->set_text( aStrResult );
     else
     {
         aStrResult.clear();
-        m_pWndFormResult->SetText( aStrResult );
+        m_xWndFormResult->set_text( aStrResult );
     }
 }
 
-
 void FormulaDlg_Impl::FillListboxes()
 {
     //  Switch between the "Pages"
@@ -864,24 +835,24 @@ void FormulaDlg_Impl::FillListboxes()
     if ( m_pFuncDesc && m_pFuncDesc->getCategory() )
     {
         // We'll never have more than int32 max categories so this is safe ...
-        if ( m_pFuncPage->GetCategory() != static_cast<sal_Int32>(m_pFuncDesc->getCategory()->getNumber() + 1) )
-            m_pFuncPage->SetCategory(m_pFuncDesc->getCategory()->getNumber() + 1);
+        if ( m_xFuncPage->GetCategory() != static_cast<sal_Int32>(m_pFuncDesc->getCategory()->getNumber() + 1) )
+            m_xFuncPage->SetCategory(m_pFuncDesc->getCategory()->getNumber() + 1);
 
-        sal_Int32 nPos = m_pFuncPage->GetFuncPos(m_pFuncDesc);
+        sal_Int32 nPos = m_xFuncPage->GetFuncPos(m_pFuncDesc);
 
-        m_pFuncPage->SetFunction(nPos);
+        m_xFuncPage->SetFunction(nPos);
     }
     else if ( pData )
     {
-        m_pFuncPage->SetCategory( 1 );
-        m_pFuncPage->SetFunction( LISTBOX_ENTRY_NOTFOUND );
+        m_xFuncPage->SetCategory( 1 );
+        m_xFuncPage->SetFunction( -1 );
     }
-    FuncSelHdl(*m_pFuncPage);
+    FuncSelHdl(*m_xFuncPage);
 
     m_pHelper->setDispatcherLock( true );   // Activate Modal-Mode
 
     //  HelpId for 1. page is the one from the resource
-    m_pParent->SetHelpId( m_aOldHelp );
+    m_rDialog.set_help_id( m_aOldHelp );
 }
 
 void FormulaDlg_Impl::FillControls( bool &rbNext, bool &rbPrev)
@@ -907,16 +878,16 @@ void FormulaDlg_Impl::FillControls( bool &rbNext, bool &rbPrev)
         const bool bTestFlag = (pOldFuncDesc != m_pFuncDesc);
         if (bTestFlag)
         {
-            m_pFtHeadLine->Hide();
-            m_pFtFuncName->Hide();
-            m_pFtFuncDesc->Hide();
-            m_pParaWin->SetFunctionDesc(m_pFuncDesc);
-            m_pFtEditName->SetText( m_pFuncDesc->getFunctionName() );
-            m_pFtEditName->Show();
-            m_pParaWinBox->Show();
+            m_xFtHeadLine->hide();
+            m_xFtFuncName->hide();
+            m_xFtFuncDesc->hide();
+            m_xParaWin->SetFunctionDesc(m_pFuncDesc);
+            m_xFtEditName->set_label( m_pFuncDesc->getFunctionName() );
+            m_xFtEditName->show();
+            m_xParaWinBox->show();
             const OString aHelpId = m_pFuncDesc->getHelpId();
             if ( !aHelpId.isEmpty() )
-                m_pMEdit->SetHelpId(aHelpId);
+                m_xMEdit->set_help_id(aHelpId);
         }
 
         sal_Int32 nOldStart, nOldEnd;
@@ -929,11 +900,11 @@ void FormulaDlg_Impl::FillControls( bool &rbNext, bool &rbPrev)
         m_aFuncSel.Max() = nNextFEnd;
 
         if (!m_bEditFlag)
-            m_pMEdit->SetText(m_pHelper->getCurrentFormula());
+            m_xMEdit->set_text(m_pHelper->getCurrentFormula());
         sal_Int32 PrivStart, PrivEnd;
         m_pHelper->getSelection( PrivStart, PrivEnd);
         if (!m_bEditFlag)
-            m_pMEdit->SetSelection( Selection( PrivStart, PrivEnd));
+            m_xMEdit->select_region(PrivStart, PrivEnd);
 
         m_nArgs = m_pFuncDesc->getSuppressedArgumentCount();
         sal_uInt16 nOffset = pData->GetOffset();
@@ -941,16 +912,22 @@ void FormulaDlg_Impl::FillControls( bool &rbNext, bool &rbPrev)
         //  Concatenate the Edit's for Focus-Control
 
         if (bTestFlag)
-            m_pParaWin->SetArgumentOffset(nOffset);
+            m_xParaWin->SetArgumentOffset(nOffset);
         sal_uInt16 nActiv = 0;
         sal_Int32   nArgPos  = m_aFormulaHelper.GetArgStart( aFormula, nFStart, 0 );
-        sal_Int32   nEditPos = m_pMEdit->GetSelection().Min();
+
+        int nStartPos, nEndPos;
+        m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+        if (nStartPos > nEndPos)
+            std::swap(nStartPos, nEndPos);
+
+        sal_Int32 nEditPos = nStartPos;
         bool    bFlag    = false;
 
         for (sal_Int32 i = 0; i < m_nArgs; i++)
         {
             sal_Int32 nLength = m_aArguments[i].getLength()+1;
-            m_pParaWin->SetArgument( i, m_aArguments[i]);
+            m_xParaWin->SetArgument( i, m_aArguments[i]);
             if (nArgPos <= nEditPos && nEditPos < nArgPos+nLength)
             {
                 nActiv = i;
@@ -958,25 +935,31 @@ void FormulaDlg_Impl::FillControls( bool &rbNext, bool &rbPrev)
             }
             nArgPos = nArgPos + nLength;
         }
-        m_pParaWin->UpdateParas();
+        m_xParaWin->UpdateParas();
 
         if (bFlag)
         {
-            m_pParaWin->SetActiveLine(nActiv);
+            m_xParaWin->SetActiveLine(nActiv);
         }
 
         UpdateValues();
     }
     else
     {
-        m_pFtEditName->SetText("");
-        m_pMEdit->SetHelpId( m_aEditHelpId );
+        m_xFtEditName->set_label("");
+        m_xMEdit->set_help_id(m_aEditHelpId);
     }
         //  test if before/after are anymore functions
 
     sal_Int32 nTempStart = m_aFormulaHelper.GetArgStart( aFormula, nFStart, 0 );
     rbNext = m_aFormulaHelper.GetNextFunc( aFormula, false, nTempStart );
-    nTempStart = m_pMEdit->GetSelection().Min();
+
+    int nStartPos, nEndPos;
+    m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+    if (nStartPos > nEndPos)
+        std::swap(nStartPos, nEndPos);
+
+    nTempStart = nStartPos;
     pData->SetFStart(nTempStart);
     rbPrev = m_aFormulaHelper.GetNextFunc( aFormula, true, nTempStart );
 }
@@ -986,20 +969,20 @@ void FormulaDlg_Impl::ClearAllParas()
 {
     DeleteArgs();
     m_pFuncDesc = nullptr;
-    m_pParaWin->ClearAll();
-    m_pWndResult->SetText(OUString());
-    m_pFtFuncName->SetText(OUString());
-    FuncSelHdl(*m_pFuncPage);
+    m_xParaWin->ClearAll();
+    m_xWndResult->set_text(OUString());
+    m_xFtFuncName->set_label(OUString());
+    FuncSelHdl(*m_xFuncPage);
 
-    if (m_pFuncPage->IsVisible())
+    if (m_xFuncPage->IsVisible())
     {
-        m_pFtEditName->Hide();
-        m_pParaWinBox->Hide();
+        m_xFtEditName->hide();
+        m_xParaWinBox->hide();
 
-        m_pBtnForward->Enable(); //@new
-        m_pFtHeadLine->Show();
-        m_pFtFuncName->Show();
-        m_pFtFuncDesc->Show();
+        m_xBtnForward->set_sensitive(true); //@new
+        m_xFtHeadLine->show();
+        m_xFtFuncName->show();
+        m_xFtFuncDesc->show();
     }
 }
 
@@ -1036,14 +1019,14 @@ void FormulaDlg_Impl::DoEnter(bool bOk)
     {
         //  remove dummy arguments
         OUString  aInputFormula = m_pHelper->getCurrentFormula();
-        OUString  aString = RepairFormula(m_pMEdit->GetText());
+        OUString  aString = RepairFormula(m_xMEdit->get_text());
         m_pHelper->setSelection( 0, aInputFormula.getLength());
         m_pHelper->setCurrentFormula(aString);
     }
 
     m_pHelper->switchBack();
 
-    m_pHelper->dispatch( bOk, m_pBtnMatrix->IsChecked());
+    m_pHelper->dispatch( bOk, m_xBtnMatrix->get_active());
     //  Clear data
     m_pHelper->deleteFormData();
 
@@ -1052,22 +1035,22 @@ void FormulaDlg_Impl::DoEnter(bool bOk)
 }
 
 
-IMPL_LINK( FormulaDlg_Impl, BtnHdl, Button*, pBtn, void )
+IMPL_LINK(FormulaDlg_Impl, BtnHdl, weld::Button&, rBtn, void)
 {
-    if ( pBtn == m_pBtnCancel )
+    if (&rBtn == m_xBtnCancel.get())
     {
         DoEnter(false);                 // closes the Dialog
     }
-    else if ( pBtn == m_pBtnEnd )
+    else if (&rBtn == m_xBtnEnd.get())
     {
         DoEnter(true);                  // closes the Dialog
     }
-    else if ( pBtn == m_pBtnForward )
+    else if (&rBtn == m_xBtnForward.get())
     {
         const IFunctionDescription* pDesc;
-        sal_Int32 nSelFunc = m_pFuncPage->GetFunction();
-        if (nSelFunc != LISTBOX_ENTRY_NOTFOUND)
-            pDesc = m_pFuncPage->GetFuncDesc( nSelFunc );
+        sal_Int32 nSelFunc = m_xFuncPage->GetFunction();
+        if (nSelFunc != -1)
+            pDesc = m_xFuncPage->GetFuncDesc( nSelFunc );
         else
         {
             // Do not overwrite the selected formula expression, just edit the
@@ -1075,61 +1058,60 @@ IMPL_LINK( FormulaDlg_Impl, BtnHdl, Button*, pBtn, void )
             m_pFuncDesc = pDesc = nullptr;
         }
 
-        if (pDesc == m_pFuncDesc || !m_pFuncPage->IsVisible())
+        if (pDesc == m_pFuncDesc || !m_xFuncPage->IsVisible())
             EditNextFunc( true );
         else
         {
-            DblClkHdl(*m_pFuncPage);      //new
-            m_pBtnForward->Enable(false); //new
+            DblClkHdl(*m_xFuncPage);      //new
+            m_xBtnForward->set_sensitive(false); //new
         }
     }
-    else if ( pBtn == m_pBtnBackward )
+    else if (&rBtn == m_xBtnBackward.get())
     {
         m_bEditFlag = false;
-        m_pBtnForward->Enable();
+        m_xBtnForward->set_sensitive(true);
         EditNextFunc( false );
-        m_pMEFormula->Invalidate();
-        m_pMEFormula->Update();
     }
 }
 
-
 //                          Functions for 1. Page
 
-
 // Handler for Listboxes
 
 IMPL_LINK_NOARG( FormulaDlg_Impl, DblClkHdl, FuncPage&, void)
 {
-    sal_Int32 nFunc = m_pFuncPage->GetFunction();
+    sal_Int32 nFunc = m_xFuncPage->GetFunction();
 
     //  ex-UpdateLRUList
-    const IFunctionDescription* pDesc = m_pFuncPage->GetFuncDesc(nFunc);
+    const IFunctionDescription* pDesc = m_xFuncPage->GetFuncDesc(nFunc);
     m_pHelper->insertEntryToLRUList(pDesc);
 
-    OUString aFuncName = m_pFuncPage->GetSelFunctionName() + "()";
+    OUString aFuncName = m_xFuncPage->GetSelFunctionName() + "()";
     m_pHelper->setCurrentFormula(aFuncName);
-    m_pMEdit->ReplaceSelected(aFuncName);
+    m_xMEdit->replace_selection(aFuncName);
 
-    Selection aSel = m_pMEdit->GetSelection();
-    aSel.Max() = aSel.Max()-1;
-    m_pMEdit->SetSelection(aSel);
+    int nStartPos, nEndPos;
+    m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+    if (nStartPos > nEndPos)
+        std::swap(nStartPos, nEndPos);
 
-    FormulaHdl(*m_pMEdit);
+    nEndPos = nEndPos - 1;
+    m_xMEdit->select_region(nStartPos, nEndPos);
 
-    aSel.Min() = aSel.Max();
-    m_pMEdit->SetSelection(aSel);
+    FormulaHdl(*m_xMEdit);
+
+    nStartPos = nEndPos;
+    m_xMEdit->select_region(nStartPos, nEndPos);
 
     if (m_nArgs == 0)
     {
-        BtnHdl(m_pBtnBackward);
+        BtnHdl(*m_xBtnBackward);
     }
 
-    m_pParaWin->SetEdFocus();
-    m_pBtnForward->Enable(false); //@New
+    m_xParaWin->SetEdFocus();
+    m_xBtnForward->set_sensitive(false); //@New
 }
 
-
 //                          Functions for right Page
 
 void FormulaDlg_Impl::SetData( sal_Int32 nFStart, sal_Int32 nNextFStart, sal_Int32 nNextFEnd, sal_Int32& PrivStart, sal_Int32& PrivEnd)
@@ -1140,14 +1122,14 @@ void FormulaDlg_Impl::SetData( sal_Int32 nFStart, sal_Int32 nNextFStart, sal_Int
     m_pHelper->getSelection( nFStart, nFEnd );
     m_pHelper->setSelection( nNextFStart, nNextFEnd );
     if (!m_bEditFlag)
-        m_pMEdit->SetText(m_pHelper->getCurrentFormula());
+        m_xMEdit->set_text(m_pHelper->getCurrentFormula());
 
 
     m_pHelper->getSelection( PrivStart, PrivEnd);
     if (!m_bEditFlag)
     {
-        m_pMEdit->SetSelection( Selection( PrivStart, PrivEnd));
-        m_pMEFormula->UpdateOldSel();
+        m_xMEdit->select_region(PrivStart, PrivEnd);
+        UpdateOldSel();
     }
 
     FormEditData* pData = m_pHelper->getFormEditData();
@@ -1264,13 +1246,13 @@ void FormulaDlg_Impl::SaveArg( sal_uInt16 nEd )
             if ( m_aArguments[i].isEmpty() )
                 m_aArguments[i] = " ";
         }
-        if (!m_pParaWin->GetArgument(nEd).isEmpty())
-            m_aArguments[nEd] = m_pParaWin->GetArgument(nEd);
+        if (!m_xParaWin->GetArgument(nEd).isEmpty())
+            m_aArguments[nEd] = m_xParaWin->GetArgument(nEd);
 
         sal_uInt16 nClearPos = nEd+1;
         for (sal_Int32 i = nEd+1; i < m_nArgs; i++)
         {
-            if ( !m_pParaWin->GetArgument(i).isEmpty() )
+            if ( !m_xParaWin->GetArgument(i).isEmpty() )
             {
                 nClearPos = i+1;
             }
@@ -1285,17 +1267,17 @@ void FormulaDlg_Impl::SaveArg( sal_uInt16 nEd )
 
 IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin&, rPtr, void )
 {
-    if (&rPtr == m_pParaWin)
+    if (&rPtr == m_xParaWin.get())
     {
-        m_pBtnForward->Enable(); //@ In order to be able to input another function.
-        m_pTabCtrl->SetCurPageId(TP_FUNCTION);
+        m_xBtnForward->set_sensitive(true); //@ In order to be able to input another function.
+        m_xTabCtrl->set_current_page("function");
 
         OUString aUndoStr = m_pHelper->getCurrentFormula();       // it will be added before a ";"
         FormEditData* pData = m_pHelper->getFormEditData();
         if (!pData)
             return;
 
-        sal_uInt16 nArgNo = m_pParaWin->GetActiveLine();
+        sal_uInt16 nArgNo = m_xParaWin->GetActiveLine();
         sal_uInt16 nEdFocus = nArgNo;
 
         SaveArg(nArgNo);
@@ -1313,23 +1295,23 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin&, rPtr, void )
         ClearAllParas();
 
         FillDialog(false);
-        m_pFuncPage->SetFocus(); //There Parawin is not visible anymore
+        m_xFuncPage->SetFocus(); //There Parawin is not visible anymore
     }
 }
 
 IMPL_LINK( FormulaDlg_Impl, ModifyHdl, ParaWin&, rPtr, void )
 {
-    if (&rPtr == m_pParaWin)
+    if (&rPtr == m_xParaWin.get())
     {
-        SaveArg(m_pParaWin->GetActiveLine());
+        SaveArg(m_xParaWin->GetActiveLine());
         UpdateValues();
 
         UpdateSelection();
-        CalcStruct(m_pMEdit->GetText());
+        CalcStruct(m_xMEdit->get_text());
     }
 }
 
-IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaHdl, Edit&, void)
+IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaHdl, weld::TextView&, void)
 {
 
     FormEditData* pData = m_pHelper->getFormEditData();
@@ -1338,48 +1320,50 @@ IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaHdl, Edit&, void)
 
     m_bEditFlag = true;
     OUString    aInputFormula = m_pHelper->getCurrentFormula();
-    OUString    aString = m_pMEdit->GetText();
+    OUString    aString = m_xMEdit->get_text();
 
-    Selection   aSel  = m_pMEdit->GetSelection();
+    int nStartPos, nEndPos;
+    m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+    if (nStartPos > nEndPos)
+        std::swap(nStartPos, nEndPos);
 
     if (aString.isEmpty())      // in case everything was cleared
     {
         aString += "=";
-        m_pMEdit->SetText(aString);
-        aSel .Min() = 1;
-        aSel .Max() = 1;
-        m_pMEdit->SetSelection(aSel);
+        m_xMEdit->set_text(aString);
+        nStartPos = 1;
+        nEndPos = 1;
+        m_xMEdit->select_region(nStartPos, nEndPos);
     }
     else if (aString[0]!='=')   // in case it's replaced
     {
         aString = "=" + aString;
-        m_pMEdit->SetText(aString);
-        aSel .Min() += 1;
-        aSel .Max() += 1;
-        m_pMEdit->SetSelection(aSel);
+        m_xMEdit->set_text(aString);
+        nStartPos += 1;
+        nEndPos += 1;
+        m_xMEdit->select_region(nStartPos, nEndPos);
     }
 
-
     m_pHelper->setSelection( 0, aInputFormula.getLength());
     m_pHelper->setCurrentFormula(aString);
-    m_pHelper->setSelection( aSel.Min(), aSel.Max());
+    m_pHelper->setSelection(nStartPos, nEndPos);
 
-    sal_Int32 nPos = aSel.Min()-1;
+    sal_Int32 nPos = nStartPos - 1;
 
     OUString aStrResult;
 
     if ( CalcValue( m_pHelper->getCurrentFormula(), aStrResult ) )
-        m_pWndFormResult->SetText( aStrResult );
+        m_xWndFormResult->set_text( aStrResult );
     else
     {
         aStrResult.clear();
-        m_pWndFormResult->SetText( aStrResult );
+        m_xWndFormResult->set_text( aStrResult );
     }
     CalcStruct(aString);
 
     nPos = GetFunctionPos(nPos);
 
-    if (nPos < aSel.Min()-1)
+    if (nPos < nStartPos - 1)
     {
         sal_Int32 nPos1 = aString.indexOf( '(', nPos);
         EditNextFunc( false, nPos1);
@@ -1389,11 +1373,11 @@ IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaHdl, Edit&, void)
         ClearAllParas();
     }
 
-    m_pHelper->setSelection( aSel.Min(), aSel.Max());
+    m_pHelper->setSelection(nStartPos, nEndPos);
     m_bEditFlag = false;
 }
 
-IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaCursorHdl, EditBox&, void)
+void FormulaDlg_Impl::FormulaCursor()
 {
     FormEditData* pData = m_pHelper->getFormEditData();
     if (!pData)
@@ -1401,20 +1385,24 @@ IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaCursorHdl, EditBox&, void)
 
     m_bEditFlag = true;
 
-    OUString    aString = m_pMEdit->GetText();
+    OUString    aString = m_xMEdit->get_text();
+
+    int nStartPos, nEndPos;
+    m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+    if (nStartPos > nEndPos)
+        std::swap(nStartPos, nEndPos);
 
-    Selection   aSel = m_pMEdit->GetSelection();
-    m_pHelper->setSelection( aSel.Min(), aSel.Max());
+    m_pHelper->setSelection(nStartPos, nEndPos);
 
-    if (aSel.Min() == 0)
+    if (nStartPos == 0)
     {
-        aSel.Min() = 1;
-        m_pMEdit->SetSelection(aSel);
+        nStartPos = 1;
+        m_xMEdit->select_region(nStartPos, nEndPos);
     }
 
-    if (aSel.Min() != aString.getLength())
+    if (nStartPos != aString.getLength())
     {
-        sal_Int32 nPos = aSel.Min();
+        sal_Int32 nPos = nStartPos;
 
         sal_Int32 nFStart = GetFunctionPos(nPos - 1);
 
@@ -1456,16 +1444,38 @@ IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaCursorHdl, EditBox&, void)
             ClearAllParas();
         }
     }
-    m_pHelper->setSelection( aSel.Min(), aSel.Max());
+    m_pHelper->setSelection(nStartPos, nEndPos);
 
     m_bEditFlag = false;
 }
 
+void FormulaDlg_Impl::UpdateOldSel()
+{
+    m_xMEdit->get_selection_bounds(m_nSelectionStart, m_nSelectionEnd);
+    if (m_nSelectionStart > m_nSelectionEnd)
+        std::swap(m_nSelectionStart, m_nSelectionEnd);
+}
+
+IMPL_LINK_NOARG( FormulaDlg_Impl, FormulaCursorHdl, weld::TextView&, void)
+{
+    int nStartPos, nEndPos;
+    m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+    if (nStartPos > nEndPos)
+        std::swap(nStartPos, nEndPos);
+
+    if (nStartPos != m_nSelectionStart || nEndPos != m_nSelectionEnd)
+    {
+        m_nSelectionStart = nStartPos;
+        m_nSelectionEnd = nEndPos;
+        FormulaCursor();
+    }
+}
+
 void FormulaDlg_Impl::UpdateSelection()
 {
     m_pHelper->setSelection( m_aFuncSel.Min(), m_aFuncSel.Max());
     m_pHelper->setCurrentFormula( m_pFuncDesc->getFormula( m_aArguments ) );
-    m_pMEdit->SetText(m_pHelper->getCurrentFormula());
+    m_xMEdit->set_text(m_pHelper->getCurrentFormula());
     sal_Int32 PrivStart, PrivEnd;
     m_pHelper->getSelection( PrivStart, PrivEnd);
     m_aFuncSel.Min() = PrivStart;
@@ -1473,10 +1483,10 @@ void FormulaDlg_Impl::UpdateSelection()
 
     m_nArgs = m_pFuncDesc->getSuppressedArgumentCount();
 
-    OUString aFormula = m_pMEdit->GetText();
+    OUString aFormula = m_xMEdit->get_text();
     sal_Int32 nArgPos = m_aFormulaHelper.GetArgStart( aFormula, PrivStart, 0);
 
-    sal_uInt16 nPos = m_pParaWin->GetActiveLine();
+    sal_uInt16 nPos = m_xParaWin->GetActiveLine();
     if (nPos >= m_aArguments.size())
     {
         SAL_WARN("formula.ui","FormulaDlg_Impl::UpdateSelection - shot in foot: nPos " <<
@@ -1493,41 +1503,48 @@ void FormulaDlg_Impl::UpdateSelection()
     }
     sal_Int32 nLength = (nPos < m_aArguments.size()) ? m_aArguments[nPos].getLength() : 0;
 
-    Selection aSel( nArgPos, nArgPos+nLength);
-    m_pHelper->setSelection( static_cast<sal_uInt16>(nArgPos),static_cast<sal_uInt16>(nArgPos+nLength));
-    m_pMEdit->SetSelection(aSel);
-    m_pMEFormula->UpdateOldSel();
+    m_pHelper->setSelection(nArgPos, nArgPos + nLength);
+    m_xMEdit->select_region(nArgPos, nArgPos + nLength);
+    UpdateOldSel();
 }
 
-::std::pair<RefButton*, RefEdit*> FormulaDlg_Impl::RefInputStartBefore( RefEdit* pEdit, RefButton* pButton )
+::std::pair<WeldRefButton*, WeldRefEdit*> FormulaDlg_Impl::RefInputStartBefore(WeldRefEdit* pEdit, WeldRefButton* pButton)
 {
-    //because its initially hidden, give it its optimal
-    //size so clicking the refbutton has an initial
-    //size to work when retro-fitting this to .ui
-    m_pEdRef->SetSizePixel(m_pEdRef->GetOptimalSize());
-    m_pEdRef->Show();
     m_pTheRefEdit = pEdit;
     m_pTheRefButton = pButton;
 
+    Selection aOrigSelection;
+    if (m_pTheRefEdit)
+    {
+        // grab selection before showing next widget in case the selection is blown away
+        // by it appearing
+        aOrigSelection = m_pTheRefEdit->GetSelection();
+    }
+
+    // because its initially hidden, give it its optimal size so clicking the
+    // refbutton has an initial size to work when retro-fitting this to .ui
+    m_xEdRef->GetWidget()->set_size_request(m_xEdRef->GetWidget()->get_preferred_size().Width(), -1);
+    m_xEdRef->GetWidget()->show();
+
     if ( m_pTheRefEdit )
     {
-        m_pEdRef->SetRefString( m_pTheRefEdit->GetText() );
-        m_pEdRef->SetSelection( m_pTheRefEdit->GetSelection() );
-        m_pEdRef->SetHelpId( m_pTheRefEdit->GetHelpId() );
+        m_xEdRef->SetRefString(m_pTheRefEdit->GetText());
+        m_xEdRef->SetSelection(aOrigSelection);
+        m_xEdRef->GetWidget()->set_help_id(m_pTheRefEdit->GetWidget()->get_help_id());
     }
 
-    m_pRefBtn->Show( pButton != nullptr );
+    m_xRefBtn->GetWidget()->set_visible(pButton != nullptr);
 
-    ::std::pair<RefButton*, RefEdit*> aPair;
-    aPair.first = pButton ? m_pRefBtn.get() : nullptr;
-    aPair.second = m_pEdRef;
+    ::std::pair<WeldRefButton*, WeldRefEdit*> aPair;
+    aPair.first = pButton ? m_xRefBtn.get() : nullptr;
+    aPair.second = m_xEdRef.get();
     return aPair;
 }
 
-::std::pair<WeldRefButton*, WeldRefEdit*> FormulaDlg_Impl::RefInputStartBefore( WeldRefEdit* pEdit, WeldRefButton* pButton )
+::std::pair<RefButton*, RefEdit*> FormulaDlg_Impl::RefInputStartBefore( RefEdit* pEdit, RefButton* pButton )
 {
     assert(!pEdit && !pButton);
-    ::std::pair<WeldRefButton*, WeldRefEdit*> aPair;
+    ::std::pair<RefButton*, RefEdit*> aPair;
     aPair.first = pButton;
     aPair.second = pEdit;
     return aPair;
@@ -1535,105 +1552,109 @@ void FormulaDlg_Impl::UpdateSelection()
 
 void FormulaDlg_Impl::RefInputStartAfter()
 {
-    m_pRefBtn->SetEndImage();
+    m_xRefBtn->SetEndImage();
 
-    if ( m_pTheRefEdit )
+    if (m_pTheRefEdit)
     {
-        OUString aStr = m_aTitle2 + " " + m_pFtEditName->GetText() + "( ";
+        OUString aStr = m_aTitle2 + " " + m_xFtEditName->get_label() + "( ";
 
-        if ( m_pParaWin->GetActiveLine() > 0 )
+        if ( m_xParaWin->GetActiveLine() > 0 )
             aStr += "...; ";
-        aStr += m_pParaWin->GetActiveArgName();
-        if ( m_pParaWin->GetActiveLine() + 1 < m_nArgs )
+        aStr += m_xParaWin->GetActiveArgName();
+        if ( m_xParaWin->GetActiveLine() + 1 < m_nArgs )
             aStr += "; ...";
         aStr += " )";
 
-        m_pParent->SetText( MnemonicGenerator::EraseAllMnemonicChars( aStr ) );
+        m_rDialog.set_title(m_rDialog.strip_mnemonic(aStr));
     }
 }
 
 void FormulaDlg_Impl::RefInputDoneAfter( bool bForced )
 {
-    m_pRefBtn->SetStartImage();
-    if ( bForced || !m_pRefBtn->IsVisible() )
+    m_xRefBtn->SetStartImage();
+    if (bForced || !m_xRefBtn->GetWidget()->get_visible())
     {
-        m_pEdRef->Hide();
-        m_pRefBtn->Hide();
+        m_xEdRef->GetWidget()->hide();
+        m_xRefBtn->GetWidget()->hide();
         if ( m_pTheRefEdit )
         {
-            m_pTheRefEdit->SetRefString( m_pEdRef->GetText() );
+            m_pTheRefEdit->SetRefString( m_xEdRef->GetText() );
             m_pTheRefEdit->GrabFocus();
 
             if ( m_pTheRefButton )
                 m_pTheRefButton->SetStartImage();
 
-            sal_uInt16 nPrivActiv = m_pParaWin->GetActiveLine();
-            m_pParaWin->SetArgument( nPrivActiv, m_pEdRef->GetText() );
-            ModifyHdl( *m_pParaWin );
+            sal_uInt16 nPrivActiv = m_xParaWin->GetActiveLine();
+            m_xParaWin->SetArgument( nPrivActiv, m_xEdRef->GetText() );
+            ModifyHdl( *m_xParaWin );
             m_pTheRefEdit = nullptr;
         }
-        m_pParent->SetText( m_aTitle1 );
+        m_rDialog.set_title(m_aTitle1);
     }
 }
 
-RefEdit* FormulaDlg_Impl::GetCurrRefEdit()
+WeldRefEdit* FormulaDlg_Impl::GetCurrRefEdit()
 {
-    return m_pEdRef->IsVisible() ? m_pEdRef.get() : m_pParaWin->GetActiveEdit();
+    return m_xEdRef->GetWidget()->get_visible() ? m_xEdRef.get() : m_xParaWin->GetActiveEdit();
 }
 
 void FormulaDlg_Impl::Update()
 {
     FormEditData* pData = m_pHelper->getFormEditData();
-    const OUString sExpression = m_pMEdit->GetText();
+    const OUString sExpression = m_xMEdit->get_text();
     m_aOldFormula.clear();
     UpdateTokenArray(sExpression);
-    FormulaCursorHdl(*m_pMEFormula);
+    FormulaCursor();
     CalcStruct(sExpression);
     if (pData->GetMode() == FormulaDlgMode::Formula)
-        m_pTabCtrl->SetCurPageId(TP_FUNCTION);
+        m_xTabCtrl->set_current_page("function");
     else
-        m_pTabCtrl->SetCurPageId(TP_STRUCT);
-    m_pBtnMatrix->Check(pData->GetMatrixFlag());
+        m_xTabCtrl->set_current_page("struct");
+    m_xBtnMatrix->set_active(pData->GetMatrixFlag());
 }
 
 void FormulaDlg_Impl::Update(const OUString& _sExp)
 {
     CalcStruct(_sExp);
     FillDialog();
-    FuncSelHdl(*m_pFuncPage);
+    FuncSelHdl(*m_xFuncPage);
 }
 
 void FormulaDlg_Impl::SetMeText(const OUString& _sText)
 {
     FormEditData* pData = m_pHelper->getFormEditData();
-    m_pMEdit->SetText(_sText);
-    m_pMEdit->SetSelection( pData->GetSelection());
-    m_pMEFormula->UpdateOldSel();
+    m_xMEdit->set_text(_sText);
+    auto aSelection = pData->GetSelection();
+    m_xMEdit->select_region(aSelection.Min(), aSelection.Max());
+    UpdateOldSel();
 }
 
 FormulaDlgMode FormulaDlg_Impl::SetMeText( const OUString& _sText, sal_Int32 PrivStart, sal_Int32 PrivEnd, bool bMatrix, bool _bSelect, bool _bUpdate)
 {
     FormulaDlgMode eMode = FormulaDlgMode::Formula;
     if (!m_bEditFlag)
-        m_pMEdit->SetText(_sText);
+        m_xMEdit->set_text(_sText);
 
     if ( _bSelect || !m_bEditFlag )
-        m_pMEdit->SetSelection( Selection( PrivStart, PrivEnd));
+        m_xMEdit->select_region(PrivStart, PrivEnd);
     if ( _bUpdate )
     {
-        m_pMEFormula->UpdateOldSel();
-        m_pMEdit->Invalidate();
-        m_pHelper->showReference(m_pMEdit->GetSelected());
+        UpdateOldSel();
+        int nStartPos, nEndPos;
+        m_xMEdit->get_selection_bounds(nStartPos, nEndPos);
+        if (nStartPos > nEndPos)
+            std::swap(nStartPos, nEndPos);
+        m_pHelper->showReference(m_xMEdit->get_text().copy(nStartPos, nEndPos - nStartPos));
         eMode = FormulaDlgMode::Edit;
 
-        m_pBtnMatrix->Check( bMatrix );
+        m_xBtnMatrix->set_active( bMatrix );
     } // if ( _bUpdate )
     return eMode;
 }
 
 bool FormulaDlg_Impl::CheckMatrix(OUString& aFormula)
 {
-    m_pMEdit->GrabFocus();
+    m_xMEdit->grab_focus();
     sal_Int32 nLen = aFormula.getLength();
     bool bMatrix =  nLen > 3                    // Matrix-Formula
             && aFormula[0] == '{'
@@ -1642,23 +1663,23 @@ bool FormulaDlg_Impl::CheckMatrix(OUString& aFormula)
     if ( bMatrix )
     {
         aFormula = aFormula.copy( 1, aFormula.getLength()-2 );
-        m_pBtnMatrix->Check( bMatrix );
-        m_pBtnMatrix->Disable();
+        m_xBtnMatrix->set_active( bMatrix );
+        m_xBtnMatrix->set_sensitive(false);
     } // if ( bMatrix )
 
-    m_pTabCtrl->SetCurPageId(TP_STRUCT);
+    m_xTabCtrl->set_current_page("struct");
     return bMatrix;
 }
 
 IMPL_LINK_NOARG( FormulaDlg_Impl, StructSelHdl, StructPage&, void)
 {
     m_bStructUpdate = false;
-    if (m_pStructPage->IsVisible())
-        m_pBtnForward->Enable(false); //@New
+    if (m_xStructPage->IsVisible())
+        m_xBtnForward->set_sensitive(false); //@New
     m_bStructUpdate = true;
 }
 
-IMPL_LINK_NOARG( FormulaDlg_Impl, MatrixHdl, Button*, void)
+IMPL_LINK_NOARG( FormulaDlg_Impl, MatrixHdl, weld::Button&, void)
 {
     m_bUserMatrixFlag = true;
     UpdateValues(true);
@@ -1666,78 +1687,78 @@ IMPL_LINK_NOARG( FormulaDlg_Impl, MatrixHdl, Button*, void)
 
 IMPL_LINK_NOARG( FormulaDlg_Impl, FuncSelHdl, FuncPage&, void)
 {
-    if (   (m_pFuncPage->GetFunctionEntryCount() > 0)
-        && (m_pFuncPage->GetFunction() != LISTBOX_ENTRY_NOTFOUND) )
+    if (   (m_xFuncPage->GetFunctionEntryCount() > 0)
+        && (m_xFuncPage->GetFunction() != -1) )
     {
-        const IFunctionDescription* pDesc = m_pFuncPage->GetFuncDesc( m_pFuncPage->GetFunction() );
+        const IFunctionDescription* pDesc = m_xFuncPage->GetFuncDesc( m_xFuncPage->GetFunction() );
 
         if (pDesc != m_pFuncDesc)
-            m_pBtnForward->Enable(); //new
+            m_xBtnForward->set_sensitive(true); //new
 
         if (pDesc)
         {
             pDesc->initArgumentInfo();      // full argument info is needed
 
             OUString aSig = pDesc->getSignature();
-            m_pFtHeadLine->SetText( pDesc->getFunctionName() );
-            m_pFtFuncName->SetText( aSig );
-            m_pFtFuncDesc->SetText( pDesc->getDescription() );
+            m_xFtHeadLine->set_label( pDesc->getFunctionName() );
+            m_xFtFuncName->set_label( aSig );
+            m_xFtFuncDesc->set_label( pDesc->getDescription() );
         }
     }
     else
     {
-        m_pFtHeadLine->SetText( OUString() );
-        m_pFtFuncName->SetText( OUString() );
-        m_pFtFuncDesc->SetText( OUString() );
+        m_xFtHeadLine->set_label( OUString() );
+        m_xFtFuncName->set_label( OUString() );
+        m_xFtFuncDesc->set_label( OUString() );
     }
 }
 
 void FormulaDlg_Impl::UpdateParaWin( const Selection& _rSelection, const OUString& _sRefStr)
 {
     Selection theSel = _rSelection;
-    m_pEdRef->ReplaceSelected( _sRefStr );
+    m_xEdRef->GetWidget()->replace_selection(_sRefStr);
     theSel.Max() = theSel.Min() + _sRefStr.getLength();
-    m_pEdRef->SetSelection( theSel );
+    m_xEdRef->SetSelection( theSel );
 
 
     // Manual Update of the results' fields:
 
-    sal_uInt16 nPrivActiv = m_pParaWin->GetActiveLine();
-    m_pParaWin->SetArgument( nPrivActiv, m_pEdRef->GetText());
-    m_pParaWin->UpdateParas();
+    sal_uInt16 nPrivActiv = m_xParaWin->GetActiveLine();
+    m_xParaWin->SetArgument( nPrivActiv, m_xEdRef->GetText());
+    m_xParaWin->UpdateParas();
 
-    Edit* pEd = GetCurrRefEdit();
-    if ( pEd != nullptr )
+    WeldRefEdit* pEd = GetCurrRefEdit();
+    if (pEd)
         pEd->SetSelection( theSel );
 }
 
 bool FormulaDlg_Impl::UpdateParaWin(Selection& _rSelection)
 {
     OUString      aStrEd;
-    Edit* pEd = GetCurrRefEdit();
-    if (pEd != nullptr && m_pTheRefEdit == nullptr)
+    WeldRefEdit* pEd = GetCurrRefEdit();
+    if (pEd && !m_pTheRefEdit)
     {
         _rSelection = pEd->GetSelection();
         _rSelection.Justify();
         aStrEd = pEd->GetText();
-        m_pEdRef->SetRefString(aStrEd);
-        m_pEdRef->SetSelection( _rSelection );
+        m_xEdRef->SetRefString(aStrEd);
+        m_xEdRef->SetSelection( _rSelection );
     }
     else
     {
-        _rSelection = m_pEdRef->GetSelection();
+        _rSelection = m_xEdRef->GetSelection();
         _rSelection.Justify();
-        aStrEd = m_pEdRef->GetText();
+        aStrEd = m_xEdRef->GetText();
     }
     return m_pTheRefEdit == nullptr;
 }
 
 void FormulaDlg_Impl::SetEdSelection()
 {
-    Edit* pEd = GetCurrRefEdit()/*aScParaWin.GetActiveEdit()*/;
-    if ( pEd )
+    WeldRefEdit* pEd = GetCurrRefEdit()/*aScParaWin.GetActiveEdit()*/;
+    if (pEd)
     {
-        Selection theSel = m_pEdRef->GetSelection();
+        Selection theSel = m_xEdRef->GetSelection();
         //  Edit may have the focus -> call ModifyHdl in addition
         //  to what's happening in GetFocus
         pEd->GetModifyHdl().Call(*pEd);
@@ -1746,24 +1767,18 @@ void FormulaDlg_Impl::SetEdSelection()
     } // if ( pEd )
 }
 
-FormulaModalDialog::FormulaModalDialog(   vcl::Window* pParent
-                                        , IFunctionManager const * _pFunctionMgr
-                                        , IControlReferenceHandler* _pDlg )
-    : ModalDialog(pParent, "FormulaDialog", "formula/ui/formuladialog.ui")
-    , m_pImpl(new FormulaDlg_Impl(this, false/*_bSupportFunctionResult*/,
+FormulaModalDialog::FormulaModalDialog(weld::Window* pParent,
+                                       IFunctionManager const * _pFunctionMgr,
+                                       IControlReferenceHandler* _pDlg)
+    : GenericDialogController(pParent, "formula/ui/formuladialog.ui", "FormulaDialog")
+    , m_pImpl(new FormulaDlg_Impl(*m_xDialog, *m_xBuilder, false/*_bSupportFunctionResult*/,
                                   false/*_bSupportResult*/, false/*_bSupportMatrix*/,
                                   this, _pFunctionMgr, _pDlg))
 {
-    SetText(m_pImpl->m_aTitle1);
+    m_xDialog->set_title(m_pImpl->m_aTitle1);
 }
 
-FormulaModalDialog::~FormulaModalDialog() { disposeOnce(); }
-
-void FormulaModalDialog::dispose()
-{
-    m_pImpl.reset();
-    ModalDialog::dispose();
-}
+FormulaModalDialog::~FormulaModalDialog() { }
 
 void FormulaModalDialog::Update(const OUString& _sExp)
 {
@@ -1785,12 +1800,12 @@ void FormulaModalDialog::Update()
     m_pImpl->Update();
 }
 
-::std::pair<RefButton*, RefEdit*> FormulaModalDialog::RefInputStartBefore( RefEdit* pEdit, RefButton* pButton )
+::std::pair<WeldRefButton*, WeldRefEdit*> FormulaModalDialog::RefInputStartBefore( WeldRefEdit* pEdit, WeldRefButton* pButton )
 {
     return m_pImpl->RefInputStartBefore( pEdit, pButton );
 }
 
-::std::pair<WeldRefButton*, WeldRefEdit*> FormulaModalDialog::RefInputStartBefore( WeldRefEdit* pEdit, WeldRefButton* pButton )
+::std::pair<RefButton*, RefEdit*> FormulaModalDialog::RefInputStartBefore( RefEdit* pEdit, RefButton* pButton )
 {
     return formula::FormulaDlg_Impl::RefInputStartBefore(pEdit, pButton);
 }
@@ -1805,40 +1820,26 @@ void FormulaModalDialog::RefInputDoneAfter()
     m_pImpl->RefInputDoneAfter( true/*bForced*/ );
 }
 
-bool FormulaModalDialog::PreNotify( NotifyEvent& rNEvt )
-{
-    if (m_pImpl)
-        m_pImpl->PreNotify( rNEvt );
-
-    return ModalDialog::PreNotify(rNEvt);
-}
-
 void FormulaModalDialog::StoreFormEditData(FormEditData* pData)
 {
     m_pImpl->StoreFormEditData(pData);
 }
 
-
 //      Initialisation / General functions  for Dialog
-
-FormulaDlg::FormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
-                             vcl::Window* pParent
-                            , IFunctionManager const * _pFunctionMgr, IControlReferenceHandler* _pDlg ) :
-        SfxModelessDialog( pB, pCW, pParent, "FormulaDialog", "formula/ui/formuladialog.ui" ),
-        m_pImpl( new FormulaDlg_Impl(this, true/*_bSupportFunctionResult*/
-                                            , true/*_bSupportResult*/
-                                            , true/*_bSupportMatrix*/
-                                            , this, _pFunctionMgr, _pDlg))
+FormulaDlg::FormulaDlg(SfxBindings* pB, SfxChildWindow* pCW,
+                       weld::Window* pParent,
+                       IFunctionManager const * _pFunctionMgr, IControlReferenceHandler* _pDlg)
+    : SfxModelessDialogController( pB, pCW, pParent, "formula/ui/formuladialog.ui", "FormulaDialog")
+    , m_pImpl(new FormulaDlg_Impl(*m_xDialog, *m_xBuilder, true/*_bSupportFunctionResult*/
+                                             , true/*_bSupportResult*/
+                                             , true/*_bSupportMatrix*/
+                                             , this, _pFunctionMgr, _pDlg))
 {
-    SetText(m_pImpl->m_aTitle1);
+    m_xDialog->set_title(m_pImpl->m_aTitle1);
 }
 
-FormulaDlg::~FormulaDlg() {disposeOnce();}
-
-void FormulaDlg::dispose()
+FormulaDlg::~FormulaDlg()
 {
-    m_pImpl.reset();
-    SfxModelessDialog::dispose();
 }
 
 void FormulaDlg::Update(const OUString& _sExp)
@@ -1846,7 +1847,6 @@ void FormulaDlg::Update(const OUString& _sExp)
     m_pImpl->Update(_sExp);
 }
 
-
 void FormulaDlg::SetMeText(const OUString& _sText)
 {
     m_pImpl->SetMeText(_sText);
@@ -1864,14 +1864,12 @@ bool FormulaDlg::CheckMatrix(OUString& aFormula)
 
 OUString FormulaDlg::GetMeText() const
 {
-    return m_pImpl->m_pMEdit->GetText();
+    return m_pImpl->m_xMEdit->get_text();
 }
 
 void FormulaDlg::Update()
 {
     m_pImpl->Update();
-    m_pImpl->m_aIdle.SetInvokeHandler( LINK( this, FormulaDlg, UpdateFocusHdl));
-    m_pImpl->m_aIdle.Start();
 }
 
 void FormulaDlg::DoEnter()
@@ -1879,12 +1877,12 @@ void FormulaDlg::DoEnter()
     m_pImpl->DoEnter(false);
 }
 
-::std::pair<RefButton*, RefEdit*> FormulaDlg::RefInputStartBefore( RefEdit* pEdit, RefButton* pButton )
+::std::pair<WeldRefButton*, WeldRefEdit*> FormulaDlg::RefInputStartBefore( WeldRefEdit* pEdit, WeldRefButton* pButton )
 {
     return m_pImpl->RefInputStartBefore( pEdit, pButton );
 }
 
-::std::pair<WeldRefButton*, WeldRefEdit*> FormulaDlg::RefInputStartBefore( WeldRefEdit* pEdit, WeldRefButton* pButton )
+::std::pair<RefButton*, RefEdit*> FormulaDlg::RefInputStartBefore( RefEdit* pEdit, RefButton* pButton )
 {
     return formula::FormulaDlg_Impl::RefInputStartBefore(pEdit, pButton);
 }
@@ -1899,16 +1897,9 @@ void FormulaDlg::RefInputDoneAfter( bool bForced )
     m_pImpl->RefInputDoneAfter( bForced );
 }
 
-bool FormulaDlg::PreNotify( NotifyEvent& rNEvt )
-{
-    if (m_pImpl)
-        m_pImpl->PreNotify( rNEvt );
-    return SfxModelessDialog::PreNotify(rNEvt);
-}
-
 void FormulaDlg::disableOk()
 {
-    m_pImpl->m_pBtnEnd->Disable();
+    m_pImpl->m_xBtnEnd->set_sensitive(false);
 }
 
 void FormulaDlg::StoreFormEditData(FormEditData* pData)
@@ -1935,9 +1926,9 @@ bool FormulaDlg::UpdateParaWin(Selection& _rSelection)
     return m_pImpl->UpdateParaWin(_rSelection);
 }
 
-RefEdit*    FormulaDlg::GetActiveEdit()
+WeldRefEdit* FormulaDlg::GetActiveEdit()
 {
-    return m_pImpl->m_pParaWin->GetActiveEdit();
+    return m_pImpl->m_xParaWin->GetActiveEdit();
 }
 
 const FormulaHelper& FormulaDlg::GetFormulaHelper() const
@@ -1950,17 +1941,6 @@ void FormulaDlg::SetEdSelection()
     m_pImpl->SetEdSelection();
 }
 
-IMPL_LINK_NOARG( FormulaDlg, UpdateFocusHdl, Timer *, void)
-{
-    FormEditData* pData = m_pImpl->m_pHelper->getFormEditData();
-    if (!pData)
-        return;
-    // won't be destroyed via Close
-    VclPtr<vcl::Window> xWin(pData->GetFocusWindow());
-    if (xWin && !xWin->IsDisposed())
-        xWin->GrabFocus();
-}
-
 void FormEditData::SaveValues()
 {
     Reset();
@@ -1972,7 +1952,6 @@ void FormEditData::Reset()
     nFStart = 0;
     nOffset = 0;
     bMatrix = false;
-    xFocusWin.clear();
     aSelection.Min() = 0;
     aSelection.Max() = 0;
     aUndoStr.clear();
@@ -1985,7 +1964,6 @@ FormEditData& FormEditData::operator=( const FormEditData& r )
     nOffset         = r.nOffset;
     aUndoStr        = r.aUndoStr;
     bMatrix         = r.bMatrix ;
-    xFocusWin       = r.xFocusWin;
     aSelection      = r.aSelection;
     return *this;
 }
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index ce8c23da4eff..3cb0facba86c 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -23,6 +23,7 @@
 #include <svl/stritem.hxx>
 #include <vcl/builderfactory.hxx>
 #include <vcl/event.hxx>
+#include <vcl/svapp.hxx>
 #include <formula/IFunctionDescription.hxx>
 
 #include "funcpage.hxx"
@@ -32,44 +33,26 @@
 namespace formula
 {
 
-FormulaListBox::FormulaListBox( vcl::Window* pParent, WinBits nBits ):
-    ListBox(pParent, nBits)
-{}
-
-void FormulaListBox::KeyInput( const KeyEvent& rKEvt )
-{
-    if(rKEvt.GetCharCode()==' ')
-        DoubleClick();
-}
-
-bool FormulaListBox::PreNotify( NotifyEvent& rNEvt )
+IMPL_LINK(FuncPage, KeyInputHdl, const KeyEvent&, rKEvt, bool)
 {
-    NotifyEvent aNotifyEvt=rNEvt;
-
-    bool bResult = ListBox::PreNotify(rNEvt);
-
-    MouseNotifyEvent nSwitch=aNotifyEvt.GetType();
-    if(nSwitch==MouseNotifyEvent::KEYINPUT)
+    if (rKEvt.GetCharCode() == ' ')
     {
-        KeyInput(*aNotifyEvt.GetKeyEvent());
+        aDoubleClickLink.Call(*this);
+        return true;
     }
-    return bResult;
+    return false;
 }
 
-VCL_BUILDER_FACTORY_ARGS(FormulaListBox, WB_BORDER | WB_SORT)
-
-FuncPage::FuncPage(vcl::Window* pParent,const IFunctionManager* _pFunctionManager):
-    TabPage(pParent, "FunctionPage", "formula/ui/functionpage.ui"),
-    m_pFunctionManager(_pFunctionManager)
+FuncPage::FuncPage(weld::Container* pParent, const IFunctionManager* _pFunctionManager)
+    : m_xBuilder(Application::CreateBuilder(pParent, "formula/ui/functionpage.ui"))
+    , m_xContainer(m_xBuilder->weld_container("FunctionPage"))
+    , m_xLbCategory(m_xBuilder->weld_combo_box("category"))
+    , m_xLbFunction(m_xBuilder->weld_tree_view("function"))
+    , m_xLbFunctionSearchString(m_xBuilder->weld_entry("search"))
+    , m_pFunctionManager(_pFunctionManager)
 {
-    get(m_pLbCategory, "category");
-    get(m_pLbFunction, "function");
-    get(m_plbFunctionSearchString, "search");
-    m_pLbFunction->SetStyle(m_pLbFunction->GetStyle() | WB_SORT);
-    Size aSize(LogicToPixel(Size(86 , 162), MapMode(MapUnit::MapAppFont)));
-    m_pLbFunction->set_height_request(aSize.Height());
-    m_pLbFunction->set_width_request(aSize.Width());
-    m_aHelpId = m_pLbFunction->GetHelpId();
+    m_xLbFunction->make_sorted();
+    m_aHelpId = m_xLbFunction->get_help_id();
 
     m_pFunctionManager->fillLastRecentlyUsedFunctions(aLRUList);
 
@@ -77,30 +60,25 @@ FuncPage::FuncPage(vcl::Window* pParent,const IFunctionManager* _pFunctionManage
     for(sal_uInt32 j= 0; j < nCategoryCount; ++j)
     {
         const IFunctionCategory* pCategory = m_pFunctionManager->getCategory(j);
-        m_pLbCategory->SetEntryData(m_pLbCategory->InsertEntry(pCategory->getName()),const_cast<IFunctionCategory *>(pCategory));
+        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pCategory)));
+        m_xLbCategory->append(sId, pCategory->getName());
     }
 
-    m_pLbCategory->SetDropDownLineCount(m_pLbCategory->GetEntryCount());
-    m_pLbCategory->SelectEntryPos(1);
-    OUString searchStr = m_plbFunctionSearchString->GetText();
+    m_xLbCategory->set_active(1);
+    OUString searchStr = m_xLbFunctionSearchString->get_text();
     UpdateFunctionList(searchStr);
-    m_pLbCategory->SetSelectHdl( LINK( this, FuncPage, SelHdl ) );
-    m_pLbFunction->SetSelectHdl( LINK( this, FuncPage, SelHdl ) );
-    m_pLbFunction->SetDoubleClickHdl( LINK( this, FuncPage, DblClkHdl ) );
-    m_plbFunctionSearchString->SetModifyHdl( LINK( this, FuncPage, ModifyHdl ) );
+    // lock to its initial size
+    m_xLbFunction->set_size_request(m_xLbFunction->get_preferred_size().Width(),
+                                    m_xLbFunction->get_height_rows(15));
+    m_xLbCategory->connect_changed( LINK( this, FuncPage, SelComboBoxHdl ) );
+    m_xLbFunction->connect_changed( LINK( this, FuncPage, SelTreeViewHdl ) );
+    m_xLbFunction->connect_row_activated( LINK( this, FuncPage, DblClkHdl ) );
+    m_xLbFunction->connect_key_press( LINK( this, FuncPage, KeyInputHdl ) );
+    m_xLbFunctionSearchString->connect_changed( LINK( this, FuncPage, ModifyHdl ) );
 }
 
 FuncPage::~FuncPage()
 {
-    disposeOnce();
-}
-
-void FuncPage::dispose()
-{
-    m_pLbCategory.clear();
-    m_pLbFunction.clear();
-    m_plbFunctionSearchString.clear();
-    TabPage::dispose();
 }
 
 void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory)
@@ -110,23 +88,24 @@ void FuncPage::impl_addFunctions(const IFunctionCategory* _pCategory)
     {
         TFunctionDesc pDesc(_pCategory->getFunction(i));
         if (!pDesc->isHidden())
-            m_pLbFunction->SetEntryData(
-                    m_pLbFunction->InsertEntry(pDesc->getFunctionName() ),const_cast<IFunctionDescription *>(pDesc) );
+        {
+            OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+            m_xLbFunction->append(sId, pDesc->getFunctionName());
+        }
     }
 }
 
 //aStr is non-empty when user types in the search box to search some function
 void FuncPage::UpdateFunctionList(const OUString& aStr)
 {
+    m_xLbFunction->clear();
+    m_xLbFunction->freeze();
 
-    m_pLbFunction->Clear();
-    m_pLbFunction->SetUpdateMode( false );
-
-    const sal_Int32 nSelPos = m_pLbCategory->GetSelectedEntryPos();
+    const sal_Int32 nSelPos = m_xLbCategory->get_active();
 
     if (aStr.isEmpty() || nSelPos == 0)
     {
-        const IFunctionCategory* pCategory = static_cast<const IFunctionCategory*>(m_pLbCategory->GetEntryData(nSelPos));
+        const IFunctionCategory* pCategory = reinterpret_cast<const IFunctionCategory*>(m_xLbCategory->get_id(nSelPos).toInt64());
 
         if ( nSelPos > 0 )
         {
@@ -149,8 +128,8 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
             {
                 if (elem)  // may be null if a function is no longer available
                 {
-                    m_pLbFunction->SetEntryData(
-                        m_pLbFunction->InsertEntry( elem->getFunctionName() ), const_cast<IFunctionDescription *>(elem) );
+                    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(elem)));
+                    m_xLbFunction->append(sId, elem->getFunctionName());
                 }
             }
         }
@@ -164,10 +143,10 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
         const sal_uInt32 nCategoryCount = m_pFunctionManager->getCount();
         // Category listbox holds additional entries for Last Used and All, so
         // the offset should be two but hard coded numbers are ugly..
-        const sal_Int32 nCategoryOffset = m_pLbCategory->GetEntryCount() - nCategoryCount;
+        const sal_Int32 nCategoryOffset = m_xLbCategory->get_count() - nCategoryCount;
         // If a real category (not Last Used or All) is selected, list only
         // functions of that category. Else list all, LRU is handled above.
-        sal_Int32 nCatBeg = (nSelPos == LISTBOX_ENTRY_NOTFOUND ? -1 : nSelPos - nCategoryOffset);
+        sal_Int32 nCatBeg = (nSelPos == -1 ? -1 : nSelPos - nCategoryOffset);
         sal_uInt32 nCatEnd;
         if (nCatBeg < 0)
         {
@@ -189,105 +168,105 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
                 {
                     if (!pDesc->isHidden())
                     {
-                        m_pLbFunction->SetEntryData(
-                                m_pLbFunction->InsertEntry( pDesc->getFunctionName()),
-                                const_cast<IFunctionDescription *>(pDesc));
+                        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDesc)));
+                        m_xLbFunction->append(sId, pDesc->getFunctionName());
                     }
                 }
             }
         }
     }
 
-    m_pLbFunction->SetUpdateMode( true );
+    m_xLbFunction->thaw();
     // Ensure no function is selected so the Next button doesn't overwrite a
     // function that is not in the list with an arbitrary selected one.
-    m_pLbFunction->SetNoSelection();
+    m_xLbFunction->unselect_all();
 
-    if(IsVisible()) SelHdl(*m_pLbFunction);
+    if (IsVisible())
+        SelTreeViewHdl(*m_xLbFunction);
 }
 
-IMPL_LINK( FuncPage, SelHdl, ListBox&, rLb, void )
+IMPL_LINK_NOARG(FuncPage, SelComboBoxHdl, weld::ComboBox&, void)
 {
-    if(&rLb==m_pLbFunction)
-    {
-        const IFunctionDescription* pDesc = GetFuncDesc( GetFunction() );
-        if ( pDesc )
-        {
-            const OString sHelpId = pDesc->getHelpId();
-            if ( !sHelpId.isEmpty() )
-                m_pLbFunction->SetHelpId(sHelpId);
-        }
-        aSelectionLink.Call(*this);
-    }
-    else
+    OUString searchStr = m_xLbFunctionSearchString->get_text();
+    m_xLbFunction->set_help_id(m_aHelpId);
+    UpdateFunctionList(searchStr);
+}
+
+IMPL_LINK_NOARG(FuncPage, SelTreeViewHdl, weld::TreeView&, void)
+{
+    const IFunctionDescription* pDesc = GetFuncDesc( GetFunction() );
+    if ( pDesc )
     {
-        OUString searchStr = m_plbFunctionSearchString->GetText();
-        m_pLbFunction->SetHelpId(m_aHelpId);
-        UpdateFunctionList(searchStr);
+        const OString sHelpId = pDesc->getHelpId();
+        if ( !sHelpId.isEmpty() )
+            m_xLbFunction->set_help_id(sHelpId);
     }
+    aSelectionLink.Call(*this);
 }
 
-IMPL_LINK_NOARG(FuncPage, DblClkHdl, ListBox&, void)
+IMPL_LINK_NOARG(FuncPage, DblClkHdl, weld::TreeView&, void)
 {
     aDoubleClickLink.Call(*this);
 }
 
-IMPL_LINK_NOARG(FuncPage, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(FuncPage, ModifyHdl, weld::Entry&, void)
 {
     // While typing select All category.
-    m_pLbCategory->SelectEntryPos(1);
-    OUString searchStr = m_plbFunctionSearchString->GetText();
+    m_xLbCategory->set_active(1);
+    OUString searchStr = m_xLbFunctionSearchString->get_text();
     UpdateFunctionList(searchStr);
 }
 
 void FuncPage::SetCategory(sal_Int32 nCat)
 {
-    m_pLbCategory->SelectEntryPos(nCat);
+    m_xLbCategory->set_active(nCat);
     UpdateFunctionList(OUString());
 }
 
 sal_Int32 FuncPage::GetFuncPos(const IFunctionDescription* _pDesc)
 {
-    return m_pLbFunction->GetEntryPos(_pDesc);
+    return m_xLbFunction->find_id(OUString::number(reinterpret_cast<sal_Int64>(_pDesc)));
 }
 
 void FuncPage::SetFunction(sal_Int32 nFunc)
 {
-    if (nFunc == LISTBOX_ENTRY_NOTFOUND)
-        m_pLbFunction->SetNoSelection();
+    if (nFunc == -1)
+        m_xLbFunction->unselect_all();
     else
-        m_pLbFunction->SelectEntryPos(nFunc);
+        m_xLbFunction->select(nFunc);
 }
 
 void FuncPage::SetFocus()
 {
-    m_pLbFunction->GrabFocus();
+    m_xLbFunction->grab_focus();
 }
 
 sal_Int32 FuncPage::GetCategory()
 {
-    return m_pLbCategory->GetSelectedEntryPos();
+    return m_xLbCategory->get_active();
 }
 
 sal_Int32 FuncPage::GetFunction()
 {
-    return m_pLbFunction->GetSelectedEntryPos();
+    return m_xLbFunction->get_selected_index();
 }
 
 sal_Int32 FuncPage::GetFunctionEntryCount()
 {
-    return m_pLbFunction->GetSelectedEntryCount();
+    return m_xLbFunction->n_children();
 }
 
 OUString FuncPage::GetSelFunctionName() const
 {
-    return m_pLbFunction->GetSelectedEntry();
+    return m_xLbFunction->get_selected_text();
 }
 
 const IFunctionDescription* FuncPage::GetFuncDesc( sal_Int32 nPos ) const
 {
+    if (nPos == -1)
+        return nullptr;
     // not pretty, but hopefully rare
-    return static_cast<const IFunctionDescription*>(m_pLbFunction->GetEntryData(nPos));
+    return reinterpret_cast<const IFunctionDescription*>(m_xLbFunction->get_id(nPos).toInt64());
 }
 
 } // formula
diff --git a/formula/source/ui/dlg/funcpage.hxx b/formula/source/ui/dlg/funcpage.hxx
index b4bccbc64199..1b5b92b6b2fb 100644
--- a/formula/source/ui/dlg/funcpage.hxx
+++ b/formula/source/ui/dlg/funcpage.hxx
@@ -37,49 +37,39 @@ class IFunctionDescription;
 class IFunctionManager;
 class IFunctionCategory;
 
-
-class FormulaListBox : public ListBox
-{
-protected:
-
-    virtual void    KeyInput( const KeyEvent& rKEvt ) override;
-    virtual bool    PreNotify( NotifyEvent& rNEvt ) override;
-
-public:
-                    FormulaListBox( vcl::Window* pParent, WinBits nBits );
-
-};
-
-
 typedef const IFunctionDescription* TFunctionDesc;
 
-class FuncPage final : public TabPage
+class FuncPage final
 {
 private:
+    std::unique_ptr<weld::Builder> m_xBuilder;
+    std::unique_ptr<weld::Container> m_xContainer;
+
+    std::unique_ptr<weld::ComboBox> m_xLbCategory;
+    std::unique_ptr<weld::TreeView> m_xLbFunction;
+    std::unique_ptr<weld::Entry> m_xLbFunctionSearchString;
+
     Link<FuncPage&,void>     aDoubleClickLink;
     Link<FuncPage&,void>     aSelectionLink;
-    VclPtr<ListBox>          m_pLbCategory;
-    VclPtr<FormulaListBox>   m_pLbFunction;
-    VclPtr<Edit>             m_plbFunctionSearchString;
     const IFunctionManager*  m_pFunctionManager;
 
     ::std::vector< TFunctionDesc >  aLRUList;
     OString    m_aHelpId;
 
-
     void impl_addFunctions(const IFunctionCategory* _pCategory);
-                    DECL_LINK( SelHdl, ListBox&, void );
-                    DECL_LINK(DblClkHdl, ListBox&, void);
-                    DECL_LINK(ModifyHdl, Edit&, void);
 
-    void            UpdateFunctionList(const OUString&);
+    DECL_LINK(SelComboBoxHdl, weld::ComboBox&, void);
+    DECL_LINK(SelTreeViewHdl, weld::TreeView&, void);
+    DECL_LINK(DblClkHdl, weld::TreeView&, void);
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+    DECL_LINK(ModifyHdl, weld::Entry&, void);
 
+    void            UpdateFunctionList(const OUString&);
 
 public:
 
-                    FuncPage( vcl::Window* pParent,const IFunctionManager* _pFunctionManager);
-    virtual         ~FuncPage() override;
-    virtual void    dispose() override;
+    FuncPage(weld::Container* pContainer, const IFunctionManager* _pFunctionManager);
+    ~FuncPage();
 
     void            SetCategory(sal_Int32  nCat);
     void            SetFunction(sal_Int32  nFunc);
@@ -96,6 +86,9 @@ public:
 
     void            SetSelectHdl( const Link<FuncPage&,void>& rLink ) { aSelectionLink = rLink; }
 
+    void            Show() { m_xContainer->show(); }
+    bool            IsVisible() { return m_xContainer->get_visible(); }
+    void            Hide() { m_xContainer->hide(); }
 };
 
 } // formula
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index 698afeab405c..2aeb01ab0ae4 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -27,6 +27,7 @@
 #include <formula/funcutl.hxx>
 #include <formula/IControlReferenceHandler.hxx>
 #include "ControlHelper.hxx"
+#include "parawin.hxx"
 #include <strings.hrc>
 #include <bitmaps.hlst>
 #include <core_resource.hxx>
@@ -36,41 +37,29 @@ namespace formula
 {
 
 // class ArgEdit
-ArgEdit::ArgEdit( vcl::Window* pParent, WinBits nBits )
-    :   RefEdit( pParent, nullptr, nBits ),
-        pEdPrev ( nullptr ),
-        pEdNext ( nullptr ),
-        pSlider ( nullptr ),
-        nArgs   ( 0 )
+ArgEdit::ArgEdit(std::unique_ptr<weld::Entry> xControl)
+    : WeldRefEdit(std::move(xControl))
+    , pEdPrev(nullptr)
+    , pEdNext(nullptr)
+    , pSlider(nullptr)
+    , pParaWin(nullptr)
+    , nArgs(0)
 {
 }
 
-ArgEdit::~ArgEdit()
-{
-    disposeOnce();
-}
-
-void ArgEdit::dispose()
-{
-    pEdPrev.clear();
-    pEdNext.clear();
-    pSlider.clear();
-    RefEdit::dispose();
-}
-
-VCL_BUILDER_FACTORY_ARGS(ArgEdit, WB_BORDER)
-
-void ArgEdit::Init( ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
-                    ScrollBar& rArgSlider, sal_uInt16 nArgCount )
+void ArgEdit::Init(ArgEdit* pPrevEdit, ArgEdit* pNextEdit,
+                   weld::ScrolledWindow& rArgSlider,
+                   ParaWin& rParaWin, sal_uInt16 nArgCount)
 {
     pEdPrev = pPrevEdit;
     pEdNext = pNextEdit;
     pSlider = &rArgSlider;
+    pParaWin = &rParaWin;
     nArgs   = nArgCount;
 }
 
 // Cursor control for Edit Fields in Argument Dialog
-void ArgEdit::KeyInput( const KeyEvent& rKEvt )
+IMPL_LINK(ArgEdit, KeyInputHdl, const KeyEvent&, rKEvt, bool)
 {
     vcl::KeyCode aCode = rKEvt.GetKeyCode();
     bool bUp = (aCode.GetCode() == KEY_UP);
@@ -83,7 +72,7 @@ void ArgEdit::KeyInput( const KeyEvent& rKEvt )
         if ( nArgs > 1 )
         {
             ArgEdit* pEd = nullptr;
-            long nThumb = pSlider->GetThumbPos();
+            int nThumb = pSlider->vadjustment_get_value();
             bool bDoScroll = false;
             bool bChangeFocus = false;
 
@@ -132,17 +121,17 @@ void ArgEdit::KeyInput( const KeyEvent& rKEvt )
 
             if ( bDoScroll )
             {
-                pSlider->SetThumbPos( nThumb );
-                pSlider->GetEndScrollHdl().Call( pSlider );
+                pSlider->vadjustment_set_value( nThumb );
+                pParaWin->SliderMoved();
             }
             else if ( bChangeFocus )
             {
                 pEd->GrabFocus();
             }
         }
+        return true;
     }
-    else
-        RefEdit::KeyInput( rKEvt );
+    return false;
 }
 
 // class ArgInput
@@ -154,8 +143,8 @@ ArgInput::ArgInput()
     pRefBtn=nullptr;
 }
 
-void ArgInput::InitArgInput( FixedText* pftArg, PushButton* pbtnFx,
-                             ArgEdit* pedArg, RefButton* prefBtn)
+void ArgInput::InitArgInput(weld::Label* pftArg, weld::Button* pbtnFx,
+                            ArgEdit* pedArg, WeldRefButton* prefBtn)
 {
     pFtArg =pftArg;
     pBtnFx =pbtnFx;
@@ -164,240 +153,124 @@ void ArgInput::InitArgInput( FixedText* pftArg, PushButton* pbtnFx,
 
     if(pBtnFx!=nullptr)
     {
-        pBtnFx->SetClickHdl   ( LINK( this, ArgInput, FxBtnClickHdl ) );
-        pBtnFx->SetGetFocusHdl( LINK( this, ArgInput, FxBtnFocusHdl ) );
+        pBtnFx->connect_clicked( LINK( this, ArgInput, FxBtnClickHdl ) );
+        pBtnFx->connect_focus_in( LINK( this, ArgInput, FxBtnFocusHdl ) );
     }
     if(pEdArg!=nullptr)
     {
         pEdArg->SetGetFocusHdl ( LINK( this, ArgInput, EdFocusHdl ) );
         pEdArg->SetModifyHdl   ( LINK( this, ArgInput, EdModifyHdl ) );
     }
-
 }
 
 // Sets the Name for the Argument
 void ArgInput::SetArgName(const OUString &aArg)
 {
-    if(pFtArg !=nullptr) pFtArg->SetText(aArg );
+    if (pFtArg)
+        pFtArg->set_label(aArg );
 }
 
 // Returns the Name for the Argument
 OUString ArgInput::GetArgName()
 {
     OUString aPrivArgName;
-    if(pFtArg !=nullptr)
-        aPrivArgName=pFtArg->GetText();
-
+    if (pFtArg)
+        aPrivArgName = pFtArg->get_label();
     return aPrivArgName;
 }
 
 //Sets the Name for the Argument
-void ArgInput::SetArgNameFont   (const vcl::Font &aFont)
+void ArgInput::SetArgNameFont(const vcl::Font &aFont)
 {
-    if(pFtArg !=nullptr) pFtArg->SetFont(aFont);
+    if (pFtArg)
+        pFtArg->set_font(aFont);
 }
 
 //Sets up the Selection for the EditBox.
-void ArgInput::SetArgSelection  (const Selection& rSel )
+void ArgInput::SelectAll()
 {
-    if(pEdArg !=nullptr) pEdArg ->SetSelection(rSel );
+    if (pEdArg)
+        pEdArg->SelectAll();
 }
 
 //Sets the Value for the Argument
 void ArgInput::SetArgVal(const OUString &rVal)
 {
-    if(pEdArg != nullptr)
-    {
-        pEdArg ->SetRefString(rVal);
-    }
+    if (pEdArg)
+        pEdArg->SetRefString(rVal);
 }
 
 //Returns the Value for the Argument
 OUString ArgInput::GetArgVal()
 {
     OUString aResult;
-    if(pEdArg!=nullptr)
-    {
+    if (pEdArg)
         aResult=pEdArg->GetText();
-    }
     return aResult;
 }
 
 //Hides the Controls
 void ArgInput::Hide()
 {
-    if ( pFtArg && pBtnFx && pEdArg && pRefBtn)
+    if (pFtArg && pBtnFx && pEdArg && pRefBtn)
     {
-        pFtArg->Hide();
-        pBtnFx->Hide();
-        pEdArg->Hide();
-        pRefBtn->Hide();
+        pFtArg->hide();
+        pBtnFx->hide();
+        pEdArg->GetWidget()->hide();
+        pRefBtn->GetWidget()->hide();
     }
 }
 
 //Casts the Controls again.
 void ArgInput::Show()
 {
-    if ( pFtArg && pBtnFx && pEdArg && pRefBtn)
+    if (pFtArg && pBtnFx && pEdArg && pRefBtn)
     {
-        pFtArg->Show();
-        pBtnFx->Show();
-        pEdArg->Show();
-        pRefBtn->Show();
+        pFtArg->show();
+        pBtnFx->show();
+        pEdArg->GetWidget()->show();
+        pRefBtn->GetWidget()->show();
     }
 }
 
 void ArgInput::UpdateAccessibleNames()
 {
     OUString aArgName(":");
-    aArgName += pFtArg->GetText();
+    aArgName += pFtArg->get_label();
 
-    OUString aName = pBtnFx->GetQuickHelpText();
+    OUString aName = pBtnFx->get_tooltip_text();
     aName += aArgName;
-    pBtnFx->SetAccessibleName(aName);
+    pBtnFx->set_accessible_name(aName);
 
-    aName = pRefBtn->GetQuickHelpText();
+    aName = pRefBtn->GetWidget()->get_tooltip_text();
     aName += aArgName;
-    pRefBtn->SetAccessibleName(aName);
+    pRefBtn->GetWidget()->set_accessible_name(aName);
 }
 
-IMPL_LINK( ArgInput, FxBtnClickHdl, Button*, pBtn, void )
+IMPL_LINK(ArgInput, FxBtnClickHdl, weld::Button&, rBtn, void)
 {
-    if(pBtn == pBtnFx)
+    if (&rBtn == pBtnFx)
         aFxClickLink.Call(*this);
 }
 
-IMPL_LINK( ArgInput, FxBtnFocusHdl, Control&, rControl, void )
+IMPL_LINK( ArgInput, FxBtnFocusHdl, weld::Widget&, rControl, void )
 {
-    if(&rControl == pBtnFx)
+    if (&rControl == pBtnFx)
         aFxFocusLink.Call(*this);
 }
 
-IMPL_LINK( ArgInput, EdFocusHdl, Control&, rControl, void )
+IMPL_LINK( ArgInput, EdFocusHdl, WeldRefEdit&, rControl, void )
 {
-    if(&rControl == pEdArg)
+    if (&rControl == pEdArg)
         aEdFocusLink.Call(*this);
 }
 
-IMPL_LINK( ArgInput, EdModifyHdl, Edit&, rEdit, void )
+IMPL_LINK( ArgInput, EdModifyHdl, WeldRefEdit&, rEdit, void )
 {
-    if(&rEdit == pEdArg)
+    if (&rEdit == pEdArg)
         aEdModifyLink.Call(*this);
 }
 
-// class EditBox
-
-EditBox::EditBox( vcl::Window* pParent, WinBits nBits )
-        :Control(pParent,nBits)
-{
-    WinBits nStyle=GetStyle();
-    SetStyle( nStyle| WB_DIALOGCONTROL);
-
-    pMEdit=VclPtr<MultiLineEdit>::Create(this,WB_LEFT | WB_VSCROLL | (nStyle & WB_TABSTOP) |
-                    WB_NOBORDER | WB_NOHIDESELECTION | WB_IGNORETAB);
-    pMEdit->Show();
-    aOldSel=pMEdit->GetSelection();
-    Resize();
-    WinBits nWinStyle=GetStyle() | WB_DIALOGCONTROL;
-    SetStyle(nWinStyle);
-
-    //  #105582# the HelpId from the resource must be set for the MultiLineEdit,
-    //  not for the control that contains it.
-    pMEdit->SetHelpId( GetHelpId() );
-    SetHelpId( "" );
-}
-
-VCL_BUILDER_FACTORY_ARGS(EditBox, WB_BORDER)
-
-EditBox::~EditBox()
-{
-    disposeOnce();
-}
-
-void EditBox::dispose()
-{
-    pMEdit->Disable();
-    pMEdit.disposeAndClear();
-    Control::dispose();
-}
-
-// When the size is changed, MultiLineEdit must be adapted..
-void EditBox::Resize()
-{
-    Size aSize=GetOutputSizePixel();
-    if(pMEdit!=nullptr) pMEdit->SetOutputSizePixel(aSize);
-}
-
-// When the Control is activated, the Selection is repealed
-// and the Cursor set at the end.
-void EditBox::GetFocus()
-{
-    if(pMEdit!=nullptr)
-    {
-        pMEdit->GrabFocus();
-    }
-}
-
-// When an event is being triggered, this routine is called first and
-// a PostUserEvent is sent.
-bool EditBox::PreNotify( NotifyEvent& rNEvt )
-{
-    bool bResult = true;
-
-    if(pMEdit==nullptr) return bResult;
-
-    MouseNotifyEvent nSwitch=rNEvt.GetType();
-    if(nSwitch==MouseNotifyEvent::KEYINPUT)// || nSwitch==MouseNotifyEvent::KEYUP)
-    {
-        const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
-        sal_uInt16 nKey=aKeyCode.GetCode();
-        if( (nKey==KEY_RETURN && !aKeyCode.IsShift()) || nKey==KEY_TAB )
-        {
-            bResult = GetParent()->EventNotify(rNEvt);
-        }
-        else
-        {
-            bResult=Control::PreNotify(rNEvt);
-            Application::PostUserEvent( LINK( this, EditBox, ChangedHdl ), nullptr, true );
-        }
-
-    }
-    else
-    {
-        bResult=Control::PreNotify(rNEvt);
-
-        if(nSwitch==MouseNotifyEvent::MOUSEBUTTONDOWN || nSwitch==MouseNotifyEvent::MOUSEBUTTONUP)
-        {
-            Application::PostUserEvent( LINK( this, EditBox, ChangedHdl ), nullptr, true );
-        }
-    }
-    return bResult;
-}
-
-// When an event was triggered, this routine is called first.
-IMPL_LINK_NOARG(EditBox, ChangedHdl, void*, void)
-{
-    if(pMEdit!=nullptr)
-    {
-        Selection aNewSel=pMEdit->GetSelection();
-
-        if(aNewSel.Min()!=aOldSel.Min() || aNewSel.Max()!=aOldSel.Max())
-        {
-            aSelChangedLink.Call(*this);
-            aOldSel=aNewSel;
-        }
-    }
-}
-
-void EditBox::UpdateOldSel()
-{
-    //  if selection is set for editing a function, store it as aOldSel,
-    //  so SelectionChanged isn't called in the next ChangedHdl call
-
-    if (pMEdit)
-        aOldSel = pMEdit->GetSelection();
-}
-
 // class RefEdit
 
 RefEdit::RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits nStyle )
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index d901bc1a7cfa..4774b7ba415b 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -21,6 +21,7 @@
 #include <svl/zforlist.hxx>
 #include <svl/stritem.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
 #include <sal/log.hxx>
 
 #include "parawin.hxx"
@@ -34,73 +35,68 @@
 namespace formula
 {
 
-
-ParaWin::ParaWin(vcl::Window* pParent,IControlReferenceHandler* _pDlg):
-    TabPage         (pParent, "ParameterPage", "formula/ui/parameter.ui"),
-    pFuncDesc       ( nullptr ),
-    pMyParent       (_pDlg),
-    m_sOptional     ( ForResId( STR_OPTIONAL ) ),
-    m_sRequired     ( ForResId( STR_REQUIRED ) )
+ParaWin::ParaWin(weld::Container* pParent,IControlReferenceHandler* _pDlg)
+    : pFuncDesc(nullptr)
+    , pMyParent(_pDlg)

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list