[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 26 06:13:13 UTC 2020
sw/source/uibase/utlui/content.cxx | 53 +++++++++++++++++--------------------
1 file changed, 25 insertions(+), 28 deletions(-)
New commits:
commit 387e0b4f4c33dfaa48b26098819726824f23f9d2
Author: Jim Raykowski <raykowj at gmail..com>
AuthorDate: Mon Feb 24 22:58:45 2020 -0900
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Feb 26 07:12:40 2020 +0100
tdf#108766 followup: outline tracking fixes for floating navigator
Fixes tracking not working and selection misbehaviour on document open
when navigator is floating.
Change-Id: Ic8e3fe7222cba354d6f2ad864ef8083861b8d324
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89409
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index f70f72815075..d55c38febdf9 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1888,28 +1888,28 @@ void SwContentTree::Display( bool bActive )
Expand(pParent);
// reselect the entry
- SvTreeListEntry* pChild = pParent;
- SvTreeListEntry* pTemp = nullptr;
- sal_uLong nPos = 1;
- while(nullptr != (pChild = Next(pChild)))
- {
- // The old text will be slightly favored
- if(sEntryName == GetEntryText(pChild) ||
- nPos == nEntryRelPos )
+ if (nEntryRelPos)
+ {
+ SvTreeListEntry* pChild = pParent;
+ sal_uLong nPos = 1;
+ while(nullptr != (pChild = Next(pChild)))
{
- pSelEntry = pChild;
- break;
+ // The old text will be slightly favored
+ if(sEntryName == GetEntryText(pChild) ||
+ nPos == nEntryRelPos)
+ {
+ pSelEntry = pChild;
+ break;
+ }
+ nPos++;
+ }
+ if(pSelEntry)
+ {
+ SetCurEntry(pSelEntry); // unselect all entries, make pSelEntry visible, and select
}
- pTemp = pChild;
- nPos++;
- }
- if(!pSelEntry)
- pSelEntry = pTemp;
- if(pSelEntry)
- {
- MakeVisible(pSelEntry);
- Select(pSelEntry);
}
+ else
+ SetCurEntry(pParent);
}
}
SetUpdateMode( true );
@@ -2754,10 +2754,9 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void)
// No update while drag and drop.
// Query view because the Navigator is cleared too late.
SwView* pView = GetParentWindow()->GetCreateView();
-
- if(pView && pView->GetWrtShellPtr() &&
- ((pView->GetWrtShellPtr()->GetWin() == GetFocusedWindow()) || m_bViewHasChanged) &&
- !bIsInDrag && !m_bIsInternalDrag && !pView->GetWrtShellPtr()->ActionPend())
+ if(pView && pView->GetWrtShellPtr() && pView->GetWrtShellPtr()->GetWin() &&
+ (pView->GetWrtShellPtr()->GetWin()->HasFocus() || m_bViewHasChanged) &&
+ !bIsInDrag && !m_bIsInternalDrag && !pView->GetWrtShellPtr()->ActionPend())
{
m_bViewHasChanged = false;
m_bIsIdleClear = false;
@@ -2797,11 +2796,11 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void)
if (lcl_IsContent(pEntry) &&
static_cast<SwContent*>(pEntry->GetUserData())->GetParent()->GetType() == ContentTypeId::OUTLINE)
{
- // only select if not already selected
// might have been scrolled out of view by the user so leave it that way
if (static_cast<SwOutlineContent*>(pEntry->GetUserData())->GetOutlinePos() == nActPos)
{
- if (pEntry != pFirstSelected)
+ // only select if not already selected or tree has multiple entries selected
+ if (pEntry != pFirstSelected || GetSelectionCount() > 1)
{
if (m_nOutlineTracking == 2) // focused outline tracking
{
@@ -2814,9 +2813,7 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate, Timer *, void)
break;
}
}
- SelectAll(false);
- Select(pEntry);
- MakeVisible(pEntry);
+ SetCurEntry(pEntry); // unselect all entries, make pEntry visible, and select
}
break;
}
More information about the Libreoffice-commits
mailing list