[Libreoffice-commits] core.git: sw/source

Joren De Cuyper joren.libreoffice at telenet.be
Tue Mar 12 16:49:42 PDT 2013


 sw/source/ui/docvw/PostItMgr.cxx |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 868f3485126827f6baf7179d1c2c3c20812cac9b
Author: Joren De Cuyper <joren.libreoffice at telenet.be>
Date:   Wed Mar 6 18:10:26 2013 +0100

    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 at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index cd94ba0..1a7c063 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)


More information about the Libreoffice-commits mailing list