Kaydet (Commit) 868f3485 authored tarafından Joren De Cuyper's avatar Joren De Cuyper Kaydeden (comit) Fridrich Strba

fdo#34800 Comments added to footer are placed at the right top of the page.

The problem is that the nodes in the Footnote and Footer are stored before
nodes of the document body in the internal structure.

Therefore I wrote this patch to check if the compared
comments are in the Footnote or Footer.
We don't need to check our comment is placed in the header
because it is already the most upper node of the whole document.

Test document: https://bugs.freedesktop.org/attachment.cgi?id=76038

Special thanks to Cédric Bosdonnat and Miklos Vajna

Change-Id: Ibcd0373110fde848dccf93ffe9100459c7cc64a5
Reviewed-on: https://gerrit.libreoffice.org/2572Reviewed-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
Tested-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
üst a3d299e1
...@@ -90,7 +90,31 @@ using namespace sw::sidebarwindows; ...@@ -90,7 +90,31 @@ using namespace sw::sidebarwindows;
bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b) bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
{ {
// sort by anchor position // sort by anchor position
return a->GetAnchorPosition() < b->GetAnchorPosition(); SwPosition aPosAnchorA = a->GetAnchorPosition();
SwPosition aPosAnchorB = b->GetAnchorPosition();
bool aAnchorAInFooter = false;
bool aAnchorBInFooter = false;
// is the anchor placed in Footnote or the Footer?
if( aPosAnchorA.nNode.GetNode().FindFootnoteStartNode() || aPosAnchorA.nNode.GetNode().FindFooterStartNode() )
aAnchorAInFooter = true;
if( aPosAnchorB.nNode.GetNode().FindFootnoteStartNode() || aPosAnchorB.nNode.GetNode().FindFooterStartNode() )
aAnchorBInFooter = true;
// fdo#34800
// if AnchorA is in footnote, and AnchorB isn't
// we do not want to change over the position
if( aAnchorAInFooter && !aAnchorBInFooter )
return 0;
// if aAnchorA is not placed in a footnote, and aAnchorB is
// force a change over
else if( !aAnchorAInFooter && aAnchorBInFooter )
return 1;
// if none of both, or both are in the footer
// arrange them depending on the position
else
return aPosAnchorA < aPosAnchorB;
} }
SwPostItMgr::SwPostItMgr(SwView* pView) SwPostItMgr::SwPostItMgr(SwView* pView)
......
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