Kaydet (Commit) 360b9d52 authored tarafından Jim Raykowski's avatar Jim Raykowski Kaydeden (comit) Michael Stahl

tdf#124305 Make multiselected outline moves keep selections

Change-Id: Ic89a07a6ac3103da77fae8d28f4295fd17c35f89
Reviewed-on: https://gerrit.libreoffice.org/69602
Tested-by: Jenkins
Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 5780a495
......@@ -2109,7 +2109,7 @@ bool SwContentTree::HasContentChanged()
}
}
}
if( !bRepaint && bOutline )
if( !bRepaint && bOutline && !HasFocus() )
{
// find out where the cursor is
const SwOutlineNodes::size_type nActPos = GetWrtShell()->GetOutlinePos(MAXLEVEL);
......@@ -2126,9 +2126,12 @@ bool SwContentTree::HasContentChanged()
MakeVisible(pFirstEntry);
}
}
else
Select(pFirstEntry, false);
else if (IsSelected(pFirstEntry))
{
SvTreeListBox::SelectListEntry(pFirstEntry, false);
}
}
bInvalidate = true;
}
......@@ -2355,7 +2358,10 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
switch (rHint.GetId())
{
case SfxHintId::DocChanged:
m_bViewHasChanged = true;
if (!(m_bIsRoot && m_nRootType == ContentTypeId::OUTLINE && HasFocus()))
{
m_bViewHasChanged = true;
}
break;
case SfxHintId::ModeChanged:
if (SwWrtShell* pShell = GetWrtShell())
......@@ -2394,6 +2400,7 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bOutlineWithChildren)
sal_Int8 nActOutlineLevel = m_nOutlineLevel;
SwOutlineNodes::size_type nActPos = pShell->GetOutlinePos(nActOutlineLevel);
std::vector<SwTextNode*> selectedOutlineNodes;
std::vector<SvTreeListEntry*> selected;
for (SvTreeListEntry * pEntry = FirstSelected(); pEntry; pEntry = NextSelected(pEntry))
{
......@@ -2416,6 +2423,16 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bOutlineWithChildren)
if (!bSkip)
{
selected.push_back(pEntry);
const SwNodes& rNodes = pShell->GetNodes();
const sal_uLong nPos = GetAbsPos(pEntry) - 1;
if (nPos < rNodes.GetOutLineNds().size())
{
SwNode* pNode = rNodes.GetOutLineNds()[ nPos ];
if (pNode)
{
selectedOutlineNodes.push_back(pNode->GetTextNode());
}
}
}
}
if (bUpDown && !bUp)
......@@ -2628,6 +2645,26 @@ void SwContentTree::ExecCommand(const OUString& rCmd, bool bOutlineWithChildren)
}
}
}
else
{
// Reselect entries
const SwOutlineNodes& rOutLineNds = pShell->GetNodes().GetOutLineNds();
for (SwTextNode* pNode : selectedOutlineNodes)
{
SwOutlineNodes::const_iterator aFndIt = rOutLineNds.find(pNode);
if(aFndIt == rOutLineNds.end())
continue;
const size_t nFndPos = aFndIt - rOutLineNds.begin();
SvTreeListEntry* pEntry = GetEntryAtAbsPos(nFndPos + 1);
if (pEntry)
{
SvTreeListBox::SelectListEntry(pEntry, true);
if (!IsExpanded(pEntry->GetParent()))
Expand(pEntry->GetParent());
}
}
SvTreeListBox::Invalidate();
}
}
}
......
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