summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-03 20:30:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-04 09:56:26 +0200
commit7e86cfab8ee1f7fdcb42f37e2b0b7a5ab5d862c1 (patch)
treeedb68dd9b4abbbc5526ac8ec551755d1126f9e0a /sc/source/ui
parent32dfaf1e23496599169b8eae163b733975cfed2e (diff)
replace sclo-ScExtIButton with MenuButton
Change-Id: I1f03bebe465e76f7e62f707937b9289e17b76605 Reviewed-on: https://gerrit.libreoffice.org/61328 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/inc/scuitphfedit.hxx4
-rw-r--r--sc/source/ui/inc/tphfedit.hxx33
-rw-r--r--sc/source/ui/pagedlg/scuitphfedit.cxx7
-rw-r--r--sc/source/ui/pagedlg/tphfedit.cxx93
4 files changed, 6 insertions, 131 deletions
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: */