summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/AnnotationWin.hxx3
-rw-r--r--sw/inc/SidebarWin.hxx2
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx12
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx6
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx2
5 files changed, 16 insertions, 9 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 07dde376b880..0062f96481e5 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -52,7 +52,8 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
virtual sal_uInt32 MoveCaret() override;
- virtual bool CalcFollow() override;
+ /// Calculate parent postit id of currrent annotation window
+ virtual sal_uInt32 CalcParent() override;
void InitAnswer(OutlinerParaObject* pText);
virtual bool IsProtected() override;
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index 742e2f29c5b3..bb6dab546d5b 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -146,7 +146,7 @@ class SwSidebarWin : public vcl::Window
bool IsFollow() { return mbIsFollow; }
void SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
- virtual bool CalcFollow() = 0;
+ virtual sal_uInt32 CalcParent() = 0;
sal_Int32 GetMetaHeight();
sal_Int32 GetMinimumSizeWithMeta();
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 8d9bff9a2a51..d8cca6fad7bd 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -177,8 +177,8 @@ sal_uInt32 SwAnnotationWin::MoveCaret()
: 1 + CountFollowing();
}
-//returns true, if there is another note right before this note
-bool SwAnnotationWin::CalcFollow()
+// 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() );
@@ -188,7 +188,13 @@ bool SwAnnotationWin::CalcFollow()
aPosition.nContent.GetIndex() - 1,
RES_TXTATR_ANNOTATION );
const SwField* pField = pTextAttr ? pTextAttr->GetFormatField().GetField() : nullptr;
- return pField && (pField->Which()== RES_POSTITFLD);
+ sal_uInt32 nParentId = 0;
+ if (pField && pField->Which() == RES_POSTITFLD)
+ {
+ const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
+ nParentId = pPostItField->GetPostItId();
+ }
+ return nParentId;
}
// counts how many SwPostItField we have right after the current one
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 43b1b55b7db0..0e9a01e31e5f 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -161,7 +161,7 @@ namespace {
const OString sRects = comphelper::string::join("; ", aRects);
aAnnotation.put("id", pField->GetPostItId());
- aAnnotation.put("reply", pWin->IsFollow());
+ aAnnotation.put("parent", pWin->CalcParent());
aAnnotation.put("author", pField->GetPar1().toUtf8().getStr());
aAnnotation.put("text", pField->GetPar2().toUtf8().getStr());
aAnnotation.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime()));
@@ -743,7 +743,7 @@ void SwPostItMgr::LayoutPostIts()
pItem->pPostIt = pPostIt;
if (mpAnswer)
{
- if (pPostIt->CalcFollow()) //do we really have another note in front of this one
+ if (static_cast<bool>(pPostIt->CalcParent())) //do we really have another note in front of this one
static_cast<sw::annotation::SwAnnotationWin*>(pPostIt.get())->InitAnswer(mpAnswer);
delete mpAnswer;
mpAnswer = nullptr;
@@ -754,7 +754,7 @@ void SwPostItMgr::LayoutPostIts()
pItem->mLayoutStatus,
GetColorAnchor(pItem->maLayoutInfo.mRedlineAuthor));
pPostIt->SetSidebarPosition(pPage->eSidebarPosition);
- pPostIt->SetFollow(pPostIt->CalcFollow());
+ pPostIt->SetFollow(static_cast<bool>(pPostIt->CalcParent()));
aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta()
? pPostIt->GetMinimumSizeWithoutMeta()
: pPostIt->GetPostItTextHeight() )
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index a43658300749..549b150198f0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3205,7 +3205,7 @@ OUString SwXTextDocument::getPostIts()
boost::property_tree::ptree aAnnotation;
aAnnotation.put("id", pField->GetPostItId());
- aAnnotation.put("reply", pWin->IsFollow());
+ aAnnotation.put("parent", pWin->CalcParent());
aAnnotation.put("author", pField->GetPar1().toUtf8().getStr());
aAnnotation.put("text", pField->GetPar2().toUtf8().getStr());
aAnnotation.put("dateTime", utl::toISO8601(pField->GetDateTime().GetUNODateTime()));