From dbad14154cb83490b966bafa7bb97ab7e858acec Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 19 Oct 2015 13:18:33 +0200 Subject: convert Link<> to typed Change-Id: I57c15ba4374b626db322f42f04adc088b8cf6ce0 --- cui/source/dialogs/colorpicker.cxx | 88 ++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 41 deletions(-) (limited to 'cui') diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 81d274aefc0e..f83e52c9117b 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -329,10 +329,10 @@ public: void KeyMove(int dx, int dy); - void SetModifyHdl(Link<>& rLink) { maModifyHdl = rLink; } + void SetModifyHdl(const Link& rLink) { maModifyHdl = rLink; } private: - Link<> maModifyHdl; + Link maModifyHdl; ColorMode meMode; Color maColor; double mdX; @@ -682,7 +682,7 @@ void ColorFieldControl::Resize() void ColorFieldControl::Modify() { - maModifyHdl.Call( this ); + maModifyHdl.Call( *this ); } void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, double y ) @@ -732,7 +732,7 @@ public: void KeyMove( int dy ); - void SetModifyHdl( Link<>& rLink ) { maModifyHdl = rLink; } + void SetModifyHdl( const Link<>& rLink ) { maModifyHdl = rLink; } sal_Int16 GetLevel() const { return mnLevel; } @@ -990,6 +990,7 @@ public: void update_color(sal_uInt16 n = UPDATE_ALL); DECL_LINK(ColorModifyHdl, void*); + DECL_LINK_TYPED(ColorFieldControlModifydl, ColorFieldControl&, void); DECL_LINK_TYPED(ColorModifyEditHdl, Edit&, void); DECL_LINK_TYPED(ModeModifyHdl, RadioButton&, void); @@ -1071,9 +1072,8 @@ ColorPickerDialog::ColorPickerDialog( vcl::Window* pParent, sal_Int32 nColor, sa set_width_request(aDialogSize.Width() + 50); set_height_request(aDialogSize.Height() + 30); - Link<> aLink( LINK( this, ColorPickerDialog, ColorModifyHdl ) ); - mpColorField->SetModifyHdl( aLink ); - mpColorSlider->SetModifyHdl( aLink ); + mpColorField->SetModifyHdl( LINK( this, ColorPickerDialog, ColorFieldControlModifydl ) ); + mpColorSlider->SetModifyHdl( LINK( this, ColorPickerDialog, ColorModifyHdl ) ); Link aLink3( LINK( this, ColorPickerDialog, ColorModifyEditHdl ) ); mpMFRed->SetModifyHdl( aLink3 ); @@ -1284,46 +1284,52 @@ IMPL_LINK_TYPED(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void) { ColorModifyHdl(&rEdit); } -IMPL_LINK(ColorPickerDialog, ColorModifyHdl, void *, p) +IMPL_LINK_NOARG_TYPED(ColorPickerDialog, ColorFieldControlModifydl, ColorFieldControl&, void) { sal_uInt16 n = 0; - if (p == mpColorField) + double x = mpColorField->GetX(); + double y = mpColorField->GetY(); + + switch( meMode ) { - double x = mpColorField->GetX(); - double y = mpColorField->GetY(); + case HUE: + mdSat = x; + setColorComponent( COLORCOMP_BRI, y ); + break; + case SATURATION: + mdHue = x * 360.0; + setColorComponent( COLORCOMP_BRI, y ); + break; + case BRIGHTNESS: + mdHue = x * 360.0; + setColorComponent( COLORCOMP_SAT, y ); + break; + case RED: + mdBlue = x; + setColorComponent( COLORCOMP_GREEN, y ); + break; + case GREEN: + mdBlue = x; + setColorComponent( COLORCOMP_RED, y ); + break; + case BLUE: + mdRed = x; + setColorComponent( COLORCOMP_GREEN, y ); + break; + } - switch( meMode ) - { - case HUE: - mdSat = x; - setColorComponent( COLORCOMP_BRI, y ); - break; - case SATURATION: - mdHue = x * 360.0; - setColorComponent( COLORCOMP_BRI, y ); - break; - case BRIGHTNESS: - mdHue = x * 360.0; - setColorComponent( COLORCOMP_SAT, y ); - break; - case RED: - mdBlue = x; - setColorComponent( COLORCOMP_GREEN, y ); - break; - case GREEN: - mdBlue = x; - setColorComponent( COLORCOMP_RED, y ); - break; - case BLUE: - mdRed = x; - setColorComponent( COLORCOMP_GREEN, y ); - break; - } + n = UPDATE_ALL &~ (UPDATE_COLORCHOOSER); - n = UPDATE_ALL &~ (UPDATE_COLORCHOOSER); - } - else if (p == mpColorSlider) + if (n) + update_color(n); + +} +IMPL_LINK(ColorPickerDialog, ColorModifyHdl, void *, p) +{ + sal_uInt16 n = 0; + + if (p == mpColorSlider) { double dValue = mpColorSlider->GetValue(); switch (meMode) -- cgit