diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-13 10:45:45 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-13 11:16:13 +0000 |
commit | 17ec3b96dee28b148773aa1715634171deaa0297 (patch) | |
tree | 791f046375ebc44e79501e15d84fbfb66d535fc9 /sd | |
parent | 703f697b22ddfdcceed955d37e75db2299f5b120 (diff) |
pass params to Outliner LINK callbacks on stack
instead of yuck..cough... on itself, which is horribly vulnerable to re-
entrancy
Change-Id: I8f3d6d39ee50fd36b56b431978cf6c2499c375a6
Reviewed-on: https://gerrit.libreoffice.org/29756
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/fuinsfil.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/inc/OutlineView.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/inc/View.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 33 | ||||
-rw-r--r-- | sd/source/ui/view/sdview.cxx | 14 |
5 files changed, 33 insertions, 36 deletions
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index e634c9224383..993fc6b310eb 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -688,12 +688,12 @@ bool FuInsertFile::InsSDDinOlMode(SfxMedium* pMedium) ::Outliner* pOutliner = pOlView->GetViewByWindow(mpWindow)->GetOutliner(); // cut notification links temporarily - Link<::Outliner*,void> aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl(); - pOutliner->SetParaInsertedHdl( Link<::Outliner*,void>()); - Link<::Outliner*,void> aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl(); - pOutliner->SetParaRemovingHdl( Link<::Outliner*,void>()); - Link<::Outliner*,void> aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl(); - pOutliner->SetDepthChangedHdl( Link<::Outliner*,void>()); + Link<Outliner::ParagraphHdlParam,void> aOldParagraphInsertedHdl = pOutliner->GetParaInsertedHdl(); + pOutliner->SetParaInsertedHdl( Link<Outliner::ParagraphHdlParam,void>()); + Link<Outliner::ParagraphHdlParam,void> aOldParagraphRemovingHdl = pOutliner->GetParaRemovingHdl(); + pOutliner->SetParaRemovingHdl( Link<Outliner::ParagraphHdlParam,void>()); + Link<Outliner::DepthChangeHdlParam,void> aOldDepthChangedHdl = pOutliner->GetDepthChangedHdl(); + pOutliner->SetDepthChangedHdl( Link<::Outliner::DepthChangeHdlParam,void>()); Link<::Outliner*,void> aOldBeginMovingHdl = pOutliner->GetBeginMovingHdl(); pOutliner->SetBeginMovingHdl( Link<::Outliner*,void>()); Link<::Outliner*,void> aOldEndMovingHdl = pOutliner->GetEndMovingHdl(); diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx index ddbf768d8192..75e5282a04cd 100644 --- a/sd/source/ui/inc/OutlineView.hxx +++ b/sd/source/ui/inc/OutlineView.hxx @@ -95,9 +95,9 @@ public: void Paint (const Rectangle& rRect, ::sd::Window* pWin); // Callbacks fuer LINKs - DECL_LINK( ParagraphInsertedHdl, ::Outliner *, void ); - DECL_LINK( ParagraphRemovingHdl, ::Outliner *, void ); - DECL_LINK( DepthChangedHdl, ::Outliner *, void ); + DECL_LINK( ParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void ); + DECL_LINK( ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void ); + DECL_LINK( DepthChangedHdl, ::Outliner::DepthChangeHdlParam, void ); DECL_LINK( StatusEventHdl, EditStatus&, void ); DECL_LINK( BeginMovingHdl, ::Outliner *, void ); DECL_LINK( EndMovingHdl, ::Outliner *, void ); diff --git a/sd/source/ui/inc/View.hxx b/sd/source/ui/inc/View.hxx index 126432fc3d48..512c4fba2207 100644 --- a/sd/source/ui/inc/View.hxx +++ b/sd/source/ui/inc/View.hxx @@ -229,8 +229,8 @@ public: SdrObject* GetSelectedSingleObject(SdPage* pPage); protected: - DECL_LINK( OnParagraphInsertedHdl, ::Outliner *, void ); - DECL_LINK( OnParagraphRemovingHdl, ::Outliner *, void ); + DECL_LINK( OnParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, void ); + DECL_LINK( OnParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, void ); virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfo ) override; virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfo ) override; diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 3288f7fb993c..5f3c9575fb54 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -358,7 +358,7 @@ Paragraph* OutlineView::GetNextTitle(const Paragraph* pPara) /** * Handler for inserting pages (paragraphs) */ -IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner, void ) +IMPL_LINK( OutlineView, ParagraphInsertedHdl, Outliner::ParagraphHdlParam, aParam, void ) { // we get calls to this handler during binary insert of drag and drop contents but // we ignore it here and handle it later in OnEndPasteOrDrop() @@ -366,17 +366,15 @@ IMPL_LINK( OutlineView, ParagraphInsertedHdl, ::Outliner *, pOutliner, void ) { OutlineViewPageChangesGuard aGuard(this); - Paragraph* pPara = pOutliner->GetHdlParagraph(); - - sal_Int32 nAbsPos = mrOutliner.GetAbsPos( pPara ); + sal_Int32 nAbsPos = mrOutliner.GetAbsPos( aParam.pPara ); UpdateParagraph( nAbsPos ); if( (nAbsPos == 0) || - ::Outliner::HasParaFlag(pPara,ParaFlag::ISPAGE) || + ::Outliner::HasParaFlag(aParam.pPara, ParaFlag::ISPAGE) || ::Outliner::HasParaFlag(mrOutliner.GetParagraph( nAbsPos-1 ), ParaFlag::ISPAGE) ) { - InsertSlideForParagraph( pPara ); + InsertSlideForParagraph( aParam.pPara ); } } } @@ -498,13 +496,13 @@ SdPage* OutlineView::InsertSlideForParagraph( Paragraph* pPara ) /** * Handler for deleting pages (paragraphs) */ -IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner, void ) +IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aParam, void ) { DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::ParagraphRemovingHdl(), model change without undo?!" ); OutlineViewPageChangesGuard aGuard(this); - Paragraph* pPara = pOutliner->GetHdlParagraph(); + Paragraph* pPara = aParam.pPara; if( ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) ) { // how many titles are in front of the title paragraph in question? @@ -547,7 +545,7 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner, void ) mnPagesProcessed = 0; } } - pOutliner->UpdateFields(); + aParam.pOutliner->UpdateFields(); } } @@ -555,14 +553,15 @@ IMPL_LINK( OutlineView, ParagraphRemovingHdl, ::Outliner *, pOutliner, void ) * Handler for changing the indentation depth of paragraphs (requires inserting * or deleting of pages in some cases) */ -IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner, void ) +IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner::DepthChangeHdlParam, aParam, void ) { DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::DepthChangedHdl(), no undo for model change?!" ); OutlineViewPageChangesGuard aGuard(this); - Paragraph* pPara = pOutliner->GetHdlParagraph(); - if( ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && ((pOutliner->GetPrevFlags() & ParaFlag::ISPAGE) == ParaFlag::NONE) ) + Paragraph* pPara = aParam.pPara; + ::Outliner* pOutliner = aParam.pOutliner; + if( ::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && ((aParam.nPrevFlags & ParaFlag::ISPAGE) == ParaFlag::NONE) ) { // the current paragraph is transformed into a slide @@ -603,7 +602,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner, void ) } } - ParagraphInsertedHdl(pOutliner); + ParagraphInsertedHdl( { aParam.pOutliner, aParam.pPara } ); mnPagesProcessed++; @@ -630,7 +629,7 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner, void ) } pOutliner->UpdateFields(); } - else if( !::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && ((pOutliner->GetPrevFlags() & ParaFlag::ISPAGE) != ParaFlag::NONE) ) + else if( !::Outliner::HasParaFlag( pPara, ParaFlag::ISPAGE ) && ((aParam.nPrevFlags & ParaFlag::ISPAGE) != ParaFlag::NONE) ) { // the paragraph was a page but now becomes a normal paragraph @@ -1353,9 +1352,9 @@ void OutlineView::SetLinks() */ void OutlineView::ResetLinks() const { - mrOutliner.SetParaInsertedHdl(Link<::Outliner*,void>()); - mrOutliner.SetParaRemovingHdl(Link<::Outliner*,void>()); - mrOutliner.SetDepthChangedHdl(Link<::Outliner*,void>()); + mrOutliner.SetParaInsertedHdl(Link<::Outliner::ParagraphHdlParam,void>()); + mrOutliner.SetParaRemovingHdl(Link<::Outliner::ParagraphHdlParam,void>()); + mrOutliner.SetDepthChangedHdl(Link<::Outliner::DepthChangeHdlParam,void>()); mrOutliner.SetBeginMovingHdl(Link<::Outliner*,void>()); mrOutliner.SetEndMovingHdl(Link<::Outliner*,void>()); mrOutliner.SetStatusEventHdl(Link<EditStatus&,void>()); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 247fe7116bac..1838126b4ab0 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -1077,32 +1077,30 @@ void View::onAccessibilityOptionsChanged() } } -IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner *, pOutliner, void ) +IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, aParam, void ) { - Paragraph* pPara = pOutliner->GetHdlParagraph(); SdrObject* pObj = GetTextEditObject(); - if( pPara && pObj ) + if( aParam.pPara && pObj ) { SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() ); if( pPage ) - pPage->onParagraphInserted( pOutliner, pPara, pObj ); + pPage->onParagraphInserted( aParam.pOutliner, aParam.pPara, pObj ); } } /** * Handler for the deletion of the pages (paragraphs). */ -IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner *, pOutliner, void ) +IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aParam, void ) { - Paragraph* pPara = pOutliner->GetHdlParagraph(); SdrObject* pObj = GetTextEditObject(); - if( pPara && pObj ) + if( aParam.pPara && pObj ) { SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() ); if( pPage ) - pPage->onParagraphRemoving( pOutliner, pPara, pObj ); + pPage->onParagraphRemoving( aParam.pOutliner, aParam.pPara, pObj ); } } |