summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-03-16 19:33:48 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-17 10:38:05 +0000
commit56552630fe21a143ca243807f093ebb150a2de98 (patch)
tree3aa080240bf2eeb60275473b6288b82262fb1a16 /sw
parenta9bbc74f1d9053cb3b950e0c14e0fae18f1b0257 (diff)
sw lok: Use unique redline identifier, instead of array indices
Use a static integer counter as identifier to each redline Change few unit-tets that was testing redlines by using a hardcoded array index. Instead use these unique redline identifiers now. Change-Id: I63aec3fc8ab10d0dad0c936600d16e96999a2bcd Reviewed-on: https://gerrit.libreoffice.org/35276 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/docary.hxx4
-rw-r--r--sw/inc/redline.hxx6
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx33
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx9
-rw-r--r--sw/sdi/swriter.sdi8
-rw-r--r--sw/source/core/doc/docredln.cxx28
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx4
-rw-r--r--sw/source/uibase/shells/textfld.cxx15
-rw-r--r--sw/source/uibase/uiview/view2.cxx33
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx2
10 files changed, 91 insertions, 51 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index fc67aa5018d6..4a95ac409512 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -366,8 +366,8 @@ public:
vector_type::const_iterator end() const { return maVector.end(); }
void Resort() { maVector.Resort(); }
- // Notifies all LOK clients when redlines are added/modified/removed
- static void LOKRedlineNotification(RedlineNotification eType, SwRedlineTable::size_type nPos, SwRangeRedline* pRedline);
+ // Notifies all LOK clients when redliens are added/modified/removed
+ static void LOKRedlineNotification(RedlineNotification eType, SwRangeRedline* pRedline);
};
/// Table that holds 'extra' redlines, such as 'table row insert\delete', 'paragraph moves' etc...
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index b75b666ae8a6..688cd1797c9d 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -173,6 +173,7 @@ class SW_DLLPUBLIC SwRangeRedline : public SwPaM
SwNodeIndex* pContentSect;
bool bDelLastPara : 1;
bool bIsVisible : 1;
+ sal_uInt32 m_nId;
void MoveToSection();
void CopyToSection();
@@ -180,6 +181,8 @@ class SW_DLLPUBLIC SwRangeRedline : public SwPaM
void MoveFromSection(size_t nMyPos);
public:
+ static sal_uInt32 m_nLastId;
+
SwRangeRedline( RedlineType_t eType, const SwPaM& rPam );
SwRangeRedline( const SwRedlineData& rData, const SwPaM& rPam );
SwRangeRedline( const SwRedlineData& rData, const SwPosition& rPos );
@@ -187,11 +190,12 @@ public:
SwRangeRedline(SwRedlineData* pData, const SwPosition& rPos,
bool bDelLP) :
SwPaM( rPos ), pRedlineData( pData ), pContentSect( nullptr ),
- bDelLastPara( bDelLP ), bIsVisible( true )
+ bDelLastPara( bDelLP ), bIsVisible( true ), m_nId( m_nLastId++ )
{}
SwRangeRedline( const SwRangeRedline& );
virtual ~SwRangeRedline() override;
+ sal_uInt32 GetId() const { return m_nId; }
SwNodeIndex* GetContentIdx() const { return pContentSect; }
// For Undo.
void SetContentIdx( const SwNodeIndex* );
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index a4275ff25d30..c07f9fb46772 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -31,6 +31,8 @@
#include <cmdid.h>
#include <sfx2/viewsh.hxx>
#include <sfx2/lokhelper.hxx>
+#include <redline.hxx>
+#include <IDocumentRedlineAccess.hxx>
static const char* const DATA_DIRECTORY = "/sw/qa/extras/tiledrendering/data/";
@@ -651,6 +653,10 @@ public:
bool m_bViewLock;
/// Set if any callback was invoked.
bool m_bCalled;
+ /// Redline table size changed payload
+ boost::property_tree::ptree m_aRedlineTableChanged;
+ /// Redline table modified payload
+ boost::property_tree::ptree m_aRedlineTableModified;
ViewCallback()
: m_bOwnCursorInvalidated(false),
@@ -757,6 +763,22 @@ public:
m_bViewLock = aTree.get_child("rectangle").get_value<std::string>() != "EMPTY";
}
break;
+ case LOK_CALLBACK_REDLINE_TABLE_SIZE_CHANGED:
+ {
+ m_aRedlineTableChanged.clear();
+ std::stringstream aStream(pPayload);
+ boost::property_tree::read_json(aStream, m_aRedlineTableChanged);
+ m_aRedlineTableChanged = m_aRedlineTableChanged.get_child("redline");
+ }
+ break;
+ case LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED:
+ {
+ m_aRedlineTableModified.clear();
+ std::stringstream aStream(pPayload);
+ boost::property_tree::read_json(aStream, m_aRedlineTableModified);
+ m_aRedlineTableModified = m_aRedlineTableModified.get_child("redline");
+ }
+ break;
}
}
};
@@ -1305,15 +1327,22 @@ void SwTiledRenderingTest::testTrackChanges()
// Turn on trak changes, type "zzz" at the end, and move to the start.
uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
+ ViewCallback aView;
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
pWrtShell->EndDoc();
pWrtShell->Insert("zzz");
pWrtShell->SttDoc();
- // Reject the change by index, while the cursor does not cover the tracked change.
+ // Get the redline just created
+ const SwRedlineTable& rTable = pWrtShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(1), rTable.size());
+ SwRangeRedline* pRedline = rTable[0];
+
+ // Reject the change by id, while the cursor does not cover the tracked change.
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
{
- {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(0))}
+ {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(pRedline->GetId()))}
}));
comphelper::dispatchCommand(".uno:RejectTrackedChange", aPropertyValues);
Scheduler::ProcessEventsToIdle();
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index d906f3f56228..aec4b5e00a77 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4120,11 +4120,14 @@ void SwUiWriterTest::testRedlineParam()
pWrtShell->EndDoc();
pWrtShell->Insert("zzz");
+ const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), rTable.size());
+
// Select the first redline.
pWrtShell->SttDoc();
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
{
- {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(0))}
+ {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[0]->GetId()))}
}));
lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues);
Scheduler::ProcessEventsToIdle();
@@ -4137,7 +4140,7 @@ void SwUiWriterTest::testRedlineParam()
pWrtShell->SttDoc();
aPropertyValues = comphelper::InitPropertySequence(
{
- {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(1))}
+ {"NextTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[1]->GetId()))}
});
lcl_dispatchCommand(mxComponent, ".uno:NextTrackedChange", aPropertyValues);
Scheduler::ProcessEventsToIdle();
@@ -4148,7 +4151,7 @@ void SwUiWriterTest::testRedlineParam()
pWrtShell->SttDoc();
aPropertyValues = comphelper::InitPropertySequence(
{
- {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(1))}
+ {"RejectTrackedChange", uno::makeAny(static_cast<sal_uInt16>(rTable[1]->GetId()))}
});
lcl_dispatchCommand(mxComponent, ".uno:RejectTrackedChange", aPropertyValues);
Scheduler::ProcessEventsToIdle();
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index e9ac67777e5f..25a9493ed6e3 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -663,7 +663,7 @@ SfxVoidItem ClosePreview FN_CLOSE_PAGEPREVIEW
]
SfxVoidItem CommentChangeTracking FN_REDLINE_COMMENT
-(SfxUInt16Item ChangeTrackingId FN_REDLINE_COMMENT,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
+(SfxUInt32Item ChangeTrackingId FN_REDLINE_COMMENT,SvxPostItTextItem Text SID_ATTR_POSTIT_TEXT)
[
AutoUpdate = FALSE,
FastCall = FALSE,
@@ -7288,7 +7288,7 @@ SfxBoolItem SpellingAndGrammarDialog FN_SPELL_GRAMMAR_DIALOG
]
SfxVoidItem AcceptTrackedChange FN_REDLINE_ACCEPT_DIRECT
-( SfxUInt16Item AcceptTrackedChange FN_REDLINE_ACCEPT_DIRECT )
+( SfxUInt32Item AcceptTrackedChange FN_REDLINE_ACCEPT_DIRECT )
[
AutoUpdate = FALSE,
FastCall = FALSE,
@@ -7307,7 +7307,7 @@ SfxVoidItem AcceptTrackedChange FN_REDLINE_ACCEPT_DIRECT
]
SfxVoidItem RejectTrackedChange FN_REDLINE_REJECT_DIRECT
-( SfxUInt16Item RejectTrackedChange FN_REDLINE_REJECT_DIRECT )
+( SfxUInt32Item RejectTrackedChange FN_REDLINE_REJECT_DIRECT )
[
AutoUpdate = FALSE,
FastCall = FALSE,
@@ -7326,7 +7326,7 @@ SfxVoidItem RejectTrackedChange FN_REDLINE_REJECT_DIRECT
]
SfxVoidItem NextTrackedChange FN_REDLINE_NEXT_CHANGE
-( SfxUInt16Item NextTrackedChange FN_REDLINE_NEXT_CHANGE )
+( SfxUInt32Item NextTrackedChange FN_REDLINE_NEXT_CHANGE )
[
AutoUpdate = FALSE,
FastCall = FALSE,
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8a485d5c9f5d..a8fc41eda758 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -302,7 +302,7 @@ bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox&
}
/// Emits LOK notification about one addition / removal of a redline item.
-void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRedlineTable::size_type nPos, SwRangeRedline* pRedline)
+void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRedline* pRedline)
{
if (!comphelper::LibreOfficeKit::isActive())
return;
@@ -311,7 +311,7 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRedline
aRedline.put("action", (nType == RedlineNotification::Add ? "Add" :
(nType == RedlineNotification::Remove ? "Remove" :
(nType == RedlineNotification::Modify ? "Modify" : "???"))));
- aRedline.put("index", nPos);
+ aRedline.put("index", pRedline->GetId());
aRedline.put("author", pRedline->GetAuthorString(1).toUtf8().getStr());
aRedline.put("type", nsRedlineType_t::SwRedlineTypeToOUString(pRedline->GetRedlineData().GetType()).toUtf8().getStr());
aRedline.put("comment", pRedline->GetRedlineData().GetComment().toUtf8().getStr());
@@ -361,7 +361,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p )
{
std::pair<vector_type::const_iterator, bool> rv = maVector.insert( p );
size_type nP = rv.first - begin();
- LOKRedlineNotification(RedlineNotification::Add, nP, p);
+ LOKRedlineNotification(RedlineNotification::Add, p);
p->CallDisplayFunc(nP);
return rv.second;
}
@@ -521,7 +521,7 @@ bool SwRedlineTable::Remove( const SwRangeRedline* p )
void SwRedlineTable::Remove( size_type nP )
{
- LOKRedlineNotification(RedlineNotification::Remove, nP, maVector[nP]);
+ LOKRedlineNotification(RedlineNotification::Remove, maVector[nP]);
SwDoc* pDoc = nullptr;
if( !nP && 1 == size() )
pDoc = maVector.front()->GetDoc();
@@ -545,12 +545,10 @@ void SwRedlineTable::DeleteAndDestroy( size_type nP, size_type nL )
if( !nP && nL && nL == size() )
pDoc = maVector.front()->GetDoc();
- size_t nCount = 0;
for( vector_type::const_iterator it = maVector.begin() + nP; it != maVector.begin() + nP + nL; ++it )
{
- LOKRedlineNotification(RedlineNotification::Remove, nP + nCount, *it);
+ LOKRedlineNotification(RedlineNotification::Remove, *it);
delete *it;
- ++nCount;
}
maVector.erase( maVector.begin() + nP, maVector.begin() + nP + nL );
@@ -927,10 +925,13 @@ OUString SwRedlineData::GetDescr() const
return SW_RES(STR_REDLINE_INSERT + GetType());
}
+sal_uInt32 SwRangeRedline::m_nLastId = 1;
+
SwRangeRedline::SwRangeRedline(RedlineType_t eTyp, const SwPaM& rPam )
: SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
pRedlineData( new SwRedlineData( eTyp, GetDoc()->getIDocumentRedlineAccess().GetRedlineAuthor() ) ),
- pContentSect( nullptr )
+ pContentSect( nullptr ),
+ m_nId( m_nLastId++ )
{
bDelLastPara = false;
bIsVisible = true;
@@ -941,7 +942,8 @@ SwRangeRedline::SwRangeRedline(RedlineType_t eTyp, const SwPaM& rPam )
SwRangeRedline::SwRangeRedline( const SwRedlineData& rData, const SwPaM& rPam )
: SwPaM( *rPam.GetMark(), *rPam.GetPoint() ),
pRedlineData( new SwRedlineData( rData )),
- pContentSect( nullptr )
+ pContentSect( nullptr ),
+ m_nId( m_nLastId++ )
{
bDelLastPara = false;
bIsVisible = true;
@@ -952,7 +954,8 @@ SwRangeRedline::SwRangeRedline( const SwRedlineData& rData, const SwPaM& rPam )
SwRangeRedline::SwRangeRedline( const SwRedlineData& rData, const SwPosition& rPos )
: SwPaM( rPos ),
pRedlineData( new SwRedlineData( rData )),
- pContentSect( nullptr )
+ pContentSect( nullptr ),
+ m_nId( m_nLastId++ )
{
bDelLastPara = false;
bIsVisible = true;
@@ -961,7 +964,8 @@ SwRangeRedline::SwRangeRedline( const SwRedlineData& rData, const SwPosition& rP
SwRangeRedline::SwRangeRedline( const SwRangeRedline& rCpy )
: SwPaM( *rCpy.GetMark(), *rCpy.GetPoint() ),
pRedlineData( new SwRedlineData( *rCpy.pRedlineData )),
- pContentSect( nullptr )
+ pContentSect( nullptr ),
+ m_nId( rCpy.m_nId )
{
bDelLastPara = false;
bIsVisible = true;
@@ -991,7 +995,7 @@ void SwRangeRedline::MaybeNotifyModification()
{
if (rRedTable[i] == this)
{
- SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, i, this);
+ SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, this);
break;
}
}
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 94d33494610d..22264c339ccc 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1222,12 +1222,12 @@ void SwTextNode::Update(
// Redline is changed only when some change occurs before it
if (nChangePos <= pRedln->Start()->nContent.GetIndex())
{
- SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, nRedlnPos, pRedln);
+ SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, pRedln);
}
}
}
else if (this == &pRedln->GetPoint()->nNode.GetNode())
- SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, nRedlnPos, pRedln);
+ SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, pRedln);
}
}
}
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index b333f5fc4e6f..8b769879ee07 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -511,19 +511,14 @@ void SwTextShell::ExecField(SfxRequest &rReq)
const SwRangeRedline *pRedline = rSh.GetCurrRedline();
SwDoc *pDoc = rSh.GetDoc();
- SwRedlineTable::size_type nRedline = SwRedlineTable::npos;
+ // If index is specified, goto and select the appropriate redline
if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
{
- //TODO: SfxUInt16Item vs. SwRedlineTable::size_type mismatch:
- nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- if (nRedline == USHRT_MAX)
- nRedline = SwRedlineTable::npos;
-
- if (nRedline != SwRedlineTable::npos)
+ const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
+ const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ for (SwRedlineTable::size_type nRedline = 0; nRedline < rRedlineTable.size(); ++nRedline)
{
- // If index is specified, goto and select the appropriate redline
- const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- if (nRedline < rTable.size())
+ if (nChangeId == rRedlineTable[nRedline]->GetId())
pRedline = rSh.GotoRedline(nRedline, true);
}
}
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 7b534fdc0f7a..d64523fbd6d5 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -663,13 +663,16 @@ void SwView::Execute(SfxRequest &rReq)
{
SwDoc *pDoc = m_pWrtShell->GetDoc();
SwPaM *pCursor = m_pWrtShell->GetCursor();
+ const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
SwRedlineTable::size_type nRedline = SwRedlineTable::npos;
if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
{
- //TODO: SfxUInt16Item vs. SwRedlineTable::size_type mismatch:
- nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- if (nRedline == USHRT_MAX)
- nRedline = SwRedlineTable::npos;
+ const sal_Int64 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
+ for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
+ {
+ if (nChangeId == rRedlineTable[i]->GetId())
+ nRedline = i;
+ }
}
if( pCursor->HasMark() && nRedline == SwRedlineTable::npos)
@@ -690,9 +693,9 @@ void SwView::Execute(SfxRequest &rReq)
{
// A redline was explicitly requested by specifying an
// index, don't guess based on the cursor position.
- const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
- if (nRedline < rTable.size())
- pRedline = rTable[nRedline];
+
+ if (nRedline < rRedlineTable.size())
+ pRedline = rRedlineTable[nRedline];
}
else
pRedline = pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline);
@@ -713,20 +716,22 @@ void SwView::Execute(SfxRequest &rReq)
{
// If a parameter is provided, try going to the nth change, not to
// the next one.
+ SwDoc* pDoc = m_pWrtShell->GetDoc();
+ const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
SwRedlineTable::size_type nRedline = SwRedlineTable::npos;
if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
{
- //TODO: SfxUInt16Item vs. SwRedlineTable::size_type mismatch:
- nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- if (nRedline == USHRT_MAX)
- nRedline = SwRedlineTable::npos;
+ const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
+ for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
+ {
+ if (nChangeId == rRedlineTable[i]->GetId())
+ nRedline = i;
+ }
}
const SwRangeRedline *pCurrent = m_pWrtShell->GetCurrRedline();
- SwDoc* pDoc = m_pWrtShell->GetDoc();
- const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
const SwRangeRedline *pNext = nullptr;
- if (nRedline < rTable.size())
+ if (nRedline < rRedlineTable.size())
pNext = m_pWrtShell->GotoRedline(nRedline, true);
else
pNext = m_pWrtShell->SelNextRedline();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index de8057e21640..a93469fb96f0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3187,7 +3187,7 @@ OUString SwXTextDocument::getTrackedChanges()
for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
{
boost::property_tree::ptree aTrackedChange;
- aTrackedChange.put("index", i);
+ aTrackedChange.put("index", rRedlineTable[i]->GetId());
aTrackedChange.put("author", rRedlineTable[i]->GetAuthorString(1).toUtf8().getStr());
aTrackedChange.put("type", nsRedlineType_t::SwRedlineTypeToOUString(rRedlineTable[i]->GetRedlineData().GetType()).toUtf8().getStr());
aTrackedChange.put("comment", rRedlineTable[i]->GetRedlineData().GetComment().toUtf8().getStr());