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

Caolán McNamara caolanm at redhat.com
Thu May 2 08:42:56 PDT 2013


 sc/source/ui/inc/tphfedit.hxx     |   10 ++++++----
 sc/source/ui/pagedlg/tphfedit.cxx |   15 ++++++++++++---
 2 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 29a2ff580eaa1cfcc3d977b84634e9836856ecc1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 2 16:40:19 2013 +0100

    we can just use a PopupMenu* here
    
    rather than a ScPopupMenu*, we don't use anything added by
    ScPopupMenu to PopupMenu.
    
    While I'm at it, expose the wrapped selected identity of
    the popup through the drop-down menu button
    
    Change-Id: Id92f4a03fca19140e624d577f888135c5b227192

diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index 79a38c5..f3d5e33 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -98,9 +98,10 @@ class SC_DLLPUBLIC ScExtIButton : public ImageButton
 private:
 
     Timer           aTimer;
-    ScPopupMenu*    pPopupMenu;
+    PopupMenu*      pPopupMenu;
     Link            aMLink;
-    sal_uInt16          nSelected;
+    sal_uInt16      nSelected;
+    OString         aSelectedIdent;
 
     SC_DLLPRIVATE  DECL_LINK( TimerHdl, void*);
 
@@ -116,9 +117,10 @@ public:
 
     ScExtIButton(Window* pParent, const ResId& rResId );
 
-    void            SetPopupMenu(ScPopupMenu* pPopUp);
+    void            SetPopupMenu(PopupMenu* pPopUp);
 
-    sal_uInt16          GetSelected();
+    sal_uInt16      GetSelected() const;
+    OString         GetSelectedIdent() const;
 
     void            SetMenuHdl( const Link& rLink ) { aMLink = rLink; }
     const Link&     GetMenuHdl() const { return aMLink; }
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index 5fd9d40..9099e23 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -348,16 +348,21 @@ ScExtIButton::ScExtIButton(Window* pParent, const ResId& rResId )
     SetDropDown( true);
 }
 
-void ScExtIButton::SetPopupMenu(ScPopupMenu* pPopUp)
+void ScExtIButton::SetPopupMenu(PopupMenu* pPopUp)
 {
     pPopupMenu=pPopUp;
 }
 
-sal_uInt16 ScExtIButton::GetSelected()
+sal_uInt16 ScExtIButton::GetSelected() const
 {
     return nSelected;
 }
 
+OString ScExtIButton::GetSelectedIdent() const
+{
+    return aSelectedIdent;
+}
+
 void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt )
 {
     if(!aTimer.IsActive())
@@ -368,6 +373,7 @@ void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt )
 
     ImageButton::MouseButtonDown(rMEvt );
 }
+
 void ScExtIButton::MouseButtonUp( const MouseEvent& rMEvt)
 {
     aTimer.Stop();
@@ -385,6 +391,7 @@ void ScExtIButton::Click()
 void ScExtIButton::StartPopup()
 {
     nSelected=0;
+    aSelectedIdent = OString();
 
     if(pPopupMenu!=NULL)
     {
@@ -393,12 +400,14 @@ void ScExtIButton::StartPopup()
         Point aPoint(0,0);
         aPoint.Y()=GetOutputSizePixel().Height();
 
-        nSelected=pPopupMenu->Execute( this, aPoint );
+        nSelected = pPopupMenu->Execute( this, aPoint );
 
         if(nSelected)
         {
+            aSelectedIdent = pPopupMenu->GetItemIdent(nSelected);
             aMLink.Call(this);
         }
+
         SetPressed( false);
     }
 }


More information about the Libreoffice-commits mailing list