summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx19
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx2
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx6
3 files changed, 6 insertions, 21 deletions
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 7ebdbead067b..16acc0cbf589 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -387,25 +387,6 @@ sal_uInt32 SwAnnotationWin::MoveCaret()
: 1 + CountFollowing();
}
-// returns a non-zero postit parent id, if exists, otherwise 0 for root comments
-sal_uInt32 SwAnnotationWin::CalcParent()
-{
- SwTextField* pTextField = mpFormatField->GetTextField();
- SwPosition aPosition( pTextField->GetTextNode(), pTextField->GetStart() );
- SwTextAttr * const pTextAttr =
- pTextField->GetTextNode().GetTextAttrForCharAt(
- aPosition.GetContentIndex() - 1,
- RES_TXTATR_ANNOTATION );
- const SwField* pField = pTextAttr ? pTextAttr->GetFormatField().GetField() : nullptr;
- sal_uInt32 nParentId = 0;
- if (pField && pField->Which() == SwFieldIds::Postit)
- {
- const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
- nParentId = pPostItField->GetPostItId();
- }
- return nParentId;
-}
-
// counts how many SwPostItField we have right after the current one
sal_uInt32 SwAnnotationWin::CountFollowing()
{
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index e8852a87f6e0..c5ca676895c0 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1118,6 +1118,8 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
// Get newly created SwPostItField and set its paraIdParent
auto pPostItField = mrMgr.GetLatestPostItField();
pPostItField->SetParentId(GetTopReplyNote()->GetParaId());
+ pPostItField->SetParentPostItId(GetTopReplyNote()->GetPostItField()->GetPostItId());
+ pPostItField->SetParentName(GetTopReplyNote()->GetPostItField()->GetName());
}
break;
}
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 07bf10be55c0..a0fda9fd7caa 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -746,7 +746,7 @@ void SwPostItMgr::LayoutPostIts()
pItem->mpPostIt = pPostIt;
if (mpAnswer)
{
- if (static_cast<bool>(pPostIt->CalcParent())) //do we really have another note in front of this one
+ if (pPostIt->GetPostItField()->GetParentPostItId() != 0) //do we really have another note in front of this one
pPostIt->InitAnswer(*mpAnswer);
mpAnswer.reset();
}
@@ -756,7 +756,9 @@ void SwPostItMgr::LayoutPostIts()
pItem->mLayoutStatus,
GetColorAnchor(pItem->maLayoutInfo.mRedlineAuthor));
pPostIt->SetSidebarPosition(pPage->eSidebarPosition);
- pPostIt->SetFollow(static_cast<bool>(pPostIt->CalcParent()));
+
+ if (pPostIt->GetPostItField()->GetParentPostItId() != 0)
+ pPostIt->SetFollow(true);
tools::Long aPostItHeight = 0;
if (bShowNotes)