sw/source/uibase/inc/view.hxx | 1 + sw/source/uibase/shells/annotsh.cxx | 29 +++++++++-------------------- sw/source/uibase/shells/drawsh.cxx | 12 +----------- sw/source/uibase/shells/drwtxtex.cxx | 12 +----------- sw/source/uibase/shells/frmsh.cxx | 14 ++------------ sw/source/uibase/shells/textsh1.cxx | 12 +----------- sw/source/uibase/uiview/view1.cxx | 15 +++++++++++++++ 7 files changed, 30 insertions(+), 65 deletions(-)
New commits: commit 0bac0582adac70380fe30ed16247b1b9f91d2680 Author: Michaël Lefèvre <lefevr...@yahoo.fr> Date: Mon Jan 26 10:56:06 2015 +0100 tdf#60739 code factorisation Limit duplciation for SfxRequest FN_WORDCOUNT_DIALOG in sw shells Change-Id: Idf63f92f0061249ba937332c0be3fd6446aaa554 Reviewed-on: https://gerrit.libreoffice.org/14182 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx index 20cf95f..0eecc7d 100644 --- a/sw/source/uibase/inc/view.hxx +++ b/sw/source/uibase/inc/view.hxx @@ -544,6 +544,7 @@ public: void StateSearch(SfxItemSet &); void GetState(SfxItemSet&); void StateStatusLine(SfxItemSet&); + void UpdateWordCount(SfxShell*, sal_uInt16); // functions for drawing void SetDrawFuncPtr(SwDrawBase* pFuncPtr); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index dea94dd..a7ee88e 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -121,7 +121,6 @@ #include <langhelper.hxx> -#include <wordcountdialog.hxx> #include <tools/diagnose_ex.h> #include <boost/scoped_ptr.hpp> @@ -426,16 +425,15 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) InsertSymbol(rReq); break; } - case FN_INSERT_STRING: - { + case FN_INSERT_STRING: + { const SfxPoolItem* pItem = 0; - if(pNewAttrs) + if (pNewAttrs) pNewAttrs->GetItemState(nSlot, false, &pItem ); - if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) - pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue()); - break; - } - + if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) + pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue()); + break; + } case FN_FORMAT_FOOTNOTE_DLG: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); @@ -466,18 +464,9 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) break; case FN_WORDCOUNT_DIALOG: { - SfxViewFrame* pVFrame = rView.GetViewFrame(); - if (pVFrame != NULL) - { - pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); - Invalidate(rReq.GetSlot()); - - SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); - if (pWrdCnt) - pWrdCnt->UpdateCounts(); - } + rView.UpdateWordCount(this, nSlot); + break; } - break; case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 056d7ce..b13a957 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -65,7 +65,6 @@ #include <sfx2/msg.hxx> #include "swslots.hxx" #include "swabstdlg.hxx" -#include <wordcountdialog.hxx> #include "misc.hrc" #include <boost/scoped_ptr.hpp> @@ -327,16 +326,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) break; case FN_WORDCOUNT_DIALOG: { - SfxViewFrame* pVFrame = GetView().GetViewFrame(); - if (pVFrame != NULL) - { - pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); - Invalidate(rReq.GetSlot()); - - SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); - if (pWrdCnt) - pWrdCnt->UpdateCounts(); - } + GetView().UpdateWordCount(this, nSlotId); } break; case SID_EXTRUSION_TOOGLE: diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index f310062..6c7b344 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -93,7 +93,6 @@ #include <viewopt.hxx> #include <wrtsh.hxx> #include <wview.hxx> -#include <wordcountdialog.hxx> #include "swabstdlg.hxx" #include "chrdlg.hrc" @@ -405,16 +404,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case FN_WORDCOUNT_DIALOG: { - SfxViewFrame* pVFrame = GetView().GetViewFrame(); - if (pVFrame != NULL) - { - pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); - Invalidate(rReq.GetSlot()); - - SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); - if (pWrdCnt) - pWrdCnt->UpdateCounts(); - } + GetView().UpdateWordCount(this, nSlot); } break; case SID_PARA_DLG: diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 6fdce9f..020bcad 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -78,7 +78,6 @@ #include "misc.hrc" #include <svx/dialogs.hrc> -#include <wordcountdialog.hxx> #include <docsh.hxx> #include <svx/drawitem.hxx> @@ -266,18 +265,9 @@ void SwFrameShell::Execute(SfxRequest &rReq) break; case FN_WORDCOUNT_DIALOG: { - SfxViewFrame* pVFrame = GetView().GetViewFrame(); - if (pVFrame != NULL) - { - pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); - Invalidate(rReq.GetSlot()); - - SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); - if (pWrdCnt) - pWrdCnt->UpdateCounts(); - } + GetView().UpdateWordCount(this, nSlot); + break; } - break; default: bMore = true; } diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 30af928..a1c9010 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -109,7 +109,6 @@ #include <sfx2/objface.hxx> #include <langhelper.hxx> #include <uiitems.hxx> -#include <wordcountdialog.hxx> #include <tools/diagnose_ex.h> #include <svx/nbdtmgfact.hxx> #include <svx/nbdtmg.hxx> @@ -1344,16 +1343,7 @@ void SwTextShell::Execute(SfxRequest &rReq) break; case FN_WORDCOUNT_DIALOG: { - SfxViewFrame* pVFrame = GetView().GetViewFrame(); - if (pVFrame != NULL) - { - pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); - Invalidate(rReq.GetSlot()); - - SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); - if (pWrdCnt) - pWrdCnt->UpdateCounts(); - } + GetView().UpdateWordCount(this, nSlot); } break; default: diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx index 85bd426..cc54ec9 100644 --- a/sw/source/uibase/uiview/view1.cxx +++ b/sw/source/uibase/uiview/view1.cxx @@ -37,6 +37,7 @@ #include <cmdid.h> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> +#include <wordcountdialog.hxx> extern bool bDocSzUpdated; @@ -180,4 +181,18 @@ void SwView::StateFormatPaintbrush(SfxItemSet &rSet) } } +void SwView::UpdateWordCount(SfxShell* pShell, sal_uInt16 nSlot) +{ + SfxViewFrame* pVFrame = GetViewFrame(); + if (pVFrame != NULL) + { + pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); + pShell->Invalidate(nSlot); + + SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); + if (pWrdCnt) + pWrdCnt->UpdateCounts(); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits