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: ...@@ -544,6 +544,7 @@ public:
void StateSearch(SfxItemSet &); void StateSearch(SfxItemSet &);
void GetState(SfxItemSet&); void GetState(SfxItemSet&);
void StateStatusLine(SfxItemSet&); void StateStatusLine(SfxItemSet&);
void UpdateWordCount(SfxShell*, sal_uInt16);
// functions for drawing // functions for drawing
void SetDrawFuncPtr(SwDrawBase* pFuncPtr); void SetDrawFuncPtr(SwDrawBase* pFuncPtr);
......
...@@ -121,7 +121,6 @@ ...@@ -121,7 +121,6 @@
#include <langhelper.hxx> #include <langhelper.hxx>
#include <wordcountdialog.hxx>
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
...@@ -426,16 +425,15 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) ...@@ -426,16 +425,15 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
InsertSymbol(rReq); InsertSymbol(rReq);
break; break;
} }
case FN_INSERT_STRING: case FN_INSERT_STRING:
{ {
const SfxPoolItem* pItem = 0; const SfxPoolItem* pItem = 0;
if(pNewAttrs) if (pNewAttrs)
pNewAttrs->GetItemState(nSlot, false, &pItem ); pNewAttrs->GetItemState(nSlot, false, &pItem );
if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue()); pOLV->InsertText(static_cast<const SfxStringItem *>(pItem)->GetValue());
break; break;
} }
case FN_FORMAT_FOOTNOTE_DLG: case FN_FORMAT_FOOTNOTE_DLG:
{ {
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
...@@ -466,18 +464,9 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) ...@@ -466,18 +464,9 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
break; break;
case FN_WORDCOUNT_DIALOG: case FN_WORDCOUNT_DIALOG:
{ {
SfxViewFrame* pVFrame = rView.GetViewFrame(); rView.UpdateWordCount(this, nSlot);
if (pVFrame != NULL) break;
{
pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
Invalidate(rReq.GetSlot());
SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
if (pWrdCnt)
pWrdCnt->UpdateCounts();
}
} }
break;
case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG_EFFECT:
case SID_CHAR_DLG: case SID_CHAR_DLG:
{ {
......
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include <sfx2/msg.hxx> #include <sfx2/msg.hxx>
#include "swslots.hxx" #include "swslots.hxx"
#include "swabstdlg.hxx" #include "swabstdlg.hxx"
#include <wordcountdialog.hxx>
#include "misc.hrc" #include "misc.hrc"
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
...@@ -327,16 +326,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) ...@@ -327,16 +326,7 @@ void SwDrawShell::Execute(SfxRequest &rReq)
break; break;
case FN_WORDCOUNT_DIALOG: case FN_WORDCOUNT_DIALOG:
{ {
SfxViewFrame* pVFrame = GetView().GetViewFrame(); GetView().UpdateWordCount(this, nSlotId);
if (pVFrame != NULL)
{
pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
Invalidate(rReq.GetSlot());
SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
if (pWrdCnt)
pWrdCnt->UpdateCounts();
}
} }
break; break;
case SID_EXTRUSION_TOOGLE: case SID_EXTRUSION_TOOGLE:
......
...@@ -93,7 +93,6 @@ ...@@ -93,7 +93,6 @@
#include <viewopt.hxx> #include <viewopt.hxx>
#include <wrtsh.hxx> #include <wrtsh.hxx>
#include <wview.hxx> #include <wview.hxx>
#include <wordcountdialog.hxx>
#include "swabstdlg.hxx" #include "swabstdlg.hxx"
#include "chrdlg.hrc" #include "chrdlg.hrc"
...@@ -405,16 +404,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) ...@@ -405,16 +404,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
break; break;
case FN_WORDCOUNT_DIALOG: case FN_WORDCOUNT_DIALOG:
{ {
SfxViewFrame* pVFrame = GetView().GetViewFrame(); GetView().UpdateWordCount(this, nSlot);
if (pVFrame != NULL)
{
pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
Invalidate(rReq.GetSlot());
SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
if (pWrdCnt)
pWrdCnt->UpdateCounts();
}
} }
break; break;
case SID_PARA_DLG: case SID_PARA_DLG:
......
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
#include "misc.hrc" #include "misc.hrc"
#include <svx/dialogs.hrc> #include <svx/dialogs.hrc>
#include <wordcountdialog.hxx>
#include <docsh.hxx> #include <docsh.hxx>
#include <svx/drawitem.hxx> #include <svx/drawitem.hxx>
...@@ -266,18 +265,9 @@ void SwFrameShell::Execute(SfxRequest &rReq) ...@@ -266,18 +265,9 @@ void SwFrameShell::Execute(SfxRequest &rReq)
break; break;
case FN_WORDCOUNT_DIALOG: case FN_WORDCOUNT_DIALOG:
{ {
SfxViewFrame* pVFrame = GetView().GetViewFrame(); GetView().UpdateWordCount(this, nSlot);
if (pVFrame != NULL) break;
{
pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
Invalidate(rReq.GetSlot());
SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
if (pWrdCnt)
pWrdCnt->UpdateCounts();
}
} }
break;
default: bMore = true; default: bMore = true;
} }
......
...@@ -109,7 +109,6 @@ ...@@ -109,7 +109,6 @@
#include <sfx2/objface.hxx> #include <sfx2/objface.hxx>
#include <langhelper.hxx> #include <langhelper.hxx>
#include <uiitems.hxx> #include <uiitems.hxx>
#include <wordcountdialog.hxx>
#include <tools/diagnose_ex.h> #include <tools/diagnose_ex.h>
#include <svx/nbdtmgfact.hxx> #include <svx/nbdtmgfact.hxx>
#include <svx/nbdtmg.hxx> #include <svx/nbdtmg.hxx>
...@@ -1344,16 +1343,7 @@ void SwTextShell::Execute(SfxRequest &rReq) ...@@ -1344,16 +1343,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
break; break;
case FN_WORDCOUNT_DIALOG: case FN_WORDCOUNT_DIALOG:
{ {
SfxViewFrame* pVFrame = GetView().GetViewFrame(); GetView().UpdateWordCount(this, nSlot);
if (pVFrame != NULL)
{
pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
Invalidate(rReq.GetSlot());
SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
if (pWrdCnt)
pWrdCnt->UpdateCounts();
}
} }
break; break;
default: default:
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <cmdid.h> #include <cmdid.h>
#include <sfx2/request.hxx> #include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <wordcountdialog.hxx>
extern bool bDocSzUpdated; extern bool bDocSzUpdated;
...@@ -180,4 +181,18 @@ void SwView::StateFormatPaintbrush(SfxItemSet &rSet) ...@@ -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: */ /* 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