summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-10-04 18:57:55 -0800
committerJim Raykowski <raykowj@gmail.com>2021-10-06 08:03:30 +0200
commitcca6092c43e6f5ff56251b2fd43e7530b99358e3 (patch)
treefdfd722bf569a2fa8e5e71c6863bea14cd9b3cf4 /sw/source/uibase/utlui
parentcf739db1d6261c43b5b28c6795a4b5b30156478f (diff)
tdf#144788 SwNavigator: Group footnotes and endnotes separately
This is a follow-up patch to separately group footnotes and endnotes under the Footnotes and Endnotes category. A separator line is shown to distinguish between footnote and endnote entries. Entries above the line are footnotes, entries below are endnotes. A tool tip is also displayed to distinguish between them. Change-Id: I2c4c3ab074da3bd6ba60220f8e7bcc60125bf81f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123124 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/content.cxx53
1 files changed, 46 insertions, 7 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index e26179b42348..fb7aab99847d 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -864,6 +864,21 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
case ContentTypeId::FOOTNOTE:
{
const SwFootnoteIdxs& rFootnoteIdxs = m_pWrtShell->GetDoc()->GetFootnoteIdxs();
+ size_t nFootnoteCount = 0;
+ for (SwTextFootnote* pTextFootnote : rFootnoteIdxs)
+ if (!pTextFootnote->GetFootnote().IsEndNote())
+ ++nFootnoteCount;
+ // insert a separator bar between footnote and endnote entries
+ if (rFootnoteIdxs.size())
+ {
+
+ std::unique_ptr<SwTextFootnoteContent> pCnt(new SwTextFootnoteContent(
+ this, "-------------------------------",
+ nullptr, nFootnoteCount + 1));
+ pCnt->SetInvisible();
+ m_pMember->insert(std::move(pCnt));
+ }
+ tools::Long nPos = 0, nInsertPos = 0;
for (SwTextFootnote* pTextFootnote : rFootnoteIdxs)
{
const SwFormatFootnote& rFormatFootnote = pTextFootnote->GetFootnote();
@@ -871,9 +886,13 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
rFormatFootnote.GetViewNumStr(*m_pWrtShell->GetDoc(),
m_pWrtShell->GetLayout(), true) + " " +
rFormatFootnote.GetFootnoteText(*m_pWrtShell->GetLayout());
+ if (rFormatFootnote.IsEndNote())
+ nInsertPos = nPos + nFootnoteCount + 2;
+ else
+ nInsertPos = ++nPos;
std::unique_ptr<SwTextFootnoteContent> pCnt(new SwTextFootnoteContent(
this, sText, pTextFootnote,
- rFormatFootnote.GetNumber()));
+ nInsertPos));
if (!pTextFootnote->GetTextNode().getLayoutFrame(m_pWrtShell->GetLayout()))
pCnt->SetInvisible();
m_pMember->insert(std::move(pCnt));
@@ -1627,6 +1646,14 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
ContentTypeId::INDEX == nContentType ||
ContentTypeId::DRAWOBJECT == nContentType);
+ if (ContentTypeId::FOOTNOTE == nContentType)
+ {
+ void* pUserData = reinterpret_cast<void*>(m_xTreeView->get_id(*xEntry).toInt64());
+ const SwTextFootnote* pFootnote =
+ static_cast<const SwTextFootnoteContent*>(pUserData)->GetTextFootnote();
+ if (!pFootnote)
+ xPop->remove(OString::number(900)); // go to
+ }
if(ContentTypeId::OUTLINE == nContentType)
{
bOutline = true;
@@ -4143,10 +4170,15 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin
}
break;
case ContentTypeId::FOOTNOTE:
+ {
assert(dynamic_cast<SwTextFootnoteContent*>(static_cast<SwTypeNumber*>(pUserData)));
- sEntry = static_cast<SwTextFootnoteContent*>(pUserData)->GetTextFootnote()->
- GetFootnote().IsEndNote() ? SwResId(STR_CONTENT_ENDNOTE) :
- SwResId(STR_CONTENT_FOOTNOTE);
+ const SwTextFootnote* pFootnote =
+ static_cast<const SwTextFootnoteContent*>(pUserData)->GetTextFootnote();
+ if (!pFootnote)
+ return SwResId(STR_FOOTNOTE_ENDNOTE_SEPARATOR_TIP);
+ sEntry = pFootnote->GetFootnote().IsEndNote() ? SwResId(STR_CONTENT_ENDNOTE) :
+ SwResId(STR_CONTENT_FOOTNOTE);
+ }
break;
default: break;
}
@@ -4159,7 +4191,9 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin
}
else
{
- const size_t nMemberCount = static_cast<SwContentType*>(pUserData)->GetMemberCount();
+ size_t nMemberCount = static_cast<SwContentType*>(pUserData)->GetMemberCount();
+ if (nMemberCount && nType == ContentTypeId::FOOTNOTE)
+ --nMemberCount; // account for horizontal footnote endnote separator entry
sEntry = OUString::number(nMemberCount) + " " +
(nMemberCount == 1
? static_cast<SwContentType*>(pUserData)->GetSingleName()
@@ -4886,8 +4920,13 @@ void SwContentTree::GotoContent(const SwContent* pCnt)
}
break;
case ContentTypeId::FOOTNOTE:
- m_pActiveShell->GotoFootnoteAnchor(
- *static_cast<const SwTextFootnoteContent*>(pCnt)->GetTextFootnote());
+ {
+ const SwTextFootnote* pFootnote =
+ static_cast<const SwTextFootnoteContent*>(pCnt)->GetTextFootnote();
+ if (!pFootnote)
+ return;
+ m_pActiveShell->GotoFootnoteAnchor(*pFootnote);
+ }
break;
default: break;
}