diff options
author | qarkai <qarkai@gmail.com> | 2017-01-21 22:35:19 +0300 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-02-01 16:30:28 +0000 |
commit | b12823aa81003e80372bd89db79bd6ba8e032a95 (patch) | |
tree | 4aa6cbe813900c6825d56c51d317da7f615b0181 | |
parent | ebe83479b42d781de73767c888148dc791ff1dbe (diff) |
tdf#39593 move duplicate code to separate method
Change-Id: I89c809a220efc006d3b5b0675c050ff07cb2dbfe
Reviewed-on: https://gerrit.libreoffice.org/33380
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 80 | ||||
-rw-r--r-- | sw/source/uibase/inc/column.hxx | 1 |
2 files changed, 35 insertions, 46 deletions
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 6d038be747f1..9954623cce85 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -235,31 +235,11 @@ IMPL_LINK(SwColumnDlg, ObjectListBoxHdl, ListBox&, rBox, void) { ObjectHdl(&rBox); } + void SwColumnDlg::ObjectHdl(ListBox* pBox) { - SfxItemSet* pSet = nullptr; - switch(nOldSelection) - { - case LISTBOX_SELECTION : - pSet = pSelectionSet; - break; - case LISTBOX_SECTION : - pSet = pSectionSet; - bSectionChanged = true; - break; - case LISTBOX_SECTIONS : - pSet = pSectionSet; - bSelSectionChanged = true; - break; - case LISTBOX_PAGE : - pSet = pPageSet; - bPageChanged = true; - break; - case LISTBOX_FRAME: - pSet = pFrameSet; - bFrameChanged = true; - break; - } + SfxItemSet* pSet = EvalCurrentSelection(); + if(pBox) { pTabPage->FillItemSet(pSet); @@ -300,29 +280,7 @@ void SwColumnDlg::ObjectHdl(ListBox* pBox) IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void) { // evaluate current selection - SfxItemSet* pSet = nullptr; - switch(nOldSelection) - { - case LISTBOX_SELECTION : - pSet = pSelectionSet; - break; - case LISTBOX_SECTION : - pSet = pSectionSet; - bSectionChanged = true; - break; - case LISTBOX_SECTIONS : - pSet = pSectionSet; - bSelSectionChanged = true; - break; - case LISTBOX_PAGE : - pSet = pPageSet; - bPageChanged = true; - break; - case LISTBOX_FRAME: - pSet = pFrameSet; - bFrameChanged = true; - break; - } + SfxItemSet* pSet = EvalCurrentSelection(); pTabPage->FillItemSet(pSet); if(pSelectionSet && SfxItemState::SET == pSelectionSet->GetItemState(RES_COL)) @@ -377,6 +335,36 @@ IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void) EndDialog(RET_OK); } +SfxItemSet* SwColumnDlg::EvalCurrentSelection(void) +{ + SfxItemSet* pSet = nullptr; + + switch(nOldSelection) + { + case LISTBOX_SELECTION : + pSet = pSelectionSet; + break; + case LISTBOX_SECTION : + pSet = pSectionSet; + bSectionChanged = true; + break; + case LISTBOX_SECTIONS : + pSet = pSectionSet; + bSelSectionChanged = true; + break; + case LISTBOX_PAGE : + pSet = pPageSet; + bPageChanged = true; + break; + case LISTBOX_FRAME: + pSet = pFrameSet; + bFrameChanged = true; + break; + } + + return pSet; +} + #if OSL_DEBUG_LEVEL < 2 inline #endif diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx index d52d9a7cbbbd..c3bfe0904583 100644 --- a/sw/source/uibase/inc/column.hxx +++ b/sw/source/uibase/inc/column.hxx @@ -64,6 +64,7 @@ class SwColumnDlg : public SfxModalDialog DECL_LINK(ObjectListBoxHdl, ListBox&, void); DECL_LINK(OkHdl, Button*, void); void ObjectHdl(ListBox*); + SfxItemSet* EvalCurrentSelection(void); public: SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh); |