summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui/content.cxx
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2019-03-23 23:42:24 -0800
committerMichael Stahl <Michael.Stahl@cib.de>2019-05-24 13:10:20 +0200
commit360b9d52e9d0e7e70ad8432802886073bbd6ee3d (patch)
treed2585263e6855f613ac79ae4bb4ac4b39992e88c /sw/source/uibase/utlui/content.cxx
parent5780a495872bbcc9df595c534425515727516a4a (diff)
tdf#124305 Make multiselected outline moves keep selections
Change-Id: Ic89a07a6ac3103da77fae8d28f4295fd17c35f89 Reviewed-on: https://gerrit.libreoffice.org/69602 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw/source/uibase/utlui/content.cxx')
-rw-r--r--sw/source/uibase/utlui/content.cxx45
1 files changed, 41 insertions, 4 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 2f482dbcf94b..21d7e3a1ecb2 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -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();
+ }
}
}