[Libreoffice-commits] core.git: sw/inc sw/source

Pranav Kant pranavk at collabora.co.uk
Fri Jan 27 10:53:43 UTC 2017


 sw/inc/docufld.hxx                |    7 ++++++-
 sw/source/core/fields/docufld.cxx |    8 ++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 85959fccad7392646675a515afd09aadaaa9ed17
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Jan 18 17:47:46 2017 +0530

    lok: Unique annotation Ids to SwPostItFields
    
    Change-Id: I6dd5186eb18ca99a75a5cb73263cc6bfcc7ff345
    Reviewed-on: https://gerrit.libreoffice.org/33467
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>

diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 636abaa8..65130c2 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -444,14 +444,18 @@ class SW_DLLPUBLIC SwPostItField : public SwField
     DateTime    aDateTime;
     OutlinerParaObject* mpText;
     rtl::Reference<SwTextAPIObject> m_xTextObject;
+    sal_uInt32 m_nPostItId;
 
 public:
+    static sal_uInt32 m_nLastPostItId;
+
     SwPostItField( SwPostItFieldType*,
                    const OUString& rAuthor,
                    const OUString& rText,
                    const OUString& rInitials,
                    const OUString& rName,
-                   const DateTime& rDate);
+                   const DateTime& rDate,
+                   const sal_uInt32 nPostItId = 0);
 
     SwPostItField(const SwPostItField&) = delete;
     SwPostItField* operator=(const SwPostItField&) = delete;
@@ -464,6 +468,7 @@ public:
     const DateTime&         GetDateTime() const             { return aDateTime; }
     inline const Date       GetDate() const                 { return Date(aDateTime.GetDate()); }
     inline const tools::Time GetTime() const                 { return aDateTime.GetTime(); }
+    inline sal_uInt32 GetPostItId() const             { return m_nPostItId; }
 
     /// Author
     virtual OUString        GetPar1() const override;
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index e9ab623..214cb57 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1635,12 +1635,15 @@ SwFieldType* SwPostItFieldType::Copy() const
 
 // PostIt field
 
+sal_uInt32 SwPostItField::m_nLastPostItId = 1;
+
 SwPostItField::SwPostItField( SwPostItFieldType* pT,
         const OUString& rAuthor,
         const OUString& rText,
         const OUString& rInitials,
         const OUString& rName,
-        const DateTime& rDateTime )
+        const DateTime& rDateTime,
+        const sal_uInt32 nPostItId)
     : SwField( pT )
     , sText( rText )
     , sAuthor( rAuthor )
@@ -1649,6 +1652,7 @@ SwPostItField::SwPostItField( SwPostItFieldType* pT,
     , aDateTime( rDateTime )
     , mpText( nullptr )
 {
+    m_nPostItId = nPostItId == 0 ? m_nLastPostItId++ : nPostItId;
 }
 
 SwPostItField::~SwPostItField()
@@ -1674,7 +1678,7 @@ OUString SwPostItField::GetDescription() const
 SwField* SwPostItField::Copy() const
 {
     SwPostItField* pRet = new SwPostItField( static_cast<SwPostItFieldType*>(GetTyp()), sAuthor, sText, sInitials, sName,
-                                aDateTime);
+                                             aDateTime, m_nPostItId);
     if (mpText)
         pRet->SetTextObject( new OutlinerParaObject(*mpText) );
 


More information about the Libreoffice-commits mailing list