[Libreoffice-commits] core.git: sw/source
qarkai
qarkai at gmail.com
Wed Feb 1 16:31:01 UTC 2017
sw/source/ui/frmdlg/column.cxx | 80 +++++++++++++++++-----------------------
sw/source/uibase/inc/column.hxx | 1
2 files changed, 35 insertions(+), 46 deletions(-)
New commits:
commit b12823aa81003e80372bd89db79bd6ba8e032a95
Author: qarkai <qarkai at gmail.com>
Date: Sat Jan 21 22:35:19 2017 +0300
tdf#39593 move duplicate code to separate method
Change-Id: I89c809a220efc006d3b5b0675c050ff07cb2dbfe
Reviewed-on: https://gerrit.libreoffice.org/33380
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 6d038be..9954623 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 d52d9a7..c3bfe09 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);
More information about the Libreoffice-commits
mailing list