[PATCH] Bug 34800 Comments added to footer are placed at the right t...

Joren De Cuyper (via Code Review) gerrit at gerrit.libreoffice.org
Wed Mar 6 09:37:42 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2572

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/72/2572/1

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

The problem is that the nodes in the footnote 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 (one, both or both not).

Special thanks to Cédric Bosdonnat

Change-Id: Ibcd0373110fde848dccf93ffe9100459c7cc64a5
---
M sw/source/ui/docvw/PostItMgr.cxx
1 file changed, 19 insertions(+), 1 deletion(-)



diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index cd94ba0..5465ecf 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -90,7 +90,25 @@
 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 = aPosAnchorA.nNode.GetNode().FindFootnoteStartNode() != NULL;
+    bool aAnchorBInFooter = aPosAnchorB.nNode.GetNode().FindFootnoteStartNode() != NULL;
+
+    // fdo#34800
+    // if AnchorA is in footnote, and AnchorB isn't
+    // we do not want to change over the position
+    if( aAnchorAInFooter && !aAnchorBInFooter )
+        return NULL;
+    // if AnchorA is not placed in a footnote, and AnchorB 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)

-- 
To view, visit https://gerrit.libreoffice.org/2572
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibcd0373110fde848dccf93ffe9100459c7cc64a5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Joren De Cuyper <joren.libreoffice at telenet.be>



More information about the LibreOffice mailing list