Kaydet (Commit) 0bac0582 authored tarafından Michaël Lefèvre's avatar Michaël Lefèvre Kaydeden (comit) Noel Grandin

tdf#60739 code factorisation

Limit duplciation for SfxRequest FN_WORDCOUNT_DIALOG in sw shells

Change-Id: Idf63f92f0061249ba937332c0be3fd6446aaa554
Reviewed-on: https://gerrit.libreoffice.org/14182Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst d57cd804
......@@ -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);
......
......@@ -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:
{
......
......@@ -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:
......
......@@ -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:
......
......@@ -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;
}
......
......@@ -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:
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment