Skip to content

Commit

Permalink
FIX author for track change deletion inside insertion [MACRO-1723] (#115
Browse files Browse the repository at this point in the history
)
  • Loading branch information
synoet authored May 7, 2024
1 parent 46387ad commit 16d3abc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libreoffice-core/sw/inc/redline.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down
21 changes: 19 additions & 2 deletions libreoffice-core/sw/source/core/doc/DocumentRedlineManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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 );
Expand Down
17 changes: 17 additions & 0 deletions libreoffice-core/sw/source/core/doc/docredln.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 16d3abc

Please sign in to comment.