sw/qa/uitest/data/tdf134960.odt     |binary
 sw/qa/uitest/navigator/tdf134960.py |   43 ++++++++++++++++++++++++++++++++++++
 sw/source/uibase/utlui/content.cxx  |    4 ++-
 3 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit 64065ade86cac68b9d500f0495ffc5745a944819
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Dec 16 21:30:19 2021 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Dec 21 06:35:56 2021 +0100

    tdf#134960 List hyperlinks in order of apperance in the document
    
    in Writer Navigator Hyperlinks content type member list
    
    Change-Id: I0473c767478b1125acbb7e1b4bda99ac22934884
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126992
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/qa/uitest/data/tdf134960.odt b/sw/qa/uitest/data/tdf134960.odt
new file mode 100644
index 000000000000..d75337522abe
Binary files /dev/null and b/sw/qa/uitest/data/tdf134960.odt differ
diff --git a/sw/qa/uitest/navigator/tdf134960.py 
b/sw/qa/uitest/navigator/tdf134960.py
new file mode 100644
index 000000000000..7d349fa03ed2
--- /dev/null
+++ b/sw/qa/uitest/navigator/tdf134960.py
@@ -0,0 +1,43 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf134960_hyperlinks(UITestCase):
+
+    def test_tdf134960_hyperlinks(self):
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as 
writer_doc:
+
+            xMainWindow = self.xUITest.getTopFocusWindow()
+            xWriterEdit = xMainWindow.getChild("writer_edit")
+
+            self.xUITest.executeCommand(".uno:Sidebar")
+
+            xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": 
"SwNavigatorPanel"}))
+
+            # wait until the navigator panel is available
+            xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
+
+            xContentTree = xNavigatorPanel.getChild("contenttree")
+            xHyperlinks = xContentTree.getChild('7')
+            self.assertEqual('Hyperlinks', 
get_state_as_dict(xHyperlinks)['Text'])
+
+            xHyperlinks.executeAction("EXPAND", tuple())
+
+            expectedHyperlinksOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6]
+            for i in range(12):
+                self.assertEqual('Hyperlink ' + 
str(expectedHyperlinksOrder[i]), 
get_state_as_dict(xHyperlinks.getChild(str(i)))['Text'])
+
+            xHyperlinks.executeAction("COLLAPSE", tuple())
+
+            self.xUITest.executeCommand(".uno:Sidebar")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index f82e2b64daa5..c2bcd914ef1e 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -190,6 +190,8 @@ namespace
         for( SwGetINetAttrs::size_type n = 0; n < nCount; ++n )
         {
             SwGetINetAttr* p = &aArr[ n ];
+            tools::Long nYPos = 
p->rINetAttr.GetTextNode().FindLayoutRect().Top()
+                    + p->rINetAttr.GetStart();
             std::unique_ptr<SwURLFieldContent> pCnt(new SwURLFieldContent(
                                 pCntType,
                                 p->sText,
@@ -197,7 +199,7 @@ namespace
                                     p->rINetAttr.GetINetFormat().GetValue(),
                                     
INetURLObject::DecodeMechanism::Unambiguous ),
                                 &p->rINetAttr,
-                                n ));
+                                nYPos));
             pMember->insert( std::move(pCnt) );
         }
         return nCount;

Reply via email to