LibreOffice Module sc (master)  1
acredlin.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <svl/undo.hxx>
21 #include <unotools/textsearch.hxx>
24 #include <sfx2/viewfrm.hxx>
25 #include <sfx2/basedlgs.hxx>
26 #include <vcl/commandevent.hxx>
27 
28 #include <acredlin.hxx>
29 #include <global.hxx>
30 #include <reffact.hxx>
31 #include <document.hxx>
32 #include <docsh.hxx>
33 #include <scresid.hxx>
34 #include <strings.hrc>
35 #include <scmod.hxx>
36 #include <tabvwsh.hxx>
37 
38 // defines -------------------------------------------------------------------
39 
40 #define RD_SPECIAL_NONE 0
41 #define RD_SPECIAL_CONTENT 1
42 #define RD_SPECIAL_VISCONTENT 2
43 
44 
46 {
48  nActionNo=0;
49  pData=nullptr;
50  bDisabled=false;
51  bIsRejectable=false;
52  bIsAcceptable=false;
56 }
57 
59 {
61  nActionNo=0;
62  pData=nullptr;
63  bDisabled=false;
64  bIsRejectable=false;
65  bIsAcceptable=false;
66 }
67 
68 
70  ScViewData* ptrViewData)
71  : SfxModelessDialogController(pB, pCW, pParent,
72  "svx/ui/acceptrejectchangesdialog.ui", "AcceptRejectChangesDialog")
73  , aSelectionIdle("ScAcceptChgDlg SelectionIdle")
74  , aReOpenIdle("ScAcceptChgDlg ReOpenIdle")
75  , pViewData( ptrViewData )
76  , pDoc( &ptrViewData->GetDocument() )
77  , aStrInsertCols(ScResId(STR_CHG_INSERT_COLS))
78  , aStrInsertRows(ScResId(STR_CHG_INSERT_ROWS))
79  , aStrInsertTabs(ScResId(STR_CHG_INSERT_TABS))
80  , aStrDeleteCols(ScResId(STR_CHG_DELETE_COLS))
81  , aStrDeleteRows(ScResId(STR_CHG_DELETE_ROWS))
82  , aStrDeleteTabs(ScResId(STR_CHG_DELETE_TABS))
83  , aStrMove(ScResId(STR_CHG_MOVE))
84  , aStrContent(ScResId(STR_CHG_CONTENT))
85  , aStrReject(ScResId(STR_CHG_REJECT))
86  , aStrAllAccepted(ScResId(STR_CHG_ACCEPTED))
87  , aStrAllRejected(ScResId(STR_CHG_REJECTED))
88  , aStrNoEntry(ScResId(STR_CHG_NO_ENTRY))
89  , aStrContentWithChild(ScResId(STR_CHG_CONTENT_WITH_CHILD))
90  , aStrChildContent(ScResId(STR_CHG_CHILD_CONTENT))
91  , aStrChildOrgContent(ScResId(STR_CHG_CHILD_ORGCONTENT))
92  , aStrEmpty(ScResId(STR_CHG_EMPTY))
93  , aUnknown("Unknown")
94  , bIgnoreMsg(false)
95  , bNoSelection(false)
96  , bHasFilterEntry(false)
97  , bUseColor(false)
98  , m_xContentArea(m_xDialog->weld_content_area())
99  , m_xPopup(m_xBuilder->weld_menu("calcmenu"))
100  , m_xSortMenu(m_xBuilder->weld_menu("calcsortmenu"))
101 {
102  m_xAcceptChgCtr.reset(new SvxAcceptChgCtr(m_xContentArea.get(), m_xDialog.get(), m_xBuilder.get()));
103  nAcceptCount=0;
104  nRejectCount=0;
105  aReOpenIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl ));
106 
107  pTPFilter = m_xAcceptChgCtr->GetFilterPage();
108  pTPView = m_xAcceptChgCtr->GetViewPage();
109 
110  // tdf#136062 Don't use "Reject/Clear formatting" instead of "Reject" buttons in Calc
111  pTPView->EnableClearFormat(false);
113 
116  aSelectionIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, UpdateSelectionHdl ));
117  aSelectionIdle.SetDebugName( "ScAcceptChgDlg aSelectionIdle" );
118 
119  pTPFilter->SetReadyHdl(LINK( this, ScAcceptChgDlg, FilterHandle ));
120  pTPFilter->SetRefHdl(LINK( this, ScAcceptChgDlg, RefHandle ));
121  pTPFilter->HideRange(false);
122  pTPView->SetRejectClickHdl( LINK( this, ScAcceptChgDlg,RejectHandle));
123  pTPView->SetAcceptClickHdl( LINK(this, ScAcceptChgDlg, AcceptHandle));
124  pTPView->SetRejectAllClickHdl( LINK( this, ScAcceptChgDlg,RejectAllHandle));
125  pTPView->SetAcceptAllClickHdl( LINK(this, ScAcceptChgDlg, AcceptAllHandle));
126 
127  weld::TreeView& rTreeView = pTheView->GetWidget();
128  rTreeView.connect_expanding(LINK(this, ScAcceptChgDlg, ExpandingHandle));
129  rTreeView.connect_changed(LINK(this, ScAcceptChgDlg, SelectHandle));
130  rTreeView.connect_popup_menu(LINK(this, ScAcceptChgDlg, CommandHdl));
131  rTreeView.set_sort_func([this](const weld::TreeIter& rLeft, const weld::TreeIter& rRight){
132  return ColCompareHdl(rLeft, rRight);
133  });
134  rTreeView.set_selection_mode(SelectionMode::Multiple);
135 
136  Init();
137 
138  UpdateView();
139 
140  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
141  if (rTreeView.get_iter_first(*xEntry))
142  rTreeView.select(*xEntry);
143 }
144 
146 {
147  ClearView();
148  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
149 
150  if (pChanges)
151  {
153  pChanges->SetModifiedLink(aLink);
154  }
155 }
156 
158 {
159  pViewData=ptrViewData;
160  if (pViewData)
161  pDoc = &ptrViewData->GetDocument();
162  else
163  pDoc = nullptr;
164 
165  bNoSelection=false;
166  bIgnoreMsg=false;
167  nAcceptCount=0;
168  nRejectCount=0;
169 
170  // don't call Init here (switching between views), just set link below
171  // (dialog is just hidden, not deleted anymore, when switching views)
172  ClearView();
173  UpdateView();
174 
175  if ( pDoc )
176  {
177  ScChangeTrack* pChanges = pDoc->GetChangeTrack();
178  if ( pChanges )
179  pChanges->SetModifiedLink( LINK( this, ScAcceptChgDlg, ChgTrackModHdl ) );
180  }
181 }
182 
184 {
185  OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" );
186 
187  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
188 
189  if(pChanges!=nullptr)
190  {
191  pChanges->SetModifiedLink( LINK( this, ScAcceptChgDlg,ChgTrackModHdl));
194  const std::set<OUString>& rUserColl = pChanges->GetUserCollection();
195  for (const auto& rItem : rUserColl)
196  pTPFilter->InsertAuthor(rItem);
197  }
198 
200  if ( pViewSettings!=nullptr )
201  aChangeViewSet = *pViewSettings;
202  // adjust TimeField for filter tabpage
204 
206 
207  DateTime aEmpty(DateTime::EMPTY);
208 
210  if (aDateTime != aEmpty)
211  {
212  pTPFilter->SetFirstDate(aDateTime);
213  pTPFilter->SetFirstTime(aDateTime);
214  }
215  aDateTime = aChangeViewSet.GetTheLastDateTime();
216  if (aDateTime != aEmpty)
217  {
218  pTPFilter->SetLastDate(aDateTime);
219  pTPFilter->SetLastTime(aDateTime);
220  }
221 
222  pTPFilter->SetDateMode(static_cast<sal_uInt16>(aChangeViewSet.GetTheDateMode()));
225 
227  OUString aString=aChangeViewSet.GetTheAuthorToShow();
228  if(!aString.isEmpty())
229  {
230  pTPFilter->SelectAuthor(aString);
231  if(pTPFilter->GetSelectedAuthor()!=aString)
232  {
233  pTPFilter->InsertAuthor(aString);
234  pTPFilter->SelectAuthor(aString);
235  }
236  }
237  else
239 
241 
243 
245  {
246  const ScRange & rRangeEntry = aChangeViewSet.GetTheRangeList().front();
247  OUString aRefStr(rRangeEntry.Format(*pDoc, ScRefFlags::RANGE_ABS_3D));
248  pTPFilter->SetRange(aRefStr);
249  }
250 
251  // init filter
252  if(!(pTPFilter->IsDate()||pTPFilter->IsRange()||
254  return;
255 
264 
266 
267  utl::SearchParam aSearchParam( pTPFilter->GetComment(),
269 
270  pTheView->SetCommentParams(&aSearchParam);
271 
273 }
274 
276 {
277  nAcceptCount=0;
278  nRejectCount=0;
279  weld::TreeView& rTreeView = pTheView->GetWidget();
280  rTreeView.all_foreach(
281  [&rTreeView](weld::TreeIter& rEntry)
282  {
283  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
284  delete pEntryData;
285  return false;
286  });
287  rTreeView.freeze();
288  rTreeView.clear();
289  rTreeView.thaw();
290 }
291 
293 {
294  OUString* pStr;
295 
296  switch(eType)
297  {
298 
299  case SC_CAT_INSERT_COLS: pStr=&aStrInsertCols;break;
300  case SC_CAT_INSERT_ROWS: pStr=&aStrInsertRows;break;
301  case SC_CAT_INSERT_TABS: pStr=&aStrInsertTabs;break;
302  case SC_CAT_DELETE_COLS: pStr=&aStrDeleteCols;break;
303  case SC_CAT_DELETE_ROWS: pStr=&aStrDeleteRows;break;
304  case SC_CAT_DELETE_TABS: pStr=&aStrDeleteTabs;break;
305  case SC_CAT_MOVE: pStr=&aStrMove;break;
306  case SC_CAT_CONTENT: pStr=&aStrContent;break;
307  case SC_CAT_REJECT: pStr=&aStrReject;break;
308  default: pStr=&aUnknown;break;
309  }
310  return pStr;
311 }
312 
313 bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction)
314 {
315  if(pScChangeAction==nullptr) return false;
316 
317  bool bFlag = false;
318 
319  ScRange aRef=pScChangeAction->GetBigRange().MakeRange();
320  OUString aUser=pScChangeAction->GetUser();
321  DateTime aDateTime=pScChangeAction->GetDateTime();
322 
323  ScChangeActionType eType=pScChangeAction->GetType();
324  OUString aDesc;
325 
326  OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
327 
328  if(eType==SC_CAT_CONTENT)
329  {
330  if(!pScChangeAction->IsDialogParent())
331  pScChangeAction->GetDescription(aDesc, *pDoc, true);
332  }
333  else
334  pScChangeAction->GetDescription(aDesc, *pDoc, !pScChangeAction->IsMasterDelete());
335 
336  if (!aDesc.isEmpty())
337  {
338  aComment += " (" + aDesc + ")";
339  }
340 
341  if (pTheView->IsValidEntry(aUser, aDateTime, aComment))
342  {
343  if(pTPFilter->IsRange())
344  {
345  for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
346  {
347  ScRange const & rRangeEntry = aRangeList[ i ];
348  if (rRangeEntry.Intersects(aRef)) {
349  bFlag = true;
350  break;
351  }
352  }
353  }
354  else
355  bFlag=true;
356  }
357 
358  return bFlag;
359 }
360 
361 std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction(
362  const ScChangeAction* pScChangeAction, bool bCreateOnDemand,
363  const weld::TreeIter* pParent, bool bDelMaster, bool bDisabled)
364 {
365  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
366 
367  if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
368 
369  bool bFlag = false;
370 
371  ScRange aRef=pScChangeAction->GetBigRange().MakeRange();
372  OUString aUser=pScChangeAction->GetUser();
373  DateTime aDateTime=pScChangeAction->GetDateTime();
374 
375  OUString aRefStr;
376  ScChangeActionType eType=pScChangeAction->GetType();
377  OUStringBuffer aBuf;
378  OUString aDesc;
379 
380  std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
381  pNewData->pData=const_cast<ScChangeAction *>(pScChangeAction);
382  pNewData->nActionNo=pScChangeAction->GetActionNumber();
383  pNewData->bIsAcceptable=pScChangeAction->IsClickable();
384  pNewData->bIsRejectable=pScChangeAction->IsRejectable();
385  pNewData->bDisabled=!pNewData->bIsAcceptable || bDisabled;
386  pNewData->aDateTime=aDateTime;
387  pNewData->nRow = aRef.aStart.Row();
388  pNewData->nCol = aRef.aStart.Col();
389  pNewData->nTable= aRef.aStart.Tab();
390 
391  if(eType==SC_CAT_CONTENT)
392  {
393  if(pScChangeAction->IsDialogParent())
394  {
395  aBuf.append(aStrContentWithChild);
396  pNewData->nInfo=RD_SPECIAL_VISCONTENT;
397  pNewData->bIsRejectable=false;
398  pNewData->bIsAcceptable=false;
399  }
400  else
401  {
402  aBuf.append(*MakeTypeString(eType));
403  pScChangeAction->GetDescription( aDesc, *pDoc, true);
404  }
405  }
406  else
407  {
408  aBuf.append(aStrContentWithChild);
409 
410  if(bDelMaster)
411  {
412  pScChangeAction->GetDescription( aDesc, *pDoc,true);
413  pNewData->bDisabled=true;
414  pNewData->bIsRejectable=false;
415  }
416  else
417  pScChangeAction->GetDescription( aDesc, *pDoc, !pScChangeAction->IsMasterDelete());
418 
419  }
420 
421  pScChangeAction->GetRefString(aRefStr, *pDoc, true);
422 
423  aBuf.append('\t');
424  aBuf.append(aRefStr);
425  aBuf.append('\t');
426 
427  bool bIsGenerated = false;
428 
429  if(!pChanges->IsGenerated(pScChangeAction->GetActionNumber()))
430  {
431  aBuf.append(aUser);
432  aBuf.append('\t');
433  aBuf.append(ScGlobal::getLocaleData().getDate(aDateTime));
434  aBuf.append(' ');
435  aBuf.append(ScGlobal::getLocaleData().getTime(aDateTime));
436  aBuf.append('\t');
437 
438  bIsGenerated = false;
439  }
440  else
441  {
442  aBuf.append('\t');
443  aBuf.append('\t');
444  bIsGenerated = true;
445  }
446 
447  OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
448 
449  if (!aDesc.isEmpty())
450  {
451  aComment += " (" + aDesc + ")";
452  }
453 
454  aBuf.append(aComment);
455 
456  if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
457  {
458  if (pTheView->IsValidComment(aComment))
459  {
460  if(pTPFilter->IsRange())
461  {
462  for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
463  {
464  ScRange const & rRangeEntry = aRangeList[ i ];
465  if( rRangeEntry.Intersects(aRef) )
466  {
467  bHasFilterEntry=true;
468  bFlag=true;
469  break;
470  }
471  }
472  }
473  else if(!bIsGenerated)
474  {
475  bHasFilterEntry=true;
476  bFlag=true;
477  }
478  }
479  }
480 
481  weld::TreeView& rTreeView = pTheView->GetWidget();
482  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
483  OUString sString(aBuf.makeStringAndClear());
484  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
485  rTreeView.insert(pParent, -1, &sString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
486  if (!bFlag && bUseColor && !pParent)
487  {
488  rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE);
489  }
490  else if (bFlag && bUseColor && pParent)
491  {
492  rTreeView.set_font_color(*xEntry, COL_GREEN);
493 
494  std::unique_ptr<weld::TreeIter> xExpEntry(rTreeView.make_iterator(pParent));
495 
496  while (!rTreeView.get_row_expanded(*xExpEntry))
497  {
498  if (rTreeView.get_iter_depth(*xExpEntry))
499  rTreeView.expand_row(*xExpEntry);
500 
501  if (!rTreeView.iter_parent(*xExpEntry))
502  break;
503  }
504  }
505  return xEntry;
506 }
507 
508 std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction(
509  const ScChangeAction* pScChangeAction, ScChangeActionState eState,
510  bool bCreateOnDemand,
511  const weld::TreeIter* pParent, bool bDelMaster, bool bDisabled)
512 {
513  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
514 
515  if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
516 
517  bool bIsGenerated = pChanges->IsGenerated(pScChangeAction->GetActionNumber());
518 
519  bool bFlag = false;
520 
521  ScRange aRef=pScChangeAction->GetBigRange().MakeRange();
522  OUString aUser=pScChangeAction->GetUser();
523  DateTime aDateTime=pScChangeAction->GetDateTime();
524 
525  if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
526  {
527  if(pTPFilter->IsRange())
528  {
529  for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
530  {
531  ScRange const & rRangeEntry=aRangeList[ i ];
532  if( rRangeEntry.Intersects(aRef) )
533  {
534  if( pScChangeAction->GetState()==eState )
535  bFlag = true;
536  break;
537  }
538  }
539  }
540  else if(pScChangeAction->GetState()==eState && !bIsGenerated)
541  bFlag = true;
542  }
543 
544  std::unique_ptr<weld::TreeIter> xEntry;
545  if(bFlag)
546  {
547  ScChangeActionType eType=pScChangeAction->GetType();
548  OUString aActionString;
549  OUString aDesc;
550 
551  std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
552  pNewData->pData=const_cast<ScChangeAction *>(pScChangeAction);
553  pNewData->nActionNo=pScChangeAction->GetActionNumber();
554  pNewData->bIsAcceptable=pScChangeAction->IsClickable();
555  pNewData->bIsRejectable=pScChangeAction->IsRejectable();
556  pNewData->bDisabled=!pNewData->bIsAcceptable || bDisabled;
557  pNewData->aDateTime=aDateTime;
558  pNewData->nRow = aRef.aStart.Row();
559  pNewData->nCol = aRef.aStart.Col();
560  pNewData->nTable= aRef.aStart.Tab();
561 
562  if(eType==SC_CAT_CONTENT)
563  {
564  if(pScChangeAction->IsDialogParent())
565  {
566  aActionString=aStrContentWithChild;
567  pNewData->nInfo=RD_SPECIAL_VISCONTENT;
568  pNewData->bIsRejectable=false;
569  pNewData->bIsAcceptable=false;
570  }
571  else
572  {
573  aActionString=*MakeTypeString(eType);
574  pScChangeAction->GetDescription( aDesc, *pDoc, true);
575  }
576  }
577  else
578  {
579  aActionString=*MakeTypeString(eType);
580 
581  if(bDelMaster)
582  {
583  pScChangeAction->GetDescription( aDesc, *pDoc,true);
584  pNewData->bDisabled=true;
585  pNewData->bIsRejectable=false;
586  }
587  else
588  pScChangeAction->GetDescription( aDesc, *pDoc,!pScChangeAction->IsMasterDelete());
589 
590  }
591 
592 
593  OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
594  if (!aDesc.isEmpty())
595  {
596  aComment += " (" + aDesc + ")";
597  }
598  if (pTheView->IsValidComment(aComment))
599  {
600  weld::TreeView& rTreeView = pTheView->GetWidget();
601  xEntry = rTreeView.make_iterator();
602  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
603  rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
604 
605  OUString aRefStr;
606  pScChangeAction->GetRefString(aRefStr, *pDoc, true);
607  rTreeView.set_text(*xEntry, aRefStr, 1);
608 
609  if (!bIsGenerated)
610  {
611  rTreeView.set_text(*xEntry, aUser, 2);
612  OUString sDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime);
613  rTreeView.set_text(*xEntry, sDate, 3);
614  }
615 
616  rTreeView.set_text(*xEntry, aComment, 4);
617  }
618  }
619  return xEntry;
620 }
621 
622 std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
623  const weld::TreeIter& rParent, sal_uLong nSpecial)
624 {
625  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
626 
627  if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
628 
629  bool bIsGenerated = pChanges->IsGenerated(pScChangeAction->GetActionNumber());
630 
631  bool bFlag = false;
632 
633  ScRange aRef=pScChangeAction->GetBigRange().MakeRange();
634  OUString aUser=pScChangeAction->GetUser();
635  DateTime aDateTime=pScChangeAction->GetDateTime();
636 
637  if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
638  {
639  if(pTPFilter->IsRange())
640  {
641  for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
642  {
643  ScRange const & rRangeEntry = aRangeList[ i ];
644  if( rRangeEntry.Intersects(aRef) )
645  {
646  bFlag=true;
647  break;
648  }
649  }
650  }
651  else if(!bIsGenerated)
652  bFlag=true;
653  }
654 
655  OUString aRefStr;
656  OUString aString;
657  OUString a2String;
658  OUString aDesc;
659 
660  if(nSpecial==RD_SPECIAL_CONTENT)
661  {
662  OUString aTmp;
663  pScChangeAction->GetOldString(aTmp, pDoc);
664  a2String = aTmp;
665  if(a2String.isEmpty()) a2String=aStrEmpty;
666 
667  //aString+="\'";
668  aString+=a2String;
669  //aString+="\'";
670 
671  aDesc = aStrChildOrgContent + ": ";
672  }
673  else
674  {
675  OUString aTmp;
676  pScChangeAction->GetNewString(aTmp, pDoc);
677  a2String = aTmp;
678  if(a2String.isEmpty())
679  {
680  a2String = aStrEmpty;
681  aString += a2String;
682  }
683  else
684  {
685  aString += "\'" + a2String + "\'";
686  a2String = aString;
687  }
688  aDesc = aStrChildContent;
689 
690  }
691 
692  aDesc += a2String;
693  aString += "\t";
694  pScChangeAction->GetRefString(aRefStr, *pDoc, true);
695  aString += aRefStr + "\t";
696 
697  if(!bIsGenerated)
698  {
699  aString += aUser + "\t"
700  + ScGlobal::getLocaleData().getDate(aDateTime) + " "
701  + ScGlobal::getLocaleData().getTime(aDateTime) + "\t";
702  }
703  else
704  {
705  aString += "\t\t";
706  }
707 
708  OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
709 
710  if(!aDesc.isEmpty())
711  {
712  aComment += " (" + aDesc + ")";
713  }
714 
715  aString += aComment;
716 
717  std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
718  pNewData->nInfo=nSpecial;
719  pNewData->pData=const_cast<ScChangeActionContent *>(pScChangeAction);
720  pNewData->nActionNo=pScChangeAction->GetActionNumber();
721  pNewData->bIsAcceptable=pScChangeAction->IsClickable();
722  pNewData->bIsRejectable=false;
723  pNewData->bDisabled=!pNewData->bIsAcceptable;
724  pNewData->aDateTime=aDateTime;
725  pNewData->nRow = aRef.aStart.Row();
726  pNewData->nCol = aRef.aStart.Col();
727  pNewData->nTable= aRef.aStart.Tab();
728 
729  weld::TreeView& rTreeView = pTheView->GetWidget();
730  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
731  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pNewData.release())));
732  rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, false, xEntry.get());
733  if (pTheView->IsValidComment(aComment) && bFlag)
734  bHasFilterEntry=true;
735  else
736  {
737  rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE);
738  }
739  return xEntry;
740 }
741 
743 {
744  std::unique_ptr<weld::TreeIter> xParent;
745  ScChangeTrack* pChanges=nullptr;
746  const ScChangeAction* pScChangeAction=nullptr;
747  m_xDialog->set_busy_cursor(true);
748  weld::TreeView& rTreeView = pTheView->GetWidget();
749  rTreeView.freeze();
750  bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
752 
753  bUseColor = bFilterFlag;
754 
755  if(pDoc!=nullptr)
756  {
757  pChanges=pDoc->GetChangeTrack();
758  if(pChanges!=nullptr)
759  pScChangeAction=pChanges->GetFirst();
760  }
761  bool bTheFlag = false;
762 
763  while(pScChangeAction!=nullptr)
764  {
765  bHasFilterEntry=false;
766  switch (pScChangeAction->GetState())
767  {
768  case SC_CAS_VIRGIN:
769 
770  if (pScChangeAction->IsDialogRoot())
771  {
772  bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
773  if (pScChangeAction->IsDialogParent())
774  xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
775  else
776  xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
777  }
778  else
779  xParent.reset();
780 
781  bTheFlag=true;
782  break;
783 
784  case SC_CAS_ACCEPTED:
785  xParent.reset();
786  nAcceptCount++;
787  break;
788 
789  case SC_CAS_REJECTED:
790  xParent.reset();
791  nRejectCount++;
792  break;
793  }
794 
795  if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
796  {
797  bool bTestFlag = bHasFilterEntry;
798  bHasFilterEntry=false;
799  if (Expand(pChanges, pScChangeAction, *xParent, !bTestFlag) && !bTestFlag)
800  rTreeView.remove(*xParent);
801  }
802 
803  pScChangeAction=pScChangeAction->GetNext();
804  }
805 
806  if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
807  bTheFlag=false;
808 
809  pTPView->EnableAccept(bTheFlag);
810  pTPView->EnableAcceptAll(bTheFlag);
811  pTPView->EnableReject(bTheFlag);
812  pTPView->EnableRejectAll(bTheFlag);
813 
814  if (nAcceptCount>0)
815  rTreeView.insert(nullptr, -1, &aStrAllAccepted, nullptr, nullptr, nullptr, true, nullptr);
816  if (nRejectCount>0)
817  rTreeView.insert(nullptr, -1, &aStrAllRejected, nullptr, nullptr, nullptr, true, nullptr);
818  rTreeView.thaw();
819  m_xDialog->set_busy_cursor(false);
820  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
821  if (rTreeView.get_iter_first(*xEntry))
822  rTreeView.select(*xEntry);
823 }
824 
826 {
827  sal_uInt16 nId =ScSimpleRefDlgWrapper::GetChildWindowId();
828 
829  SC_MOD()->SetRefDialog( nId, true );
830 
831  SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
832  ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
833 
834  if(pWnd!=nullptr)
835  {
836  sal_uInt16 nAcceptId=ScAcceptChgDlgWrapper::GetChildWindowId();
837  pViewFrm->ShowChildWindow(nAcceptId,false);
838  pWnd->SetCloseHdl(LINK( this, ScAcceptChgDlg,RefInfoHandle));
839  pWnd->SetRefString(pTPFilter->GetRange());
841  auto xWin = pWnd->GetController();
842  m_xDialog->hide();
843  xWin->set_title(m_xDialog->get_title());
844  pWnd->StartRefInput();
845  }
846 }
847 
848 IMPL_LINK( ScAcceptChgDlg, RefInfoHandle, const OUString*, pResult, void)
849 {
850  sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
851 
853 
854  SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
855  if (pResult)
856  {
857  pTPFilter->SetRange(*pResult);
858  FilterHandle(pTPFilter);
859 
860  pViewFrm->ShowChildWindow(nId);
861  }
862  else
863  {
864  pViewFrm->SetChildWindow(nId, false);
865  }
866 }
867 
868 IMPL_LINK( ScAcceptChgDlg, FilterHandle, SvxTPFilter*, pRef, void )
869 {
870  if(pRef!=nullptr)
871  {
872  ClearView();
873  aRangeList.RemoveAll();
874  aRangeList.Parse(pTPFilter->GetRange(), *pDoc);
875  UpdateView();
876  }
877 }
878 
879 IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void )
880 {
881  m_xDialog->set_busy_cursor(true);
882 
883  bIgnoreMsg=true;
884  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
885 
886  if(pRef!=nullptr)
887  {
888  weld::TreeView& rTreeView = pTheView->GetWidget();
889  rTreeView.selected_foreach([this, pChanges, &rTreeView](weld::TreeIter& rEntry){
890  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
891  if (pEntryData)
892  {
893  ScChangeAction* pScChangeAction= static_cast<ScChangeAction*>(pEntryData->pData);
894  if (pScChangeAction->GetType()==SC_CAT_INSERT_TABS)
895  pViewData->SetTabNo(0);
896  pChanges->Reject(pScChangeAction);
897  }
898  return false;
899  });
900  ScDocShell* pDocSh=pViewData->GetDocShell();
901  pDocSh->PostPaintExtras();
902  pDocSh->PostPaintGridAll();
903  pDocSh->GetUndoManager()->Clear();
904  pDocSh->SetDocumentModified();
905  ClearView();
906  UpdateView();
907  }
908 
909  m_xDialog->set_busy_cursor(false);
910 
911  bIgnoreMsg=false;
912 }
913 IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
914 {
915  m_xDialog->set_busy_cursor(true);
916 
917  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
918  bIgnoreMsg=true;
919  if(pRef!=nullptr)
920  {
921  weld::TreeView& rTreeView = pTheView->GetWidget();
922  rTreeView.selected_foreach([pChanges, &rTreeView](weld::TreeIter& rEntry) {
923  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
924  if (pEntryData)
925  {
926  ScChangeAction* pScChangeAction=
927  static_cast<ScChangeAction*>(pEntryData->pData);
928  if(pScChangeAction->GetType()==SC_CAT_CONTENT)
929  {
930  if(pEntryData->nInfo==RD_SPECIAL_CONTENT)
931  pChanges->SelectContent(pScChangeAction,true);
932  else
933  pChanges->SelectContent(pScChangeAction);
934  }
935  else
936  pChanges->Accept(pScChangeAction);
937  }
938  return false;
939  });
940  ScDocShell* pDocSh=pViewData->GetDocShell();
941  pDocSh->PostPaintExtras();
942  pDocSh->PostPaintGridAll();
943  pDocSh->SetDocumentModified();
944  ClearView();
945  UpdateView();
946  }
947  m_xDialog->set_busy_cursor(false);
948  bIgnoreMsg=false;
949 }
950 
952 {
953  if(pDoc==nullptr) return;
954  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
955  const ScChangeAction* pScChangeAction=nullptr;
956 
957  if(pChanges!=nullptr)
958  {
959  pScChangeAction=pChanges->GetLast();
960  }
961 
962  while(pScChangeAction!=nullptr)
963  {
964  if(pScChangeAction->IsDialogRoot())
965  if(IsValidAction(pScChangeAction))
966  pChanges->Reject(const_cast<ScChangeAction*>(pScChangeAction));
967 
968  pScChangeAction=pScChangeAction->GetPrev();
969  }
970 }
972 {
973  if(pDoc==nullptr) return;
974  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
975  const ScChangeAction* pScChangeAction=nullptr;
976 
977  if(pChanges!=nullptr)
978  pScChangeAction=pChanges->GetLast();
979 
980  while(pScChangeAction!=nullptr)
981  {
982  if(pScChangeAction->IsDialogRoot())
983  if(IsValidAction(pScChangeAction))
984  pChanges->Accept(const_cast<ScChangeAction*>(pScChangeAction));
985 
986  pScChangeAction=pScChangeAction->GetPrev();
987  }
988 }
989 
990 IMPL_LINK_NOARG(ScAcceptChgDlg, RejectAllHandle, SvxTPView*, void)
991 {
992  m_xDialog->set_busy_cursor(true);
993  bIgnoreMsg=true;
994  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
995  if(pChanges!=nullptr)
996  {
997  if(pTPFilter->IsDate()||pTPFilter->IsAuthor()||pTPFilter->IsRange()||pTPFilter->IsComment())
998  RejectFiltered();
999  else
1000  pChanges->RejectAll();
1001 
1002  pViewData->SetTabNo(0);
1003 
1004  ScDocShell* pDocSh=pViewData->GetDocShell();
1005  pDocSh->PostPaintExtras();
1006  pDocSh->PostPaintGridAll();
1007  pDocSh->GetUndoManager()->Clear();
1008  pDocSh->SetDocumentModified();
1009  ClearView();
1010  UpdateView();
1011  }
1012  m_xDialog->set_busy_cursor(false);
1013 
1014  bIgnoreMsg=false;
1015 }
1016 
1017 IMPL_LINK_NOARG(ScAcceptChgDlg, AcceptAllHandle, SvxTPView*, void)
1018 {
1019  m_xDialog->set_busy_cursor(true);
1020 
1021  bIgnoreMsg=true;
1022  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1023  if(pChanges!=nullptr)
1024  {
1025  if(pTPFilter->IsDate()||pTPFilter->IsAuthor()||pTPFilter->IsRange()||pTPFilter->IsComment())
1026  AcceptFiltered();
1027  else
1028  pChanges->AcceptAll();
1029 
1030  ScDocShell* pDocSh=pViewData->GetDocShell();
1031  pDocSh->PostPaintExtras();
1032  pDocSh->PostPaintGridAll();
1033  pDocSh->SetDocumentModified();
1034  ClearView();
1035  UpdateView();
1036  }
1037  bIgnoreMsg=false;
1038 
1039  m_xDialog->set_busy_cursor(false);
1040 }
1041 
1043 {
1044  if (!bNoSelection)
1045  aSelectionIdle.Start();
1046 
1047  bNoSelection=false;
1048 }
1049 
1050 void ScAcceptChgDlg::GetDependents(const ScChangeAction* pScChangeAction,
1051  ScChangeActionMap& aActionMap,
1052  const weld::TreeIter& rEntry)
1053 {
1054  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1055 
1056  weld::TreeView& rTreeView = pTheView->GetWidget();
1057  std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
1058  if (rTreeView.iter_parent(*xParent))
1059  {
1060  ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xParent).toInt64());
1061  ScChangeAction* pParentAction=static_cast<ScChangeAction*>(pParentData->pData);
1062 
1063  if(pParentAction!=pScChangeAction)
1064  pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction),
1065  aActionMap,pScChangeAction->IsMasterDelete());
1066  else
1067  pChanges->GetDependents( const_cast<ScChangeAction*>(pScChangeAction),
1068  aActionMap );
1069  }
1070  else
1071  pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction),
1072  aActionMap, pScChangeAction->IsMasterDelete() );
1073 }
1074 
1076 {
1077  bool bTheTestFlag = true;
1078  weld::TreeView& rTreeView = pTheView->GetWidget();
1079  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rParent).toInt64());
1080  const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1081  bool bParentInserted = false;
1082  // If the parent is a MatrixOrigin then place it in the right order before
1083  // the MatrixReferences. Also if it is the first content change at this
1084  // position don't insert the first dependent MatrixReference as the special
1085  // content (original value) but insert the predecessor of the MatrixOrigin
1086  // itself instead.
1087  if ( pScChangeAction->GetType() == SC_CAT_CONTENT &&
1088  static_cast<const ScChangeActionContent*>(pScChangeAction)->IsMatrixOrigin() )
1089  {
1090  pActionMap->insert( ::std::make_pair( pScChangeAction->GetActionNumber(),
1091  const_cast<ScChangeAction*>( pScChangeAction ) ) );
1092  bParentInserted = true;
1093  }
1094 
1095  ScChangeActionMap::iterator itChangeAction = std::find_if(pActionMap->begin(), pActionMap->end(),
1096  [](const std::pair<sal_uLong, ScChangeAction*>& rEntry) { return rEntry.second->GetState() == SC_CAS_VIRGIN; });
1097 
1098  if( itChangeAction == pActionMap->end() )
1099  return true;
1100 
1101  std::unique_ptr<weld::TreeIter> xOriginal = InsertChangeActionContent(
1102  dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
1103  rParent, RD_SPECIAL_CONTENT );
1104 
1105  if (xOriginal)
1106  {
1107  bTheTestFlag=false;
1108  ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xOriginal).toInt64());
1109  pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
1110  pParentData->nActionNo=pScChangeAction->GetActionNumber();
1111  pParentData->bIsAcceptable=pScChangeAction->IsRejectable(); // select old value
1112  pParentData->bIsRejectable=false;
1113  pParentData->bDisabled=false;
1114  }
1115  while( itChangeAction != pActionMap->end() )
1116  {
1117  if( itChangeAction->second->GetState() == SC_CAS_VIRGIN )
1118  {
1119  std::unique_ptr<weld::TreeIter> xEntry =
1120  InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
1121  rParent, RD_SPECIAL_NONE );
1122 
1123  if (xEntry)
1124  bTheTestFlag=false;
1125  }
1126  ++itChangeAction;
1127  }
1128 
1129  if ( !bParentInserted )
1130  {
1131  std::unique_ptr<weld::TreeIter> xEntry =
1132  InsertChangeActionContent(static_cast<const ScChangeActionContent*>(
1133  pScChangeAction),rParent,RD_SPECIAL_NONE);
1134 
1135  if (xEntry)
1136  {
1137  bTheTestFlag=false;
1138  ScRedlinData *pParentData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1139  pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
1140  pParentData->nActionNo=pScChangeAction->GetActionNumber();
1141  pParentData->bIsAcceptable=pScChangeAction->IsClickable();
1142  pParentData->bIsRejectable=false;
1143  pParentData->bDisabled=false;
1144  }
1145  }
1146 
1147  return bTheTestFlag;
1148 }
1149 
1151 {
1152  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1153  bool bTheTestFlag = true;
1154 
1156  weld::TreeView& rTreeView = pTheView->GetWidget();
1157  OUString aString = rTreeView.get_text(rParent, 0);
1158  OUString a2String = aString.copy(0, aStrAllAccepted.getLength());
1159  if (a2String == aStrAllAccepted)
1160  eState=SC_CAS_ACCEPTED;
1161  else
1162  {
1163  a2String = aString.copy(0, aStrAllRejected.getLength());
1164  if (a2String == aStrAllRejected)
1165  eState=SC_CAS_REJECTED;
1166  }
1167 
1168  ScChangeAction* pScChangeAction = pChanges->GetFirst();
1169  while (pScChangeAction)
1170  {
1171  if (pScChangeAction->GetState()==eState &&
1172  AppendFilteredAction(pScChangeAction, eState, false, &rParent))
1173  bTheTestFlag=false;
1174  pScChangeAction=pScChangeAction->GetNext();
1175  }
1176  return bTheTestFlag;
1177 }
1178 
1180 {
1181  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1182  bool bTheTestFlag = true;
1183 
1184  for( const auto& rChangeAction : *pActionMap )
1185  {
1186  std::unique_ptr<weld::TreeIter> xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
1187 
1188  if (xEntry)
1189  {
1190  bTheTestFlag=false;
1191 
1192  weld::TreeView& rTreeView = pTheView->GetWidget();
1193  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1194  pEntryData->bIsRejectable=false;
1195  pEntryData->bIsAcceptable=false;
1196  pEntryData->bDisabled=true;
1197 
1198  if (rChangeAction.second->IsDialogParent())
1199  Expand(pChanges, rChangeAction.second, *xEntry);
1200  }
1201  }
1202  return bTheTestFlag;
1203 }
1204 
1206  ScChangeActionMap* pActionMap, const weld::TreeIter& rParent)
1207 {
1208  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1209  bool bTheTestFlag = true;
1210  std::unique_ptr<weld::TreeIter> xEntry;
1211 
1212  for( const auto& rChangeAction : *pActionMap )
1213  {
1214 
1215  if( pScChangeAction != rChangeAction.second )
1216  xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
1217  else
1218  xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, true, true);
1219 
1220  if (xEntry)
1221  {
1222  weld::TreeView& rTreeView = pTheView->GetWidget();
1223  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1224  pEntryData->bIsRejectable=false;
1225  pEntryData->bIsAcceptable=false;
1226  pEntryData->bDisabled=true;
1227 
1228  bTheTestFlag=false;
1229 
1230  if (rChangeAction.second->IsDialogParent())
1231  Expand(pChanges, rChangeAction.second, *xEntry);
1232  }
1233  }
1234  return bTheTestFlag;
1235 }
1236 
1237 bool ScAcceptChgDlg::Expand(const ScChangeTrack* pChanges, const ScChangeAction* pScChangeAction,
1238  const weld::TreeIter& rEntry, bool bFilter)
1239 {
1240  bool bTheTestFlag = true;
1241 
1242  if (pChanges && pScChangeAction)
1243  {
1244  ScChangeActionMap aActionMap;
1245 
1246  GetDependents(pScChangeAction, aActionMap, rEntry);
1247 
1248  switch(pScChangeAction->GetType())
1249  {
1250  case SC_CAT_CONTENT:
1251  {
1252  InsertContentChildren(&aActionMap, rEntry);
1253  bTheTestFlag=!bHasFilterEntry;
1254  break;
1255  }
1256  case SC_CAT_DELETE_COLS:
1257  case SC_CAT_DELETE_ROWS:
1258  case SC_CAT_DELETE_TABS:
1259  {
1260  InsertDeletedChildren(pScChangeAction, &aActionMap, rEntry);
1261  bTheTestFlag=!bHasFilterEntry;
1262  break;
1263  }
1264  default:
1265  {
1266  if(!bFilter)
1267  bTheTestFlag = InsertChildren(&aActionMap, rEntry);
1268  break;
1269  }
1270  }
1271  aActionMap.clear();
1272  }
1273  return bTheTestFlag;
1274 }
1275 
1276 IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool)
1277 {
1278  ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1279  if (pChanges)
1280  {
1281  m_xDialog->set_busy_cursor(true);
1282  ScChangeActionMap aActionMap;
1283  weld::TreeView& rTreeView = pTheView->GetWidget();
1284  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
1285  if (!rTreeView.iter_has_child(rEntry))
1286  {
1287  bool bTheTestFlag = true;
1288 
1289  if (pEntryData)
1290  {
1291  ScChangeAction* pScChangeAction=static_cast<ScChangeAction*>(pEntryData->pData);
1292 
1293  GetDependents(pScChangeAction, aActionMap, rEntry);
1294 
1295  switch (pScChangeAction->GetType())
1296  {
1297  case SC_CAT_CONTENT:
1298  {
1299  bTheTestFlag = InsertContentChildren( &aActionMap, rEntry );
1300  break;
1301  }
1302  case SC_CAT_DELETE_COLS:
1303  case SC_CAT_DELETE_ROWS:
1304  case SC_CAT_DELETE_TABS:
1305  {
1306  bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, rEntry );
1307  break;
1308  }
1309  default:
1310  {
1311  bTheTestFlag = InsertChildren( &aActionMap, rEntry );
1312  break;
1313  }
1314  }
1315  aActionMap.clear();
1316 
1317  }
1318  else
1319  {
1320  bTheTestFlag = InsertAcceptedORejected(rEntry);
1321  }
1322  if (bTheTestFlag)
1323  {
1324  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1325  rTreeView.insert(&rEntry, -1, &aStrNoEntry, nullptr, nullptr, nullptr, false, xEntry.get());
1326  rTreeView.set_font_color(*xEntry, COL_GRAY);
1327  }
1328  }
1329  m_xDialog->set_busy_cursor(false);
1330  }
1331  return true;
1332 }
1333 
1334 void ScAcceptChgDlg::AppendChanges(const ScChangeTrack* pChanges,sal_uLong nStartAction,
1335  sal_uLong nEndAction)
1336 {
1337  if(pChanges==nullptr)
1338  return;
1339 
1340  std::unique_ptr<weld::TreeIter> xParent;
1341  m_xDialog->set_busy_cursor(true);
1342  weld::TreeView& rTreeView = pTheView->GetWidget();
1343  rTreeView.freeze();
1344 
1345  bool bTheFlag = false;
1346 
1347  bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
1349 
1350  bUseColor = bFilterFlag;
1351 
1352  for(sal_uLong i=nStartAction;i<=nEndAction;i++)
1353  {
1354  const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
1355  if(pScChangeAction==nullptr) continue;
1356 
1357  switch (pScChangeAction->GetState())
1358  {
1359  case SC_CAS_VIRGIN:
1360 
1361  if (pScChangeAction->IsDialogRoot())
1362  {
1363  bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
1364  if (pScChangeAction->IsDialogParent())
1365  xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
1366  else
1367  xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
1368  }
1369  else
1370  xParent.reset();
1371 
1372  bTheFlag=true;
1373  break;
1374 
1375  case SC_CAS_ACCEPTED:
1376  xParent.reset();
1377  nAcceptCount++;
1378  break;
1379 
1380  case SC_CAS_REJECTED:
1381  xParent.reset();
1382  nRejectCount++;
1383  break;
1384  }
1385 
1386  if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
1387  {
1388  bool bTestFlag = bHasFilterEntry;
1389  bHasFilterEntry = false;
1390  if (Expand(pChanges,pScChangeAction,*xParent,!bTestFlag)&&!bTestFlag)
1391  rTreeView.remove(*xParent);
1392  }
1393  }
1394 
1395  if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
1396  bTheFlag=false;
1397 
1398  pTPView->EnableAccept(bTheFlag);
1399  pTPView->EnableAcceptAll(bTheFlag);
1400  pTPView->EnableReject(bTheFlag);
1401  pTPView->EnableRejectAll(bTheFlag);
1402 
1403  rTreeView.thaw();
1404  m_xDialog->set_busy_cursor(false);
1405 }
1406 
1408 {
1409  weld::TreeView& rTreeView = pTheView->GetWidget();
1410 
1411  ScRedlinData *pEntryData=nullptr;
1412  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1413  if (rTreeView.get_cursor(xEntry.get()))
1414  pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1415 
1416  if (!rTreeView.get_iter_first(*xEntry))
1417  return;
1418 
1419  sal_uLong nAction=0;
1420  if (pEntryData)
1421  nAction=pEntryData->nActionNo;
1422 
1423  if (nAction>=nStartAction && nAction<=nEndAction)
1424  rTreeView.set_cursor(*xEntry);
1425 
1426  std::vector<OUString> aIdsToRemove;
1427 
1428  do
1429  {
1430  OUString sId(rTreeView.get_id(*xEntry));
1431  pEntryData = reinterpret_cast<ScRedlinData *>(sId.toInt64());
1432  if (pEntryData)
1433  {
1434  nAction = pEntryData->nActionNo;
1435  if (nStartAction <= nAction && nAction <= nEndAction)
1436  {
1437  aIdsToRemove.push_back(sId);
1438  delete pEntryData;
1439  }
1440  }
1441  }
1442  while (rTreeView.iter_next(*xEntry));
1443 
1444  rTreeView.freeze();
1445 
1446  // MUST do it backwards, don't delete parents before children and GPF
1447  for (auto it = aIdsToRemove.rbegin(); it != aIdsToRemove.rend(); ++it)
1448  rTreeView.remove_id(*it);
1449 
1450  rTreeView.thaw();
1451 }
1452 
1453 void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nStartAction,sal_uLong nEndAction)
1454 {
1455  weld::TreeView& rTreeView = pTheView->GetWidget();
1456  rTreeView.freeze();
1457 
1458  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1459  std::unique_ptr<weld::TreeIter> xLastEntry(rTreeView.make_iterator());
1460  std::unique_ptr<weld::TreeIter> xNextEntry(rTreeView.make_iterator());
1461 
1462  bool bEntry = rTreeView.get_iter_first(*xEntry);
1463  bool bLastEntry = false;
1464 
1465  while (bEntry)
1466  {
1467  bool bRemove = false;
1468  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1469  if (pEntryData)
1470  {
1471  ScChangeAction* pScChangeAction=
1472  static_cast<ScChangeAction*>(pEntryData->pData);
1473 
1474  sal_uLong nAction=pScChangeAction->GetActionNumber();
1475 
1476  if(nStartAction<=nAction && nAction<=nEndAction) bRemove=true;
1477  }
1478 
1479  bool bNextEntry;
1480  if (bRemove)
1481  {
1482  rTreeView.remove(*xEntry);
1483  delete pEntryData;
1484 
1485  if (!bLastEntry)
1486  bLastEntry = rTreeView.get_iter_first(*xLastEntry);
1487  if (bLastEntry)
1488  {
1489  rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
1490  bNextEntry = rTreeView.iter_next(*xNextEntry);
1491  if (!bNextEntry)
1492  {
1493  rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
1494  bLastEntry = false;
1495  }
1496  }
1497  else
1498  bNextEntry = false;
1499  }
1500  else
1501  {
1502  rTreeView.copy_iterator(*xEntry, *xLastEntry);
1503  bLastEntry = true;
1504 
1505  rTreeView.copy_iterator(*xEntry, *xNextEntry);
1506  bNextEntry = rTreeView.iter_next(*xNextEntry);
1507  }
1508 
1509  rTreeView.copy_iterator(*xNextEntry, *xEntry);
1510  bEntry = bNextEntry;
1511  }
1512 
1513  AppendChanges(pChgTrack,nStartAction,nEndAction);
1514 
1515  rTreeView.thaw();
1516 }
1517 
1518 IMPL_LINK( ScAcceptChgDlg, ChgTrackModHdl, ScChangeTrack&, rChgTrack, void)
1519 {
1520  ScChangeTrackMsgQueue& aMsgQueue= rChgTrack.GetMsgQueue();
1521 
1522  sal_uLong nStartAction;
1523  sal_uLong nEndAction;
1524 
1525  for (const auto& rMsg : aMsgQueue)
1526  {
1527  nStartAction = rMsg.nStartAction;
1528  nEndAction = rMsg.nEndAction;
1529 
1530  if(!bIgnoreMsg)
1531  {
1532  bNoSelection=true;
1533 
1534  switch(rMsg.eMsgType)
1535  {
1537  AppendChanges(&rChgTrack,nStartAction,nEndAction);
1538  break;
1540  RemoveEntries(nStartAction,nEndAction);
1541  break;
1543  case ScChangeTrackMsgType::Change: //bNeedsUpdate=true;
1544  UpdateEntries(&rChgTrack,nStartAction,nEndAction);
1545  break;
1546  default: assert(false); break;
1547  }
1548  }
1549  }
1550 
1551  aMsgQueue.clear();
1552 }
1553 
1554 IMPL_LINK_NOARG(ScAcceptChgDlg, ReOpenTimerHdl, Timer *, void)
1555 {
1557  m_xAcceptChgCtr->ShowFilterPage();
1558  RefHandle(nullptr);
1559 }
1560 
1561 IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
1562 {
1563  ScTabView* pTabView = pViewData->GetView();
1564 
1565  bool bAcceptFlag = true;
1566  bool bRejectFlag = true;
1567 
1568  pTabView->DoneBlockMode(); // clears old marking
1569  weld::TreeView& rTreeView = pTheView->GetWidget();
1570  std::vector<const ScChangeAction*> aActions;
1571  rTreeView.selected_foreach([&rTreeView, &bAcceptFlag, &bRejectFlag, &aActions](weld::TreeIter& rEntry){
1572  ScRedlinData* pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rEntry).toInt64());
1573  if (pEntryData)
1574  {
1575  bRejectFlag &= pEntryData->bIsRejectable;
1576  bAcceptFlag &= pEntryData->bIsAcceptable;
1577 
1578  const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1579  if( pScChangeAction && (pScChangeAction->GetType() != SC_CAT_DELETE_TABS) &&
1580  (!pEntryData->bDisabled || pScChangeAction->IsVisible()) )
1581  {
1582  aActions.push_back(pScChangeAction);
1583  }
1584  }
1585  else
1586  {
1587  bAcceptFlag = false;
1588  bRejectFlag = false;
1589  }
1590  return false;
1591  });
1592 
1593  bool bContMark = false;
1594  for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
1595  {
1596  const ScBigRange& rBigRange = aActions[i]->GetBigRange();
1597  if (rBigRange.IsValid(*pDoc) && m_xDialog->has_toplevel_focus())
1598  {
1599  bool bSetCursor = i == nCount - 1;
1600  pTabView->MarkRange(rBigRange.MakeRange(), bSetCursor, bContMark);
1601  bContMark = true;
1602  }
1603  }
1604 
1605  ScChangeTrack* pChanges = pDoc->GetChangeTrack();
1606  bool bEnable = pDoc->IsDocEditable() && pChanges && !pChanges->IsProtected();
1607  pTPView->EnableAccept( bAcceptFlag && bEnable );
1608  pTPView->EnableReject( bRejectFlag && bEnable );
1609 }
1610 
1611 IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
1612 {
1613  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
1614  return false;
1615 
1616  weld::TreeView& rTreeView = pTheView->GetWidget();
1617  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1618  bool bEntry = rTreeView.get_cursor(xEntry.get());
1619  if (bEntry)
1620  rTreeView.select(*xEntry);
1621 
1622  int nSortedCol = rTreeView.get_sort_column();
1623  for (sal_Int32 i = 0; i < 5; ++i)
1624  m_xSortMenu->set_active("calcsort" + OString::number(i), i == nSortedCol);
1625 
1626  m_xPopup->set_sensitive("calcedit", false);
1627 
1628  if (pDoc->IsDocEditable() && bEntry)
1629  {
1630  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1631  if (pEntryData)
1632  {
1633  ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1634  if (pScChangeAction && !rTreeView.get_iter_depth(*xEntry))
1635  m_xPopup->set_sensitive("calcedit", true);
1636  }
1637  }
1638 
1639  OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
1640 
1641  if (!sCommand.isEmpty())
1642  {
1643  if (sCommand == "calcedit")
1644  {
1645  if (bEntry)
1646  {
1647  ScRedlinData *pEntryData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(*xEntry).toInt64());
1648  if (pEntryData)
1649  {
1650  ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1651  pViewData->GetDocShell()->ExecuteChangeCommentDialog(pScChangeAction, m_xDialog.get(), false);
1652  }
1653  }
1654  }
1655  else
1656  {
1657  int nDialogCol = sCommand.copy(8).toInt32();
1658  pTheView->HeaderBarClick(nDialogCol);
1659  }
1660  }
1661 
1662  return true;
1663 }
1664 
1665 namespace
1666 {
1667  //at one point we were writing multiple AcceptChgDat strings,
1668  //so strip all of them and keep the results of the last one
1669  OUString lcl_StripAcceptChgDat(OUString &rExtraString)
1670  {
1671  OUString aStr;
1672  while (true)
1673  {
1674  sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:");
1675  if (nPos == -1)
1676  break;
1677  // Try to read the alignment string "ALIGN:(...)"; if it is missing
1678  // we have an old version
1679  sal_Int32 n1 = rExtraString.indexOf('(', nPos);
1680  if ( n1 != -1 )
1681  {
1682  sal_Int32 n2 = rExtraString.indexOf(')', n1);
1683  if ( n2 != -1 )
1684  {
1685  // cut out alignment string
1686  aStr = rExtraString.copy(nPos, n2 - nPos + 1);
1687  rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, "");
1688  aStr = aStr.copy( n1-nPos+1 );
1689  }
1690  }
1691  }
1692  return aStr;
1693  }
1694 }
1695 
1697 {
1698  OUString aStr;
1699  if (pInfo && !pInfo->aExtraString.isEmpty())
1700  aStr = lcl_StripAcceptChgDat(pInfo->aExtraString);
1701 
1703 
1704  if (aStr.isEmpty())
1705  return;
1706 
1707  int nCount = aStr.toInt32();
1708  if (nCount <= 2)
1709  return;
1710 
1711  std::vector<int> aEndPos;
1712 
1713  for (int i = 0; i < nCount; ++i)
1714  {
1715  sal_Int32 n1 = aStr.indexOf(';');
1716  aStr = aStr.copy( n1+1 );
1717  aEndPos.push_back(aStr.toInt32());
1718  }
1719 
1720  std::vector<int> aWidths;
1721  for (int i = 1; i < nCount; ++i)
1722  aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
1723 
1724  // turn column end points back to column widths, ignoring the small
1725  // value used for the expander column
1726  weld::TreeView& rTreeView = pTheView->GetWidget();
1727  rTreeView.set_column_fixed_widths(aWidths);
1728 }
1729 
1731 {
1733  //remove any old one before adding a new one
1734  lcl_StripAcceptChgDat(rInfo.aExtraString);
1735  rInfo.aExtraString += "AcceptChgDat:(";
1736 
1737  const int nTabCount = 5;
1738 
1739  rInfo.aExtraString += OUString::number(nTabCount);
1740  rInfo.aExtraString += ";";
1741 
1742  weld::TreeView& rTreeView = pTheView->GetWidget();
1743  std::vector<int> aWidths;
1744  // turn column widths back into column end points for compatibility
1745  // with how they used to be stored, including a small value for the
1746  // expander column
1747  aWidths.push_back(rTreeView.get_checkbox_column_width());
1748  for (int i = 0; i < nTabCount - 1; ++i)
1749  aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i));
1750 
1751  for (auto a : aWidths)
1752  {
1753  rInfo.aExtraString += OUString::number(a);
1754  rInfo.aExtraString += ";";
1755  }
1756  rInfo.aExtraString += ")";
1757 }
1758 
1759 #define CALC_DATE 3
1760 #define CALC_POS 1
1761 
1762 int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeIter& rRight) const
1763 {
1764  weld::TreeView& rTreeView = pTheView->GetWidget();
1765 
1766  sal_Int32 nCompare = 0;
1767  SCCOL nSortCol = rTreeView.get_sort_column();
1768 
1769  if (CALC_DATE == nSortCol)
1770  {
1771  RedlinData *pLeftData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rLeft).toInt64());
1772  RedlinData *pRightData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rRight).toInt64());
1773  if (pLeftData && pRightData)
1774  {
1775  if(pLeftData->aDateTime < pRightData->aDateTime)
1776  nCompare = -1;
1777  else if(pLeftData->aDateTime > pRightData->aDateTime)
1778  nCompare = 1;
1779  return nCompare;
1780  }
1781  }
1782  else if (CALC_POS == nSortCol)
1783  {
1784  ScRedlinData *pLeftData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rLeft).toInt64());
1785  ScRedlinData *pRightData = reinterpret_cast<ScRedlinData*>(rTreeView.get_id(rRight).toInt64());
1786  if (pLeftData && pRightData)
1787  {
1788  nCompare = 1;
1789 
1790  if(pLeftData->nTable < pRightData->nTable)
1791  nCompare = -1;
1792  else if(pLeftData->nTable == pRightData->nTable)
1793  {
1794  if(pLeftData->nRow < pRightData->nRow)
1795  nCompare = -1;
1796  else if(pLeftData->nRow == pRightData->nRow)
1797  {
1798  if(pLeftData->nCol < pRightData->nCol)
1799  nCompare = -1;
1800  else if(pLeftData->nCol == pRightData->nCol)
1801  nCompare = 0;
1802  }
1803  }
1804 
1805  return nCompare;
1806  }
1807  }
1808 
1809  return ScGlobal::GetCaseCollator().compareString(rTreeView.get_text(rLeft, nSortCol),
1810  rTreeView.get_text(rRight, nSortCol));
1811 }
1812 
1813 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void FillInfo(SfxChildWinInfo &) const
std::shared_ptr< SfxDialogController > & GetController()
virtual void set_text(int row, const OUString &rText, int col=-1)=0
void SetFilterDate(bool bFlag)
SfxViewFrame * GetViewFrame() const
bool bHasFilterEntry
Definition: acredlin.hxx:77
void SetDateMode(sal_uInt16 nMode)
OUString aStrReject
Definition: acredlin.hxx:64
OUString aStrDeleteCols
Definition: acredlin.hxx:59
void AppendChanges(const ScChangeTrack *pChanges, sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1334
OUString GetRefString(const ScBigRange &rRange, const ScDocument &rDoc, bool bFlag3D=false) const
Definition: chgtrack.cxx:480
bool IsGenerated(sal_uLong nAction) const
Definition: chgtrack.cxx:2131
void SetFilterComment(bool bFlag)
void SetFirstDate(const Date &aDate)
virtual void set_sort_func(const std::function< int(const weld::TreeIter &, const weld::TreeIter &)> &func)
bool IsDate() const
ScChangeActionState
Definition: chgtrack.hxx:76
OUString aExtraString
ScAddress aStart
Definition: address.hxx:499
bool HasComment() const
Definition: chgviset.hxx:98
std::unique_ptr< weld::TreeIter > AppendChangeAction(const ScChangeAction *pScChangeAction, bool bCreateOnDemand, const weld::TreeIter *pParent=nullptr, bool bDelMaster=false, bool bDisabled=false)
Definition: acredlin.cxx:361
ScChangeActionType GetType() const
Definition: chgtrack.hxx:317
sal_uLong nRejectCount
Definition: acredlin.hxx:74
bool IsDialogRoot() const
Definition: chgtrack.cxx:232
SfxChildWindow * GetChildWindow(sal_uInt16)
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
void SetRejectAllClickHdl(const Link< SvxTPView *, void > &rLink)
std::vector< ScChangeTrackMsgInfo > ScChangeTrackMsgQueue
Definition: chgtrack.hxx:803
void Initialize(SfxChildWinInfo const *pInfo)
void SetCalcView()
OUString aStrInsertCols
Definition: acredlin.hxx:56
SCROW Row() const
Definition: address.hxx:261
void PostPaintGridAll()
Definition: docsh3.cxx:183
const OUString & GetUser() const
Definition: chgtrack.hxx:977
virtual bool iter_parent(TreeIter &rIter) const =0
ScChangeAction * GetNext() const
Definition: chgtrack.hxx:322
virtual void copy_iterator(const TreeIter &rSource, TreeIter &rDest) const =0
#define RD_SPECIAL_VISCONTENT
Definition: acredlin.cxx:42
#define CALC_DATE
Definition: acredlin.cxx:1759
bool IsMasterDelete() const
Definition: chgtrack.cxx:273
void SetCommentParams(const utl::SearchParam *pSearchPara)
void remove_id(const OUString &rText)
ScChangeAction * GetLast() const
Definition: chgtrack.hxx:959
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, bool bChildrenOnDemand, TreeIter *pRet)=0
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1687
int n1
SC_DLLPUBLIC ScChangeAction * GetAction(sal_uLong nAction) const
Definition: chgtrack.cxx:2136
tools::Time GetFirstTime() const
bool Intersects(const ScRange &rRange) const
Definition: address.cxx:1558
ScChangeActionState GetState() const
Definition: chgtrack.hxx:318
bool RejectAll()
Definition: chgtrack.cxx:4122
void * pData
sal_uIntPtr sal_uLong
OUString aStrAllAccepted
Definition: acredlin.hxx:65
const SCCOL SCCOL_MAX
Definition: address.hxx:56
SCROW nRow
Definition: acredlin.hxx:43
void SetAuthor(const OUString &)
bool IsValidComment(const OUString &rComment)
aBuf
void SetTheAuthorToShow(const OUString &aString)
Definition: chgviset.hxx:96
void SetDocumentModified()
Definition: docsh.cxx:2940
sal_Int16 nId
void PostPaintExtras()
Definition: docsh3.cxx:198
virtual void clear()=0
ScChangeActionType
Definition: chgtrack.hxx:62
bool bIsRejectable
Definition: acredlin.hxx:44
void SetRange(const OUString &rString)
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
void CheckRange(bool bFlag)
bool IsDialogParent() const
Definition: chgtrack.cxx:237
void SetModifiedLink(const Link< ScChangeTrack &, void > &r)
Definition: chgtrack.hxx:1115
void EnableRejectAll(bool bFlag)
SvxTPView * pTPView
Definition: acredlin.hxx:81
IMPL_LINK_NOARG(ScAcceptChgDlg, RefHandle, SvxTPFilter *, void)
Definition: acredlin.cxx:825
void SetFirstTime(const tools::Time &)
void EnableClearFormat(bool bFlag)
bool InsertContentChildren(ScChangeActionMap *pActionMap, const weld::TreeIter &rParent)
Definition: acredlin.cxx:1075
const SCROW SCROW_MAX
Definition: address.hxx:55
sal_uLong nInfo
Definition: acredlin.hxx:40
bool Expand(const ScChangeTrack *pChanges, const ScChangeAction *pScChangeAction, const weld::TreeIter &rEntry, bool bFilter=false)
Definition: acredlin.cxx:1237
OUString aStrContentWithChild
Definition: acredlin.hxx:68
ScChangeAction * GetPrev() const
Definition: chgtrack.hxx:323
virtual void FillInfo(SfxChildWinInfo &) const override
Definition: acredlin.cxx:1730
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
void SetRefString(const OUString &rStr)
Definition: reffact.cxx:168
void ClearAuthors()
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
OUString aStrChildOrgContent
Definition: acredlin.hxx:70
virtual void thaw()=0
virtual int get_column_width(int nCol) const =0
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2926
void HideRange(bool bHide=true)
void connect_changed(const Link< TreeView &, void > &rLink)
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
Definition: global.cxx:1007
virtual void GetDescription(OUString &rStr, ScDocument &rDoc, bool bSplitRange=false, bool bWarning=true) const
Definition: chgtrack.cxx:420
int ColCompareHdl(const weld::TreeIter &rLeft, const weld::TreeIter &rRight) const
Definition: acredlin.cxx:1762
int n2
Idle aSelectionIdle
Definition: acredlin.hxx:50
OUString aStrEmpty
Definition: acredlin.hxx:71
SvxRedlinDateMode GetTheDateMode() const
Definition: chgviset.hxx:84
std::unique_ptr< weld::TreeIter > InsertChangeActionContent(const ScChangeActionContent *pScChangeAction, const weld::TreeIter &rParent, sal_uLong nSpecial)
Definition: acredlin.cxx:622
void SetFilterAuthor(bool bFlag)
void SetReadyHdl(const Link< SvxTPFilter *, void > &rLink)
int nCount
OUString aStrInsertTabs
Definition: acredlin.hxx:58
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual void selected_foreach(const std::function< bool(TreeIter &)> &func)=0
bool bIsAcceptable
Definition: acredlin.hxx:45
void AcceptFiltered()
Definition: acredlin.cxx:971
ScChangeAction * GetFirst() const
Definition: chgtrack.hxx:958
DateTime aDateTime
virtual OUString get_id(int pos) const =0
SCTAB Tab() const
Definition: address.hxx:270
bool InsertAcceptedORejected(const weld::TreeIter &rParent)
Definition: acredlin.cxx:1150
OUString aStrContent
Definition: acredlin.hxx:63
bool IsRejectable() const
Definition: chgtrack.cxx:196
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
virtual void set_font_color(int pos, const Color &rColor)=0
void UpdateEntries(const ScChangeTrack *pChgTrack, sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1453
OUString GetComment() const
void RemoveEntries(sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1407
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2405
void CheckAuthor(bool bFlag)
OUString aStrChildContent
Definition: acredlin.hxx:69
bool IsProtected() const
Definition: chgtrack.hxx:1132
bool empty() const
Definition: rangelst.hxx:88
void SetDebugName(const char *pDebugName)
DocumentType eType
OUString aStrAllRejected
Definition: acredlin.hxx:66
std::unique_ptr< weld::TreeIter > AppendFilteredAction(const ScChangeAction *pScChangeAction, ScChangeActionState eState, bool bCreateOnDemand, const weld::TreeIter *pParent=nullptr, bool bDelMaster=false, bool bDisabled=false)
Definition: acredlin.cxx:508
void AdjustDateMode(const ScDocument &rDoc)
Adjust dates according to selected DateMode.
Definition: chgviset.cxx:105
OUString aUnknown
Definition: acredlin.hxx:72
std::unique_ptr< SvxAcceptChgCtr > m_xAcceptChgCtr
Definition: acredlin.hxx:86
const ScRangeList & GetTheRangeList() const
Definition: chgviset.hxx:109
bool HasDate() const
Definition: chgviset.hxx:80
int i
uno_Any a
void SetFirstDate(const Date &)
sal_Int16 SCCOL
Definition: types.hxx:21
tools::Time GetLastTime() const
bool HasRange() const
Definition: chgviset.hxx:106
bool IsAuthor() const
const OUString & GetTheAuthorToShow() const
Definition: chgviset.hxx:95
static void SetAutoReOpen(bool bFlag)
Definition: reffact.cxx:163
virtual void freeze()=0
#define SC_MOD()
Definition: scmod.hxx:250
const OUString & GetComment() const
Definition: chgtrack.hxx:352
void connect_expanding(const Link< const TreeIter &, bool > &rLink)
void EnableClearFormatAll(bool bFlag)
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2212
virtual void Clear()
virtual bool iter_has_child(const TreeIter &rIter) const =0
void SetLastTime(const tools::Time &aTime)
bool IsValid(const ScDocument &rDoc) const
Definition: bigrange.hxx:134
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_GRAY
size_t size() const
Definition: rangelst.hxx:89
bool SelectContent(ScChangeAction *, bool bOldest=false)
Definition: chgtrack.cxx:4011
virtual bool iter_next(TreeIter &rIter) const =0
void AcceptAll()
Definition: chgtrack.cxx:4094
void GetNewString(OUString &rStr, const ScDocument *pDoc) const
Definition: chgtrack.cxx:1398
OUString GetSelectedAuthor() const
ScBigRange & GetBigRange()
Definition: chgtrack.hxx:231
void ReInit(ScViewData *ptrViewData)
Definition: acredlin.cxx:157
virtual OUString get_text(int row, int col=-1) const =0
void GetOldString(OUString &rStr, const ScDocument *pDoc) const
Definition: chgtrack.cxx:1393
#define RD_SPECIAL_NONE
Definition: acredlin.cxx:40
virtual void expand_row(const TreeIter &rIter)=0
virtual bool get_cursor(TreeIter *pIter) const =0
OUString aStrDeleteRows
Definition: acredlin.hxx:60
virtual void GetRefString(OUString &rStr, ScDocument &rDoc, bool bFlag3D=false) const override
Definition: chgtrack.cxx:1444
bool IsComment() const
SfxViewShell * GetViewShell() const
bool IsValidAction(const ScChangeAction *pScChangeAction)
Definition: acredlin.cxx:313
SCCOL Col() const
Definition: address.hxx:266
OUString * MakeTypeString(ScChangeActionType eType)
Definition: acredlin.cxx:292
void CheckComment(bool bFlag)
OUString aStrInsertRows
Definition: acredlin.hxx:57
void SelectedAuthorPos(sal_Int32 nPos)
sal_uLong GetActionNumber() const
Definition: chgtrack.hxx:319
virtual void remove(int pos)=0
int get_checkbox_column_width() const
bool InsertChildren(ScChangeActionMap *pActionMap, const weld::TreeIter &rParent)
Definition: acredlin.cxx:1179
ScRangeList aRangeList
Definition: acredlin.hxx:54
bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment)
void SetLastTime(const tools::Time &)
OUString getDate(const Date &rDate) const
std::map< sal_uLong, ScChangeAction * > ScChangeActionMap
Definition: chgtrack.hxx:805
ScRange MakeRange() const
Definition: bigrange.hxx:136
bool bDisabled
OUString aStrMove
Definition: acredlin.hxx:62
virtual void select(int pos)=0
virtual ~ScRedlinData() override
Definition: acredlin.cxx:58
virtual void all_foreach(const std::function< bool(TreeIter &)> &func)=0
#define CALC_POS
Definition: acredlin.cxx:1760
void UpdateView()
Definition: acredlin.cxx:742
void EnableReject(bool bFlag)
static CollatorWrapper & GetCaseCollator()
case-sensitive collator
Definition: global.cxx:1058
const DateTime & GetTheLastDateTime() const
Definition: chgviset.hxx:90
virtual int get_sort_column() const =0
bool IsRange() const
sal_Int32 SelectAuthor(const OUString &aString)
weld::TreeView & GetWidget()
sal_uLong nActionNo
Definition: acredlin.hxx:39
bool Reject(ScChangeAction *, ScChangeActionMap *, bool bRecursion)
Definition: chgtrack.cxx:4153
constexpr::Color COL_GREEN(0x00, 0x80, 0x00)
bool InsertDeletedChildren(const ScChangeAction *pChangeAction, ScChangeActionMap *pActionMap, const weld::TreeIter &rParent)
Definition: acredlin.cxx:1205
void EnableAccept(bool bFlag)
SCTAB nTable
Definition: acredlin.hxx:41
Date GetLastDate() const
void SetFirstTime(const tools::Time &aTime)
std::unique_ptr< weld::Container > m_xContentArea
Definition: acredlin.hxx:84
bool bNoSelection
Definition: acredlin.hxx:76
void ClearView()
Definition: acredlin.cxx:275
bool IsVisible() const
Definition: chgtrack.cxx:142
bool IsDocEditable() const
Definition: documen3.cxx:1908
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
void SetLastDate(const Date &)
ScChangeViewSettings * GetChangeViewSettings() const
Definition: document.hxx:2166
bool HasAuthor() const
Definition: chgviset.hxx:92
const OUString & GetTheComment() const
Definition: chgviset.hxx:101
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
Idle aReOpenIdle
Definition: acredlin.hxx:51
void SetLastDate(const Date &aDate)
virtual bool get_iter_first(TreeIter &rIter) const =0
Reference< XExecutableDialog > m_xDialog
void SetDateTimeMode(SvxRedlinDateMode nMode)
virtual void set_cursor(int pos)=0
void SetInvokeHandler(const Link< Timer *, void > &rLink)
SvxRedlinTable * GetTableControl()
virtual void set_selection_mode(SelectionMode eMode)=0
const DateTime & GetTheFirstDateTime() const
Definition: chgviset.hxx:87
ScAcceptChgDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData *ptrViewData)
Definition: acredlin.cxx:69
SvxRedlinTable * pTheView
Definition: acredlin.hxx:82
void ShowChildWindow(sal_uInt16, bool bVisible=true)
const OUString & GetUser() const
Definition: chgtrack.hxx:351
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
const std::set< OUString > & GetUserCollection() const
Definition: chgtrack.hxx:978
Date GetFirstDate() const
ScRange & front()
Definition: rangelst.hxx:92
IMPL_LINK(ScAcceptChgDlg, RefInfoHandle, const OUString *, pResult, void)
Definition: acredlin.cxx:848
ScChangeViewSettings aChangeViewSet
Definition: acredlin.hxx:55
OUString aStrDeleteTabs
Definition: acredlin.hxx:61
virtual bool get_row_expanded(const TreeIter &rIter) const =0
SvxRedlinDateMode GetDateMode() const
void Initialize(SfxChildWinInfo *pInfo)
Definition: acredlin.cxx:1696
void SetRefHdl(const Link< SvxTPFilter *, void > &rLink)
void CheckDate(bool bFlag)
void SetComment(const OUString &rComment)
void RejectFiltered()
Definition: acredlin.cxx:951
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
SC_DLLPUBLIC bool Accept(ScChangeAction *)
Definition: chgtrack.cxx:4102
virtual ~ScAcceptChgDlg() override
Definition: acredlin.cxx:145
void UpdateFilterTest()
SC_DLLPUBLIC void GetDependents(ScChangeAction *, ScChangeActionMap &, bool bListMasterDelete=false, bool bAllFlat=false) const
Definition: chgtrack.cxx:3816
void GetDependents(const ScChangeAction *pScChangeAction, ScChangeActionMap &aActionMap, const weld::TreeIter &rEntry)
Definition: acredlin.cxx:1050
const SCTAB SCTAB_MAX
Definition: address.hxx:57
void SetCloseHdl(const Link< const OUString *, void > &rLink)
Definition: reffact.cxx:177
bool IsClickable() const
Definition: chgtrack.cxx:165
sal_uLong nAcceptCount
Definition: acredlin.hxx:73
void InsertAuthor(const OUString &rString)
ScViewData * pViewData
Definition: acredlin.hxx:52
virtual void connect_popup_menu(const Link< const CommandEvent &, bool > &rLink)
#define RD_SPECIAL_CONTENT
Definition: acredlin.cxx:41
ScDocument * pDoc
Definition: acredlin.hxx:53
SvxTPFilter * pTPFilter
Definition: acredlin.hxx:80
aStr
void EnableAcceptAll(bool bFlag)
SC_DLLPUBLIC DateTime GetDateTime() const
Definition: chgtrack.cxx:406
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
sal_uInt16 nPos
virtual int get_iter_depth(const TreeIter &rIter) const =0
SCCOL nCol
Definition: acredlin.hxx:42
OUString sId