diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-09-22 14:02:33 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-21 10:23:49 +0200 |
commit | 569a1b967af589358f72aef30f63c937d462a01d (patch) | |
tree | 1a54c0ac1712700ccc81902e4f2aaea8a69e469f | |
parent | 215a189e5d35a0423bf26937405993499a8ed987 (diff) |
unit-verification: convert Link<> to typed
(fix build after rebasing on master)
Change-Id: Iecbdbf5a854de0b552f6c9074e72da3fa47d91a4
-rw-r--r-- | sc/source/ui/inc/unitsconversiondlg.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/viewfunc.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/unitsconversiondlg.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 55 |
4 files changed, 34 insertions, 34 deletions
diff --git a/sc/source/ui/inc/unitsconversiondlg.hxx b/sc/source/ui/inc/unitsconversiondlg.hxx index 01116d2c424b..cda8f83e6124 100644 --- a/sc/source/ui/inc/unitsconversiondlg.hxx +++ b/sc/source/ui/inc/unitsconversiondlg.hxx @@ -84,7 +84,7 @@ private: bool CheckUnitsAreConvertible(); void PerformConversion(); - DECL_LINK( OkClicked, PushButton* ); + DECL_LINK_TYPED( OkClicked, Button*, void ); DECL_LINK( GetFocusHandler, Control* ); DECL_LINK( LoseFocusHandler, void* ); DECL_LINK( OutputUnitsModified, void* ); diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 259bcf014757..2682cf5b9647 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -371,14 +371,14 @@ private: void NotifyUnitErrorInFormula( const ScAddress& rAddress, ScDocument* pDoc, const sc::units::FormulaStatus& rStatus); - DECL_LINK( EditUnitErrorFormulaHandler, PushButton* ); + DECL_LINK_TYPED( EditUnitErrorFormulaHandler, Button*, void); void NotifyUnitConversionRecommended( const ScAddress& rCellAddress, ScDocument* pDoc, const OUString& sHeaderUnit, const ScAddress& rHeaderAddress, const OUString& sCellUnit ); - DECL_LINK( UnitConversionRecommendedHandler, UnitConversionPushButton* ); + DECL_LINK_TYPED( UnitConversionRecommendedHandler, Button*, void); }; #endif diff --git a/sc/source/ui/miscdlgs/unitsconversiondlg.cxx b/sc/source/ui/miscdlgs/unitsconversiondlg.cxx index a3a67449cddb..cea5405422b5 100644 --- a/sc/source/ui/miscdlgs/unitsconversiondlg.cxx +++ b/sc/source/ui/miscdlgs/unitsconversiondlg.cxx @@ -192,26 +192,25 @@ bool ScUnitsConversionDialog::CheckUnitsAreConvertible() return bCompatibleInputFound; } -IMPL_LINK( ScUnitsConversionDialog, OkClicked, PushButton*, /*pButton*/ ) +IMPL_LINK_TYPED( ScUnitsConversionDialog, OkClicked, Button*, /*pButton*/, void ) { if (!CheckUnitsAreConvertible()) { // As we have now clicked on this button, the output units entry // box has lost focus, so the "no conversion possible" warning // will already be shown by the OutputUnitsComplete handler. - return 0; + return; } PerformConversion(); Close(); - return 0; } IMPL_LINK( ScUnitsConversionDialog, GetFocusHandler, Control*, pCtrl ) { Edit* pEdit = NULL; - if( (pCtrl == (Control*) mpInputRangeEdit) || (pCtrl == (Control*) mpInputRangeButton) ) { + if( (pCtrl == mpInputRangeEdit.get()) || (pCtrl == mpInputRangeButton.get()) ) { pEdit = mpInputRangeEdit; } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index f382f76af572..a22ddbc08895 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2897,9 +2897,8 @@ void ScViewFunc::NotifyUnitErrorInFormula( const ScAddress& rAddress, ScDocument pInfoBar->addButton( pButtonGotoCell); } -IMPL_LINK( ScViewFunc, EditUnitErrorFormulaHandler, PushButton*, pButton ) +IMPL_LINK_TYPED( ScViewFunc, EditUnitErrorFormulaHandler, Button*, pButton, void ) { - OUString sAddress; { // keep pInfoBar within this scope only as we'll be deleting it just below (using RemoveInfoBar) @@ -2920,8 +2919,6 @@ IMPL_LINK( ScViewFunc, EditUnitErrorFormulaHandler, PushButton*, pButton ) // UI making it a bit easier to see where the data is coming from). ScModule* pScMod = SC_MOD(); pScMod->SetInputMode( SC_INPUT_TABLE ); - - return 0; } /* @@ -2995,14 +2992,20 @@ void ScViewFunc::NotifyUnitConversionRecommended( const ScAddress& rCellAddress, pInfoBar->addButton( pButtonConvertCell ); } -IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButton*, pButton ) +IMPL_LINK_TYPED( ScViewFunc, UnitConversionRecommendedHandler, Button*, pButton, void ) { // Do conversion first, and only then remove the infobar as we need data from the infobar // (specifically from the pushbutton) to do the conversion. #ifdef ENABLE_CALC_UNITVERIFICATION + + // We can't pass in a UnitConversionPushButton* as this would require template-parameter downcasting + // (which is illegal) when setting pButtonConvertCell->SetClickHdl (which expects a + // Link<Button*, void>). Instead we can just cast back to the expected type here. + UnitConversionPushButton* pPushButton = dynamic_cast<UnitConversionPushButton*>( pButton ); + boost::shared_ptr< Units > pUnits = Units::GetUnits(); - ScDocument* pDoc = pButton->mpDoc; + ScDocument* pDoc = pPushButton->mpDoc; ScDocShell* pDocShell = static_cast<ScDocShell*>(pDoc->GetDocumentShell()); ScDocShellModificator aModificator( *pDocShell ); @@ -3018,12 +3021,12 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto { pUndoManager = pDocShell->GetUndoManager(); - aOldVal.assign( *pDoc, pButton->aCellAddress ); + aOldVal.assign( *pDoc, pPushButton->aCellAddress ); - aMark.SetMarkArea( pButton->aCellAddress ); + aMark.SetMarkArea( pPushButton->aCellAddress ); pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); - pUndoDoc->InitUndo( pDoc, pButton->aCellAddress.Tab(), pButton->aCellAddress.Tab() ); - pDoc->CopyToDocument( ScRange( pButton->aCellAddress ), IDF_ATTRIB, false, pUndoDoc, &aMark ); + pUndoDoc->InitUndo( pDoc, pPushButton->aCellAddress.Tab(), pPushButton->aCellAddress.Tab() ); + pDoc->CopyToDocument( ScRange( pPushButton->aCellAddress ), IDF_ATTRIB, false, pUndoDoc, &aMark ); // This commences logging of changes to the drawing layer // (i.e. notes) for storing in an undo. (See more below.) @@ -3031,14 +3034,14 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto pDrawLayer->BeginCalcUndo(false); } - OUString sOriginalValue = pDoc->GetString( pButton->aCellAddress ); + OUString sOriginalValue = pDoc->GetString( pPushButton->aCellAddress ); - pUnits->convertCellToHeaderUnit( pButton->aCellAddress, + pUnits->convertCellToHeaderUnit( pPushButton->aCellAddress, pDoc, - pButton->sHeaderUnit, - pButton->sCellUnit ); + pPushButton->sHeaderUnit, + pPushButton->sCellUnit ); - const OUString sCurrentNoteText = pDoc->GetOrCreateNote( pButton->aCellAddress )->GetText(); + const OUString sCurrentNoteText = pDoc->GetOrCreateNote( pPushButton->aCellAddress )->GetText(); const OUString sConversionNote("Original input: " + sOriginalValue); OUString sNewNoteText; @@ -3052,11 +3055,11 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto } // ensure existing caption object before draw undo tracking starts - ScPostIt* pOldNote = pDoc->ReleaseNote( pButton->aCellAddress ); + ScPostIt* pOldNote = pDoc->ReleaseNote( pPushButton->aCellAddress ); ScNoteData aOldNoteData = pOldNote->GetNoteData(); delete pOldNote; - ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( *pDoc, pButton->aCellAddress, sNewNoteText, false, true ); + ScPostIt* pNewNote = ScNoteUtil::CreateNoteFromString( *pDoc, pPushButton->aCellAddress, sNewNoteText, false, true ); assert( pNewNote ); if ( bUndo ) @@ -3065,14 +3068,14 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto pUndoManager->EnterListAction( aUndo, aUndo ); ScCellValue aNewVal; - aNewVal.assign( *pDoc, pButton->aCellAddress ); - const ScPatternAttr* pNewPat = pDoc->GetPattern( pButton->aCellAddress ); + aNewVal.assign( *pDoc, pPushButton->aCellAddress ); + const ScPatternAttr* pNewPat = pDoc->GetPattern( pPushButton->aCellAddress ); - pUndoManager->AddUndoAction( new ScUndoSetCell( pDocShell, pButton->aCellAddress, aOldVal, aNewVal ) ); + pUndoManager->AddUndoAction( new ScUndoSetCell( pDocShell, pPushButton->aCellAddress, aOldVal, aNewVal ) ); pUndoManager->AddUndoAction( new ScUndoSelectionAttr( pDocShell, aMark, - pButton->aCellAddress.Col(), pButton->aCellAddress.Row(), pButton->aCellAddress.Tab(), - pButton->aCellAddress.Col(), pButton->aCellAddress.Row(), pButton->aCellAddress.Tab(), + pPushButton->aCellAddress.Col(), pPushButton->aCellAddress.Row(), pPushButton->aCellAddress.Tab(), + pPushButton->aCellAddress.Col(), pPushButton->aCellAddress.Row(), pPushButton->aCellAddress.Tab(), pUndoDoc, false, pNewPat) ); @@ -3083,7 +3086,7 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto // different constructors for each case. if ( sCurrentNoteText.isEmpty() ) { - pUndoManager->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pButton->aCellAddress, + pUndoManager->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pPushButton->aCellAddress, aNewNoteData, true, nullptr ) ); } else @@ -3091,14 +3094,14 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto // Actual note content changes are stored in the DrawLayer CalcUndo, // as opposed to being the NoteData (which just seems to store note // metadata) - hence we need to make sure that we save that too. - pUndoManager->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pButton->aCellAddress, + pUndoManager->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pPushButton->aCellAddress, aOldNoteData, aNewNoteData, pDrawLayer->GetCalcUndo() ) ); } pUndoManager->LeaveListAction(); } - pDocShell->PostPaint(ScRange( pButton->aCellAddress), PAINT_GRID); + pDocShell->PostPaint(ScRange( pPushButton->aCellAddress), PAINT_GRID); aModificator.SetDocumentModified(); SfxGetpApp()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); @@ -3122,8 +3125,6 @@ IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, UnitConversionPushButto GetViewData().GetDispatcher().Execute( SID_CURRENTCELL, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, &aPosition, &aUnmark, 0L ); - - return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |