Kaydet (Commit) b12823aa authored tarafından qarkai's avatar qarkai Kaydeden (comit) Michael Stahl

tdf#39593 move duplicate code to separate method

Change-Id: I89c809a220efc006d3b5b0675c050ff07cb2dbfe
Reviewed-on: https://gerrit.libreoffice.org/33380Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst ebe83479
...@@ -235,31 +235,11 @@ IMPL_LINK(SwColumnDlg, ObjectListBoxHdl, ListBox&, rBox, void) ...@@ -235,31 +235,11 @@ IMPL_LINK(SwColumnDlg, ObjectListBoxHdl, ListBox&, rBox, void)
{ {
ObjectHdl(&rBox); ObjectHdl(&rBox);
} }
void SwColumnDlg::ObjectHdl(ListBox* pBox) void SwColumnDlg::ObjectHdl(ListBox* pBox)
{ {
SfxItemSet* pSet = nullptr; SfxItemSet* pSet = EvalCurrentSelection();
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;
}
if(pBox) if(pBox)
{ {
pTabPage->FillItemSet(pSet); pTabPage->FillItemSet(pSet);
...@@ -300,29 +280,7 @@ void SwColumnDlg::ObjectHdl(ListBox* pBox) ...@@ -300,29 +280,7 @@ void SwColumnDlg::ObjectHdl(ListBox* pBox)
IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void) IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void)
{ {
// evaluate current selection // evaluate current selection
SfxItemSet* pSet = nullptr; SfxItemSet* pSet = EvalCurrentSelection();
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;
}
pTabPage->FillItemSet(pSet); pTabPage->FillItemSet(pSet);
if(pSelectionSet && SfxItemState::SET == pSelectionSet->GetItemState(RES_COL)) if(pSelectionSet && SfxItemState::SET == pSelectionSet->GetItemState(RES_COL))
...@@ -377,6 +335,36 @@ IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void) ...@@ -377,6 +335,36 @@ IMPL_LINK_NOARG(SwColumnDlg, OkHdl, Button*, void)
EndDialog(RET_OK); 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 #if OSL_DEBUG_LEVEL < 2
inline inline
#endif #endif
......
...@@ -64,6 +64,7 @@ class SwColumnDlg : public SfxModalDialog ...@@ -64,6 +64,7 @@ class SwColumnDlg : public SfxModalDialog
DECL_LINK(ObjectListBoxHdl, ListBox&, void); DECL_LINK(ObjectListBoxHdl, ListBox&, void);
DECL_LINK(OkHdl, Button*, void); DECL_LINK(OkHdl, Button*, void);
void ObjectHdl(ListBox*); void ObjectHdl(ListBox*);
SfxItemSet* EvalCurrentSelection(void);
public: public:
SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh); SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh);
......
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