sw/qa/uitest/navigator/tdf140661.py |    5 ++++-
 sw/source/uibase/utlui/content.cxx  |   18 +++++++-----------
 2 files changed, 11 insertions(+), 12 deletions(-)

New commits:
commit 9e046e43fc6d3fecd193da076c0871a458ba71dd
Author:     Jim Raykowski <[email protected]>
AuthorDate: Thu Dec 9 20:22:07 2021 -0900
Commit:     Jim Raykowski <[email protected]>
CommitDate: Tue Dec 14 01:32:37 2021 +0100

    tdf#134960 List drawing objects in order of appearance in document
    
    in Writer Navigator drawing objects content type member list
    
    Current code seems like it should work but GetFrameOfModified doesn't
    provide layout position for drawing objects like it does for table and
    frame objects. This patch gets position of drawing object in document
    directly from SdrObject.
    
    Change-Id: I501757900f265370d8e3b606cb4b3a81464e73f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126627
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    Reviewed-by: Jim Raykowski <[email protected]>

diff --git a/sw/qa/uitest/navigator/tdf140661.py 
b/sw/qa/uitest/navigator/tdf140661.py
index 258dd5e5ee63..d6c79eb2a00b 100644
--- a/sw/qa/uitest/navigator/tdf140661.py
+++ b/sw/qa/uitest/navigator/tdf140661.py
@@ -34,8 +34,11 @@ class tdf140661(UITestCase):
             self.assertEqual('DrawObject1', 
get_state_as_dict(xDrawings.getChild('0'))['Text'])
         else:
             self.assertEqual(12, len(xDrawings.getChildren()))
+
+            # tdf#134960
+            expectedShapeOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6]
             for i in range(12):
-                self.assertEqual('Shape' + str(i + 1), 
get_state_as_dict(xDrawings.getChild(str(i)))['Text'])
+                self.assertEqual('Shape' + str(expectedShapeOrder[i]), 
get_state_as_dict(xDrawings.getChild(str(i)))['Text'])
 
         xDrawings.executeAction("COLLAPSE", tuple())
 
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index d181182de36b..1a8db68e9baa 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1035,18 +1035,14 @@ void SwContentType::FillMemberList(bool* 
pbLevelOrVisibilityChanged)
                     // #i51726# - all drawing objects can be named now
                     if (!pTemp->GetName().isEmpty())
                     {
-                        SwContact* pContact = 
static_cast<SwContact*>(pTemp->GetUserCall());
-                        tools::Long nYPos = 0;
-                        const Point aNullPt;
-                        if(pContact && pContact->GetFormat())
-                            nYPos = 
pContact->GetFormat()->FindLayoutRect(false, &aNullPt).Top();
-                        SwContent* pCnt = new SwContent(
-                                            this,
-                                            pTemp->GetName(),
-                                            nYPos);
-                        if(!rIDDMA.IsVisibleLayerId(pTemp->GetLayer()))
+                        tools::Long nYPos = LONG_MIN;
+                        const bool bIsVisible = 
rIDDMA.IsVisibleLayerId(pTemp->GetLayer());
+                        if (bIsVisible)
+                            nYPos = pTemp->GetLogicRect().Top();
+                        auto pCnt(std::make_unique<SwContent>(this, 
pTemp->GetName(), nYPos));
+                        if (!bIsVisible)
                             pCnt->SetInvisible();
-                        m_pMember->insert(std::unique_ptr<SwContent>(pCnt));
+                        m_pMember->insert(std::move(pCnt));
                         m_nMemberCount++;
                     }
                 }

Reply via email to