diff options
-rw-r--r-- | sw/inc/docufld.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/fields/docufld.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/txtnode/thints.cxx | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index f1023e372970..32ab1d5d12ba 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -481,6 +481,7 @@ public: Date GetDate() const { return Date(m_aDateTime.GetDate()); } tools::Time GetTime() const { return tools::Time(m_aDateTime.GetTime()); } sal_uInt32 GetPostItId() const { return m_nPostItId; } + void SetPostItId(const sal_uInt32 nPostItId = 0); /// Author virtual OUString GetPar1() const override; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 902a7bcea33a..a3b5d5a5e12d 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1831,6 +1831,11 @@ sal_Int32 SwPostItField::GetNumberOfParagraphs() const return mpText ? mpText->Count() : 1; } +void SwPostItField::SetPostItId(const sal_uInt32 nPostItId) +{ + m_nPostItId = nPostItId == 0 ? s_nLastPostItId++ : nPostItId; +} + bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const { switch( nWhichId ) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 75f04356e476..71d0263850d2 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1092,7 +1092,9 @@ SwTextAttr* MakeTextAttr( // the relation to its annotation mark (relation established via annotation field's name). // If the annotation mark is also copied, the relation and thus the annotated text range will be reestablished, // when the annotation mark is created and inserted into the document. - const_cast<SwPostItField&>(dynamic_cast<const SwPostItField&>(*(pNew->GetFormatField().GetField()))).SetName(OUString()); + auto& pField = const_cast<SwPostItField&>(dynamic_cast<const SwPostItField&>(*(pNew->GetFormatField().GetField()))); + pField.SetName(OUString()); + pField.SetPostItId(); } } break; |