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>
24#include <sfx2/viewfrm.hxx>
25#include <sfx2/basedlgs.hxx>
26#include <vcl/commandevent.hxx>
27#include <o3tl/string_view.hxx>
28
29#include <acredlin.hxx>
30#include <global.hxx>
31#include <reffact.hxx>
32#include <document.hxx>
33#include <docsh.hxx>
34#include <scresid.hxx>
35#include <strings.hrc>
36#include <scmod.hxx>
37#include <tabvwsh.hxx>
38
39// defines -------------------------------------------------------------------
40
41#define RD_SPECIAL_NONE 0
42#define RD_SPECIAL_CONTENT 1
43#define RD_SPECIAL_VISCONTENT 2
44
45
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 aSelectionIdle" )
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 , m_xSortMenu(m_xBuilder->weld_menu("calcsortmenu"))
102{
104 nAcceptCount=0;
105 nRejectCount=0;
106 aReOpenIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, ReOpenTimerHdl ));
107
108 pTPFilter = m_xAcceptChgCtr->GetFilterPage();
109 pTPView = m_xAcceptChgCtr->GetViewPage();
110
111 // tdf#136062 Don't use "Reject/Clear formatting" instead of "Reject" buttons in Calc
114
117 aSelectionIdle.SetInvokeHandler(LINK( this, ScAcceptChgDlg, UpdateSelectionHdl ));
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
208
210 if (aDateTime != aEmpty)
211 {
212 pTPFilter->SetFirstDate(aDateTime);
213 pTPFilter->SetFirstTime(aDateTime);
214 }
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 = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
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
314{
315 if(pScChangeAction==nullptr) return false;
316
317 bool bFlag = false;
318
319 ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc);
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
329 {
330 if(!pScChangeAction->IsDialogParent())
331 aDesc = pScChangeAction->GetDescription(*pDoc, true);
332 }
333 else
334 aDesc = pScChangeAction->GetDescription(*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
361std::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(*pDoc);
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
392 {
393 if(pScChangeAction->IsDialogParent())
394 {
396 pNewData->nInfo=RD_SPECIAL_VISCONTENT;
397 pNewData->bIsRejectable=false;
398 pNewData->bIsAcceptable=false;
399 }
400 else
401 {
402 aBuf.append(*MakeTypeString(eType));
403 aDesc = pScChangeAction->GetDescription(*pDoc, true);
404 }
405 }
406 else
407 {
409
410 if(bDelMaster)
411 {
412 aDesc = pScChangeAction->GetDescription(*pDoc,true);
413 pNewData->bDisabled=true;
414 pNewData->bIsRejectable=false;
415 }
416 else
417 aDesc = pScChangeAction->GetDescription(*pDoc, !pScChangeAction->IsMasterDelete());
418
419 }
420
421 aRefStr = pScChangeAction->GetRefString(*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(weld::toId(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
508std::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(*pDoc);
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
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 aDesc = pScChangeAction->GetDescription(*pDoc, true);
575 }
576 }
577 else
578 {
579 aActionString=*MakeTypeString(eType);
580
581 if(bDelMaster)
582 {
583 aDesc = pScChangeAction->GetDescription(*pDoc,true);
584 pNewData->bDisabled=true;
585 pNewData->bIsRejectable=false;
586 }
587 else
588 aDesc = pScChangeAction->GetDescription(*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(weld::toId(pNewData.release()));
603 rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
604
605 OUString aRefStr = pScChangeAction->GetRefString(*pDoc, true);
606 rTreeView.set_text(*xEntry, aRefStr, 1);
607
608 if (!bIsGenerated)
609 {
610 rTreeView.set_text(*xEntry, aUser, 2);
611 OUString sDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime);
612 rTreeView.set_text(*xEntry, sDate, 3);
613 }
614
615 rTreeView.set_text(*xEntry, aComment, 4);
616 }
617 }
618 return xEntry;
619}
620
621std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
622 const weld::TreeIter& rParent, sal_uLong nSpecial)
623{
624 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
625
626 if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
627
628 bool bIsGenerated = pChanges->IsGenerated(pScChangeAction->GetActionNumber());
629
630 bool bFlag = false;
631
632 ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc);
633 OUString aUser=pScChangeAction->GetUser();
634 DateTime aDateTime=pScChangeAction->GetDateTime();
635
636 if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
637 {
638 if(pTPFilter->IsRange())
639 {
640 for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
641 {
642 ScRange const & rRangeEntry = aRangeList[ i ];
643 if( rRangeEntry.Intersects(aRef) )
644 {
645 bFlag=true;
646 break;
647 }
648 }
649 }
650 else if(!bIsGenerated)
651 bFlag=true;
652 }
653
654 OUString aRefStr;
655 OUString aString;
656 OUString a2String;
657 OUString aDesc;
658
659 if(nSpecial==RD_SPECIAL_CONTENT)
660 {
661 OUString aTmp = pScChangeAction->GetOldString(pDoc);
662 a2String = aTmp;
663 if(a2String.isEmpty()) a2String=aStrEmpty;
664
665 //aString+="\'";
666 aString+=a2String;
667 //aString+="\'";
668
669 aDesc = aStrChildOrgContent + ": ";
670 }
671 else
672 {
673 OUString aTmp = pScChangeAction->GetNewString(pDoc);
674 a2String = aTmp;
675 if(a2String.isEmpty())
676 {
677 a2String = aStrEmpty;
678 aString += a2String;
679 }
680 else
681 {
682 aString += "\'" + a2String + "\'";
683 a2String = aString;
684 }
685 aDesc = aStrChildContent;
686
687 }
688
689 aDesc += a2String;
690 aString += "\t";
691 aRefStr = pScChangeAction->GetRefString(*pDoc, true);
692 aString += aRefStr + "\t";
693
694 if(!bIsGenerated)
695 {
696 aString += aUser + "\t"
697 + ScGlobal::getLocaleData().getDate(aDateTime) + " "
698 + ScGlobal::getLocaleData().getTime(aDateTime) + "\t";
699 }
700 else
701 {
702 aString += "\t\t";
703 }
704
705 OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
706
707 if(!aDesc.isEmpty())
708 {
709 aComment += " (" + aDesc + ")";
710 }
711
712 aString += aComment;
713
714 std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
715 pNewData->nInfo=nSpecial;
716 pNewData->pData=const_cast<ScChangeActionContent *>(pScChangeAction);
717 pNewData->nActionNo=pScChangeAction->GetActionNumber();
718 pNewData->bIsAcceptable=pScChangeAction->IsClickable();
719 pNewData->bIsRejectable=false;
720 pNewData->bDisabled=!pNewData->bIsAcceptable;
721 pNewData->aDateTime=aDateTime;
722 pNewData->nRow = aRef.aStart.Row();
723 pNewData->nCol = aRef.aStart.Col();
724 pNewData->nTable= aRef.aStart.Tab();
725
726 weld::TreeView& rTreeView = pTheView->GetWidget();
727 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
728 OUString sId(weld::toId(pNewData.release()));
729 rTreeView.insert(&rParent, -1, &aString, &sId, nullptr, nullptr, false, xEntry.get());
730 if (pTheView->IsValidComment(aComment) && bFlag)
731 bHasFilterEntry=true;
732 else
733 {
734 rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE);
735 }
736 return xEntry;
737}
738
740{
741 std::unique_ptr<weld::TreeIter> xParent;
742 ScChangeTrack* pChanges=nullptr;
743 const ScChangeAction* pScChangeAction=nullptr;
744 m_xDialog->set_busy_cursor(true);
745 weld::TreeView& rTreeView = pTheView->GetWidget();
746 rTreeView.freeze();
747 bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
749
750 bUseColor = bFilterFlag;
751
752 if(pDoc!=nullptr)
753 {
754 pChanges=pDoc->GetChangeTrack();
755 if(pChanges!=nullptr)
756 pScChangeAction=pChanges->GetFirst();
757 }
758 bool bTheFlag = false;
759
760 while(pScChangeAction!=nullptr)
761 {
762 bHasFilterEntry=false;
763 switch (pScChangeAction->GetState())
764 {
765 case SC_CAS_VIRGIN:
766
767 if (pScChangeAction->IsDialogRoot())
768 {
769 bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
770 if (pScChangeAction->IsDialogParent())
771 xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
772 else
773 xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
774 }
775 else
776 xParent.reset();
777
778 bTheFlag=true;
779 break;
780
781 case SC_CAS_ACCEPTED:
782 xParent.reset();
783 nAcceptCount++;
784 break;
785
786 case SC_CAS_REJECTED:
787 xParent.reset();
788 nRejectCount++;
789 break;
790 }
791
792 if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
793 {
794 bool bTestFlag = bHasFilterEntry;
795 bHasFilterEntry=false;
796 if (Expand(pChanges, pScChangeAction, *xParent, !bTestFlag) && !bTestFlag)
797 rTreeView.remove(*xParent);
798 }
799
800 pScChangeAction=pScChangeAction->GetNext();
801 }
802
803 if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
804 bTheFlag=false;
805
806 pTPView->EnableAccept(bTheFlag);
807 pTPView->EnableAcceptAll(bTheFlag);
808 pTPView->EnableReject(bTheFlag);
809 pTPView->EnableRejectAll(bTheFlag);
810
811 if (nAcceptCount>0)
812 rTreeView.insert(nullptr, -1, &aStrAllAccepted, nullptr, nullptr, nullptr, true, nullptr);
813 if (nRejectCount>0)
814 rTreeView.insert(nullptr, -1, &aStrAllRejected, nullptr, nullptr, nullptr, true, nullptr);
815 rTreeView.thaw();
816 m_xDialog->set_busy_cursor(false);
817 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
818 if (rTreeView.get_iter_first(*xEntry))
819 rTreeView.select(*xEntry);
820}
821
823{
824 sal_uInt16 nId =ScSimpleRefDlgWrapper::GetChildWindowId();
825
826 SC_MOD()->SetRefDialog( nId, true );
827
828 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
829 ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
830
831 if(pWnd!=nullptr)
832 {
833 sal_uInt16 nAcceptId=ScAcceptChgDlgWrapper::GetChildWindowId();
834 pViewFrm->ShowChildWindow(nAcceptId,false);
835 pWnd->SetCloseHdl(LINK( this, ScAcceptChgDlg,RefInfoHandle));
836 pWnd->SetRefString(pTPFilter->GetRange());
838 auto xWin = pWnd->GetController();
839 m_xDialog->hide();
840 xWin->set_title(m_xDialog->get_title());
841 pWnd->StartRefInput();
842 }
843}
844
845IMPL_LINK( ScAcceptChgDlg, RefInfoHandle, const OUString*, pResult, void)
846{
847 sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
848
850
851 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
852 if (pResult)
853 {
854 pTPFilter->SetRange(*pResult);
855 FilterHandle(pTPFilter);
856
857 pViewFrm->ShowChildWindow(nId);
858 }
859 else
860 {
861 pViewFrm->SetChildWindow(nId, false);
862 }
863}
864
865IMPL_LINK( ScAcceptChgDlg, FilterHandle, SvxTPFilter*, pRef, void )
866{
867 if(pRef!=nullptr)
868 {
869 ClearView();
870 aRangeList.RemoveAll();
871 aRangeList.Parse(pTPFilter->GetRange(), *pDoc);
872 UpdateView();
873 }
874}
875
876IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void )
877{
878 m_xDialog->set_busy_cursor(true);
879
880 bIgnoreMsg=true;
881 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
882
883 if(pRef!=nullptr)
884 {
885 weld::TreeView& rTreeView = pTheView->GetWidget();
886 rTreeView.selected_foreach([this, pChanges, &rTreeView](weld::TreeIter& rEntry){
887 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
888 if (pEntryData)
889 {
890 ScChangeAction* pScChangeAction= static_cast<ScChangeAction*>(pEntryData->pData);
891 if (pScChangeAction->GetType()==SC_CAT_INSERT_TABS)
892 pViewData->SetTabNo(0);
893 pChanges->Reject(pScChangeAction);
894 }
895 return false;
896 });
897 ScDocShell* pDocSh=pViewData->GetDocShell();
898 pDocSh->PostPaintExtras();
899 pDocSh->PostPaintGridAll();
900 pDocSh->GetUndoManager()->Clear();
901 pDocSh->SetDocumentModified();
902 ClearView();
903 UpdateView();
904 }
905
906 m_xDialog->set_busy_cursor(false);
907
908 bIgnoreMsg=false;
909}
910IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
911{
912 m_xDialog->set_busy_cursor(true);
913
914 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
915 bIgnoreMsg=true;
916 if(pRef!=nullptr)
917 {
918 weld::TreeView& rTreeView = pTheView->GetWidget();
919 rTreeView.selected_foreach([pChanges, &rTreeView](weld::TreeIter& rEntry) {
920 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
921 if (pEntryData)
922 {
923 ScChangeAction* pScChangeAction=
924 static_cast<ScChangeAction*>(pEntryData->pData);
925 if(pScChangeAction->GetType()==SC_CAT_CONTENT)
926 {
927 if(pEntryData->nInfo==RD_SPECIAL_CONTENT)
928 pChanges->SelectContent(pScChangeAction,true);
929 else
930 pChanges->SelectContent(pScChangeAction);
931 }
932 else
933 pChanges->Accept(pScChangeAction);
934 }
935 return false;
936 });
937 ScDocShell* pDocSh=pViewData->GetDocShell();
938 pDocSh->PostPaintExtras();
939 pDocSh->PostPaintGridAll();
940 pDocSh->SetDocumentModified();
941 ClearView();
942 UpdateView();
943 }
944 m_xDialog->set_busy_cursor(false);
945 bIgnoreMsg=false;
946}
947
949{
950 if(pDoc==nullptr) return;
951 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
952 const ScChangeAction* pScChangeAction=nullptr;
953
954 if(pChanges!=nullptr)
955 {
956 pScChangeAction=pChanges->GetLast();
957 }
958
959 while(pScChangeAction!=nullptr)
960 {
961 if(pScChangeAction->IsDialogRoot())
962 if(IsValidAction(pScChangeAction))
963 pChanges->Reject(const_cast<ScChangeAction*>(pScChangeAction));
964
965 pScChangeAction=pScChangeAction->GetPrev();
966 }
967}
969{
970 if(pDoc==nullptr) return;
971 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
972 const ScChangeAction* pScChangeAction=nullptr;
973
974 if(pChanges!=nullptr)
975 pScChangeAction=pChanges->GetLast();
976
977 while(pScChangeAction!=nullptr)
978 {
979 if(pScChangeAction->IsDialogRoot())
980 if(IsValidAction(pScChangeAction))
981 pChanges->Accept(const_cast<ScChangeAction*>(pScChangeAction));
982
983 pScChangeAction=pScChangeAction->GetPrev();
984 }
985}
986
987IMPL_LINK_NOARG(ScAcceptChgDlg, RejectAllHandle, SvxTPView*, void)
988{
989 m_xDialog->set_busy_cursor(true);
990 bIgnoreMsg=true;
991 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
992 if(pChanges!=nullptr)
993 {
994 if(pTPFilter->IsDate()||pTPFilter->IsAuthor()||pTPFilter->IsRange()||pTPFilter->IsComment())
995 RejectFiltered();
996 else
997 pChanges->RejectAll();
998
999 pViewData->SetTabNo(0);
1000
1001 ScDocShell* pDocSh=pViewData->GetDocShell();
1002 pDocSh->PostPaintExtras();
1003 pDocSh->PostPaintGridAll();
1004 pDocSh->GetUndoManager()->Clear();
1005 pDocSh->SetDocumentModified();
1006 ClearView();
1007 UpdateView();
1008 }
1009 m_xDialog->set_busy_cursor(false);
1010
1011 bIgnoreMsg=false;
1012}
1013
1015{
1016 m_xDialog->set_busy_cursor(true);
1017
1018 bIgnoreMsg=true;
1019 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1020 if(pChanges!=nullptr)
1021 {
1022 if(pTPFilter->IsDate()||pTPFilter->IsAuthor()||pTPFilter->IsRange()||pTPFilter->IsComment())
1023 AcceptFiltered();
1024 else
1025 pChanges->AcceptAll();
1026
1027 ScDocShell* pDocSh=pViewData->GetDocShell();
1028 pDocSh->PostPaintExtras();
1029 pDocSh->PostPaintGridAll();
1030 pDocSh->SetDocumentModified();
1031 ClearView();
1032 UpdateView();
1033 }
1034 bIgnoreMsg=false;
1035
1036 m_xDialog->set_busy_cursor(false);
1037}
1038
1040{
1041 if (!bNoSelection)
1042 aSelectionIdle.Start();
1043
1044 bNoSelection=false;
1045}
1046
1048 ScChangeActionMap& aActionMap,
1049 const weld::TreeIter& rEntry)
1050{
1051 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1052
1053 weld::TreeView& rTreeView = pTheView->GetWidget();
1054 std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
1055 if (rTreeView.iter_parent(*xParent))
1056 {
1057 ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xParent));
1058 ScChangeAction* pParentAction=static_cast<ScChangeAction*>(pParentData->pData);
1059
1060 if(pParentAction!=pScChangeAction)
1061 pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction),
1062 aActionMap,pScChangeAction->IsMasterDelete());
1063 else
1064 pChanges->GetDependents( const_cast<ScChangeAction*>(pScChangeAction),
1065 aActionMap );
1066 }
1067 else
1068 pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction),
1069 aActionMap, pScChangeAction->IsMasterDelete() );
1070}
1071
1073{
1074 bool bTheTestFlag = true;
1075 weld::TreeView& rTreeView = pTheView->GetWidget();
1076 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rParent));
1077 const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1078 bool bParentInserted = false;
1079 // If the parent is a MatrixOrigin then place it in the right order before
1080 // the MatrixReferences. Also if it is the first content change at this
1081 // position don't insert the first dependent MatrixReference as the special
1082 // content (original value) but insert the predecessor of the MatrixOrigin
1083 // itself instead.
1084 if ( pScChangeAction->GetType() == SC_CAT_CONTENT &&
1085 static_cast<const ScChangeActionContent*>(pScChangeAction)->IsMatrixOrigin() )
1086 {
1087 pActionMap->insert( ::std::make_pair( pScChangeAction->GetActionNumber(),
1088 const_cast<ScChangeAction*>( pScChangeAction ) ) );
1089 bParentInserted = true;
1090 }
1091
1092 ScChangeActionMap::iterator itChangeAction = std::find_if(pActionMap->begin(), pActionMap->end(),
1093 [](const std::pair<sal_uLong, ScChangeAction*>& rEntry) { return rEntry.second->GetState() == SC_CAS_VIRGIN; });
1094
1095 if( itChangeAction == pActionMap->end() )
1096 return true;
1097
1098 std::unique_ptr<weld::TreeIter> xOriginal = InsertChangeActionContent(
1099 dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
1100 rParent, RD_SPECIAL_CONTENT );
1101
1102 if (xOriginal)
1103 {
1104 bTheTestFlag=false;
1105 ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xOriginal));
1106 pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
1107 pParentData->nActionNo=pScChangeAction->GetActionNumber();
1108 pParentData->bIsAcceptable=pScChangeAction->IsRejectable(); // select old value
1109 pParentData->bIsRejectable=false;
1110 pParentData->bDisabled=false;
1111 }
1112 while( itChangeAction != pActionMap->end() )
1113 {
1114 if( itChangeAction->second->GetState() == SC_CAS_VIRGIN )
1115 {
1116 std::unique_ptr<weld::TreeIter> xEntry =
1117 InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
1118 rParent, RD_SPECIAL_NONE );
1119
1120 if (xEntry)
1121 bTheTestFlag=false;
1122 }
1123 ++itChangeAction;
1124 }
1125
1126 if ( !bParentInserted )
1127 {
1128 std::unique_ptr<weld::TreeIter> xEntry =
1130 pScChangeAction),rParent,RD_SPECIAL_NONE);
1131
1132 if (xEntry)
1133 {
1134 bTheTestFlag=false;
1135 ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1136 pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
1137 pParentData->nActionNo=pScChangeAction->GetActionNumber();
1138 pParentData->bIsAcceptable=pScChangeAction->IsClickable();
1139 pParentData->bIsRejectable=false;
1140 pParentData->bDisabled=false;
1141 }
1142 }
1143
1144 return bTheTestFlag;
1145}
1146
1148{
1149 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1150 bool bTheTestFlag = true;
1151
1153 weld::TreeView& rTreeView = pTheView->GetWidget();
1154 OUString aString = rTreeView.get_text(rParent, 0);
1155 OUString a2String = aString.copy(0, aStrAllAccepted.getLength());
1156 if (a2String == aStrAllAccepted)
1157 eState=SC_CAS_ACCEPTED;
1158 else
1159 {
1160 a2String = aString.copy(0, aStrAllRejected.getLength());
1161 if (a2String == aStrAllRejected)
1162 eState=SC_CAS_REJECTED;
1163 }
1164
1165 ScChangeAction* pScChangeAction = pChanges->GetFirst();
1166 while (pScChangeAction)
1167 {
1168 if (pScChangeAction->GetState()==eState &&
1169 AppendFilteredAction(pScChangeAction, eState, false, &rParent))
1170 bTheTestFlag=false;
1171 pScChangeAction=pScChangeAction->GetNext();
1172 }
1173 return bTheTestFlag;
1174}
1175
1177{
1178 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1179 bool bTheTestFlag = true;
1180
1181 for( const auto& rChangeAction : *pActionMap )
1182 {
1183 std::unique_ptr<weld::TreeIter> xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
1184
1185 if (xEntry)
1186 {
1187 bTheTestFlag=false;
1188
1189 weld::TreeView& rTreeView = pTheView->GetWidget();
1190 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1191 pEntryData->bIsRejectable=false;
1192 pEntryData->bIsAcceptable=false;
1193 pEntryData->bDisabled=true;
1194
1195 if (rChangeAction.second->IsDialogParent())
1196 Expand(pChanges, rChangeAction.second, *xEntry);
1197 }
1198 }
1199 return bTheTestFlag;
1200}
1201
1203 ScChangeActionMap* pActionMap, const weld::TreeIter& rParent)
1204{
1205 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1206 bool bTheTestFlag = true;
1207 std::unique_ptr<weld::TreeIter> xEntry;
1208
1209 for( const auto& rChangeAction : *pActionMap )
1210 {
1211
1212 if( pScChangeAction != rChangeAction.second )
1213 xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
1214 else
1215 xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, true, true);
1216
1217 if (xEntry)
1218 {
1219 weld::TreeView& rTreeView = pTheView->GetWidget();
1220 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1221 pEntryData->bIsRejectable=false;
1222 pEntryData->bIsAcceptable=false;
1223 pEntryData->bDisabled=true;
1224
1225 bTheTestFlag=false;
1226
1227 if (rChangeAction.second->IsDialogParent())
1228 Expand(pChanges, rChangeAction.second, *xEntry);
1229 }
1230 }
1231 return bTheTestFlag;
1232}
1233
1234bool ScAcceptChgDlg::Expand(const ScChangeTrack* pChanges, const ScChangeAction* pScChangeAction,
1235 const weld::TreeIter& rEntry, bool bFilter)
1236{
1237 bool bTheTestFlag = true;
1238
1239 if (pChanges && pScChangeAction)
1240 {
1241 ScChangeActionMap aActionMap;
1242
1243 GetDependents(pScChangeAction, aActionMap, rEntry);
1244
1245 switch(pScChangeAction->GetType())
1246 {
1247 case SC_CAT_CONTENT:
1248 {
1249 InsertContentChildren(&aActionMap, rEntry);
1250 bTheTestFlag=!bHasFilterEntry;
1251 break;
1252 }
1253 case SC_CAT_DELETE_COLS:
1254 case SC_CAT_DELETE_ROWS:
1255 case SC_CAT_DELETE_TABS:
1256 {
1257 InsertDeletedChildren(pScChangeAction, &aActionMap, rEntry);
1258 bTheTestFlag=!bHasFilterEntry;
1259 break;
1260 }
1261 default:
1262 {
1263 if(!bFilter)
1264 bTheTestFlag = InsertChildren(&aActionMap, rEntry);
1265 break;
1266 }
1267 }
1268 aActionMap.clear();
1269 }
1270 return bTheTestFlag;
1271}
1272
1273IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool)
1274{
1275 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1276 if (pChanges)
1277 {
1278 m_xDialog->set_busy_cursor(true);
1279 ScChangeActionMap aActionMap;
1280 weld::TreeView& rTreeView = pTheView->GetWidget();
1281 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
1282 if (!rTreeView.iter_has_child(rEntry))
1283 {
1284 bool bTheTestFlag = true;
1285
1286 if (pEntryData)
1287 {
1288 ScChangeAction* pScChangeAction=static_cast<ScChangeAction*>(pEntryData->pData);
1289
1290 GetDependents(pScChangeAction, aActionMap, rEntry);
1291
1292 switch (pScChangeAction->GetType())
1293 {
1294 case SC_CAT_CONTENT:
1295 {
1296 bTheTestFlag = InsertContentChildren( &aActionMap, rEntry );
1297 break;
1298 }
1299 case SC_CAT_DELETE_COLS:
1300 case SC_CAT_DELETE_ROWS:
1301 case SC_CAT_DELETE_TABS:
1302 {
1303 bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, rEntry );
1304 break;
1305 }
1306 default:
1307 {
1308 bTheTestFlag = InsertChildren( &aActionMap, rEntry );
1309 break;
1310 }
1311 }
1312 aActionMap.clear();
1313
1314 }
1315 else
1316 {
1317 bTheTestFlag = InsertAcceptedORejected(rEntry);
1318 }
1319 if (bTheTestFlag)
1320 {
1321 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1322 rTreeView.insert(&rEntry, -1, &aStrNoEntry, nullptr, nullptr, nullptr, false, xEntry.get());
1323 rTreeView.set_font_color(*xEntry, COL_GRAY);
1324 }
1325 }
1326 m_xDialog->set_busy_cursor(false);
1327 }
1328 return true;
1329}
1330
1332 sal_uLong nEndAction)
1333{
1334 if(pChanges==nullptr)
1335 return;
1336
1337 std::unique_ptr<weld::TreeIter> xParent;
1338 m_xDialog->set_busy_cursor(true);
1339 weld::TreeView& rTreeView = pTheView->GetWidget();
1340 rTreeView.freeze();
1341
1342 bool bTheFlag = false;
1343
1344 bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
1346
1347 bUseColor = bFilterFlag;
1348
1349 for(sal_uLong i=nStartAction;i<=nEndAction;i++)
1350 {
1351 const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
1352 if(pScChangeAction==nullptr) continue;
1353
1354 switch (pScChangeAction->GetState())
1355 {
1356 case SC_CAS_VIRGIN:
1357
1358 if (pScChangeAction->IsDialogRoot())
1359 {
1360 bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
1361 if (pScChangeAction->IsDialogParent())
1362 xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
1363 else
1364 xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
1365 }
1366 else
1367 xParent.reset();
1368
1369 bTheFlag=true;
1370 break;
1371
1372 case SC_CAS_ACCEPTED:
1373 xParent.reset();
1374 nAcceptCount++;
1375 break;
1376
1377 case SC_CAS_REJECTED:
1378 xParent.reset();
1379 nRejectCount++;
1380 break;
1381 }
1382
1383 if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
1384 {
1385 bool bTestFlag = bHasFilterEntry;
1386 bHasFilterEntry = false;
1387 if (Expand(pChanges,pScChangeAction,*xParent,!bTestFlag)&&!bTestFlag)
1388 rTreeView.remove(*xParent);
1389 }
1390 }
1391
1392 if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
1393 bTheFlag=false;
1394
1395 pTPView->EnableAccept(bTheFlag);
1396 pTPView->EnableAcceptAll(bTheFlag);
1397 pTPView->EnableReject(bTheFlag);
1398 pTPView->EnableRejectAll(bTheFlag);
1399
1400 rTreeView.thaw();
1401 m_xDialog->set_busy_cursor(false);
1402}
1403
1405{
1406 weld::TreeView& rTreeView = pTheView->GetWidget();
1407
1408 ScRedlinData *pEntryData=nullptr;
1409 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1410 if (rTreeView.get_cursor(xEntry.get()))
1411 pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1412
1413 if (!rTreeView.get_iter_first(*xEntry))
1414 return;
1415
1416 sal_uLong nAction=0;
1417 if (pEntryData)
1418 nAction=pEntryData->nActionNo;
1419
1420 if (nAction>=nStartAction && nAction<=nEndAction)
1421 rTreeView.set_cursor(*xEntry);
1422
1423 std::vector<OUString> aIdsToRemove;
1424
1425 do
1426 {
1427 OUString sId(rTreeView.get_id(*xEntry));
1428 pEntryData = weld::fromId<ScRedlinData*>(sId);
1429 if (pEntryData)
1430 {
1431 nAction = pEntryData->nActionNo;
1432 if (nStartAction <= nAction && nAction <= nEndAction)
1433 {
1434 aIdsToRemove.push_back(sId);
1435 delete pEntryData;
1436 }
1437 }
1438 }
1439 while (rTreeView.iter_next(*xEntry));
1440
1441 rTreeView.freeze();
1442
1443 // MUST do it backwards, don't delete parents before children and GPF
1444 for (auto it = aIdsToRemove.rbegin(); it != aIdsToRemove.rend(); ++it)
1445 rTreeView.remove_id(*it);
1446
1447 rTreeView.thaw();
1448}
1449
1450void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nStartAction,sal_uLong nEndAction)
1451{
1452 weld::TreeView& rTreeView = pTheView->GetWidget();
1453 rTreeView.freeze();
1454
1455 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1456 std::unique_ptr<weld::TreeIter> xLastEntry(rTreeView.make_iterator());
1457 std::unique_ptr<weld::TreeIter> xNextEntry(rTreeView.make_iterator());
1458
1459 bool bEntry = rTreeView.get_iter_first(*xEntry);
1460 bool bLastEntry = false;
1461
1462 while (bEntry)
1463 {
1464 bool bRemove = false;
1465 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1466 if (pEntryData)
1467 {
1468 ScChangeAction* pScChangeAction=
1469 static_cast<ScChangeAction*>(pEntryData->pData);
1470
1471 sal_uLong nAction=pScChangeAction->GetActionNumber();
1472
1473 if(nStartAction<=nAction && nAction<=nEndAction) bRemove=true;
1474 }
1475
1476 bool bNextEntry;
1477 if (bRemove)
1478 {
1479 rTreeView.remove(*xEntry);
1480 delete pEntryData;
1481
1482 if (!bLastEntry)
1483 bLastEntry = rTreeView.get_iter_first(*xLastEntry);
1484 if (bLastEntry)
1485 {
1486 rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
1487 bNextEntry = rTreeView.iter_next(*xNextEntry);
1488 if (!bNextEntry)
1489 {
1490 rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
1491 bLastEntry = false;
1492 }
1493 }
1494 else
1495 bNextEntry = false;
1496 }
1497 else
1498 {
1499 rTreeView.copy_iterator(*xEntry, *xLastEntry);
1500 bLastEntry = true;
1501
1502 rTreeView.copy_iterator(*xEntry, *xNextEntry);
1503 bNextEntry = rTreeView.iter_next(*xNextEntry);
1504 }
1505
1506 rTreeView.copy_iterator(*xNextEntry, *xEntry);
1507 bEntry = bNextEntry;
1508 }
1509
1510 AppendChanges(pChgTrack,nStartAction,nEndAction);
1511
1512 rTreeView.thaw();
1513}
1514
1515IMPL_LINK( ScAcceptChgDlg, ChgTrackModHdl, ScChangeTrack&, rChgTrack, void)
1516{
1517 ScChangeTrackMsgQueue& aMsgQueue= rChgTrack.GetMsgQueue();
1518
1519 sal_uLong nStartAction;
1520 sal_uLong nEndAction;
1521
1522 for (const auto& rMsg : aMsgQueue)
1523 {
1524 nStartAction = rMsg.nStartAction;
1525 nEndAction = rMsg.nEndAction;
1526
1527 if(!bIgnoreMsg)
1528 {
1529 bNoSelection=true;
1530
1531 switch(rMsg.eMsgType)
1532 {
1534 AppendChanges(&rChgTrack,nStartAction,nEndAction);
1535 break;
1537 RemoveEntries(nStartAction,nEndAction);
1538 break;
1540 case ScChangeTrackMsgType::Change: //bNeedsUpdate=true;
1541 UpdateEntries(&rChgTrack,nStartAction,nEndAction);
1542 break;
1543 default: assert(false); break;
1544 }
1545 }
1546 }
1547
1548 aMsgQueue.clear();
1549}
1550
1551IMPL_LINK_NOARG(ScAcceptChgDlg, ReOpenTimerHdl, Timer *, void)
1552{
1554 m_xAcceptChgCtr->ShowFilterPage();
1555 RefHandle(nullptr);
1556}
1557
1558IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
1559{
1560 ScTabView* pTabView = pViewData->GetView();
1561
1562 bool bAcceptFlag = true;
1563 bool bRejectFlag = true;
1564
1565 pTabView->DoneBlockMode(); // clears old marking
1566 weld::TreeView& rTreeView = pTheView->GetWidget();
1567 std::vector<const ScChangeAction*> aActions;
1568 rTreeView.selected_foreach([&rTreeView, &bAcceptFlag, &bRejectFlag, &aActions](weld::TreeIter& rEntry){
1569 ScRedlinData* pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
1570 if (pEntryData)
1571 {
1572 bRejectFlag &= pEntryData->bIsRejectable;
1573 bAcceptFlag &= pEntryData->bIsAcceptable;
1574
1575 const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1576 if( pScChangeAction && (pScChangeAction->GetType() != SC_CAT_DELETE_TABS) &&
1577 (!pEntryData->bDisabled || pScChangeAction->IsVisible()) )
1578 {
1579 aActions.push_back(pScChangeAction);
1580 }
1581 }
1582 else
1583 {
1584 bAcceptFlag = false;
1585 bRejectFlag = false;
1586 }
1587 return false;
1588 });
1589
1590 bool bContMark = false;
1591 for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
1592 {
1593 const ScBigRange& rBigRange = aActions[i]->GetBigRange();
1594 if (rBigRange.IsValid(*pDoc) && m_xDialog->has_toplevel_focus())
1595 {
1596 bool bSetCursor = i == nCount - 1;
1597 pTabView->MarkRange(rBigRange.MakeRange(*pDoc), bSetCursor, bContMark);
1598 bContMark = true;
1599 }
1600 }
1601
1602 ScChangeTrack* pChanges = pDoc->GetChangeTrack();
1603 bool bEnable = pDoc->IsDocEditable() && pChanges && !pChanges->IsProtected();
1604 pTPView->EnableAccept( bAcceptFlag && bEnable );
1605 pTPView->EnableReject( bRejectFlag && bEnable );
1606}
1607
1608IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
1609{
1610 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
1611 return false;
1612
1613 weld::TreeView& rTreeView = pTheView->GetWidget();
1614 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1615 bool bEntry = rTreeView.get_cursor(xEntry.get());
1616 if (bEntry)
1617 rTreeView.select(*xEntry);
1618
1619 int nSortedCol = rTreeView.get_sort_column();
1620 for (sal_Int32 i = 0; i < 5; ++i)
1621 m_xSortMenu->set_active("calcsort" + OString::number(i), i == nSortedCol);
1622
1623 m_xPopup->set_sensitive("calcedit", false);
1624
1625 if (pDoc->IsDocEditable() && bEntry)
1626 {
1627 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1628 if (pEntryData)
1629 {
1630 ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1631 if (pScChangeAction && !rTreeView.get_iter_depth(*xEntry))
1632 m_xPopup->set_sensitive("calcedit", true);
1633 }
1634 }
1635
1636 OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
1637
1638 if (!sCommand.isEmpty())
1639 {
1640 if (sCommand == "calcedit")
1641 {
1642 if (bEntry)
1643 {
1644 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1645 if (pEntryData)
1646 {
1647 ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1648 pViewData->GetDocShell()->ExecuteChangeCommentDialog(pScChangeAction, m_xDialog.get(), false);
1649 }
1650 }
1651 }
1652 else
1653 {
1654 int nDialogCol = o3tl::toInt32(sCommand.subView(8));
1655 pTheView->HeaderBarClick(nDialogCol);
1656 }
1657 }
1658
1659 return true;
1660}
1661
1662namespace
1663{
1664 //at one point we were writing multiple AcceptChgDat strings,
1665 //so strip all of them and keep the results of the last one
1666 OUString lcl_StripAcceptChgDat(OUString &rExtraString)
1667 {
1668 OUString aStr;
1669 while (true)
1670 {
1671 sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:");
1672 if (nPos == -1)
1673 break;
1674 // Try to read the alignment string "ALIGN:(...)"; if it is missing
1675 // we have an old version
1676 sal_Int32 n1 = rExtraString.indexOf('(', nPos);
1677 if ( n1 != -1 )
1678 {
1679 sal_Int32 n2 = rExtraString.indexOf(')', n1);
1680 if ( n2 != -1 )
1681 {
1682 // cut out alignment string
1683 aStr = rExtraString.copy(nPos, n2 - nPos + 1);
1684 rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, u"");
1685 aStr = aStr.copy( n1-nPos+1 );
1686 }
1687 }
1688 }
1689 return aStr;
1690 }
1691}
1692
1694{
1695 OUString aStr;
1696 if (pInfo && !pInfo->aExtraString.isEmpty())
1697 aStr = lcl_StripAcceptChgDat(pInfo->aExtraString);
1698
1700
1701 if (aStr.isEmpty())
1702 return;
1703
1704 int nCount = aStr.toInt32();
1705 if (nCount <= 2)
1706 return;
1707
1708 std::vector<int> aEndPos;
1709
1710 for (int i = 0; i < nCount; ++i)
1711 {
1712 sal_Int32 n1 = aStr.indexOf(';');
1713 aStr = aStr.copy( n1+1 );
1714 aEndPos.push_back(aStr.toInt32());
1715 }
1716
1717 std::vector<int> aWidths;
1718 for (int i = 1; i < nCount; ++i)
1719 aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
1720
1721 // turn column end points back to column widths, ignoring the small
1722 // value used for the expander column
1723 weld::TreeView& rTreeView = pTheView->GetWidget();
1724 rTreeView.set_column_fixed_widths(aWidths);
1725}
1726
1728{
1730 //remove any old one before adding a new one
1731 lcl_StripAcceptChgDat(rInfo.aExtraString);
1732 rInfo.aExtraString += "AcceptChgDat:(";
1733
1734 const int nTabCount = 5;
1735
1736 rInfo.aExtraString += OUString::number(nTabCount);
1737 rInfo.aExtraString += ";";
1738
1739 weld::TreeView& rTreeView = pTheView->GetWidget();
1740 std::vector<int> aWidths;
1741 // turn column widths back into column end points for compatibility
1742 // with how they used to be stored, including a small value for the
1743 // expander column
1744 aWidths.push_back(rTreeView.get_checkbox_column_width());
1745 for (int i = 0; i < nTabCount - 1; ++i)
1746 aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i));
1747
1748 for (auto a : aWidths)
1749 {
1750 rInfo.aExtraString += OUString::number(a);
1751 rInfo.aExtraString += ";";
1752 }
1753 rInfo.aExtraString += ")";
1754}
1755
1756#define CALC_DATE 3
1757#define CALC_POS 1
1758
1760{
1761 weld::TreeView& rTreeView = pTheView->GetWidget();
1762
1763 sal_Int32 nCompare = 0;
1764 SCCOL nSortCol = rTreeView.get_sort_column();
1765
1766 if (CALC_DATE == nSortCol)
1767 {
1768 RedlinData *pLeftData = weld::fromId<RedlinData*>(rTreeView.get_id(rLeft));
1769 RedlinData *pRightData = weld::fromId<RedlinData*>(rTreeView.get_id(rRight));
1770 if (pLeftData && pRightData)
1771 {
1772 if(pLeftData->aDateTime < pRightData->aDateTime)
1773 nCompare = -1;
1774 else if(pLeftData->aDateTime > pRightData->aDateTime)
1775 nCompare = 1;
1776 return nCompare;
1777 }
1778 }
1779 else if (CALC_POS == nSortCol)
1780 {
1781 ScRedlinData *pLeftData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rLeft));
1782 ScRedlinData *pRightData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rRight));
1783 if (pLeftData && pRightData)
1784 {
1785 nCompare = 1;
1786
1787 if(pLeftData->nTable < pRightData->nTable)
1788 nCompare = -1;
1789 else if(pLeftData->nTable == pRightData->nTable)
1790 {
1791 if(pLeftData->nRow < pRightData->nRow)
1792 nCompare = -1;
1793 else if(pLeftData->nRow == pRightData->nRow)
1794 {
1795 if(pLeftData->nCol < pRightData->nCol)
1796 nCompare = -1;
1797 else if(pLeftData->nCol == pRightData->nCol)
1798 nCompare = 0;
1799 }
1800 }
1801
1802 return nCompare;
1803 }
1804 }
1805
1806 return ScGlobal::GetCaseCollator().compareString(rTreeView.get_text(rLeft, nSortCol),
1807 rTreeView.get_text(rRight, nSortCol));
1808}
1809
1810/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define CALC_POS
Definition: acredlin.cxx:1757
#define RD_SPECIAL_NONE
Definition: acredlin.cxx:41
#define RD_SPECIAL_VISCONTENT
Definition: acredlin.cxx:43
IMPL_LINK_NOARG(ScAcceptChgDlg, RefHandle, SvxTPFilter *, void)
Definition: acredlin.cxx:822
#define CALC_DATE
Definition: acredlin.cxx:1756
IMPL_LINK(ScAcceptChgDlg, RefInfoHandle, const OUString *, pResult, void)
Definition: acredlin.cxx:845
#define RD_SPECIAL_CONTENT
Definition: acredlin.cxx:42
const SCCOL SCCOL_MAX
Definition: address.hxx:56
const SCTAB SCTAB_MAX
Definition: address.hxx:57
const SCROW SCROW_MAX
Definition: address.hxx:55
Reference< XExecutableDialog > m_xDialog
std::map< sal_uLong, ScChangeAction * > ScChangeActionMap
Definition: chgtrack.hxx:800
std::vector< ScChangeTrackMsgInfo > ScChangeTrackMsgQueue
Definition: chgtrack.hxx:798
ScChangeActionType
Definition: chgtrack.hxx:63
@ SC_CAT_MOVE
Definition: chgtrack.hxx:71
@ SC_CAT_DELETE_TABS
Definition: chgtrack.hxx:70
@ SC_CAT_INSERT_TABS
Definition: chgtrack.hxx:67
@ SC_CAT_DELETE_ROWS
Definition: chgtrack.hxx:69
@ SC_CAT_CONTENT
Definition: chgtrack.hxx:72
@ SC_CAT_REJECT
Definition: chgtrack.hxx:73
@ SC_CAT_DELETE_COLS
Definition: chgtrack.hxx:68
@ SC_CAT_INSERT_ROWS
Definition: chgtrack.hxx:66
@ SC_CAT_INSERT_COLS
Definition: chgtrack.hxx:65
ScChangeActionState
Definition: chgtrack.hxx:77
@ SC_CAS_REJECTED
Definition: chgtrack.hxx:80
@ SC_CAS_VIRGIN
Definition: chgtrack.hxx:78
@ SC_CAS_ACCEPTED
Definition: chgtrack.hxx:79
sal_Int32 compareString(const OUString &s1, const OUString &s2) const
OUString getDate(const Date &rDate) const
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
bool bDisabled
DateTime aDateTime
void * pData
OUString aStrDeleteCols
Definition: acredlin.hxx:59
OUString aStrEmpty
Definition: acredlin.hxx:71
void ClearView()
Definition: acredlin.cxx:275
bool InsertDeletedChildren(const ScChangeAction *pChangeAction, ScChangeActionMap *pActionMap, const weld::TreeIter &rParent)
Definition: acredlin.cxx:1202
void UpdateView()
Definition: acredlin.cxx:739
OUString aStrDeleteTabs
Definition: acredlin.hxx:61
SvxRedlinTable * pTheView
Definition: acredlin.hxx:82
std::unique_ptr< weld::Container > m_xContentArea
Definition: acredlin.hxx:84
bool bNoSelection
Definition: acredlin.hxx:76
void UpdateEntries(const ScChangeTrack *pChgTrack, sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1450
void RemoveEntries(sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1404
OUString aStrDeleteRows
Definition: acredlin.hxx:60
OUString aUnknown
Definition: acredlin.hxx:72
void AcceptFiltered()
Definition: acredlin.cxx:968
std::unique_ptr< weld::TreeIter > InsertChangeActionContent(const ScChangeActionContent *pScChangeAction, const weld::TreeIter &rParent, sal_uLong nSpecial)
Definition: acredlin.cxx:621
void AppendChanges(const ScChangeTrack *pChanges, sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1331
virtual void FillInfo(SfxChildWinInfo &) const override
Definition: acredlin.cxx:1727
bool bHasFilterEntry
Definition: acredlin.hxx:77
bool IsValidAction(const ScChangeAction *pScChangeAction)
Definition: acredlin.cxx:313
OUString aStrInsertCols
Definition: acredlin.hxx:56
void GetDependents(const ScChangeAction *pScChangeAction, ScChangeActionMap &aActionMap, const weld::TreeIter &rEntry)
Definition: acredlin.cxx:1047
SvxTPFilter * pTPFilter
Definition: acredlin.hxx:80
OUString aStrContent
Definition: acredlin.hxx:63
OUString aStrInsertRows
Definition: acredlin.hxx:57
Idle aReOpenIdle
Definition: acredlin.hxx:51
ScDocument * pDoc
Definition: acredlin.hxx:53
bool InsertAcceptedORejected(const weld::TreeIter &rParent)
Definition: acredlin.cxx:1147
OUString aStrAllAccepted
Definition: acredlin.hxx:65
OUString * MakeTypeString(ScChangeActionType eType)
Definition: acredlin.cxx:292
ScRangeList aRangeList
Definition: acredlin.hxx:54
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
OUString aStrChildOrgContent
Definition: acredlin.hxx:70
sal_uLong nRejectCount
Definition: acredlin.hxx:74
OUString aStrMove
Definition: acredlin.hxx:62
std::unique_ptr< SvxAcceptChgCtr > m_xAcceptChgCtr
Definition: acredlin.hxx:86
OUString aStrChildContent
Definition: acredlin.hxx:69
OUString aStrInsertTabs
Definition: acredlin.hxx:58
OUString aStrContentWithChild
Definition: acredlin.hxx:68
bool InsertContentChildren(ScChangeActionMap *pActionMap, const weld::TreeIter &rParent)
Definition: acredlin.cxx:1072
bool Expand(const ScChangeTrack *pChanges, const ScChangeAction *pScChangeAction, const weld::TreeIter &rEntry, bool bFilter=false)
Definition: acredlin.cxx:1234
sal_uLong nAcceptCount
Definition: acredlin.hxx:73
void RejectFiltered()
Definition: acredlin.cxx:948
SvxTPView * pTPView
Definition: acredlin.hxx:81
ScAcceptChgDlg(SfxBindings *pB, SfxChildWindow *pCW, weld::Window *pParent, ScViewData *ptrViewData)
Definition: acredlin.cxx:70
bool InsertChildren(ScChangeActionMap *pActionMap, const weld::TreeIter &rParent)
Definition: acredlin.cxx:1176
void ReInit(ScViewData *ptrViewData)
Definition: acredlin.cxx:157
ScViewData * pViewData
Definition: acredlin.hxx:52
int ColCompareHdl(const weld::TreeIter &rLeft, const weld::TreeIter &rRight) const
Definition: acredlin.cxx:1759
OUString aStrReject
Definition: acredlin.hxx:64
void Initialize(SfxChildWinInfo *pInfo)
Definition: acredlin.cxx:1693
ScChangeViewSettings aChangeViewSet
Definition: acredlin.hxx:55
Idle aSelectionIdle
Definition: acredlin.hxx:50
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
OUString aStrAllRejected
Definition: acredlin.hxx:66
virtual ~ScAcceptChgDlg() override
Definition: acredlin.cxx:145
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
bool IsValid(const ScDocument &rDoc) const
Definition: bigrange.hxx:132
ScRange MakeRange(const ScDocument &rDoc) const
Definition: bigrange.hxx:134
virtual OUString GetRefString(ScDocument &rDoc, bool bFlag3D=false) const override
Definition: chgtrack.cxx:1433
OUString GetOldString(const ScDocument *pDoc) const
Definition: chgtrack.cxx:1383
OUString GetNewString(const ScDocument *pDoc) const
Definition: chgtrack.cxx:1388
const OUString & GetComment() const
Definition: chgtrack.hxx:350
ScBigRange & GetBigRange()
Definition: chgtrack.hxx:231
bool IsClickable() const
Definition: chgtrack.cxx:165
bool IsVisible() const
Definition: chgtrack.cxx:142
bool IsMasterDelete() const
Definition: chgtrack.cxx:273
bool IsDialogRoot() const
Definition: chgtrack.cxx:232
bool IsDialogParent() const
Definition: chgtrack.cxx:237
sal_uLong GetActionNumber() const
Definition: chgtrack.hxx:319
ScChangeActionType GetType() const
Definition: chgtrack.hxx:317
bool IsRejectable() const
Definition: chgtrack.cxx:196
virtual OUString GetDescription(ScDocument &rDoc, bool bSplitRange=false, bool bWarning=true) const
Definition: chgtrack.cxx:420
ScChangeAction * GetNext() const
Definition: chgtrack.hxx:322
ScChangeAction * GetPrev() const
Definition: chgtrack.hxx:323
SC_DLLPUBLIC DateTime GetDateTime() const
Definition: chgtrack.cxx:406
OUString GetRefString(const ScBigRange &rRange, const ScDocument &rDoc, bool bFlag3D=false) const
Definition: chgtrack.cxx:476
ScChangeActionState GetState() const
Definition: chgtrack.hxx:318
const OUString & GetUser() const
Definition: chgtrack.hxx:349
const std::set< OUString > & GetUserCollection() const
Definition: chgtrack.hxx:973
bool SelectContent(ScChangeAction *, bool bOldest=false)
Definition: chgtrack.cxx:3987
ScChangeAction * GetLast() const
Definition: chgtrack.hxx:954
SC_DLLPUBLIC ScChangeAction * GetAction(sal_uLong nAction) const
Definition: chgtrack.cxx:2115
void SetModifiedLink(const Link< ScChangeTrack &, void > &r)
Definition: chgtrack.hxx:1110
void AcceptAll()
Definition: chgtrack.cxx:4070
bool RejectAll()
Definition: chgtrack.cxx:4098
bool IsProtected() const
Definition: chgtrack.hxx:1127
SC_DLLPUBLIC void GetDependents(ScChangeAction *, ScChangeActionMap &, bool bListMasterDelete=false, bool bAllFlat=false) const
Definition: chgtrack.cxx:3792
SC_DLLPUBLIC bool Accept(ScChangeAction *)
Definition: chgtrack.cxx:4078
bool IsGenerated(sal_uLong nAction) const
Definition: chgtrack.cxx:2110
bool Reject(ScChangeAction *, ScChangeActionMap *, bool bRecursion)
Definition: chgtrack.cxx:4129
const OUString & GetUser() const
Definition: chgtrack.hxx:972
ScChangeAction * GetFirst() const
Definition: chgtrack.hxx:953
const ScRangeList & GetTheRangeList() const
Definition: chgviset.hxx:109
bool HasAuthor() const
Definition: chgviset.hxx:92
const OUString & GetTheComment() const
Definition: chgviset.hxx:101
const DateTime & GetTheFirstDateTime() const
Definition: chgviset.hxx:87
SvxRedlinDateMode GetTheDateMode() const
Definition: chgviset.hxx:84
bool HasComment() const
Definition: chgviset.hxx:98
bool HasDate() const
Definition: chgviset.hxx:80
bool HasRange() const
Definition: chgviset.hxx:106
void SetTheAuthorToShow(const OUString &aString)
Definition: chgviset.hxx:96
const DateTime & GetTheLastDateTime() const
Definition: chgviset.hxx:90
void AdjustDateMode(const ScDocument &rDoc)
Adjust dates according to selected DateMode.
Definition: chgviset.cxx:105
const OUString & GetTheAuthorToShow() const
Definition: chgviset.hxx:95
void PostPaintGridAll()
Definition: docsh3.cxx:183
void SetDocumentModified()
Definition: docsh.cxx:2961
void PostPaintExtras()
Definition: docsh3.cxx:198
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2947
bool IsDocEditable() const
Definition: documen3.cxx:1913
ScChangeViewSettings * GetChangeViewSettings() const
Definition: document.hxx:2238
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
Definition: global.cxx:1053
static CollatorWrapper & GetCaseCollator()
case-sensitive collator
Definition: global.cxx:1104
ScRange & front()
Definition: rangelst.hxx:92
bool empty() const
Definition: rangelst.hxx:88
size_t size() const
Definition: rangelst.hxx:89
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:2170
bool Intersects(const ScRange &rRange) const
Definition: address.hxx:734
ScAddress aStart
Definition: address.hxx:497
virtual ~ScRedlinData() override
Definition: acredlin.cxx:59
bool bIsAcceptable
Definition: acredlin.hxx:45
sal_uLong nInfo
Definition: acredlin.hxx:40
SCCOL nCol
Definition: acredlin.hxx:42
SCROW nRow
Definition: acredlin.hxx:43
SCTAB nTable
Definition: acredlin.hxx:41
bool bIsRejectable
Definition: acredlin.hxx:44
sal_uLong nActionNo
Definition: acredlin.hxx:39
void SetCloseHdl(const Link< const OUString *, void > &rLink)
Definition: reffact.cxx:177
void SetRefString(const OUString &rStr)
Definition: reffact.cxx:168
static void SetAutoReOpen(bool bFlag)
Definition: reffact.cxx:163
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1711
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
std::shared_ptr< SfxDialogController > & GetController()
virtual void FillInfo(SfxChildWinInfo &) const
void Initialize(SfxChildWinInfo const *pInfo)
SfxViewShell * GetViewShell() const
virtual void Clear()
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
SfxChildWindow * GetChildWindow(sal_uInt16)
void ShowChildWindow(sal_uInt16, bool bVisible=true)
SfxViewFrame * GetViewFrame() const
void SetFilterAuthor(bool bFlag)
void SetDateTimeMode(SvxRedlinDateMode nMode)
void SetAuthor(const OUString &)
void SetFirstTime(const tools::Time &)
void SetCalcView()
void SetLastDate(const Date &)
void SetCommentParams(const utl::SearchParam *pSearchPara)
void SetFirstDate(const Date &)
void SetLastTime(const tools::Time &)
bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment)
void UpdateFilterTest()
void SetFilterDate(bool bFlag)
bool IsValidComment(const OUString &rComment)
void SetFilterComment(bool bFlag)
weld::TreeView & GetWidget()
void CheckComment(bool bFlag)
void SetFirstTime(const tools::Time &aTime)
void HideRange(bool bHide=true)
bool IsRange() const
Date GetLastDate() const
void SelectedAuthorPos(sal_Int32 nPos)
void ClearAuthors()
OUString GetSelectedAuthor() const
Date GetFirstDate() const
void SetLastTime(const tools::Time &aTime)
bool IsAuthor() const
void SetFirstDate(const Date &aDate)
void CheckDate(bool bFlag)
void SetRefHdl(const Link< SvxTPFilter *, void > &rLink)
OUString GetComment() const
SvxRedlinDateMode GetDateMode() const
void SetComment(const OUString &rComment)
void InsertAuthor(const OUString &rString)
void SetReadyHdl(const Link< SvxTPFilter *, void > &rLink)
void CheckAuthor(bool bFlag)
void CheckRange(bool bFlag)
void SetRange(const OUString &rString)
sal_Int32 SelectAuthor(const OUString &aString)
void SetDateMode(sal_uInt16 nMode)
bool IsComment() const
tools::Time GetLastTime() const
bool IsDate() const
void SetLastDate(const Date &aDate)
tools::Time GetFirstTime() const
void EnableRejectAll(bool bFlag)
void EnableAccept(bool bFlag)
void EnableClearFormat(bool bFlag)
SvxRedlinTable * GetTableControl()
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
void EnableAcceptAll(bool bFlag)
void SetRejectAllClickHdl(const Link< SvxTPView *, void > &rLink)
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
void EnableReject(bool bFlag)
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
void EnableClearFormatAll(bool bFlag)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual void connect_popup_menu(const Link< const CommandEvent &, bool > &rLink)
virtual void set_font_color(int pos, const Color &rColor)=0
virtual void expand_row(const TreeIter &rIter)=0
virtual void set_text(int row, const OUString &rText, int col=-1)=0
virtual bool get_row_expanded(const TreeIter &rIter) const=0
virtual OUString get_text(int row, int col=-1) const=0
void remove_id(const OUString &rText)
int get_checkbox_column_width() const
virtual void set_selection_mode(SelectionMode eMode)=0
virtual int get_sort_column() const=0
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, bool bChildrenOnDemand, TreeIter *pRet)=0
virtual void clear()=0
virtual void selected_foreach(const std::function< bool(TreeIter &)> &func)=0
void connect_changed(const Link< TreeView &, void > &rLink)
void connect_expanding(const Link< const TreeIter &, bool > &rLink)
virtual bool get_iter_first(TreeIter &rIter) const=0
virtual void copy_iterator(const TreeIter &rSource, TreeIter &rDest) const=0
virtual void remove(int pos)=0
virtual void select(int pos)=0
virtual bool iter_parent(TreeIter &rIter) const=0
virtual void set_sort_func(const std::function< int(const weld::TreeIter &, const weld::TreeIter &)> &func)
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual bool iter_next(TreeIter &rIter) const=0
virtual bool iter_has_child(const TreeIter &rIter) const=0
virtual bool get_cursor(TreeIter *pIter) const=0
virtual int get_column_width(int nCol) const=0
virtual void set_cursor(int pos)=0
virtual int get_iter_depth(const TreeIter &rIter) const=0
virtual void all_foreach(const std::function< bool(TreeIter &)> &func)=0
virtual OUString get_id(int pos) const=0
virtual void freeze()=0
virtual void thaw()=0
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_GREEN(0x00, 0x80, 0x00)
constexpr ::Color COL_LIGHTBLUE(0x00, 0x00, 0xFF)
int nCount
DocumentType eType
uno_Any a
sal_uInt16 nPos
aStr
aBuf
int n2
int n1
int i
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
OUString toId(const void *pValue)
sal_Int16 nId
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SC_MOD()
Definition: scmod.hxx:249
sal_uIntPtr sal_uLong
OUString aExtraString
sal_Int16 SCCOL
Definition: types.hxx:21
OUString sId