summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-12-17 16:36:40 -0900
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-21 12:37:36 +0100
commit6c9f77e2f776f3a28764e423bbe42696c0b0627c (patch)
treee11da15119871b434d939ac0aff421c1cf17112d /sw/source
parent40b84167a58901d50d98730260d968046283376c (diff)
tdf#143569 fix fly frame Headings out of order in Navigator
This fix uses the function that is used to determine SwSectionsContent nYPos. Using this approach also works to make the listing order of members of outline content type (Headings) the same order as they appear in the document. Change-Id: I108994553026e05088b103e1094e38a94d6608be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127022 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com> (cherry picked from commit c8ac73daa670ab571c3d52541c67c28270ee6a08) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127182 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/utlui/content.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 774576df7d22..69443e613a82 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -306,8 +306,8 @@ namespace
return false;
}
-// Gets "YPos" for SwRegionContent, i.e. a number used to sort sections in Navigator's list
-sal_Int32 getYPosForSection(const SwNodeIndex& rNodeIndex)
+// Gets "YPos" for SwRegionContent or SwOutlineContent, i.e. a number used to sort sections in Navigator's list
+sal_Int32 getYPosForSectionOrOutline(const SwNodeIndex& rNodeIndex)
{
SwNodeOffset nIndex = rNodeIndex.GetIndex();
if (rNodeIndex.GetNodes().GetEndOfExtras().GetIndex() >= nIndex)
@@ -319,7 +319,7 @@ sal_Int32 getYPosForSection(const SwNodeIndex& rNodeIndex)
// Get node index of anchor
if (auto pSwPosition = pFlyFormat->GetAnchor().GetContentAnchor())
{
- return getYPosForSection(pSwPosition->nNode);
+ return getYPosForSectionOrOutline(pSwPosition->nNode);
}
}
}
@@ -473,7 +473,7 @@ void SwContentType::Init(bool* pbInvalidateWindow)
}
std::unique_ptr<SwContent> pCnt(new SwRegionContent(this, rSectionName,
- nLevel, getYPosForSection(*pNodeIndex)));
+ nLevel, getYPosForSectionOrOutline(*pNodeIndex)));
SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, nullptr );
if( !pFormat->GetInfo( aAskItem ) &&
@@ -652,12 +652,14 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
--m_nMemberCount;
continue; // don't hide it, just skip it
}
+ tools::Long nYPos = getYPosForSectionOrOutline(
+ *m_pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNode(i));
OUString aEntry(comphelper::string::stripStart(
m_pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(
i, m_pWrtShell->GetLayout(), true, false, false), ' '));
aEntry = SwNavigationPI::CleanEntry(aEntry);
- std::unique_ptr<SwOutlineContent> pCnt(new SwOutlineContent(this, aEntry, i, nLevel,
- m_pWrtShell->IsOutlineMovable( i ), nPos ));
+ auto pCnt(make_unique<SwOutlineContent>(this, aEntry, i, nLevel,
+ m_pWrtShell->IsOutlineMovable( i ), nYPos));
m_pMember->insert(std::move(pCnt));
// with the same number and existing "pOldMember" the
// old one is compared with the new OutlinePos.
@@ -927,7 +929,7 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
}
std::unique_ptr<SwContent> pCnt(new SwRegionContent(this, sSectionName,
- nLevel, getYPosForSection(*pNodeIndex)));
+ nLevel, getYPosForSectionOrOutline(*pNodeIndex)));
if( !pFormat->GetInfo( aAskItem ) &&
!aAskItem.pObject ) // not visible
pCnt->SetInvisible();