diff --git a/libreoffice-core/sw/inc/redline.hxx b/libreoffice-core/sw/inc/redline.hxx index e0951f4101..263809d63b 100644 --- a/libreoffice-core/sw/inc/redline.hxx +++ b/libreoffice-core/sw/inc/redline.hxx @@ -126,6 +126,8 @@ public: RedlineType GetType() const { return m_eType; } std::size_t GetAuthor() const { return m_nAuthor; } + // MACRO-1723 + void SetAuthor( std::size_t n ) { m_nAuthor = n; } const OUString& GetComment() const { return m_sComment; } const DateTime& GetTimeStamp() const { return m_aStamp; } bool IsAnonymized() const @@ -261,6 +263,8 @@ public: bool CanCombine( const SwRangeRedline& rRedl ) const; void PushData( const SwRangeRedline& rRedl, bool bOwnAsNext = true ); + // MACRO-1723 + void PushData( const SwRedlineData& rData, bool bOwnAsNext = true ); bool PopData(); bool PopAllDataAfter(int depth); diff --git a/libreoffice-core/sw/source/core/doc/DocumentRedlineManager.cxx b/libreoffice-core/sw/source/core/doc/DocumentRedlineManager.cxx index 528324c9cd..e338bda49c 100644 --- a/libreoffice-core/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/libreoffice-core/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1941,13 +1941,23 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall case SwComparePosition::Inside: { + // Redlines have the same start position if( *pRStt == *pStt ) { // #i97421# // redline w/out extent loops + // new redline has some content if (*pStt != *pEnd) { - pNewRedl->PushData( *pRedl, false ); + + // MACRO-1723: Fix Author when adding deletion within + // an existing insertion: { + // Copy the redline data from the existing redline + // but keep the author of the new redline + SwRedlineData pTmp = pRedl->GetRedlineData(); + pTmp.SetAuthor(pNewRedl->GetAuthor()); + pNewRedl->PushData( pTmp, false ); + // MACRO: } pRedl->SetStart( *pEnd, pRStt ); // re-insert maRedlineTable.Remove( n ); @@ -1957,7 +1967,14 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall } else { - pNewRedl->PushData( *pRedl, false ); + // MACRO-1723: Fix Author when adding deletion within + // an existing insertion: { + // Copy the redline data from the existing redline + // but keep the author of the new redline + SwRedlineData pTmp = pRedl->GetRedlineData(); + pTmp.SetAuthor(pNewRedl->GetAuthor()); + pNewRedl->PushData( pTmp, false ); + // MACRO : } if( *pREnd != *pEnd ) { pNew = new SwRangeRedline( *pRedl ); diff --git a/libreoffice-core/sw/source/core/doc/docredln.cxx b/libreoffice-core/sw/source/core/doc/docredln.cxx index 96638c9a0e..47bf3509b9 100644 --- a/libreoffice-core/sw/source/core/doc/docredln.cxx +++ b/libreoffice-core/sw/source/core/doc/docredln.cxx @@ -2116,6 +2116,23 @@ void SwRangeRedline::PushData( const SwRangeRedline& rRedl, bool bOwnAsNext ) } } +// MACRO-1723: { +void SwRangeRedline::PushData( const SwRedlineData& rData, bool bOwnAsNext) +{ + SwRedlineData* pNew = new SwRedlineData(rData, false); + if (bOwnAsNext) + { + pNew->m_pNext = m_pRedlineData; + m_pRedlineData = pNew; + } + else + { + pNew->m_pNext = m_pRedlineData->m_pNext; + m_pRedlineData->m_pNext = pNew; + } +} +// MACRO: } + bool SwRangeRedline::PopData() { if( !m_pRedlineData->m_pNext )