extras/source/glade/libreoffice-catalog.xml.in |    4 -
 sc/source/ui/inc/scuitphfedit.hxx              |    4 -
 sc/source/ui/inc/tphfedit.hxx                  |   33 --------
 sc/source/ui/pagedlg/scuitphfedit.cxx          |    7 -
 sc/source/ui/pagedlg/tphfedit.cxx              |   93 -------------------------
 sc/uiconfig/scalc/ui/headerfootercontent.ui    |    7 -
 6 files changed, 8 insertions(+), 140 deletions(-)

New commits:
commit 7e86cfab8ee1f7fdcb42f37e2b0b7a5ab5d862c1
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Oct 3 20:30:11 2018 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Oct 4 09:56:26 2018 +0200

    replace sclo-ScExtIButton with MenuButton
    
    Change-Id: I1f03bebe465e76f7e62f707937b9289e17b76605
    Reviewed-on: https://gerrit.libreoffice.org/61328
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/extras/source/glade/libreoffice-catalog.xml.in 
b/extras/source/glade/libreoffice-catalog.xml.in
index b2174e4a59d0..b66e748fc24b 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -477,10 +477,6 @@
                         generic-name="IntellectualPropertyPartEdit" 
parent="GtkEntry"
                         icon-name="widget-gtk-textentry"/>
 
-    <glade-widget-class title="Combo Image Button" name="sclo-ScExtIButton"
-                        generic-name="Combo Image Button" parent="GtkButton"
-                        icon-name="widget-gtk-button"/>
-
     <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/sc/source/ui/inc/scuitphfedit.hxx 
b/sc/source/ui/inc/scuitphfedit.hxx
index 825bd22b57b6..6c34d6ba7ddd 100644
--- a/sc/source/ui/inc/scuitphfedit.hxx
+++ b/sc/source/ui/inc/scuitphfedit.hxx
@@ -67,7 +67,7 @@ private:
     VclPtr<ListBox>         m_pLbDefined;
     VclPtr<FixedText>       m_pFtCustomHF;
     VclPtr<PushButton>      m_pBtnText;
-    VclPtr<ScExtIButton>    m_pBtnFile;
+    VclPtr<MenuButton>      m_pBtnFile;
     VclPtr<PushButton>      m_pBtnTable;
     VclPtr<PushButton>      m_pBtnPage;
     VclPtr<PushButton>      m_pBtnLastPage;
@@ -99,7 +99,7 @@ private:
     static bool IsExtFileNameEntry(const EditTextObject* pTextObj);
     DECL_LINK( ListHdl_Impl, ListBox&, void);
     DECL_LINK( ClickHdl, Button*, void );
-    DECL_LINK( MenuHdl, ScExtIButton&, void );
+    DECL_LINK( MenuHdl, MenuButton*, void );
 };
 
 class ScRightHeaderEditPage : public ScHFEditPage
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index 606053ef4920..e7226d3ebb41 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -24,6 +24,7 @@
 #include <svx/pageitem.hxx>
 #include <vcl/group.hxx>
 #include <vcl/lstbox.hxx>
+#include <vcl/menubtn.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/virdev.hxx>
 #include <scdllapi.h>
@@ -97,38 +98,6 @@ private:
     std::function<void (ScEditWindow&)> m_GetFocusLink;
 };
 
-class SC_DLLPUBLIC ScExtIButton final : public ImageButton
-{
-    Idle            aIdle;
-    VclPtr<PopupMenu>        pPopupMenu;
-    Link<ScExtIButton&,void> aMLink;
-    sal_uInt16      nSelected;
-    OString         aSelectedIdent;
-
-                    DECL_DLLPRIVATE_LINK( TimerHdl, Timer*, void );
-
-    virtual void    MouseButtonDown( const MouseEvent& rMEvt ) override;
-    virtual void    MouseButtonUp( const MouseEvent& rMEvt) override;
-    virtual void    Click() override;
-
-    void            StartPopup();
-
-public:
-
-    ScExtIButton(vcl::Window* pParent, WinBits nBits );
-    virtual ~ScExtIButton() override;
-    virtual void dispose() override;
-
-    void            SetPopupMenu(PopupMenu* pPopUp);
-
-    sal_uInt16      GetSelected() const { return nSelected;}
-    const OString&  GetSelectedIdent() const { return aSelectedIdent;}
-
-    void            SetMenuHdl( const Link<ScExtIButton&,void>& rLink ) { 
aMLink = rLink; }
-
-    virtual bool    PreNotify( NotifyEvent& rNEvt ) override;
-};
-
 #endif // INCLUDED_SC_SOURCE_UI_INC_TPHFEDIT_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx 
b/sc/source/ui/pagedlg/scuitphfedit.cxx
index 5596a1df7b20..4249db1bd7ab 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -91,7 +91,7 @@ ScHFEditPage::ScHFEditPage( vcl::Window*             pParent,
     m_pBtnFile->SetPopupMenu(get_menu("popup"));
 
     m_pLbDefined->SetSelectHdl( LINK( this, ScHFEditPage, ListHdl_Impl ) );
-    m_pBtnFile->SetMenuHdl( LINK( this, ScHFEditPage, MenuHdl ) );
+    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 ) );
@@ -799,13 +799,12 @@ IMPL_LINK( ScHFEditPage, ClickHdl, Button*, pBtn, void )
     m_pEditFocus->GrabFocus();
 }
 
-IMPL_LINK( ScHFEditPage, MenuHdl, ScExtIButton&, rBtn, void )
+IMPL_LINK(ScHFEditPage, MenuHdl, MenuButton*, pBtn, void)
 {
     if (!m_pEditFocus)
         return;
 
-    SAL_WARN_IF(rBtn.GetSelected() == 0, "sc.ui", "nothing selected");
-    OString sSelectedId = rBtn.GetSelectedIdent();
+    OString sSelectedId = pBtn->GetCurItemIdent();
 
     if (sSelectedId == "title")
     {
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx 
b/sc/source/ui/pagedlg/tphfedit.cxx
index a2da0b30da8d..fbb75dfacfe7 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -335,97 +335,4 @@ css::uno::Reference< css::accessibility::XAccessible > 
ScEditWindow::CreateAcces
     return pAcc;
 }
 
-ScExtIButton::ScExtIButton(vcl::Window* pParent, WinBits nBits )
-    : ImageButton(pParent,nBits),
-    aIdle("sc pagedlg ScExtIButton"),
-    pPopupMenu(nullptr)
-{
-    nSelected=0;
-    aIdle.SetPriority(TaskPriority::LOWEST);
-    SetDropDown(PushButtonDropdownStyle::Toolbox);
-}
-
-ScExtIButton::~ScExtIButton()
-{
-    disposeOnce();
-}
-
-void ScExtIButton::dispose()
-{
-    pPopupMenu.clear();
-    ImageButton::dispose();
-}
-
-VCL_BUILDER_FACTORY_ARGS(ScExtIButton, 0 /* WB_BORDER|WB_TABSTOP */)
-
-void ScExtIButton::SetPopupMenu(PopupMenu* pPopUp)
-{
-    pPopupMenu=pPopUp;
-}
-
-void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt )
-{
-    if(!aIdle.IsActive())
-    {
-        aIdle.SetInvokeHandler(LINK( this, ScExtIButton, TimerHdl));
-        aIdle.Start();
-    }
-
-    ImageButton::MouseButtonDown(rMEvt );
-}
-
-void ScExtIButton::MouseButtonUp( const MouseEvent& rMEvt)
-{
-    aIdle.Stop();
-    aIdle.ClearInvokeHandler();
-    ImageButton::MouseButtonUp(rMEvt );
-}
-
-void ScExtIButton::Click()
-{
-    aIdle.Stop();
-    aIdle.ClearInvokeHandler();
-    ImageButton::Click();
-}
-
-void ScExtIButton::StartPopup()
-{
-    nSelected=0;
-    aSelectedIdent.clear();
-
-    if(pPopupMenu!=nullptr)
-    {
-        SetPressed( true );
-        EndSelection();
-        Point aPoint(0,0);
-        aPoint.setY(GetOutputSizePixel().Height() );
-
-        nSelected = pPopupMenu->Execute( this, aPoint );
-
-        if(nSelected)
-        {
-            aSelectedIdent = pPopupMenu->GetItemIdent(nSelected);
-            aMLink.Call(*this);
-        }
-
-        SetPressed( false);
-    }
-}
-
-bool ScExtIButton::PreNotify( NotifyEvent& rNEvt )
-{
-    MouseNotifyEvent nSwitch=rNEvt.GetType();
-    if(nSwitch==MouseNotifyEvent::MOUSEBUTTONUP)
-    {
-        MouseButtonUp(*rNEvt.GetMouseEvent());
-    }
-
-    return ImageButton::PreNotify(rNEvt );
-}
-
-IMPL_LINK_NOARG(ScExtIButton, TimerHdl, Timer *, void)
-{
-    StartPopup();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/ui/headerfootercontent.ui 
b/sc/uiconfig/scalc/ui/headerfootercontent.ui
index aaf499c73547..1fd4d4e29089 100644
--- a/sc/uiconfig/scalc/ui/headerfootercontent.ui
+++ b/sc/uiconfig/scalc/ui/headerfootercontent.ui
@@ -239,10 +239,11 @@
               </packing>
             </child>
             <child>
-              <object class="sclo-ScExtIButton" id="buttonBTN_FILE">
+              <object class="GtkMenuButton" id="buttonBTN_FILE">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="receives_default">True</property>
+                <property name="has_tooltip">True</property>
                 <property name="tooltip_text" translatable="yes" 
context="headerfootercontent|buttonBTN_FILE|tooltip_text">Title</property>
                 <property name="image">imageBTN_FILE</property>
               </object>
@@ -260,7 +261,6 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_text" translatable="yes" 
context="headerfootercontent|buttonBTN_TABLE|tooltip_text">Sheet Name</property>
                 <property name="image">imageBTN_TABLE</property>
-                <property name="yalign">0.47999998927116394</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -291,7 +291,6 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_text" translatable="yes" 
context="headerfootercontent|buttonBTN_PAGES|tooltip_text">Pages</property>
                 <property name="image">imageBTN_PAGES</property>
-                <property name="yalign">0.49000000953674316</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -307,7 +306,6 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_text" translatable="yes" 
context="headerfootercontent|buttonBTN_DATE|tooltip_text">Date</property>
                 <property name="image">imageBTN_DATE</property>
-                <property name="yalign">0.37000000476837158</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -323,7 +321,6 @@
                 <property name="has_tooltip">True</property>
                 <property name="tooltip_text" translatable="yes" 
context="headerfootercontent|buttonBTN_TIME|tooltip_text">Time</property>
                 <property name="image">imageBTN_TIME</property>
-                <property name="yalign">0.41999998688697815</property>
               </object>
               <packing>
                 <property name="expand">False</property>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to