sc/source/ui/miscdlgs/acredlin.cxx | 96 +++++++++++++++---------------------- 1 file changed, 39 insertions(+), 57 deletions(-)
New commits: commit fc441f3886330c4ae2abeb67c0758b935ba23f47 Author: Eike Rathke <er...@redhat.com> AuthorDate: Wed Jan 18 18:40:50 2023 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Wed Jan 18 20:37:30 2023 +0000 Resolves: tdf#153096 Split change track content action into columns again Old SvTreeList did split a string on embedded \t Tab characters, the new weld::TreeView does not but needs column text set explicitly. Regression from commit 56dd851cfc77c362c3db5c0aae4a490c7f6782cc CommitDate: Sat Apr 27 12:41:14 2019 +0200 weld cluster of change tracking dialogs that did the necessary changes for ScAcceptChgDlg::AppendFilteredAction() but not for ScAcceptChgDlg::AppendChangeAction() and ScAcceptChgDlg::InsertChangeActionContent(). Odd that no one reported this in all the time.. Additionally, the "Changed contents" label being used instead of "Row inserted"/"Column inserted"/"Row deleted"/"Column deleted" as soon as cell content change is present depending on such action, was a copypasta fallout from commit e7c76b30bd2ef802ce08f8739eac186253c79696 CommitDate: Mon Aug 29 17:21:12 2011 -0400 String to rtl::OUString. Change-Id: I855c527da61723c104c743e3b3f159fb026917df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145749 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index d1427a8a3c28..87292fe06c1e 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -369,12 +369,13 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( bool bFlag = false; ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc); - OUString aUser=pScChangeAction->GetUser(); DateTime aDateTime=pScChangeAction->GetDateTime(); - OUString aRefStr; ScChangeActionType eType=pScChangeAction->GetType(); - OUStringBuffer aBuf; + OUString aActionString; + OUString aRefStr; + OUString aUser; + OUString aDate; OUString aDesc; std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData); @@ -392,20 +393,20 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( { if(pScChangeAction->IsDialogParent()) { - aBuf.append(aStrContentWithChild); + aActionString = aStrContentWithChild; pNewData->nInfo=RD_SPECIAL_VISCONTENT; pNewData->bIsRejectable=false; pNewData->bIsAcceptable=false; } else { - aBuf.append(*MakeTypeString(eType)); + aActionString = *MakeTypeString(eType); aDesc = pScChangeAction->GetDescription(*pDoc, true); } } else { - aBuf.append(aStrContentWithChild); + aActionString = *MakeTypeString(eType); if(bDelMaster) { @@ -420,27 +421,16 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( aRefStr = pScChangeAction->GetRefString(*pDoc, true); - aBuf.append('\t'); - aBuf.append(aRefStr); - aBuf.append('\t'); - bool bIsGenerated = false; if(!pChanges->IsGenerated(pScChangeAction->GetActionNumber())) { - aBuf.append(aUser); - aBuf.append('\t'); - aBuf.append(ScGlobal::getLocaleData().getDate(aDateTime)); - aBuf.append(' '); - aBuf.append(ScGlobal::getLocaleData().getTime(aDateTime)); - aBuf.append('\t'); - + aUser = pScChangeAction->GetUser(); + aDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime); bIsGenerated = false; } else { - aBuf.append('\t'); - aBuf.append('\t'); bIsGenerated = true; } @@ -451,8 +441,6 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( aComment += " (" + aDesc + ")"; } - aBuf.append(aComment); - if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated) { if (pTheView->IsValidComment(aComment)) @@ -480,9 +468,15 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction( weld::TreeView& rTreeView = pTheView->GetWidget(); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); - OUString sString(aBuf.makeStringAndClear()); OUString sId(weld::toId(pNewData.release())); - rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get()); + rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get()); + rTreeView.set_text( *xEntry, aRefStr, 1); + if (!aUser.isEmpty()) + rTreeView.set_text( *xEntry, aUser, 2); + if (!aDate.isEmpty()) + rTreeView.set_text( *xEntry, aDate, 3); + if (!aComment.isEmpty()) + rTreeView.set_text( *xEntry, aComment, 4); if (!bFlag && bUseColor && !pParent) { rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE); @@ -651,55 +645,38 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const bFlag=true; } + OUString aContent; OUString aRefStr; - OUString aString; - OUString a2String; + OUString aDate; OUString aDesc; if(nSpecial==RD_SPECIAL_CONTENT) { - OUString aTmp = pScChangeAction->GetOldString(pDoc); - a2String = aTmp; - if(a2String.isEmpty()) a2String=aStrEmpty; - - //aString+="\'"; - aString+=a2String; - //aString+="\'"; - - aDesc = aStrChildOrgContent + ": "; + aContent = pScChangeAction->GetOldString(pDoc); + if (aContent.isEmpty()) + aContent = aStrEmpty; + aDesc = aStrChildOrgContent + ": " + aContent; } else { - OUString aTmp = pScChangeAction->GetNewString(pDoc); - a2String = aTmp; - if(a2String.isEmpty()) - { - a2String = aStrEmpty; - aString += a2String; - } + const OUString aTmp( pScChangeAction->GetNewString(pDoc)); + if (aTmp.isEmpty()) + aContent = aStrEmpty; else - { - aString += "\'" + a2String + "\'"; - a2String = aString; - } - aDesc = aStrChildContent; - + aContent = "\'" + aTmp + "\'"; + aDesc = aStrChildContent + aContent; } - aDesc += a2String; - aString += "\t"; aRefStr = pScChangeAction->GetRefString(*pDoc, true); - aString += aRefStr + "\t"; if(!bIsGenerated) { - aString += aUser + "\t" - + ScGlobal::getLocaleData().getDate(aDateTime) + " " - + ScGlobal::getLocaleData().getTime(aDateTime) + "\t"; + // aUser is kept. + aDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime); } else { - aString += "\t\t"; + aUser.clear(); } OUString aComment = pScChangeAction->GetComment().replaceAll("\n", ""); @@ -709,8 +686,6 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const aComment += " (" + aDesc + ")"; } - aString += aComment; - std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData); pNewData->nInfo=nSpecial; pNewData->pData=const_cast<ScChangeActionContent *>(pScChangeAction); @@ -726,7 +701,14 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const weld::TreeView& rTreeView = pTheView->GetWidget(); std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator()); OUString sId(weld::toId(pNewData.release())); - rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, false, xEntry.get()); + rTreeView.insert(&rParent, -1, &aContent, &sId, nullptr, nullptr, false, xEntry.get()); + rTreeView.set_text( *xEntry, aRefStr, 1); + if (!aUser.isEmpty()) + rTreeView.set_text( *xEntry, aUser, 2); + if (!aDate.isEmpty()) + rTreeView.set_text( *xEntry, aDate, 3); + if (!aComment.isEmpty()) + rTreeView.set_text( *xEntry, aComment, 4); if (pTheView->IsValidComment(aComment) && bFlag) bHasFilterEntry=true; else