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