summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2014-11-16 23:45:14 -0200
committerMarcos Paulo de Souza <marcos.souza.org@gmail.com>2014-11-21 09:02:54 +0000
commitfde82414b4c0531c1addcfc99e55ca17d52c3fec (patch)
tree3c2fc16effbf19acc1bdef4d836c39dcb11cb8f1 /starmath
parent9ae034bb49642c276c5b2a963bd28e50b9ab4146 (diff)
Use boost::signal in SmElementsControl
Change-Id: Icb19466db6720350e105b75cb1c0c858f39403ef Reviewed-on: https://gerrit.libreoffice.org/12509 Reviewed-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com> Tested-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/ElementsDockingWindow.hxx9
-rw-r--r--starmath/source/ElementsDockingWindow.cxx10
2 files changed, 8 insertions, 11 deletions
diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index 73534ef15cff..013b6cd30e7b 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
#include <boost/scoped_ptr.hpp>
+#include <boost/signals2/signal.hpp>
#include <sfx2/dockwin.hxx>
#include <svx/dlgctrl.hxx>
#include <vcl/scrbar.hxx>
@@ -80,8 +81,6 @@ class SmElementsControl : public Control
static const sal_uInt16 aFormats[][2];
static const sal_uInt16 aOthers[][2];
- Link aSelectHdlLink;
-
virtual void Paint(const Rectangle&) SAL_OVERRIDE;
virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -115,10 +114,10 @@ public:
void setVerticalMode(bool bVertical);
- void SetSelectHdl(const Link& rLink) { aSelectHdlLink = rLink; }
-
DECL_LINK( ScrollHdl, void* );
void DoScroll(long nDelta);
+
+ boost::signals2::signal< void ( SmElement* ) > selectedSignal;
};
class SmElementsDockingWindow : public SfxDockingWindow
@@ -131,7 +130,7 @@ class SmElementsDockingWindow : public SfxDockingWindow
virtual void Resize() SAL_OVERRIDE;
SmViewShell* GetView();
- DECL_LINK(SelectClickHdl, SmElement*);
+ void SelectClickHandler(SmElement* pElement);
DECL_LINK(ElementSelectedHandle, ListBox*);
public:
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 4b2cd4a50152..e22982817dbf 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -415,7 +415,7 @@ void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent)
Rectangle rect(element->mBoxLocation, element->mBoxSize);
if (rect.IsInside(rMouseEvent.GetPosPixel()))
{
- aSelectHdlLink.Call(element);
+ selectedSignal(element);
return;
}
}
@@ -650,13 +650,12 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf
}
maElementListBox.SetSelectHdl(LINK(this, SmElementsDockingWindow, ElementSelectedHandle));
+ maElementListBox.SelectEntry(SM_RESSTR(RID_CATEGORY_UNARY_BINARY_OPERATORS));
maElementsControl.SetBackground( Color( COL_WHITE ) );
maElementsControl.SetTextColor( Color( COL_BLACK ) );
- maElementsControl.SetSelectHdl(LINK(this, SmElementsDockingWindow, SelectClickHdl));
-
- maElementListBox.SelectEntry(SM_RESSTR(RID_CATEGORY_UNARY_BINARY_OPERATORS));
maElementsControl.setElementSetId(RID_CATEGORY_UNARY_BINARY_OPERATORS);
+ maElementsControl.selectedSignal.connect( boost::bind( &SmElementsDockingWindow::SelectClickHandler, this, _1 ) );
FreeResource();
}
@@ -682,7 +681,7 @@ void SmElementsDockingWindow::EndDocking( const Rectangle& rReactangle, bool bFl
maElementsControl.setVerticalMode(bVertical);
}
-IMPL_LINK( SmElementsDockingWindow, SelectClickHdl, SmElement*, pElement)
+void SmElementsDockingWindow::SelectClickHandler( SmElement* pElement )
{
SmViewShell* pViewSh = GetView();
@@ -692,7 +691,6 @@ IMPL_LINK( SmElementsDockingWindow, SelectClickHdl, SmElement*, pElement)
SID_INSERTCOMMANDTEXT, SfxCallMode::RECORD,
new SfxStringItem(SID_INSERTCOMMANDTEXT, pElement->getText()), 0L);
}
- return 0;
}
IMPL_LINK( SmElementsDockingWindow, ElementSelectedHandle, ListBox*, pList)