sw/qa/uitest/navigator/tdf140661.py | 5 ++++- sw/source/uibase/utlui/content.cxx | 18 +++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-)
New commits: commit 2b035eb5ba1f9600ea19937519cbc9068c31263b Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Thu Dec 9 20:22:07 2021 -0900 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Dec 14 11:12:36 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 <xiscofa...@libreoffice.org> Reviewed-by: Jim Raykowski <rayk...@gmail.com> (cherry picked from commit 9e046e43fc6d3fecd193da076c0871a458ba71dd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126808 diff --git a/sw/qa/uitest/navigator/tdf140661.py b/sw/qa/uitest/navigator/tdf140661.py index 75b496b027f9..5c1b6ac50385 100644 --- a/sw/qa/uitest/navigator/tdf140661.py +++ b/sw/qa/uitest/navigator/tdf140661.py @@ -32,8 +32,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 380af4aba7a4..93b2af042fe7 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++; } }