[Libreoffice-commits] core.git: extras/source include/vcl sc/source sc/uiconfig solenv/bin svx/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 8 20:22:18 UTC 2019


 extras/source/glade/libreoffice-catalog.xml.in |    4 
 include/vcl/customweld.hxx                     |    3 
 sc/source/ui/inc/AccessibleContextBase.hxx     |   11 
 sc/source/ui/inc/scuitphfedit.hxx              |   77 ++-
 sc/source/ui/inc/tphfedit.hxx                  |   42 +-
 sc/source/ui/pagedlg/scuitphfedit.cxx          |  513 +++++++++++--------------
 sc/source/ui/pagedlg/tphfedit.cxx              |  129 +++---
 sc/uiconfig/scalc/ui/headerfootercontent.ui    |  112 +++--
 solenv/bin/native-code.py                      |    1 
 svx/source/dialog/ClassificationEditView.cxx   |    2 
 10 files changed, 481 insertions(+), 413 deletions(-)

New commits:
commit 2fb6e8365c6792422c10c56e2c976b781c194b77
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Apr 7 21:45:01 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Apr 8 22:21:57 2019 +0200

    weld ScHFEditPage
    
    Change-Id: Icf40e51ed40659cc79b61798de47132162e86541
    Reviewed-on: https://gerrit.libreoffice.org/70414
    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 afd5a35b392d..0c2957caa44b 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -328,10 +328,6 @@
                         generic-name="Cursor Reference Edit" parent="foruilo-RefEdit"
                         icon-name="widget-gtk-textentry"/>
 
-    <glade-widget-class title="Text View" name="sclo-ScEditWindow"
-                        generic-name="Text View" parent="GtkTextView"
-                        icon-name="widget-gtk-textentry"/>
-
     <glade-widget-class title="Open Document ListBox" name="dbulo-OpenDocumentListBox"
                         generic-name="Open Document ListBox" parent="GtkComboBox"
                         icon-name="widget-gtk-combobox"/>
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index e8bbb2129912..a003d6b4bace 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -38,6 +38,7 @@ public:
     virtual tools::Rectangle GetFocusRect() { return tools::Rectangle(); }
     virtual FactoryFunction GetUITestFactory() const { return nullptr; }
     virtual OUString RequestHelp(tools::Rectangle&) { return OUString(); }
+    virtual OUString GetHelpText() const { return m_pDrawingArea->get_tooltip_text(); }
     Size const& GetOutputSizePixel() const { return m_aSize; }
     void SetOutputSizePixel(const Size& rSize) { m_aSize = rSize; }
     virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) { m_pDrawingArea = pDrawingArea; }
@@ -124,6 +125,8 @@ public:
     void set_sensitive(bool bSensitive) { m_xDrawingArea->set_sensitive(bSensitive); }
     bool get_sensitive() const { return m_xDrawingArea->get_sensitive(); }
     bool get_visible() const { return m_xDrawingArea->get_visible(); }
+    void set_grid_left_attach(int nAttach) { m_xDrawingArea->set_grid_left_attach(nAttach); }
+    int get_grid_left_attach() const { return m_xDrawingArea->get_grid_left_attach(); }
 };
 }
 #endif
diff --git a/sc/source/ui/inc/AccessibleContextBase.hxx b/sc/source/ui/inc/AccessibleContextBase.hxx
index d8e7353f123b..8451169a8f70 100644
--- a/sc/source/ui/inc/AccessibleContextBase.hxx
+++ b/sc/source/ui/inc/AccessibleContextBase.hxx
@@ -241,6 +241,12 @@ public:
     void
         CommitChange(const css::accessibility::AccessibleEventObject& rEvent) const;
 
+    /// Use this method to set initial Name without notification
+    void SetName(const OUString& rName) { msName = rName; }
+
+    /// Use this method to set initial Description without notification
+    void SetDescription(const OUString& rDesc) { msDescription = rDesc; }
+
 protected:
     /// Calls all FocusListener to tell they that the focus is gained.
     void CommitFocusGained() const;
@@ -253,11 +259,6 @@ protected:
     /// @throws css::lang::DisposedException
     void IsObjectValid() const;
 
-    /// Use this method to set initial Name without notification
-    void SetName(const OUString& rName) { msName = rName; }
-    /// Use this method to set initial Description without notification
-    void SetDescription(const OUString& rDesc) { msDescription = rDesc; }
-
     /// Reference to the parent object.
     css::uno::Reference<css::accessibility::XAccessible> mxParent;
 
diff --git a/sc/source/ui/inc/scuitphfedit.hxx b/sc/source/ui/inc/scuitphfedit.hxx
index 541ff19b76ee..d377a12d0cba 100644
--- a/sc/source/ui/inc/scuitphfedit.hxx
+++ b/sc/source/ui/inc/scuitphfedit.hxx
@@ -21,8 +21,8 @@
 #define INCLUDED_SC_SOURCE_UI_INC_SCUITPHFEDIT_HXX
 
 #include "tphfedit.hxx"
-#include <sfx2/tabdlg.hxx>
-#include <vcl/menubtn.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
 
 enum ScHFEntryId
 {
@@ -54,40 +54,48 @@ public:
     void            ClearTextAreas();
 
 protected:
-                ScHFEditPage( vcl::Window*           pParent,
+                ScHFEditPage( TabPageParent pParent,
                               const SfxItemSet& rCoreSet,
                               sal_uInt16        nWhich,
                               bool              bHeader );
     virtual     ~ScHFEditPage() override;
-    virtual void dispose() override;
 
 private:
-    VclPtr<ScEditWindow>    m_pWndLeft;
-    VclPtr<ScEditWindow>    m_pWndCenter;
-    VclPtr<ScEditWindow>    m_pWndRight;
-    VclPtr<FixedText>       m_pFtDefinedHF;
-    VclPtr<ListBox>         m_pLbDefined;
-    VclPtr<FixedText>       m_pFtCustomHF;
-    VclPtr<PushButton>      m_pBtnText;
-    VclPtr<MenuButton>      m_pBtnFile;
-    VclPtr<PushButton>      m_pBtnTable;
-    VclPtr<PushButton>      m_pBtnPage;
-    VclPtr<PushButton>      m_pBtnLastPage;
-    VclPtr<PushButton>      m_pBtnDate;
-    VclPtr<PushButton>      m_pBtnTime;
-
-    VclPtr<FixedText>       m_pFtConfidential;
-    VclPtr<FixedText>       m_pFtPage;
-    VclPtr<FixedText>       m_pFtOfQuestion;
-    VclPtr<FixedText>       m_pFtOf;
-    VclPtr<FixedText>       m_pFtNone;
-    VclPtr<FixedText>       m_pFtCreatedBy;
-    VclPtr<FixedText>       m_pFtCustomized;
+    sal_uInt16 const       nWhich;
+    bool m_bDropDownActive;
+    sal_Int64 m_nTimeToggled;
+
+    std::unique_ptr<weld::Label> m_xFtDefinedHF;
+    std::unique_ptr<weld::ComboBox> m_xLbDefined;
+    std::unique_ptr<weld::Label> m_xFtCustomHF;
+    std::unique_ptr<weld::Button> m_xBtnText;
+    std::unique_ptr<weld::MenuButton> m_xBtnFile;
+    std::unique_ptr<weld::Button> m_xBtnTable;
+    std::unique_ptr<weld::Button> m_xBtnPage;
+    std::unique_ptr<weld::Button> m_xBtnLastPage;
+    std::unique_ptr<weld::Button> m_xBtnDate;
+    std::unique_ptr<weld::Button> m_xBtnTime;
+
+    std::unique_ptr<weld::Label> m_xFtConfidential;
+    std::unique_ptr<weld::Label> m_xFtPage;
+    std::unique_ptr<weld::Label> m_xFtOfQuestion;
+    std::unique_ptr<weld::Label> m_xFtOf;
+    std::unique_ptr<weld::Label> m_xFtNone;
+    std::unique_ptr<weld::Label> m_xFtCreatedBy;
+    std::unique_ptr<weld::Label> m_xFtCustomized;
+
+    std::unique_ptr<weld::Widget> m_xLeft;
+    std::unique_ptr<weld::Widget> m_xRight;
+
+    std::unique_ptr<ScEditWindow> m_xWndLeft;
+    std::unique_ptr<ScEditWindow> m_xWndCenter;
+    std::unique_ptr<ScEditWindow> m_xWndRight;
+    std::unique_ptr<weld::CustomWeld> m_xWndLeftWnd;
+    std::unique_ptr<weld::CustomWeld> m_xWndCenterWnd;
+    std::unique_ptr<weld::CustomWeld> m_xWndRightWnd;
 
     ScEditWindow * m_pEditFocus; ///one of m_pWndLeft, m_pWndCenter, m_pWndRight
 
-    sal_uInt16 const       nWhich;
-
     DECL_LINK( ObjectSelectHdl, ScEditWindow&, void );
 
 private:
@@ -99,9 +107,10 @@ private:
     bool IsPageEntry(EditEngine*pEngine, const EditTextObject* pTextObj);
     static bool IsDateEntry(const EditTextObject* pTextObj);
     static bool IsExtFileNameEntry(const EditTextObject* pTextObj);
-    DECL_LINK( ListHdl_Impl, ListBox&, void);
-    DECL_LINK( ClickHdl, Button*, void );
-    DECL_LINK( MenuHdl, MenuButton*, void );
+    DECL_LINK( ListHdl_Impl, weld::ComboBox&, void);
+    DECL_LINK( ListToggleHdl_Impl, weld::ComboBox&, void);
+    DECL_LINK( ClickHdl, weld::Button&, void );
+    DECL_LINK( MenuHdl, const OString&, void );
 };
 
 class ScRightHeaderEditPage : public ScHFEditPage
@@ -111,7 +120,7 @@ public:
     static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rCoreSet );
 
 private:
-    ScRightHeaderEditPage( vcl::Window* pParent, const SfxItemSet& rSet );
+    ScRightHeaderEditPage( TabPageParent pParent, const SfxItemSet& rSet );
 };
 
 class ScLeftHeaderEditPage : public ScHFEditPage
@@ -121,7 +130,7 @@ public:
     static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rCoreSet );
 
 private:
-    ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemSet& rSet );
+    ScLeftHeaderEditPage( TabPageParent pParent, const SfxItemSet& rSet );
 };
 
 class ScRightFooterEditPage : public ScHFEditPage
@@ -131,7 +140,7 @@ public:
     static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rCoreSet );
 
 private:
-    ScRightFooterEditPage( vcl::Window* pParent, const SfxItemSet& rSet );
+    ScRightFooterEditPage( TabPageParent pParent, const SfxItemSet& rSet );
 };
 
 class ScLeftFooterEditPage : public ScHFEditPage
@@ -141,7 +150,7 @@ public:
     static VclPtr<SfxTabPage>  Create( TabPageParent pParent, const SfxItemSet* rCoreSet );
 
 private:
-    ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemSet& rSet );
+    ScLeftFooterEditPage( TabPageParent pParent, const SfxItemSet& rSet );
 };
 
 #endif
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index f7036cf8a22f..790840e85bea 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -23,9 +23,9 @@
 #include <scdllapi.h>
 #include <cppuhelper/weakref.hxx>
 #include <tools/wintypes.hxx>
+#include <editeng/editview.hxx>
 #include <editeng/svxenum.hxx>
-#include <vcl/ctrl.hxx>
-#include <vcl/menu.hxx>
+#include <vcl/customweld.hxx>
 
 #include <functional>
 
@@ -46,16 +46,15 @@ enum ScEditWindowLocation
     Right
 };
 
-class SC_DLLPUBLIC ScEditWindow : public Control
+class SC_DLLPUBLIC ScEditWindow : public weld::CustomWidgetController
+                                , public EditViewCallbacks
 {
 public:
-            ScEditWindow( vcl::Window* pParent,  WinBits nBits , ScEditWindowLocation eLoc );
-            virtual ~ScEditWindow() override;
-    virtual void dispose() override;
+    ScEditWindow(ScEditWindowLocation eLoc, weld::Window* pParent);
+    virtual void SetDrawingArea(weld::DrawingArea* pArea) override;
+    virtual ~ScEditWindow() override;
 
-    using Control::SetFont;
     void            SetFont( const ScPatternAttr& rPattern );
-    using Control::SetText;
     void            SetText( const EditTextObject& rTextObject );
     std::unique_ptr<EditTextObject> CreateTextObject();
     void            SetCharAttributes();
@@ -73,20 +72,37 @@ public:
     void SetLocation(ScEditWindowLocation eLoc) { eLocation = eLoc; }
 protected:
     virtual void    Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
-    virtual void    MouseMove( const MouseEvent& rMEvt ) override;
-    virtual void    MouseButtonDown( const MouseEvent& rMEvt ) override;
-    virtual void    MouseButtonUp( const MouseEvent& rMEvt ) override;
-    virtual void    KeyInput( const KeyEvent& rKEvt ) override;
-    virtual void    Command( const CommandEvent& rCEvt ) override;
+    virtual bool    MouseMove( const MouseEvent& rMEvt ) override;
+    virtual bool    MouseButtonDown( const MouseEvent& rMEvt ) override;
+    virtual bool    MouseButtonUp( const MouseEvent& rMEvt ) override;
+    virtual bool    KeyInput( const KeyEvent& rKEvt ) override;
     virtual void    GetFocus() override;
     virtual void    LoseFocus() override;
     virtual void    Resize() override;
 
+    virtual void EditViewInvalidate(const tools::Rectangle& rRect) const override
+    {
+        weld::DrawingArea* pDrawingArea = GetDrawingArea();
+        pDrawingArea->queue_draw_area(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight());
+    }
+
+    virtual void EditViewSelectionChange() const override
+    {
+        weld::DrawingArea* pDrawingArea = GetDrawingArea();
+        pDrawingArea->queue_draw();
+    }
+
+    virtual OutputDevice& EditViewOutputDevice() const override
+    {
+        return GetDrawingArea()->get_ref_device();
+    }
+
 private:
     std::unique_ptr<ScHeaderEditEngine> pEdEngine;
     std::unique_ptr<EditView>           pEdView;
     ScEditWindowLocation eLocation;
     bool mbRTL;
+    weld::Window* mpDialog;
 
     css::uno::WeakReference< css::accessibility::XAccessible > xAcc;
     ScAccessibleEditObject* pAcc;
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx
index 0eeeeb0d748e..d49f37f8c962 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -24,6 +24,7 @@
 
 #include <editeng/editobj.hxx>
 #include <editeng/flditem.hxx>
+#include <osl/time.h>
 #include <sfx2/tabdlg.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/lstbox.hxx>
@@ -41,108 +42,92 @@
 
 // class ScHFEditPage
 
-ScHFEditPage::ScHFEditPage( vcl::Window*             pParent,
-                            const SfxItemSet&   rCoreAttrs,
-                            sal_uInt16          nWhichId,
-                            bool                bHeader  )
-    : SfxTabPage( pParent, "HeaderFooterContent", "modules/scalc/ui/headerfootercontent.ui", &rCoreAttrs )
-    , m_pEditFocus(nullptr)
+ScHFEditPage::ScHFEditPage(TabPageParent pParent,
+                           const SfxItemSet& rCoreAttrs,
+                           sal_uInt16 nWhichId,
+                           bool bHeader)
+    : SfxTabPage(pParent, "modules/scalc/ui/headerfootercontent.ui", "HeaderFooterContent", &rCoreAttrs)
     , nWhich( nWhichId )
+    , m_bDropDownActive(false)
+    , m_nTimeToggled(-1)
+    , m_xFtDefinedHF(m_xBuilder->weld_label(!bHeader ? "labelFT_F_DEFINED" : "labelFT_H_DEFINED"))
+    , m_xLbDefined(m_xBuilder->weld_combo_box("comboLB_DEFINED"))
+    , m_xFtCustomHF(m_xBuilder->weld_label(!bHeader ? "labelFT_F_CUSTOM" : "labelFT_H_CUSTOM"))
+    , m_xBtnText(m_xBuilder->weld_button("buttonBTN_TEXT"))
+    , m_xBtnFile(m_xBuilder->weld_menu_button("buttonBTN_FILE"))
+    , m_xBtnTable(m_xBuilder->weld_button("buttonBTN_TABLE"))
+    , m_xBtnPage(m_xBuilder->weld_button("buttonBTN_PAGE"))
+    , m_xBtnLastPage(m_xBuilder->weld_button("buttonBTN_PAGES"))
+    , m_xBtnDate(m_xBuilder->weld_button("buttonBTN_DATE"))
+    , m_xBtnTime(m_xBuilder->weld_button("buttonBTN_TIME"))
+    , m_xFtConfidential(m_xBuilder->weld_label("labelSTR_HF_CONFIDENTIAL"))
+    , m_xFtPage(m_xBuilder->weld_label("labelSTR_PAGE"))
+    , m_xFtOfQuestion(m_xBuilder->weld_label("labelSTR_HF_OF_QUESTION"))
+    , m_xFtOf(m_xBuilder->weld_label("labelSTR_HF_OF"))
+    , m_xFtNone(m_xBuilder->weld_label("labelSTR_HF_NONE_IN_BRACKETS"))
+    , m_xFtCreatedBy(m_xBuilder->weld_label("labelSTR_HF_CREATED_BY"))
+    , m_xFtCustomized(m_xBuilder->weld_label("labelSTR_HF_CUSTOMIZED"))
+    , m_xLeft(m_xBuilder->weld_widget("labelFT_LEFT"))
+    , m_xRight(m_xBuilder->weld_widget("labelFT_RIGHT"))
+    , m_xWndLeft(new ScEditWindow(Left, pParent.GetFrameWeld()))
+    , m_xWndCenter(new ScEditWindow(Center, pParent.GetFrameWeld()))
+    , m_xWndRight(new ScEditWindow(Right, pParent.GetFrameWeld()))
+    , m_xWndLeftWnd(new weld::CustomWeld(*m_xBuilder, "textviewWND_LEFT", *m_xWndLeft))
+    , m_xWndCenterWnd(new weld::CustomWeld(*m_xBuilder, "textviewWND_CENTER", *m_xWndCenter))
+    , m_xWndRightWnd(new weld::CustomWeld(*m_xBuilder, "textviewWND_RIGHT", *m_xWndRight))
+    , m_pEditFocus(nullptr)
 {
-    get(m_pWndLeft,"textviewWND_LEFT");
-    m_pWndLeft->SetLocation(Left);
-    get(m_pWndCenter,"textviewWND_CENTER");
-    m_pWndCenter->SetLocation(Center);
-    get(m_pWndRight,"textviewWND_RIGHT");
-    m_pWndRight->SetLocation(Right);
-
-    get(m_pLbDefined,"comboLB_DEFINED");
     // tdf#114695 override natural size with a small value
     // we expect this to get stretched to some larger but
     // limited size based on surrounding widgets
-    m_pLbDefined->set_width_request(m_pLbDefined->approximate_digit_width() * 20);
-
-    get(m_pBtnText,"buttonBTN_TEXT");
-    get(m_pBtnTable,"buttonBTN_TABLE");
-    get(m_pBtnPage,"buttonBTN_PAGE");
-    get(m_pBtnLastPage,"buttonBTN_PAGES");
-    get(m_pBtnDate,"buttonBTN_DATE");
-    get(m_pBtnTime,"buttonBTN_TIME");
-
-    get(m_pBtnFile,"buttonBTN_FILE");
-
-    get(m_pFtConfidential,"labelSTR_HF_CONFIDENTIAL");
-    get(m_pFtPage,"labelSTR_PAGE");
-    get(m_pFtOfQuestion,"labelSTR_HF_OF_QUESTION");
-    get(m_pFtOf,"labelSTR_HF_OF");
-    get(m_pFtNone,"labelSTR_HF_NONE_IN_BRACKETS");
-    get(m_pFtCreatedBy,"labelSTR_HF_CREATED_BY");
-    get(m_pFtCustomized,"labelSTR_HF_CUSTOMIZED");
+    m_xLbDefined->set_size_request(m_xLbDefined->get_approximate_digit_width() * 20, -1);
 
     //! use default style from current document?
     //! if font color is used, header/footer background color must be set
 
-    ScPatternAttr   aPatAttr( rCoreAttrs.GetPool() );
-
-    m_pBtnFile->SetPopupMenu(get_menu("popup"));
+    ScPatternAttr aPatAttr( rCoreAttrs.GetPool() );
 
-    m_pLbDefined->SetSelectHdl( LINK( this, ScHFEditPage, ListHdl_Impl ) );
-    m_pBtnFile->SetSelectHdl( LINK( this, ScHFEditPage, MenuHdl ) );
-    m_pBtnText->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
-    m_pBtnPage->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
-    m_pBtnLastPage->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
-    m_pBtnDate->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
-    m_pBtnTime->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
-    m_pBtnFile->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
-    m_pBtnTable->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xLbDefined->connect_popup_toggled( LINK( this, ScHFEditPage, ListToggleHdl_Impl) );
+    m_xLbDefined->connect_changed( LINK( this, ScHFEditPage, ListHdl_Impl ) );
+    m_xBtnFile->connect_selected( LINK( this, ScHFEditPage, MenuHdl ) );
+    m_xBtnText->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xBtnPage->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xBtnLastPage->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xBtnDate->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xBtnTime->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xBtnFile->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
+    m_xBtnTable->connect_clicked( LINK( this, ScHFEditPage, ClickHdl ) );
 
-    get(m_pFtDefinedHF,!bHeader ? "labelFT_F_DEFINED" : "labelFT_H_DEFINED");
-    get(m_pFtCustomHF, !bHeader ? "labelFT_F_CUSTOM" : "labelFT_H_CUSTOM");
-
-    m_pFtDefinedHF->Show();
-    m_pFtCustomHF->Show();
+    m_xFtDefinedHF->show();
+    m_xFtCustomHF->show();
 
     //swap left/right areas and their labels in RTL mode
     if( AllSettings::GetLayoutRTL() )
     {
-        vcl::Window *pLeft = get<vcl::Window>("labelFT_LEFT");
-        vcl::Window *pRight = get<vcl::Window>("labelFT_RIGHT");
-        sal_Int32 nOldLeftAttach = pLeft->get_grid_left_attach();
-        sal_Int32 nOldRightAttach = pRight->get_grid_left_attach();
-        pLeft->set_grid_left_attach(nOldRightAttach);
-        pRight->set_grid_left_attach(nOldLeftAttach);
-
-        pLeft = m_pWndLeft;
-        pRight = m_pWndRight;
-        nOldLeftAttach = pLeft->get_grid_left_attach();
-        nOldRightAttach = pRight->get_grid_left_attach();
-        pLeft->set_grid_left_attach(nOldRightAttach);
-        pRight->set_grid_left_attach(nOldLeftAttach);
-    }
-    m_pWndLeft->SetFont( aPatAttr );
-    m_pWndCenter->SetFont( aPatAttr );
-    m_pWndRight->SetFont( aPatAttr );
-
-    // Set size request for all 3 widgets
-    Size aSize = LogicToPixel(Size(80, 120), MapMode(MapUnit::MapAppFont));
-    VclPtr<ScEditWindow> aEditWindows[] = {m_pWndLeft, m_pWndCenter, m_pWndRight};
-
-    for (auto &pEditWindow : aEditWindows)
-    {
-        pEditWindow->set_width_request(aSize.Width());
-        pEditWindow->set_height_request(aSize.Height());
+        sal_Int32 nOldLeftAttach = m_xLeft->get_grid_left_attach();
+        sal_Int32 nOldRightAttach = m_xRight->get_grid_left_attach();
+        m_xLeft->set_grid_left_attach(nOldRightAttach);
+        m_xRight->set_grid_left_attach(nOldLeftAttach);
+
+        nOldLeftAttach = m_xWndLeftWnd->get_grid_left_attach();
+        nOldRightAttach = m_xWndRightWnd->get_grid_left_attach();
+        m_xWndLeftWnd->set_grid_left_attach(nOldRightAttach);
+        m_xWndRightWnd->set_grid_left_attach(nOldLeftAttach);
     }
+    m_xWndLeft->SetFont( aPatAttr );
+    m_xWndCenter->SetFont( aPatAttr );
+    m_xWndRight->SetFont( aPatAttr );
 
-    m_pWndLeft->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
-    m_pWndCenter->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
-    m_pWndRight->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+    m_xWndLeft->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+    m_xWndCenter->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+    m_xWndRight->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
     auto setEditFocus = [this](ScEditWindow & rEdit) { this->m_pEditFocus = &rEdit; };
-    m_pWndLeft->SetGetFocusHdl(setEditFocus);
-    m_pWndCenter->SetGetFocusHdl(setEditFocus);
-    m_pWndRight->SetGetFocusHdl(setEditFocus);
+    m_xWndLeft->SetGetFocusHdl(setEditFocus);
+    m_xWndCenter->SetGetFocusHdl(setEditFocus);
+    m_xWndRight->SetGetFocusHdl(setEditFocus);
 
-    m_pWndLeft->GrabFocus();
-    m_pEditFocus = m_pWndLeft; // there's no event from GrabFocus()
+    m_xWndLeft->GrabFocus();
+    m_pEditFocus = m_xWndLeft.get(); // there's no event from grab_focus()
 
     InitPreDefinedList();
 
@@ -150,7 +135,7 @@ ScHFEditPage::ScHFEditPage( vcl::Window*             pParent,
 
 IMPL_LINK_NOARG( ScHFEditPage, ObjectSelectHdl, ScEditWindow&, void )
 {
-    m_pBtnText->GrabFocus();
+    m_xBtnText->grab_focus();
 }
 
 ScHFEditPage::~ScHFEditPage()
@@ -158,36 +143,11 @@ ScHFEditPage::~ScHFEditPage()
     disposeOnce();
 }
 
-void ScHFEditPage::dispose()
-{
-    m_pWndLeft.clear();
-    m_pWndCenter.clear();
-    m_pWndRight.clear();
-    m_pFtDefinedHF.clear();
-    m_pLbDefined.clear();
-    m_pFtCustomHF.clear();
-    m_pBtnText.clear();
-    m_pBtnFile.clear();
-    m_pBtnTable.clear();
-    m_pBtnPage.clear();
-    m_pBtnLastPage.clear();
-    m_pBtnDate.clear();
-    m_pBtnTime.clear();
-    m_pFtConfidential.clear();
-    m_pFtPage.clear();
-    m_pFtOfQuestion.clear();
-    m_pFtOf.clear();
-    m_pFtNone.clear();
-    m_pFtCreatedBy.clear();
-    m_pFtCustomized.clear();
-    SfxTabPage::dispose();
-}
-
 void ScHFEditPage::SetNumType(SvxNumType eNumType)
 {
-    m_pWndLeft->SetNumType(eNumType);
-    m_pWndCenter->SetNumType(eNumType);
-    m_pWndRight->SetNumType(eNumType);
+    m_xWndLeft->SetNumType(eNumType);
+    m_xWndCenter->SetNumType(eNumType);
+    m_xWndRight->SetNumType(eNumType);
 }
 
 void ScHFEditPage::Reset( const SfxItemSet* rCoreSet )
@@ -198,11 +158,11 @@ void ScHFEditPage::Reset( const SfxItemSet* rCoreSet )
         const ScPageHFItem& rItem = static_cast<const ScPageHFItem&>(*pItem);
 
         if( const EditTextObject* pLeft = rItem.GetLeftArea() )
-            m_pWndLeft->SetText( *pLeft );
+            m_xWndLeft->SetText( *pLeft );
         if( const EditTextObject* pCenter = rItem.GetCenterArea() )
-            m_pWndCenter->SetText( *pCenter );
+            m_xWndCenter->SetText( *pCenter );
         if( const EditTextObject* pRight = rItem.GetRightArea() )
-            m_pWndRight->SetText( *pRight );
+            m_xWndRight->SetText( *pRight );
 
         SetSelectDefinedList();
     }
@@ -211,9 +171,9 @@ void ScHFEditPage::Reset( const SfxItemSet* rCoreSet )
 bool ScHFEditPage::FillItemSet( SfxItemSet* rCoreSet )
 {
     ScPageHFItem    aItem( nWhich );
-    std::unique_ptr<EditTextObject> pLeft   = m_pWndLeft->CreateTextObject();
-    std::unique_ptr<EditTextObject> pCenter = m_pWndCenter->CreateTextObject();
-    std::unique_ptr<EditTextObject> pRight  = m_pWndRight->CreateTextObject();
+    std::unique_ptr<EditTextObject> pLeft   = m_xWndLeft->CreateTextObject();
+    std::unique_ptr<EditTextObject> pCenter = m_xWndCenter->CreateTextObject();
+    std::unique_ptr<EditTextObject> pRight  = m_xWndRight->CreateTextObject();
 
     aItem.SetLeftArea  ( *pLeft );
     aItem.SetCenterArea( *pCenter );
@@ -232,64 +192,64 @@ void ScHFEditPage::InitPreDefinedList()
     boost::optional<Color> pFldColour;
 
     // Get the all field values at the outset.
-    OUString aPageFieldValue(m_pWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
-    OUString aSheetFieldValue(m_pWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
-    OUString aFileFieldValue(m_pWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
-    OUString aExtFileFieldValue(m_pWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxExtFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
-    OUString aDateFieldValue(m_pWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxDateField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
+    OUString aPageFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
+    OUString aSheetFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
+    OUString aFileFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
+    OUString aExtFileFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxExtFileField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
+    OUString aDateFieldValue(m_xWndLeft->GetEditEngine()->CalcFieldValue(SvxFieldItem(SvxDateField(), EE_FEATURE_FIELD), 0,0, pTxtColour, pFldColour));
 
-    m_pLbDefined->Clear();
+    m_xLbDefined->clear();
 
-    m_pLbDefined->InsertEntry(m_pFtNone->GetText());
+    m_xLbDefined->append_text(m_xFtNone->get_label());
 
-    OUString aPageEntry(m_pFtPage->GetText() + " " + aPageFieldValue);
-    m_pLbDefined->InsertEntry(aPageEntry);
+    OUString aPageEntry(m_xFtPage->get_label() + " " + aPageFieldValue);
+    m_xLbDefined->append_text(aPageEntry);
 
-    OUString aPageOfEntry(aPageEntry + " " + m_pFtOfQuestion->GetText());
-    m_pLbDefined->InsertEntry( aPageOfEntry);
+    OUString aPageOfEntry(aPageEntry + " " + m_xFtOfQuestion->get_label());
+    m_xLbDefined->append_text( aPageOfEntry);
 
-    m_pLbDefined->InsertEntry(aSheetFieldValue);
+    m_xLbDefined->append_text(aSheetFieldValue);
 
-    OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_pFtConfidential->GetText() + ", " + aDateFieldValue + ", " + aPageEntry);
-    m_pLbDefined->InsertEntry( aConfidentialEntry);
+    OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_xFtConfidential->get_label() + ", " + aDateFieldValue + ", " + aPageEntry);
+    m_xLbDefined->append_text( aConfidentialEntry);
 
     OUString aFileNamePageEntry(aFileFieldValue + ", " + aPageEntry);
-    m_pLbDefined->InsertEntry( aFileNamePageEntry);
+    m_xLbDefined->append_text( aFileNamePageEntry);
 
-    m_pLbDefined->InsertEntry( aExtFileFieldValue);
+    m_xLbDefined->append_text( aExtFileFieldValue);
 
     OUString aPageSheetNameEntry(aPageEntry + ", " + aSheetFieldValue);
-    m_pLbDefined->InsertEntry( aPageSheetNameEntry);
+    m_xLbDefined->append_text( aPageSheetNameEntry);
 
     OUString aPageFileNameEntry(aPageEntry + ", " + aFileFieldValue);
-    m_pLbDefined->InsertEntry( aPageFileNameEntry);
+    m_xLbDefined->append_text( aPageFileNameEntry);
 
     OUString aPagePathNameEntry(aPageEntry + ", " + aExtFileFieldValue);
-    m_pLbDefined->InsertEntry( aPagePathNameEntry);
+    m_xLbDefined->append_text( aPagePathNameEntry);
 
     OUString aUserNameEntry(aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName() + ", " + aPageEntry + ", " + aDateFieldValue);
-    m_pLbDefined->InsertEntry( aUserNameEntry);
+    m_xLbDefined->append_text( aUserNameEntry);
 
-    OUString aCreatedByEntry( m_pFtCreatedBy->GetText() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName() + ", ");
+    OUString aCreatedByEntry( m_xFtCreatedBy->get_label() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName() + ", ");
     aCreatedByEntry += aDateFieldValue + ", " + aPageEntry;
-    m_pLbDefined->InsertEntry( aCreatedByEntry);
+    m_xLbDefined->append_text( aCreatedByEntry);
 }
 
 void ScHFEditPage::InsertToDefinedList()
 {
-    const sal_Int32 nCount =  m_pLbDefined->GetEntryCount();
+    const sal_Int32 nCount =  m_xLbDefined->get_count();
     if(nCount == eEntryCount)
     {
-        m_pLbDefined->InsertEntry( m_pFtCustomized->GetText() );
-        m_pLbDefined->SelectEntryPos(eEntryCount);
+        m_xLbDefined->append_text( m_xFtCustomized->get_label() );
+        m_xLbDefined->set_active(eEntryCount);
     }
 }
 
 void ScHFEditPage::RemoveFromDefinedList()
 {
-    const sal_Int32 nCount =  m_pLbDefined->GetEntryCount();
+    const sal_Int32 nCount =  m_xLbDefined->get_count();
     if(nCount > eEntryCount )
-        m_pLbDefined->RemoveEntry( nCount-1);
+        m_xLbDefined->remove( nCount-1);
 }
 
 // determine if the header/footer exists in our predefined list and set select to it.
@@ -308,13 +268,13 @@ void ScHFEditPage::SetSelectDefinedList()
     OUString aCenterEntry;
     OUString aRightEntry;
 
-    pLeftObj = m_pWndLeft->GetEditEngine()->CreateTextObject();
-    pCenterObj = m_pWndCenter->GetEditEngine()->CreateTextObject();
-    pRightObj = m_pWndRight->GetEditEngine()->CreateTextObject();
+    pLeftObj = m_xWndLeft->GetEditEngine()->CreateTextObject();
+    pCenterObj = m_xWndCenter->GetEditEngine()->CreateTextObject();
+    pRightObj = m_xWndRight->GetEditEngine()->CreateTextObject();
 
     bool bFound = false;
 
-    const sal_Int32 nCount = m_pLbDefined->GetEntryCount();
+    const sal_Int32 nCount = m_xLbDefined->get_count();
     for(sal_Int32 i = 0; i < nCount && !bFound; ++i)
     {
         switch(static_cast<ScHFEntryId>(i))
@@ -339,7 +299,7 @@ void ScHFEditPage::SetSelectDefinedList()
                 aRightEntry = pRightObj->GetText(0);
                 if(aLeftEntry == EMPTY_OUSTRING && aRightEntry == EMPTY_OUSTRING)
                 {
-                    if(IsPageEntry(m_pWndCenter->GetEditEngine(), pCenterObj.get()))
+                    if(IsPageEntry(m_xWndCenter->GetEditEngine(), pCenterObj.get()))
                     {
                         eSelectEntry = ePageEntry;
                         bFound = true;
@@ -379,10 +339,10 @@ void ScHFEditPage::SetSelectDefinedList()
 
             case eConfidentialEntry:
             {
-                if(IsDateEntry(pCenterObj.get()) && IsPageEntry(m_pWndRight->GetEditEngine(), pRightObj.get()))
+                if(IsDateEntry(pCenterObj.get()) && IsPageEntry(m_xWndRight->GetEditEngine(), pRightObj.get()))
                 {
-                    OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_pFtConfidential->GetText());
-                    if(aConfidentialEntry == m_pWndLeft->GetEditEngine()->GetText(0))
+                    OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_xFtConfidential->get_label());
+                    if(aConfidentialEntry == m_xWndLeft->GetEditEngine()->GetText(0))
                     {
                         eSelectEntry = eConfidentialEntry;
                         bFound = true;
@@ -425,7 +385,7 @@ void ScHFEditPage::SetSelectDefinedList()
             case ePageExtFileNameEntry:
             {
                 aLeftEntry = pLeftObj->GetText(0);
-                if(IsPageEntry(m_pWndCenter->GetEditEngine(), pCenterObj.get()) &&
+                if(IsPageEntry(m_xWndCenter->GetEditEngine(), pCenterObj.get()) &&
                     IsExtFileNameEntry(pRightObj.get()) && aLeftEntry == EMPTY_OUSTRING)
                 {
                     eSelectEntry = ePageExtFileNameEntry;
@@ -436,11 +396,11 @@ void ScHFEditPage::SetSelectDefinedList()
 
             case eUserNameEntry:
             {
-                if(IsDateEntry(pRightObj.get()) && IsPageEntry(m_pWndCenter->GetEditEngine(), pCenterObj.get()))
+                if(IsDateEntry(pRightObj.get()) && IsPageEntry(m_xWndCenter->GetEditEngine(), pCenterObj.get()))
                 {
                     OUString aUserNameEntry(aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
 
-                    if(aUserNameEntry == m_pWndLeft->GetEditEngine()->GetText(0))
+                    if(aUserNameEntry == m_xWndLeft->GetEditEngine()->GetText(0))
                     {
                         eSelectEntry = eUserNameEntry;
                         bFound = true;
@@ -451,11 +411,11 @@ void ScHFEditPage::SetSelectDefinedList()
 
             case eCreatedByEntry:
             {
-                if(IsDateEntry(pCenterObj.get()) && IsPageEntry(m_pWndRight->GetEditEngine(), pRightObj.get()))
+                if(IsDateEntry(pCenterObj.get()) && IsPageEntry(m_xWndRight->GetEditEngine(), pRightObj.get()))
                 {
-                    OUString aCreatedByEntry(m_pFtCreatedBy->GetText() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
+                    OUString aCreatedByEntry(m_xFtCreatedBy->get_label() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
 
-                    if(aCreatedByEntry == m_pWndLeft->GetEditEngine()->GetText(0))
+                    if(aCreatedByEntry == m_xWndLeft->GetEditEngine()->GetText(0))
                     {
                         eSelectEntry = eCreatedByEntry;
                         bFound = true;
@@ -474,7 +434,7 @@ void ScHFEditPage::SetSelectDefinedList()
     if(eSelectEntry == eEntryCount)
         InsertToDefinedList();
 
-    m_pLbDefined->SelectEntryPos( sal::static_int_cast<sal_uInt16>( eSelectEntry ) );
+    m_xLbDefined->set_active( sal::static_int_cast<sal_uInt16>( eSelectEntry ) );
 }
 
 bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, const EditTextObject* pTextObj)
@@ -490,7 +450,7 @@ bool ScHFEditPage::IsPageEntry(EditEngine*pEngine, const EditTextObject* pTextOb
         pEngine->GetPortions(0,aPosList);
         if(aPosList.size() == 2)
         {
-            OUString aPageEntry(m_pFtPage->GetText() + " ");
+            OUString aPageEntry(m_xFtPage->get_label() + " ");
             ESelection aSel(0,0,0,0);
             aSel.nEndPos = aPageEntry.getLength();
             if(aPageEntry == pEngine->GetText(aSel))
@@ -561,17 +521,17 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
         case eNoneEntry:
             ClearTextAreas();
             if(!bTravelling)
-                m_pWndLeft->GrabFocus();
+                m_xWndLeft->GrabFocus();
         break;
 
         case ePageEntry:
         {
             ClearTextAreas();
-            OUString aPageEntry( m_pFtPage->GetText() + " " );
-            m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
-            m_pWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
+            OUString aPageEntry( m_xFtPage->get_label() + " " );
+            m_xWndCenter->GetEditEngine()->SetText(aPageEntry);
+            m_xWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         }
         break;
 
@@ -579,42 +539,42 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
         {
             ClearTextAreas();
             ESelection aSel(0,0,0,0);
-            OUString aPageEntry( m_pFtPage->GetText() + " ");
-            m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
+            OUString aPageEntry( m_xFtPage->get_label() + " ");
+            m_xWndCenter->GetEditEngine()->SetText(aPageEntry);
             aSel.nEndPos = aPageEntry.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             ++aSel.nEndPos;
 
-            OUString aPageOfEntry(" " + m_pFtOf->GetText() + " ");
-            m_pWndCenter->GetEditEngine()->QuickInsertText(aPageOfEntry,ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            OUString aPageOfEntry(" " + m_xFtOf->get_label() + " ");
+            m_xWndCenter->GetEditEngine()->QuickInsertText(aPageOfEntry,ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             aSel.nEndPos = aSel.nEndPos + aPageOfEntry.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
-            pTextObj = m_pWndCenter->GetEditEngine()->CreateTextObject();
-            m_pWndCenter->SetText(*pTextObj);
+            m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject();
+            m_xWndCenter->SetText(*pTextObj);
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         }
         break;
 
         case eSheetEntry:
             ClearTextAreas();
-            m_pWndCenter->InsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD) );
+            m_xWndCenter->InsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD) );
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         break;
 
         case eConfidentialEntry:
         {
             ClearTextAreas();
-            OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_pFtConfidential->GetText());
-            m_pWndLeft->GetEditEngine()->SetText(aConfidentialEntry);
-            m_pWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
+            OUString aConfidentialEntry(aUserOpt.GetCompany() + " " + m_xFtConfidential->get_label());
+            m_xWndLeft->GetEditEngine()->SetText(aConfidentialEntry);
+            m_xWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
 
-            OUString aPageEntry( m_pFtPage->GetText() + " ");
-            m_pWndRight->GetEditEngine()->SetText(aPageEntry);
-            m_pWndRight->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
+            OUString aPageEntry( m_xFtPage->get_label() + " ");
+            m_xWndRight->GetEditEngine()->SetText(aPageEntry);
+            m_xWndRight->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
             if(!bTravelling)
-                m_pWndRight->GrabFocus();
+                m_xWndRight->GrabFocus();
         }
         break;
 
@@ -622,46 +582,46 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
         {
             ClearTextAreas();
             ESelection aSel(0,0,0,0);
-            m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD ), aSel );
+            m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD ), aSel );
             ++aSel.nEndPos;
-            OUString aPageEntry(", " + m_pFtPage->GetText() + " ");
-            m_pWndCenter->GetEditEngine()->QuickInsertText(aPageEntry, ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            OUString aPageEntry(", " + m_xFtPage->get_label() + " ");
+            m_xWndCenter->GetEditEngine()->QuickInsertText(aPageEntry, ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             aSel.nStartPos = aSel.nEndPos;
             aSel.nEndPos = aSel.nEndPos + aPageEntry.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
-            pTextObj = m_pWndCenter->GetEditEngine()->CreateTextObject();
-            m_pWndCenter->SetText(*pTextObj);
+            m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara,aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject();
+            m_xWndCenter->SetText(*pTextObj);
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         }
         break;
 
         case eExtFileNameEntry:
             ClearTextAreas();
-            m_pWndCenter->InsertField( SvxFieldItem( SvxExtFileField(
+            m_xWndCenter->InsertField( SvxFieldItem( SvxExtFileField(
                 EMPTY_OUSTRING, SvxFileType::Var, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         break;
 
         case ePageSheetEntry:
         {
             ClearTextAreas();
             ESelection aSel(0,0,0,0);
-            OUString aPageEntry( m_pFtPage->GetText() + " " );
-            m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
+            OUString aPageEntry( m_xFtPage->get_label() + " " );
+            m_xWndCenter->GetEditEngine()->SetText(aPageEntry);
             aSel.nEndPos = aPageEntry.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             ++aSel.nEndPos;
 
             OUString aCommaSpace(", ");
-            m_pWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            m_xWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             aSel.nEndPos = aSel.nEndPos + aCommaSpace.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
-            pTextObj = m_pWndCenter->GetEditEngine()->CreateTextObject();
-            m_pWndCenter->SetText(*pTextObj);
+            m_xWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject();
+            m_xWndCenter->SetText(*pTextObj);
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         }
         break;
 
@@ -669,32 +629,32 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
         {
             ClearTextAreas();
             ESelection aSel(0,0,0,0);
-            OUString aPageEntry( m_pFtPage->GetText() + " " );
-            m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
+            OUString aPageEntry( m_xFtPage->get_label() + " " );
+            m_xWndCenter->GetEditEngine()->SetText(aPageEntry);
             aSel.nEndPos = aPageEntry.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            m_xWndCenter->GetEditEngine()->QuickInsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             ++aSel.nEndPos;
             OUString aCommaSpace(", ");
-            m_pWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            m_xWndCenter->GetEditEngine()->QuickInsertText(aCommaSpace,ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
             aSel.nEndPos = aSel.nEndPos + aCommaSpace.getLength();
-            m_pWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
-            pTextObj = m_pWndCenter->GetEditEngine()->CreateTextObject();
-            m_pWndCenter->SetText(*pTextObj);
+            m_xWndCenter->GetEditEngine()->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(aSel.nEndPara, aSel.nEndPos, aSel.nEndPara, aSel.nEndPos));
+            pTextObj = m_xWndCenter->GetEditEngine()->CreateTextObject();
+            m_xWndCenter->SetText(*pTextObj);
             if(!bTravelling)
-                m_pWndCenter->GrabFocus();
+                m_xWndCenter->GrabFocus();
         }
         break;
 
         case ePageExtFileNameEntry:
         {
             ClearTextAreas();
-            OUString aPageEntry( m_pFtPage->GetText() + " " );
-            m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
-            m_pWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
-            m_pWndRight->InsertField( SvxFieldItem( SvxExtFileField(
+            OUString aPageEntry( m_xFtPage->get_label() + " " );
+            m_xWndCenter->GetEditEngine()->SetText(aPageEntry);
+            m_xWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
+            m_xWndRight->InsertField( SvxFieldItem( SvxExtFileField(
                 EMPTY_OUSTRING, SvxFileType::Var, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
             if(!bTravelling)
-                m_pWndRight->GrabFocus();
+                m_xWndRight->GrabFocus();
         }
         break;
 
@@ -702,29 +662,29 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
         {
             ClearTextAreas();
             OUString aUserNameEntry(aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
-            m_pWndLeft->GetEditEngine()->SetText(aUserNameEntry);
-            OUString aPageEntry( m_pFtPage->GetText() + " ");
+            m_xWndLeft->GetEditEngine()->SetText(aUserNameEntry);
+            OUString aPageEntry( m_xFtPage->get_label() + " ");
             //aPageEntry += " ";
-            m_pWndCenter->GetEditEngine()->SetText(aPageEntry);
-            m_pWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
-            m_pWndRight->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
+            m_xWndCenter->GetEditEngine()->SetText(aPageEntry);
+            m_xWndCenter->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
+            m_xWndRight->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
             if(!bTravelling)
-                m_pWndRight->GrabFocus();
+                m_xWndRight->GrabFocus();
         }
         break;
 
         case eCreatedByEntry:
         {
             ClearTextAreas();
-            OUString aCreatedByEntry( m_pFtCreatedBy->GetText() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
-            m_pWndLeft->GetEditEngine()->SetText(aCreatedByEntry);
-            m_pWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
-            OUString aPageEntry( m_pFtPage->GetText() );
+            OUString aCreatedByEntry( m_xFtCreatedBy->get_label() + " " + aUserOpt.GetFirstName() + " " + aUserOpt.GetLastName());
+            m_xWndLeft->GetEditEngine()->SetText(aCreatedByEntry);
+            m_xWndCenter->InsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SvxDateType::Var), EE_FEATURE_FIELD) );
+            OUString aPageEntry( m_xFtPage->get_label() );
             aPageEntry += " ";
-            m_pWndRight->GetEditEngine()->SetText(aPageEntry);
-            m_pWndRight->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
+            m_xWndRight->GetEditEngine()->SetText(aPageEntry);
+            m_xWndRight->InsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD) );
             if(!bTravelling)
-                m_pWndRight->GrabFocus();
+                m_xWndRight->GrabFocus();
         }
         break;
 
@@ -735,83 +695,92 @@ void ScHFEditPage::ProcessDefinedListSel(ScHFEntryId eSel, bool bTravelling)
 
 void ScHFEditPage::ClearTextAreas()
 {
-    m_pWndLeft->GetEditEngine()->SetText(EMPTY_OUSTRING);
-    m_pWndLeft->Invalidate();
-    m_pWndCenter->GetEditEngine()->SetText(EMPTY_OUSTRING);
-    m_pWndCenter->Invalidate();
-    m_pWndRight->GetEditEngine()->SetText(EMPTY_OUSTRING);
-    m_pWndRight->Invalidate();
+    m_xWndLeft->GetEditEngine()->SetText(EMPTY_OUSTRING);
+    m_xWndLeft->Invalidate();
+    m_xWndCenter->GetEditEngine()->SetText(EMPTY_OUSTRING);
+    m_xWndCenter->Invalidate();
+    m_xWndRight->GetEditEngine()->SetText(EMPTY_OUSTRING);
+    m_xWndRight->Invalidate();
 }
 
 // Handler:
-
-IMPL_LINK( ScHFEditPage, ListHdl_Impl, ListBox&, rList, void )
+IMPL_LINK_NOARG(ScHFEditPage, ListToggleHdl_Impl, weld::ComboBox&, void)
 {
-    if ( &rList == m_pLbDefined )
-    {
-        ScHFEntryId eSel = static_cast<ScHFEntryId>(m_pLbDefined->GetSelectedEntryPos());
-        if(!m_pLbDefined->IsTravelSelect())
-        {
-            ProcessDefinedListSel(eSel, false);
+    m_bDropDownActive = !m_bDropDownActive;
+    TimeValue aNow;
+    osl_getSystemTime(&aNow);
+    m_nTimeToggled = sal_Int64(aNow.Seconds) * 1000000000L + aNow.Nanosec;
+}
 
-            // check if we need to remove the customized entry.
-            if(eSel < eEntryCount)
-                RemoveFromDefinedList();
-        }
-        else
-        {
-            ProcessDefinedListSel(eSel, true);
-        }
-    }
+IMPL_LINK_NOARG(ScHFEditPage, ListHdl_Impl, weld::ComboBox&, void)
+{
+    ScHFEntryId eSel = static_cast<ScHFEntryId>(m_xLbDefined->get_active());
+
+    TimeValue aNow;
+    osl_getSystemTime(&aNow);
+    sal_Int64 nNow = sal_Int64(aNow.Seconds) * 1000000000L + aNow.Nanosec;
+
+    // order of dropdown vs select not guaranteed
+    bool bDiscrepency = m_xLbDefined->get_popup_shown() != m_bDropDownActive;
+    if (bDiscrepency)
+        ListToggleHdl_Impl(*m_xLbDefined);
+
+    bool bFocusToTarget = !m_xLbDefined->get_popup_shown() && m_nTimeToggled != -1 && (nNow - m_nTimeToggled < 800000000L);
+    ProcessDefinedListSel(eSel, !bFocusToTarget);
+    // check if we need to remove the customized entry.
+    if (!m_bDropDownActive && eSel < eEntryCount)
+        RemoveFromDefinedList();
+
+    // keep balanced
+    if (bDiscrepency)
+        ListToggleHdl_Impl(*m_xLbDefined);
 }
 
-IMPL_LINK( ScHFEditPage, ClickHdl, Button*, pBtn, void )
+IMPL_LINK( ScHFEditPage, ClickHdl, weld::Button&, rBtn, void )
 {
     if (!m_pEditFocus)
         return;
 
-    if ( pBtn == m_pBtnText )
+    if (&rBtn == m_xBtnText.get())
     {
         m_pEditFocus->SetCharAttributes();
     }
     else
     {
-        if ( pBtn == m_pBtnPage )
+        if ( &rBtn == m_xBtnPage.get() )
             m_pEditFocus->InsertField(SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD));
-        else if ( pBtn == m_pBtnLastPage )
+        else if ( &rBtn == m_xBtnLastPage.get() )
             m_pEditFocus->InsertField(SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD));
-        else if ( pBtn == m_pBtnDate )
+        else if ( &rBtn == m_xBtnDate.get() )
             m_pEditFocus->InsertField(SvxFieldItem(SvxDateField(Date(Date::SYSTEM),SvxDateType::Var), EE_FEATURE_FIELD));
-        else if ( pBtn == m_pBtnTime )
+        else if ( &rBtn == m_xBtnTime.get() )
             m_pEditFocus->InsertField(SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD));
-        else if ( pBtn == m_pBtnFile )
+        else if ( &rBtn == m_xBtnFile.get() )
         {
             m_pEditFocus->InsertField(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD));
         }
-        else if ( pBtn == m_pBtnTable )
+        else if ( &rBtn == m_xBtnTable.get() )
             m_pEditFocus->InsertField(SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD));
     }
     InsertToDefinedList();
     m_pEditFocus->GrabFocus();
 }
 
-IMPL_LINK(ScHFEditPage, MenuHdl, MenuButton*, pBtn, void)
+IMPL_LINK(ScHFEditPage, MenuHdl, const OString&, rSelectedId, void)
 {
     if (!m_pEditFocus)
         return;
 
-    OString sSelectedId = pBtn->GetCurItemIdent();
-
-    if (sSelectedId == "title")
+    if (rSelectedId == "title")
     {
         m_pEditFocus->InsertField(SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD));
     }
-    else if (sSelectedId == "filename")
+    else if (rSelectedId == "filename")
     {
         m_pEditFocus->InsertField( SvxFieldItem( SvxExtFileField(
             OUString(), SvxFileType::Var, SvxFileFormat::NameAndExt ), EE_FEATURE_FIELD ) );
     }
-    else if (sSelectedId == "pathname")
+    else if (rSelectedId == "pathname")
     {
         m_pEditFocus->InsertField( SvxFieldItem( SvxExtFileField(
             OUString(), SvxFileType::Var, SvxFileFormat::PathFull ), EE_FEATURE_FIELD ) );
@@ -820,7 +789,7 @@ IMPL_LINK(ScHFEditPage, MenuHdl, MenuButton*, pBtn, void)
 
 // class ScRightHeaderEditPage
 
-ScRightHeaderEditPage::ScRightHeaderEditPage( vcl::Window* pParent, const SfxItemSet& rCoreSet )
+ScRightHeaderEditPage::ScRightHeaderEditPage( TabPageParent pParent, const SfxItemSet& rCoreSet )
     : ScHFEditPage( pParent,
                     rCoreSet,
                     rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_HEADERRIGHT ),
@@ -829,12 +798,12 @@ ScRightHeaderEditPage::ScRightHeaderEditPage( vcl::Window* pParent, const SfxIte
 
 VclPtr<SfxTabPage> ScRightHeaderEditPage::Create( TabPageParent pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<ScRightHeaderEditPage>::Create( pParent.pParent, *rCoreSet );
+    return VclPtr<ScRightHeaderEditPage>::Create( pParent, *rCoreSet );
 }
 
 // class ScLeftHeaderEditPage
 
-ScLeftHeaderEditPage::ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemSet& rCoreSet )
+ScLeftHeaderEditPage::ScLeftHeaderEditPage( TabPageParent pParent, const SfxItemSet& rCoreSet )
     : ScHFEditPage( pParent,
                     rCoreSet,
                     rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_HEADERLEFT ),
@@ -843,12 +812,12 @@ ScLeftHeaderEditPage::ScLeftHeaderEditPage( vcl::Window* pParent, const SfxItemS
 
 VclPtr<SfxTabPage> ScLeftHeaderEditPage::Create( TabPageParent pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<ScLeftHeaderEditPage>::Create( pParent.pParent, *rCoreSet );
+    return VclPtr<ScLeftHeaderEditPage>::Create( pParent, *rCoreSet );
 }
 
 // class ScRightFooterEditPage
 
-ScRightFooterEditPage::ScRightFooterEditPage( vcl::Window* pParent, const SfxItemSet& rCoreSet )
+ScRightFooterEditPage::ScRightFooterEditPage( TabPageParent pParent, const SfxItemSet& rCoreSet )
     : ScHFEditPage( pParent,
                     rCoreSet,
                     rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_FOOTERRIGHT ),
@@ -857,12 +826,12 @@ ScRightFooterEditPage::ScRightFooterEditPage( vcl::Window* pParent, const SfxIte
 
 VclPtr<SfxTabPage> ScRightFooterEditPage::Create( TabPageParent pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<ScRightFooterEditPage>::Create( pParent.pParent, *rCoreSet );
+    return VclPtr<ScRightFooterEditPage>::Create( pParent, *rCoreSet );
 }
 
 // class ScLeftFooterEditPage
 
-ScLeftFooterEditPage::ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemSet& rCoreSet )
+ScLeftFooterEditPage::ScLeftFooterEditPage( TabPageParent pParent, const SfxItemSet& rCoreSet )
     : ScHFEditPage( pParent,
                     rCoreSet,
                     rCoreSet.GetPool()->GetWhich(SID_SCATTR_PAGE_FOOTERLEFT ),
@@ -871,7 +840,7 @@ ScLeftFooterEditPage::ScLeftFooterEditPage( vcl::Window* pParent, const SfxItemS
 
 VclPtr<SfxTabPage> ScLeftFooterEditPage::Create( TabPageParent pParent, const SfxItemSet* rCoreSet )
 {
-    return VclPtr<ScLeftFooterEditPage>::Create( pParent.pParent, *rCoreSet );
+    return VclPtr<ScLeftFooterEditPage>::Create( pParent, *rCoreSet );
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index 80a7073609fb..ca845a16d53d 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -59,26 +59,39 @@ static void lcl_GetFieldData( ScHeaderFieldData& rData )
 
 // class ScEditWindow
 
-ScEditWindow::ScEditWindow( vcl::Window* pParent, WinBits nBits, ScEditWindowLocation eLoc )
-    :   Control( pParent, nBits ),
-    eLocation(eLoc),
-    pAcc(nullptr)
+ScEditWindow::ScEditWindow(ScEditWindowLocation eLoc, weld::Window* pDialog)
+    : eLocation(eLoc)
+    , mbRTL(ScGlobal::IsSystemRTL())
+    , mpDialog(pDialog)
+    , pAcc(nullptr)
 {
+}
+
+void ScEditWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
+{
+    OutputDevice& rDevice = pDrawingArea->get_ref_device();
+
+    Size aSize = rDevice.LogicToPixel(Size(80, 120), MapMode(MapUnit::MapAppFont));
+    pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
+    SetOutputSizePixel(aSize);
+
+    weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
+
     EnableRTL(false);
 
     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     Color aBgColor = rStyleSettings.GetWindowColor();
 
-    SetMapMode(MapMode(MapUnit::MapTwip));
-    SetPointer( PointerStyle::Text );
-    SetBackground( aBgColor );
+    rDevice.SetMapMode(MapMode(MapUnit::MapTwip));
+    rDevice.SetBackground(aBgColor);
 
-    Size aSize( GetOutputSize() );
+    Size aOutputSize(rDevice.PixelToLogic(aSize));
+    aSize = aOutputSize;
     aSize.setHeight( aSize.Height() * 4 );
 
     pEdEngine.reset( new ScHeaderEditEngine( EditEngine::CreatePool() ) );
     pEdEngine->SetPaperSize( aSize );
-    pEdEngine->SetRefDevice( this );
+    pEdEngine->SetRefDevice( &rDevice );
 
     ScHeaderFieldData aData;
     lcl_GetFieldData( aData );
@@ -86,34 +99,35 @@ ScEditWindow::ScEditWindow( vcl::Window* pParent, WinBits nBits, ScEditWindowLoc
     // fields
     pEdEngine->SetData( aData );
     pEdEngine->SetControlWord( pEdEngine->GetControlWord() | EEControlBits::MARKFIELDS );
-    mbRTL = ScGlobal::IsSystemRTL();
     if (mbRTL)
         pEdEngine->SetDefaultHorizontalTextDirection(EEHorizontalTextDirection::R2L);
 
-    pEdView.reset( new EditView( pEdEngine.get(), this ) );
-    pEdView->SetOutputArea( tools::Rectangle( Point(0,0), GetOutputSize() ) );
+    pEdView.reset(new EditView(pEdEngine.get(), nullptr));
+    pEdView->setEditViewCallbacks(this);
+    pEdView->SetOutputArea(tools::Rectangle(Point(0,0), aOutputSize));
 
     pEdView->SetBackgroundColor( aBgColor );
     pEdEngine->InsertView( pEdView.get() );
+
+    pDrawingArea->set_text_cursor();
+
+    if (pAcc)
+        pAcc->SetDescription(pDrawingArea->get_tooltip_text());
 }
 
 void ScEditWindow::Resize()
 {
-    Size aOutputSize(GetOutputSize());
+    OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
+    Size aOutputSize(rDevice.PixelToLogic(GetOutputSizePixel()));
     Size aSize(aOutputSize);
     aSize.setHeight( aSize.Height() * 4 );
     pEdEngine->SetPaperSize(aSize);
     pEdView->SetOutputArea(tools::Rectangle(Point(0,0), aOutputSize));
-    Control::Resize();
+    weld::CustomWidgetController::Resize();
 }
 
 ScEditWindow::~ScEditWindow()
 {
-    disposeOnce();
-}
-
-void ScEditWindow::dispose()
-{
     // delete Accessible object before deleting EditEngine and EditView
     if (pAcc)
     {
@@ -123,12 +137,6 @@ void ScEditWindow::dispose()
     }
     pEdEngine.reset();
     pEdView.reset();
-    Control::dispose();
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void makeScEditWindow(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &)
-{
-    rRet = VclPtr<ScEditWindow>::Create(pParent, WB_BORDER|WB_TABSTOP, Left);
 }
 
 void ScEditWindow::SetNumType(SvxNumType eNumType)
@@ -196,9 +204,8 @@ void ScEditWindow::SetCharAttributes()
 
         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
 
-        vcl::Window* pWin = GetParent();
         ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScCharDlg(
-            pWin ? pWin->GetFrameWeld() : nullptr,  &aSet, pDocSh));
+            mpDialog,  &aSet, pDocSh));
         pDlg->SetText( ScResId( STR_TEXTATTRS ) );
         if ( pDlg->Execute() == RET_OK )
         {
@@ -213,62 +220,81 @@ void ScEditWindow::SetCharAttributes()
 
 void ScEditWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect )
 {
+    //note: ClassificationEditView::Paint is similar
+
+    rRenderContext.Push(PushFlags::ALL);
+    rRenderContext.SetClipRegion();
+
     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
     Color aBgColor = rStyleSettings.GetWindowColor();
 
     pEdView->SetBackgroundColor( aBgColor );
 
-    SetBackground( aBgColor );
-
-    Control::Paint(rRenderContext, rRect);
+    rRenderContext.SetBackground( aBgColor );
 
-    pEdView->Paint(rRect);
+    tools::Rectangle aLogicRect(rRenderContext.PixelToLogic(rRect));
+    pEdView->Paint(aLogicRect, &rRenderContext);
 
-    if( HasFocus() )
+    if (HasFocus())
+    {
         pEdView->ShowCursor();
+        vcl::Cursor* pCursor = pEdView->GetCursor();
+        pCursor->DrawToDevice(rRenderContext);
+    }
+
+    std::vector<tools::Rectangle> aLogicRects;
+
+    // get logic selection
+    pEdView->GetSelectionRectangles(aLogicRects);
+
+    rRenderContext.SetLineColor();
+    rRenderContext.SetFillColor(COL_BLACK);
+    rRenderContext.SetRasterOp(RasterOp::Invert);
+
+    for (const auto &rSelectionRect : aLogicRects)
+        rRenderContext.DrawRect(rSelectionRect);
+
+    rRenderContext.Pop();
 }
 
-void ScEditWindow::MouseMove( const MouseEvent& rMEvt )
+bool ScEditWindow::MouseMove( const MouseEvent& rMEvt )
 {
-    pEdView->MouseMove( rMEvt );
+    return pEdView->MouseMove( rMEvt );
 }
 
-void ScEditWindow::MouseButtonDown( const MouseEvent& rMEvt )
+bool ScEditWindow::MouseButtonDown( const MouseEvent& rMEvt )
 {
     if ( !HasFocus() )
         GrabFocus();
 
-    pEdView->MouseButtonDown( rMEvt );
+    return pEdView->MouseButtonDown( rMEvt );
 }
 
-void ScEditWindow::MouseButtonUp( const MouseEvent& rMEvt )
+bool ScEditWindow::MouseButtonUp( const MouseEvent& rMEvt )
 {
-    pEdView->MouseButtonUp( rMEvt );
+    return pEdView->MouseButtonUp( rMEvt );
 }
 
-void ScEditWindow::KeyInput( const KeyEvent& rKEvt )
+bool ScEditWindow::KeyInput( const KeyEvent& rKEvt )
 {
     sal_uInt16 nKey =  rKEvt.GetKeyCode().GetModifier()
                  + rKEvt.GetKeyCode().GetCode();
 
     if ( nKey == KEY_TAB || nKey == KEY_TAB + KEY_SHIFT )
     {
-        Control::KeyInput( rKEvt );
+        return false;
     }
     else if ( !pEdView->PostKeyEvent( rKEvt ) )
     {
-        Control::KeyInput( rKEvt );
+        return false;
     }
     else if ( !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsShift() &&
                 rKEvt.GetKeyCode().IsMod2() && rKEvt.GetKeyCode().GetCode() == KEY_DOWN )
     {
         aObjectSelectLink.Call(*this);
+        return true;
     }
-}
-
-void ScEditWindow::Command( const CommandEvent& rCEvt )
-{
-    pEdView->Command( rCEvt );
+    return false;
 }
 
 void ScEditWindow::GetFocus()
@@ -286,7 +312,7 @@ void ScEditWindow::GetFocus()
     else
         pAcc = nullptr;
 
-    Control::GetFocus();
+    weld::CustomWidgetController::GetFocus();
 }
 
 void ScEditWindow::LoseFocus()
@@ -298,13 +324,13 @@ void ScEditWindow::LoseFocus()
     }
     else
         pAcc = nullptr;
-    Control::LoseFocus();
+    weld::CustomWidgetController::LoseFocus();
+    Invalidate(); // redraw without cursor
 }
 
 css::uno::Reference< css::accessibility::XAccessible > ScEditWindow::CreateAccessible()
 {
     OUString sName;
-    OUString sDescription(GetHelpText());
     switch (eLocation)
     {
     case Left:
@@ -323,10 +349,13 @@ css::uno::Reference< css::accessibility::XAccessible > ScEditWindow::CreateAcces
         }
         break;
     }
+#if 0
+    //TODO
     pAcc = new ScAccessibleEditObject(GetAccessibleParentWindow()->GetAccessible(), pEdView.get(), this,
-        sName, sDescription, ScAccessibleEditObject::EditControl);
+        sName, OUString(), ScAccessibleEditObject::EditControl);
     css::uno::Reference< css::accessibility::XAccessible > xAccessible = pAcc;
     xAcc = xAccessible;
+#endif
     return pAcc;
 }
 
diff --git a/sc/uiconfig/scalc/ui/headerfootercontent.ui b/sc/uiconfig/scalc/ui/headerfootercontent.ui
index 7ef031f12b43..d39796409fb8 100644
--- a/sc/uiconfig/scalc/ui/headerfootercontent.ui
+++ b/sc/uiconfig/scalc/ui/headerfootercontent.ui
@@ -2,7 +2,6 @@
 <!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkImage" id="imageBTN_DATE">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -38,6 +37,34 @@
     <property name="can_focus">False</property>
     <property name="icon_name">sc/res/time.png</property>
   </object>
+  <object class="GtkMenu" id="popup">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="title">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="headerfootercontent|title">Title</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="filename">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="headerfootercontent|filename">File Name</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="pathname">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="headerfootercontent|pathname">Path/File Name</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
+  </object>
   <object class="GtkBox" id="HeaderFooterContent">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -94,11 +121,24 @@
           </packing>
         </child>
         <child>
-          <object class="sclo-ScEditWindow" id="textviewWND_LEFT">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="wrap_mode">word</property>
-            <property name="overwrite">True</property>
+            <property name="border_width">0</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkViewport">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkDrawingArea" id="textviewWND_LEFT">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -106,9 +146,24 @@
           </packing>
         </child>
         <child>
-          <object class="sclo-ScEditWindow" id="textviewWND_CENTER">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="border_width">0</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkViewport">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkDrawingArea" id="textviewWND_CENTER">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">1</property>
@@ -116,9 +171,24 @@
           </packing>
         </child>
         <child>
-          <object class="sclo-ScEditWindow" id="textviewWND_RIGHT">
+          <object class="GtkScrolledWindow">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="border_width">0</property>
+            <property name="shadow_type">in</property>
+            <child>
+              <object class="GtkViewport">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkDrawingArea" id="textviewWND_RIGHT">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">2</property>
@@ -247,6 +317,8 @@
                 <property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_FILE|tooltip_text">Title</property>
                 <property name="image">imageBTN_FILE</property>
                 <property name="draw_indicator">True</property>
+                <property name="popup">popup</property>
+                <property name="use_popover">False</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -487,32 +559,4 @@
       </packing>
     </child>
   </object>
-  <object class="GtkMenu" id="popup">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkMenuItem" id="title">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="headerfootercontent|title">Title</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="filename">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="headerfootercontent|filename">File Name</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="pathname">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes" context="headerfootercontent|pathname">Path/File Name</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-  </object>
 </interface>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 2b2974590ef7..4992863879e1 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -471,7 +471,6 @@ custom_widgets = [
     'ScCursorRefEdit',
     'ScDataTableView',
     'ScDoubleField',
-    'ScEditWindow',
     'ScPivotLayoutTreeList',
     'ScPivotLayoutTreeListData',
     'ScPivotLayoutTreeListLabel',
diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx
index e428f02172b6..70f4418e9b25 100644
--- a/svx/source/dialog/ClassificationEditView.cxx
+++ b/svx/source/dialog/ClassificationEditView.cxx
@@ -128,6 +128,8 @@ void ClassificationEditView::InvertSelectionWeight()
 
 void ClassificationEditView::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
 {
+    //note: ScEditWindow::Paint is similar
+
     rRenderContext.Push(PushFlags::ALL);
     rRenderContext.SetClipRegion();
 


More information about the Libreoffice-commits mailing list