[Libreoffice-commits] core.git: Branch 'libreoffice-3-6' - sw/source

Joren De Cuyper joren.libreoffice at telenet.be
Mon Mar 18 03:24:56 PDT 2013


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

New commits:
commit 271e47b20da7581b2cf1518dd3274c1348bf7083
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.
    
    I also merged (manually) the changes of the cleanup
    commit of Michael Stahl ( commit id 859e94294bdfd8595c88dd7f14da09ead8b32a45 )
    
    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>
    Reviewed-on: https://gerrit.libreoffice.org/2788
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index c82a782..d9ffdd8 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -99,7 +99,33 @@ 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 false;
+    // if aAnchorA is not placed in a footnote, and aAnchorB is
+    // force a change over
+    else if( !aAnchorAInFooter && aAnchorBInFooter )
+        return true;
+    // If neither or both are in the footer, compare the positions.
+    // Since footnotes are in Inserts section of nodes array and footers
+    // in Autotext section, all footnotes precede any footers so no need
+    // to check that.
+    else
+        return aPosAnchorA < aPosAnchorB;
 }
 
 SwPostItMgr::SwPostItMgr(SwView* pView)


More information about the Libreoffice-commits mailing list