Kaydet (Commit) 743c7c09 authored tarafından Matteo Casalin's avatar Matteo Casalin Kaydeden (comit) Michael Stahl

SwGlTreeListBox: NotifyCoping and NotifyMoving almost equal

Change-Id: I4cb9f7fccb7d5525a84dc8f5b1f25d1350d0f106
Reviewed-on: https://gerrit.libreoffice.org/5615Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 45f2cba6
...@@ -70,6 +70,10 @@ class SwGlTreeListBox : public SvTreeListBox ...@@ -70,6 +70,10 @@ class SwGlTreeListBox : public SvTreeListBox
SvTreeListEntry* pEntry, SvTreeListEntry* pEntry,
SvTreeListEntry*& rpNewParent, SvTreeListEntry*& rpNewParent,
sal_uLong& rNewChildPos); sal_uLong& rNewChildPos);
sal_Bool NotifyCopyingOrMoving( SvTreeListEntry* pTarget,
SvTreeListEntry* pEntry,
bool bIsMove);
public: public:
SwGlTreeListBox(Window* pParent, WinBits nBits); SwGlTreeListBox(Window* pParent, WinBits nBits);
......
...@@ -954,44 +954,7 @@ sal_Bool SwGlTreeListBox::NotifyMoving( SvTreeListEntry* pTarget, ...@@ -954,44 +954,7 @@ sal_Bool SwGlTreeListBox::NotifyMoving( SvTreeListEntry* pTarget,
sal_uLong& /*rNewChildPos*/ sal_uLong& /*rNewChildPos*/
) )
{ {
pDragEntry = 0; return NotifyCopyingOrMoving(pTarget, pEntry, true);
if(!pTarget) // move to the beginning
{
pTarget = GetEntry(0);
}
// 1. move to different groups?
// 2. allowed to write in both groups?
SvTreeListEntry* pSrcParent = GetParent(pEntry);
SvTreeListEntry* pDestParent =
GetParent(pTarget) ? GetParent(pTarget) : pTarget;
sal_Bool bRet = sal_False;
if(pDestParent != pSrcParent)
{
SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParentDialog();
SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True );
GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData();
OUString sSourceGroup = pGroupData->sGroupName
+ OUString(GLOS_DELIM)
+ OUString::number(pGroupData->nPathIdx);
pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup);
OUString sTitle(GetEntryText(pEntry));
OUString sShortName(*(String*)pEntry->GetUserData());
GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData();
OUString sDestName = pDestData->sGroupName
+ OUString(GLOS_DELIM)
+ OUString::number(pDestData->nPathIdx);
bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName,
sDestName, sTitle, sal_True );
if(bRet)
{
SvTreeListEntry* pChild = InsertEntry(sTitle, pDestParent);
pChild->SetUserData(new String(sShortName));
GetModel()->Remove(pEntry);
}
}
return sal_False; // otherwise the entry is being set automatically
} }
sal_Bool SwGlTreeListBox::NotifyCopying( SvTreeListEntry* pTarget, sal_Bool SwGlTreeListBox::NotifyCopying( SvTreeListEntry* pTarget,
...@@ -999,6 +962,14 @@ sal_Bool SwGlTreeListBox::NotifyCopying( SvTreeListEntry* pTarget, ...@@ -999,6 +962,14 @@ sal_Bool SwGlTreeListBox::NotifyCopying( SvTreeListEntry* pTarget,
SvTreeListEntry*& /*rpNewParent*/, SvTreeListEntry*& /*rpNewParent*/,
sal_uLong& /*rNewChildPos*/ sal_uLong& /*rNewChildPos*/
) )
{
return NotifyCopyingOrMoving(pTarget, pEntry, false);
}
sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving(
SvTreeListEntry* pTarget,
SvTreeListEntry* pEntry,
bool bIsMove)
{ {
pDragEntry = 0; pDragEntry = 0;
// 1. move in different groups? // 1. move in different groups?
...@@ -1031,11 +1002,15 @@ sal_Bool SwGlTreeListBox::NotifyCopying( SvTreeListEntry* pTarget, ...@@ -1031,11 +1002,15 @@ sal_Bool SwGlTreeListBox::NotifyCopying( SvTreeListEntry* pTarget,
+ OUString::number(pDestData->nPathIdx); + OUString::number(pDestData->nPathIdx);
bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName, bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName,
sDestName, sTitle, sal_False ); sDestName, sTitle, bIsMove );
if(bRet) if(bRet)
{ {
SvTreeListEntry* pChild = InsertEntry(sTitle, pDestParent); SvTreeListEntry* pChild = InsertEntry(sTitle, pDestParent);
pChild->SetUserData(new String(sShortName)); pChild->SetUserData(new String(sShortName));
if (bIsMove)
{
GetModel()->Remove(pEntry);
}
} }
} }
return sal_False; // otherwise the entry is being set automatically return sal_False; // otherwise the entry is being set automatically
......
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