summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoren De Cuyper <joren.libreoffice@telenet.be>2013-03-06 18:10:26 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-03-12 23:49:21 +0000
commit868f3485126827f6baf7179d1c2c3c20812cac9b (patch)
treeb824c46e179394b2f48677c88d6f906e78a86476
parenta3d299e15526fdcbcaae269e33a83a9c0b187a5a (diff)
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/2572 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx26
1 files changed, 25 insertions, 1 deletions
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index cd94ba066259..1a7c06365986 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -90,7 +90,31 @@ using namespace sw::sidebarwindows;
bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
{
// 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)