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 DateTime aDateTime=pScChangeAction->GetDateTime();
373
374 ScChangeActionType eType=pScChangeAction->GetType();
375 OUString aActionString;
376 OUString aRefStr;
377 OUString aUser;
378 OUString aDate;
379 OUString aDesc;
380
381 std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
382 pNewData->pData=const_cast<ScChangeAction *>(pScChangeAction);
383 pNewData->nActionNo=pScChangeAction->GetActionNumber();
384 pNewData->bIsAcceptable=pScChangeAction->IsClickable();
385 pNewData->bIsRejectable=pScChangeAction->IsRejectable();
386 pNewData->bDisabled=!pNewData->bIsAcceptable || bDisabled;
387 pNewData->aDateTime=aDateTime;
388 pNewData->nRow = aRef.aStart.Row();
389 pNewData->nCol = aRef.aStart.Col();
390 pNewData->nTable= aRef.aStart.Tab();
391
393 {
394 if(pScChangeAction->IsDialogParent())
395 {
396 aActionString = aStrContentWithChild;
397 pNewData->nInfo=RD_SPECIAL_VISCONTENT;
398 pNewData->bIsRejectable=false;
399 pNewData->bIsAcceptable=false;
400 }
401 else
402 {
403 aActionString = *MakeTypeString(eType);
404 aDesc = pScChangeAction->GetDescription(*pDoc, true);
405 }
406 }
407 else
408 {
409 aActionString = *MakeTypeString(eType);
410
411 if(bDelMaster)
412 {
413 aDesc = pScChangeAction->GetDescription(*pDoc,true);
414 pNewData->bDisabled=true;
415 pNewData->bIsRejectable=false;
416 }
417 else
418 aDesc = pScChangeAction->GetDescription(*pDoc, !pScChangeAction->IsMasterDelete());
419
420 }
421
422 aRefStr = pScChangeAction->GetRefString(*pDoc, true);
423
424 bool bIsGenerated = false;
425
426 if(!pChanges->IsGenerated(pScChangeAction->GetActionNumber()))
427 {
428 aUser = pScChangeAction->GetUser();
429 aDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime);
430 bIsGenerated = false;
431 }
432 else
433 {
434 bIsGenerated = true;
435 }
436
437 OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
438
439 if (!aDesc.isEmpty())
440 {
441 aComment += " (" + aDesc + ")";
442 }
443
444 if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
445 {
446 if (pTheView->IsValidComment(aComment))
447 {
448 if(pTPFilter->IsRange())
449 {
450 for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
451 {
452 ScRange const & rRangeEntry = aRangeList[ i ];
453 if( rRangeEntry.Intersects(aRef) )
454 {
455 bHasFilterEntry=true;
456 bFlag=true;
457 break;
458 }
459 }
460 }
461 else if(!bIsGenerated)
462 {
463 bHasFilterEntry=true;
464 bFlag=true;
465 }
466 }
467 }
468
469 weld::TreeView& rTreeView = pTheView->GetWidget();
470 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
471 OUString sId(weld::toId(pNewData.release()));
472 rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
473 rTreeView.set_text( *xEntry, aRefStr, 1);
474 if (!aUser.isEmpty())
475 rTreeView.set_text( *xEntry, aUser, 2);
476 if (!aDate.isEmpty())
477 rTreeView.set_text( *xEntry, aDate, 3);
478 if (!aComment.isEmpty())
479 rTreeView.set_text( *xEntry, aComment, 4);
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
502std::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(*pDoc);
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
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 aDesc = pScChangeAction->GetDescription(*pDoc, true);
569 }
570 }
571 else
572 {
573 aActionString=*MakeTypeString(eType);
574
575 if(bDelMaster)
576 {
577 aDesc = pScChangeAction->GetDescription(*pDoc,true);
578 pNewData->bDisabled=true;
579 pNewData->bIsRejectable=false;
580 }
581 else
582 aDesc = pScChangeAction->GetDescription(*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(weld::toId(pNewData.release()));
597 rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
598
599 OUString aRefStr = pScChangeAction->GetRefString(*pDoc, true);
600 rTreeView.set_text(*xEntry, aRefStr, 1);
601
602 if (!bIsGenerated)
603 {
604 rTreeView.set_text(*xEntry, aUser, 2);
605 OUString sDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime);
606 rTreeView.set_text(*xEntry, sDate, 3);
607 }
608
609 rTreeView.set_text(*xEntry, aComment, 4);
610 }
611 }
612 return xEntry;
613}
614
615std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction,
616 const weld::TreeIter& rParent, sal_uLong nSpecial)
617{
618 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
619
620 if(pScChangeAction==nullptr || pChanges==nullptr) return nullptr;
621
622 bool bIsGenerated = pChanges->IsGenerated(pScChangeAction->GetActionNumber());
623
624 bool bFlag = false;
625
626 ScRange aRef=pScChangeAction->GetBigRange().MakeRange(*pDoc);
627 OUString aUser=pScChangeAction->GetUser();
628 DateTime aDateTime=pScChangeAction->GetDateTime();
629
630 if (pTheView->IsValidEntry(aUser, aDateTime) || bIsGenerated)
631 {
632 if(pTPFilter->IsRange())
633 {
634 for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i )
635 {
636 ScRange const & rRangeEntry = aRangeList[ i ];
637 if( rRangeEntry.Intersects(aRef) )
638 {
639 bFlag=true;
640 break;
641 }
642 }
643 }
644 else if(!bIsGenerated)
645 bFlag=true;
646 }
647
648 OUString aContent;
649 OUString aRefStr;
650 OUString aDate;
651 OUString aDesc;
652
653 if(nSpecial==RD_SPECIAL_CONTENT)
654 {
655 aContent = pScChangeAction->GetOldString(pDoc);
656 if (aContent.isEmpty())
657 aContent = aStrEmpty;
658 aDesc = aStrChildOrgContent + ": " + aContent;
659 }
660 else
661 {
662 const OUString aTmp( pScChangeAction->GetNewString(pDoc));
663 if (aTmp.isEmpty())
664 aContent = aStrEmpty;
665 else
666 aContent = "\'" + aTmp + "\'";
667 aDesc = aStrChildContent + aContent;
668 }
669
670 aRefStr = pScChangeAction->GetRefString(*pDoc, true);
671
672 if(!bIsGenerated)
673 {
674 // aUser is kept.
675 aDate = ScGlobal::getLocaleData().getDate(aDateTime) + " " + ScGlobal::getLocaleData().getTime(aDateTime);
676 }
677 else
678 {
679 aUser.clear();
680 }
681
682 OUString aComment = pScChangeAction->GetComment().replaceAll("\n", "");
683
684 if(!aDesc.isEmpty())
685 {
686 aComment += " (" + aDesc + ")";
687 }
688
689 std::unique_ptr<ScRedlinData> pNewData(new ScRedlinData);
690 pNewData->nInfo=nSpecial;
691 pNewData->pData=const_cast<ScChangeActionContent *>(pScChangeAction);
692 pNewData->nActionNo=pScChangeAction->GetActionNumber();
693 pNewData->bIsAcceptable=pScChangeAction->IsClickable();
694 pNewData->bIsRejectable=false;
695 pNewData->bDisabled=!pNewData->bIsAcceptable;
696 pNewData->aDateTime=aDateTime;
697 pNewData->nRow = aRef.aStart.Row();
698 pNewData->nCol = aRef.aStart.Col();
699 pNewData->nTable= aRef.aStart.Tab();
700
701 weld::TreeView& rTreeView = pTheView->GetWidget();
702 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
703 OUString sId(weld::toId(pNewData.release()));
704 rTreeView.insert(&rParent, -1, &aContent, &sId, nullptr, nullptr, false, xEntry.get());
705 rTreeView.set_text( *xEntry, aRefStr, 1);
706 if (!aUser.isEmpty())
707 rTreeView.set_text( *xEntry, aUser, 2);
708 if (!aDate.isEmpty())
709 rTreeView.set_text( *xEntry, aDate, 3);
710 if (!aComment.isEmpty())
711 rTreeView.set_text( *xEntry, aComment, 4);
712 if (pTheView->IsValidComment(aComment) && bFlag)
713 bHasFilterEntry=true;
714 else
715 {
716 rTreeView.set_font_color(*xEntry, COL_LIGHTBLUE);
717 }
718 return xEntry;
719}
720
722{
723 std::unique_ptr<weld::TreeIter> xParent;
724 ScChangeTrack* pChanges=nullptr;
725 const ScChangeAction* pScChangeAction=nullptr;
726 m_xDialog->set_busy_cursor(true);
727 weld::TreeView& rTreeView = pTheView->GetWidget();
728 rTreeView.freeze();
729 bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
731
732 bUseColor = bFilterFlag;
733
734 if(pDoc!=nullptr)
735 {
736 pChanges=pDoc->GetChangeTrack();
737 if(pChanges!=nullptr)
738 pScChangeAction=pChanges->GetFirst();
739 }
740 bool bTheFlag = false;
741
742 while(pScChangeAction!=nullptr)
743 {
744 bHasFilterEntry=false;
745 switch (pScChangeAction->GetState())
746 {
747 case SC_CAS_VIRGIN:
748
749 if (pScChangeAction->IsDialogRoot())
750 {
751 bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
752 if (pScChangeAction->IsDialogParent())
753 xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
754 else
755 xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
756 }
757 else
758 xParent.reset();
759
760 bTheFlag=true;
761 break;
762
763 case SC_CAS_ACCEPTED:
764 xParent.reset();
765 nAcceptCount++;
766 break;
767
768 case SC_CAS_REJECTED:
769 xParent.reset();
770 nRejectCount++;
771 break;
772 }
773
774 if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
775 {
776 bool bTestFlag = bHasFilterEntry;
777 bHasFilterEntry=false;
778 if (Expand(pChanges, pScChangeAction, *xParent, !bTestFlag) && !bTestFlag)
779 rTreeView.remove(*xParent);
780 }
781
782 pScChangeAction=pScChangeAction->GetNext();
783 }
784
785 if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
786 bTheFlag=false;
787
788 pTPView->EnableAccept(bTheFlag);
789 pTPView->EnableAcceptAll(bTheFlag);
790 pTPView->EnableReject(bTheFlag);
791 pTPView->EnableRejectAll(bTheFlag);
792
793 if (nAcceptCount>0)
794 rTreeView.insert(nullptr, -1, &aStrAllAccepted, nullptr, nullptr, nullptr, true, nullptr);
795 if (nRejectCount>0)
796 rTreeView.insert(nullptr, -1, &aStrAllRejected, nullptr, nullptr, nullptr, true, nullptr);
797 rTreeView.thaw();
798 m_xDialog->set_busy_cursor(false);
799 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
800 if (rTreeView.get_iter_first(*xEntry))
801 rTreeView.select(*xEntry);
802}
803
805{
806 sal_uInt16 nId =ScSimpleRefDlgWrapper::GetChildWindowId();
807
808 SC_MOD()->SetRefDialog( nId, true );
809
810 SfxViewFrame& rViewFrm = pViewData->GetViewShell()->GetViewFrame();
811 ScSimpleRefDlgWrapper* pWnd = static_cast<ScSimpleRefDlgWrapper*>(rViewFrm.GetChildWindow( nId ));
812
813 if(pWnd!=nullptr)
814 {
815 sal_uInt16 nAcceptId=ScAcceptChgDlgWrapper::GetChildWindowId();
816 rViewFrm.ShowChildWindow(nAcceptId,false);
817 pWnd->SetCloseHdl(LINK( this, ScAcceptChgDlg,RefInfoHandle));
818 pWnd->SetRefString(pTPFilter->GetRange());
820 auto xWin = pWnd->GetController();
821 m_xDialog->hide();
822 xWin->set_title(m_xDialog->get_title());
823 pWnd->StartRefInput();
824 }
825}
826
827IMPL_LINK( ScAcceptChgDlg, RefInfoHandle, const OUString*, pResult, void)
828{
829 sal_uInt16 nId = ScAcceptChgDlgWrapper::GetChildWindowId();
830
832
833 SfxViewFrame& rViewFrm = pViewData->GetViewShell()->GetViewFrame();
834 if (pResult)
835 {
836 pTPFilter->SetRange(*pResult);
837 FilterHandle(pTPFilter);
838
839 rViewFrm.ShowChildWindow(nId);
840 }
841 else
842 {
843 rViewFrm.SetChildWindow(nId, false);
844 }
845}
846
847IMPL_LINK( ScAcceptChgDlg, FilterHandle, SvxTPFilter*, pRef, void )
848{
849 if(pRef!=nullptr)
850 {
851 ClearView();
852 aRangeList.RemoveAll();
853 aRangeList.Parse(pTPFilter->GetRange(), *pDoc);
854 UpdateView();
855 }
856}
857
858IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef, void )
859{
860 m_xDialog->set_busy_cursor(true);
861
862 bIgnoreMsg=true;
863 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
864
865 if(pRef!=nullptr)
866 {
867 weld::TreeView& rTreeView = pTheView->GetWidget();
868 rTreeView.selected_foreach([this, pChanges, &rTreeView](weld::TreeIter& rEntry){
869 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
870 if (pEntryData)
871 {
872 ScChangeAction* pScChangeAction= static_cast<ScChangeAction*>(pEntryData->pData);
873 if (pScChangeAction->GetType()==SC_CAT_INSERT_TABS)
874 pViewData->SetTabNo(0);
875 pChanges->Reject(pScChangeAction);
876 }
877 return false;
878 });
879 ScDocShell* pDocSh=pViewData->GetDocShell();
880 pDocSh->PostPaintExtras();
881 pDocSh->PostPaintGridAll();
882 pDocSh->GetUndoManager()->Clear();
883 pDocSh->SetDocumentModified();
884 ClearView();
885 UpdateView();
886 }
887
888 m_xDialog->set_busy_cursor(false);
889
890 bIgnoreMsg=false;
891}
892IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef, void )
893{
894 m_xDialog->set_busy_cursor(true);
895
896 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
897 bIgnoreMsg=true;
898 if(pRef!=nullptr)
899 {
900 weld::TreeView& rTreeView = pTheView->GetWidget();
901 rTreeView.selected_foreach([pChanges, &rTreeView](weld::TreeIter& rEntry) {
902 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
903 if (pEntryData)
904 {
905 ScChangeAction* pScChangeAction=
906 static_cast<ScChangeAction*>(pEntryData->pData);
907 if(pScChangeAction->GetType()==SC_CAT_CONTENT)
908 {
909 if(pEntryData->nInfo==RD_SPECIAL_CONTENT)
910 pChanges->SelectContent(pScChangeAction,true);
911 else
912 pChanges->SelectContent(pScChangeAction);
913 }
914 else
915 pChanges->Accept(pScChangeAction);
916 }
917 return false;
918 });
919 ScDocShell* pDocSh=pViewData->GetDocShell();
920 pDocSh->PostPaintExtras();
921 pDocSh->PostPaintGridAll();
922 pDocSh->SetDocumentModified();
923 ClearView();
924 UpdateView();
925 }
926 m_xDialog->set_busy_cursor(false);
927 bIgnoreMsg=false;
928}
929
931{
932 if(pDoc==nullptr) return;
933 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
934 const ScChangeAction* pScChangeAction=nullptr;
935
936 if(pChanges!=nullptr)
937 {
938 pScChangeAction=pChanges->GetLast();
939 }
940
941 while(pScChangeAction!=nullptr)
942 {
943 if(pScChangeAction->IsDialogRoot())
944 if(IsValidAction(pScChangeAction))
945 pChanges->Reject(const_cast<ScChangeAction*>(pScChangeAction));
946
947 pScChangeAction=pScChangeAction->GetPrev();
948 }
949}
951{
952 if(pDoc==nullptr) return;
953 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
954 const ScChangeAction* pScChangeAction=nullptr;
955
956 if(pChanges!=nullptr)
957 pScChangeAction=pChanges->GetLast();
958
959 while(pScChangeAction!=nullptr)
960 {
961 if(pScChangeAction->IsDialogRoot())
962 if(IsValidAction(pScChangeAction))
963 pChanges->Accept(const_cast<ScChangeAction*>(pScChangeAction));
964
965 pScChangeAction=pScChangeAction->GetPrev();
966 }
967}
968
969IMPL_LINK_NOARG(ScAcceptChgDlg, RejectAllHandle, SvxTPView*, void)
970{
971 m_xDialog->set_busy_cursor(true);
972 bIgnoreMsg=true;
973 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
974 if(pChanges!=nullptr)
975 {
976 if(pTPFilter->IsDate()||pTPFilter->IsAuthor()||pTPFilter->IsRange()||pTPFilter->IsComment())
977 RejectFiltered();
978 else
979 pChanges->RejectAll();
980
981 pViewData->SetTabNo(0);
982
983 ScDocShell* pDocSh=pViewData->GetDocShell();
984 pDocSh->PostPaintExtras();
985 pDocSh->PostPaintGridAll();
986 pDocSh->GetUndoManager()->Clear();
987 pDocSh->SetDocumentModified();
988 ClearView();
989 UpdateView();
990 }
991 m_xDialog->set_busy_cursor(false);
992
993 bIgnoreMsg=false;
994}
995
996IMPL_LINK_NOARG(ScAcceptChgDlg, AcceptAllHandle, SvxTPView*, void)
997{
998 m_xDialog->set_busy_cursor(true);
999
1000 bIgnoreMsg=true;
1001 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1002 if(pChanges!=nullptr)
1003 {
1004 if(pTPFilter->IsDate()||pTPFilter->IsAuthor()||pTPFilter->IsRange()||pTPFilter->IsComment())
1005 AcceptFiltered();
1006 else
1007 pChanges->AcceptAll();
1008
1009 ScDocShell* pDocSh=pViewData->GetDocShell();
1010 pDocSh->PostPaintExtras();
1011 pDocSh->PostPaintGridAll();
1012 pDocSh->SetDocumentModified();
1013 ClearView();
1014 UpdateView();
1015 }
1016 bIgnoreMsg=false;
1017
1018 m_xDialog->set_busy_cursor(false);
1019}
1020
1022{
1023 if (!bNoSelection)
1024 aSelectionIdle.Start();
1025
1026 bNoSelection=false;
1027}
1028
1030 ScChangeActionMap& aActionMap,
1031 const weld::TreeIter& rEntry)
1032{
1033 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1034
1035 weld::TreeView& rTreeView = pTheView->GetWidget();
1036 std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator(&rEntry));
1037 if (rTreeView.iter_parent(*xParent))
1038 {
1039 ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xParent));
1040 ScChangeAction* pParentAction=static_cast<ScChangeAction*>(pParentData->pData);
1041
1042 if(pParentAction!=pScChangeAction)
1043 pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction),
1044 aActionMap,pScChangeAction->IsMasterDelete());
1045 else
1046 pChanges->GetDependents( const_cast<ScChangeAction*>(pScChangeAction),
1047 aActionMap );
1048 }
1049 else
1050 pChanges->GetDependents(const_cast<ScChangeAction*>(pScChangeAction),
1051 aActionMap, pScChangeAction->IsMasterDelete() );
1052}
1053
1055{
1056 bool bTheTestFlag = true;
1057 weld::TreeView& rTreeView = pTheView->GetWidget();
1058 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rParent));
1059 const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1060 bool bParentInserted = false;
1061 // If the parent is a MatrixOrigin then place it in the right order before
1062 // the MatrixReferences. Also if it is the first content change at this
1063 // position don't insert the first dependent MatrixReference as the special
1064 // content (original value) but insert the predecessor of the MatrixOrigin
1065 // itself instead.
1066 if ( pScChangeAction->GetType() == SC_CAT_CONTENT &&
1067 static_cast<const ScChangeActionContent*>(pScChangeAction)->IsMatrixOrigin() )
1068 {
1069 pActionMap->insert( ::std::make_pair( pScChangeAction->GetActionNumber(),
1070 const_cast<ScChangeAction*>( pScChangeAction ) ) );
1071 bParentInserted = true;
1072 }
1073
1074 ScChangeActionMap::iterator itChangeAction = std::find_if(pActionMap->begin(), pActionMap->end(),
1075 [](const std::pair<sal_uLong, ScChangeAction*>& rEntry) { return rEntry.second->GetState() == SC_CAS_VIRGIN; });
1076
1077 if( itChangeAction == pActionMap->end() )
1078 return true;
1079
1080 std::unique_ptr<weld::TreeIter> xOriginal = InsertChangeActionContent(
1081 dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
1082 rParent, RD_SPECIAL_CONTENT );
1083
1084 if (xOriginal)
1085 {
1086 bTheTestFlag=false;
1087 ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xOriginal));
1088 pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
1089 pParentData->nActionNo=pScChangeAction->GetActionNumber();
1090 pParentData->bIsAcceptable=pScChangeAction->IsRejectable(); // select old value
1091 pParentData->bIsRejectable=false;
1092 pParentData->bDisabled=false;
1093 }
1094 while( itChangeAction != pActionMap->end() )
1095 {
1096 if( itChangeAction->second->GetState() == SC_CAS_VIRGIN )
1097 {
1098 std::unique_ptr<weld::TreeIter> xEntry =
1099 InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ),
1100 rParent, RD_SPECIAL_NONE );
1101
1102 if (xEntry)
1103 bTheTestFlag=false;
1104 }
1105 ++itChangeAction;
1106 }
1107
1108 if ( !bParentInserted )
1109 {
1110 std::unique_ptr<weld::TreeIter> xEntry =
1112 pScChangeAction),rParent,RD_SPECIAL_NONE);
1113
1114 if (xEntry)
1115 {
1116 bTheTestFlag=false;
1117 ScRedlinData *pParentData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1118 pParentData->pData=const_cast<ScChangeAction *>(pScChangeAction);
1119 pParentData->nActionNo=pScChangeAction->GetActionNumber();
1120 pParentData->bIsAcceptable=pScChangeAction->IsClickable();
1121 pParentData->bIsRejectable=false;
1122 pParentData->bDisabled=false;
1123 }
1124 }
1125
1126 return bTheTestFlag;
1127}
1128
1130{
1131 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1132 bool bTheTestFlag = true;
1133
1135 weld::TreeView& rTreeView = pTheView->GetWidget();
1136 OUString aString = rTreeView.get_text(rParent, 0);
1137 OUString a2String = aString.copy(0, aStrAllAccepted.getLength());
1138 if (a2String == aStrAllAccepted)
1139 eState=SC_CAS_ACCEPTED;
1140 else
1141 {
1142 a2String = aString.copy(0, aStrAllRejected.getLength());
1143 if (a2String == aStrAllRejected)
1144 eState=SC_CAS_REJECTED;
1145 }
1146
1147 ScChangeAction* pScChangeAction = pChanges->GetFirst();
1148 while (pScChangeAction)
1149 {
1150 if (pScChangeAction->GetState()==eState &&
1151 AppendFilteredAction(pScChangeAction, eState, false, &rParent))
1152 bTheTestFlag=false;
1153 pScChangeAction=pScChangeAction->GetNext();
1154 }
1155 return bTheTestFlag;
1156}
1157
1159{
1160 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1161 bool bTheTestFlag = true;
1162
1163 for( const auto& rChangeAction : *pActionMap )
1164 {
1165 std::unique_ptr<weld::TreeIter> xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
1166
1167 if (xEntry)
1168 {
1169 bTheTestFlag=false;
1170
1171 weld::TreeView& rTreeView = pTheView->GetWidget();
1172 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1173 pEntryData->bIsRejectable=false;
1174 pEntryData->bIsAcceptable=false;
1175 pEntryData->bDisabled=true;
1176
1177 if (rChangeAction.second->IsDialogParent())
1178 Expand(pChanges, rChangeAction.second, *xEntry);
1179 }
1180 }
1181 return bTheTestFlag;
1182}
1183
1185 ScChangeActionMap* pActionMap, const weld::TreeIter& rParent)
1186{
1187 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1188 bool bTheTestFlag = true;
1189 std::unique_ptr<weld::TreeIter> xEntry;
1190
1191 for( const auto& rChangeAction : *pActionMap )
1192 {
1193
1194 if( pScChangeAction != rChangeAction.second )
1195 xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, false, true);
1196 else
1197 xEntry = AppendChangeAction(rChangeAction.second, false, &rParent, true, true);
1198
1199 if (xEntry)
1200 {
1201 weld::TreeView& rTreeView = pTheView->GetWidget();
1202 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1203 pEntryData->bIsRejectable=false;
1204 pEntryData->bIsAcceptable=false;
1205 pEntryData->bDisabled=true;
1206
1207 bTheTestFlag=false;
1208
1209 if (rChangeAction.second->IsDialogParent())
1210 Expand(pChanges, rChangeAction.second, *xEntry);
1211 }
1212 }
1213 return bTheTestFlag;
1214}
1215
1216bool ScAcceptChgDlg::Expand(const ScChangeTrack* pChanges, const ScChangeAction* pScChangeAction,
1217 const weld::TreeIter& rEntry, bool bFilter)
1218{
1219 bool bTheTestFlag = true;
1220
1221 if (pChanges && pScChangeAction)
1222 {
1223 ScChangeActionMap aActionMap;
1224
1225 GetDependents(pScChangeAction, aActionMap, rEntry);
1226
1227 switch(pScChangeAction->GetType())
1228 {
1229 case SC_CAT_CONTENT:
1230 {
1231 InsertContentChildren(&aActionMap, rEntry);
1232 bTheTestFlag=!bHasFilterEntry;
1233 break;
1234 }
1235 case SC_CAT_DELETE_COLS:
1236 case SC_CAT_DELETE_ROWS:
1237 case SC_CAT_DELETE_TABS:
1238 {
1239 InsertDeletedChildren(pScChangeAction, &aActionMap, rEntry);
1240 bTheTestFlag=!bHasFilterEntry;
1241 break;
1242 }
1243 default:
1244 {
1245 if(!bFilter)
1246 bTheTestFlag = InsertChildren(&aActionMap, rEntry);
1247 break;
1248 }
1249 }
1250 aActionMap.clear();
1251 }
1252 return bTheTestFlag;
1253}
1254
1255IMPL_LINK(ScAcceptChgDlg, ExpandingHandle, const weld::TreeIter&, rEntry, bool)
1256{
1257 ScChangeTrack* pChanges=pDoc->GetChangeTrack();
1258 if (pChanges)
1259 {
1260 m_xDialog->set_busy_cursor(true);
1261 ScChangeActionMap aActionMap;
1262 weld::TreeView& rTreeView = pTheView->GetWidget();
1263 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
1264 if (!rTreeView.iter_has_child(rEntry))
1265 {
1266 bool bTheTestFlag = true;
1267
1268 if (pEntryData)
1269 {
1270 ScChangeAction* pScChangeAction=static_cast<ScChangeAction*>(pEntryData->pData);
1271
1272 GetDependents(pScChangeAction, aActionMap, rEntry);
1273
1274 switch (pScChangeAction->GetType())
1275 {
1276 case SC_CAT_CONTENT:
1277 {
1278 bTheTestFlag = InsertContentChildren( &aActionMap, rEntry );
1279 break;
1280 }
1281 case SC_CAT_DELETE_COLS:
1282 case SC_CAT_DELETE_ROWS:
1283 case SC_CAT_DELETE_TABS:
1284 {
1285 bTheTestFlag = InsertDeletedChildren( pScChangeAction, &aActionMap, rEntry );
1286 break;
1287 }
1288 default:
1289 {
1290 bTheTestFlag = InsertChildren( &aActionMap, rEntry );
1291 break;
1292 }
1293 }
1294 aActionMap.clear();
1295
1296 }
1297 else
1298 {
1299 bTheTestFlag = InsertAcceptedORejected(rEntry);
1300 }
1301 if (bTheTestFlag)
1302 {
1303 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1304 rTreeView.insert(&rEntry, -1, &aStrNoEntry, nullptr, nullptr, nullptr, false, xEntry.get());
1305 rTreeView.set_font_color(*xEntry, COL_GRAY);
1306 }
1307 }
1308 m_xDialog->set_busy_cursor(false);
1309 }
1310 return true;
1311}
1312
1314 sal_uLong nEndAction)
1315{
1316 if(pChanges==nullptr)
1317 return;
1318
1319 std::unique_ptr<weld::TreeIter> xParent;
1320 m_xDialog->set_busy_cursor(true);
1321 weld::TreeView& rTreeView = pTheView->GetWidget();
1322 rTreeView.freeze();
1323
1324 bool bTheFlag = false;
1325
1326 bool bFilterFlag = pTPFilter->IsDate() || pTPFilter->IsRange() ||
1328
1329 bUseColor = bFilterFlag;
1330
1331 for(sal_uLong i=nStartAction;i<=nEndAction;i++)
1332 {
1333 const ScChangeAction* pScChangeAction=pChanges->GetAction(i);
1334 if(pScChangeAction==nullptr) continue;
1335
1336 switch (pScChangeAction->GetState())
1337 {
1338 case SC_CAS_VIRGIN:
1339
1340 if (pScChangeAction->IsDialogRoot())
1341 {
1342 bool bOnDemandChildren = !bFilterFlag && pScChangeAction->IsDialogParent();
1343 if (pScChangeAction->IsDialogParent())
1344 xParent = AppendChangeAction(pScChangeAction, bOnDemandChildren);
1345 else
1346 xParent = AppendFilteredAction(pScChangeAction, SC_CAS_VIRGIN, bOnDemandChildren);
1347 }
1348 else
1349 xParent.reset();
1350
1351 bTheFlag=true;
1352 break;
1353
1354 case SC_CAS_ACCEPTED:
1355 xParent.reset();
1356 nAcceptCount++;
1357 break;
1358
1359 case SC_CAS_REJECTED:
1360 xParent.reset();
1361 nRejectCount++;
1362 break;
1363 }
1364
1365 if (xParent && pScChangeAction->IsDialogParent() && bFilterFlag)
1366 {
1367 bool bTestFlag = bHasFilterEntry;
1368 bHasFilterEntry = false;
1369 if (Expand(pChanges,pScChangeAction,*xParent,!bTestFlag)&&!bTestFlag)
1370 rTreeView.remove(*xParent);
1371 }
1372 }
1373
1374 if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
1375 bTheFlag=false;
1376
1377 pTPView->EnableAccept(bTheFlag);
1378 pTPView->EnableAcceptAll(bTheFlag);
1379 pTPView->EnableReject(bTheFlag);
1380 pTPView->EnableRejectAll(bTheFlag);
1381
1382 rTreeView.thaw();
1383 m_xDialog->set_busy_cursor(false);
1384}
1385
1387{
1388 weld::TreeView& rTreeView = pTheView->GetWidget();
1389
1390 ScRedlinData *pEntryData=nullptr;
1391 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1392 if (rTreeView.get_cursor(xEntry.get()))
1393 pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1394
1395 if (!rTreeView.get_iter_first(*xEntry))
1396 return;
1397
1398 sal_uLong nAction=0;
1399 if (pEntryData)
1400 nAction=pEntryData->nActionNo;
1401
1402 if (nAction>=nStartAction && nAction<=nEndAction)
1403 rTreeView.set_cursor(*xEntry);
1404
1405 std::vector<OUString> aIdsToRemove;
1406
1407 do
1408 {
1409 OUString sId(rTreeView.get_id(*xEntry));
1410 pEntryData = weld::fromId<ScRedlinData*>(sId);
1411 if (pEntryData)
1412 {
1413 nAction = pEntryData->nActionNo;
1414 if (nStartAction <= nAction && nAction <= nEndAction)
1415 {
1416 aIdsToRemove.push_back(sId);
1417 delete pEntryData;
1418 }
1419 }
1420 }
1421 while (rTreeView.iter_next(*xEntry));
1422
1423 rTreeView.freeze();
1424
1425 // MUST do it backwards, don't delete parents before children and GPF
1426 for (auto it = aIdsToRemove.rbegin(); it != aIdsToRemove.rend(); ++it)
1427 rTreeView.remove_id(*it);
1428
1429 rTreeView.thaw();
1430}
1431
1432void ScAcceptChgDlg::UpdateEntries(const ScChangeTrack* pChgTrack, sal_uLong nStartAction,sal_uLong nEndAction)
1433{
1434 weld::TreeView& rTreeView = pTheView->GetWidget();
1435 rTreeView.freeze();
1436
1437 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1438 std::unique_ptr<weld::TreeIter> xLastEntry(rTreeView.make_iterator());
1439 std::unique_ptr<weld::TreeIter> xNextEntry(rTreeView.make_iterator());
1440
1441 bool bEntry = rTreeView.get_iter_first(*xEntry);
1442 bool bLastEntry = false;
1443
1444 while (bEntry)
1445 {
1446 bool bRemove = false;
1447 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1448 if (pEntryData)
1449 {
1450 ScChangeAction* pScChangeAction=
1451 static_cast<ScChangeAction*>(pEntryData->pData);
1452
1453 sal_uLong nAction=pScChangeAction->GetActionNumber();
1454
1455 if(nStartAction<=nAction && nAction<=nEndAction) bRemove=true;
1456 }
1457
1458 bool bNextEntry;
1459 if (bRemove)
1460 {
1461 rTreeView.remove(*xEntry);
1462 delete pEntryData;
1463
1464 if (!bLastEntry)
1465 bLastEntry = rTreeView.get_iter_first(*xLastEntry);
1466 if (bLastEntry)
1467 {
1468 rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
1469 bNextEntry = rTreeView.iter_next(*xNextEntry);
1470 if (!bNextEntry)
1471 {
1472 rTreeView.copy_iterator(*xLastEntry, *xNextEntry);
1473 bLastEntry = false;
1474 }
1475 }
1476 else
1477 bNextEntry = false;
1478 }
1479 else
1480 {
1481 rTreeView.copy_iterator(*xEntry, *xLastEntry);
1482 bLastEntry = true;
1483
1484 rTreeView.copy_iterator(*xEntry, *xNextEntry);
1485 bNextEntry = rTreeView.iter_next(*xNextEntry);
1486 }
1487
1488 rTreeView.copy_iterator(*xNextEntry, *xEntry);
1489 bEntry = bNextEntry;
1490 }
1491
1492 AppendChanges(pChgTrack,nStartAction,nEndAction);
1493
1494 rTreeView.thaw();
1495}
1496
1497IMPL_LINK( ScAcceptChgDlg, ChgTrackModHdl, ScChangeTrack&, rChgTrack, void)
1498{
1499 ScChangeTrackMsgQueue& aMsgQueue= rChgTrack.GetMsgQueue();
1500
1501 sal_uLong nStartAction;
1502 sal_uLong nEndAction;
1503
1504 for (const auto& rMsg : aMsgQueue)
1505 {
1506 nStartAction = rMsg.nStartAction;
1507 nEndAction = rMsg.nEndAction;
1508
1509 if(!bIgnoreMsg)
1510 {
1511 bNoSelection=true;
1512
1513 switch(rMsg.eMsgType)
1514 {
1516 AppendChanges(&rChgTrack,nStartAction,nEndAction);
1517 break;
1519 RemoveEntries(nStartAction,nEndAction);
1520 break;
1522 case ScChangeTrackMsgType::Change: //bNeedsUpdate=true;
1523 UpdateEntries(&rChgTrack,nStartAction,nEndAction);
1524 break;
1525 default: assert(false); break;
1526 }
1527 }
1528 }
1529
1530 aMsgQueue.clear();
1531}
1532
1533IMPL_LINK_NOARG(ScAcceptChgDlg, ReOpenTimerHdl, Timer *, void)
1534{
1536 m_xAcceptChgCtr->ShowFilterPage();
1537 RefHandle(nullptr);
1538}
1539
1540IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
1541{
1542 ScTabView* pTabView = pViewData->GetView();
1543
1544 bool bAcceptFlag = true;
1545 bool bRejectFlag = true;
1546
1547 pTabView->DoneBlockMode(); // clears old marking
1548 weld::TreeView& rTreeView = pTheView->GetWidget();
1549 std::vector<const ScChangeAction*> aActions;
1550 rTreeView.selected_foreach([&rTreeView, &bAcceptFlag, &bRejectFlag, &aActions](weld::TreeIter& rEntry){
1551 ScRedlinData* pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rEntry));
1552 if (pEntryData)
1553 {
1554 bRejectFlag &= pEntryData->bIsRejectable;
1555 bAcceptFlag &= pEntryData->bIsAcceptable;
1556
1557 const ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1558 if( pScChangeAction && (pScChangeAction->GetType() != SC_CAT_DELETE_TABS) &&
1559 (!pEntryData->bDisabled || pScChangeAction->IsVisible()) )
1560 {
1561 aActions.push_back(pScChangeAction);
1562 }
1563 }
1564 else
1565 {
1566 bAcceptFlag = false;
1567 bRejectFlag = false;
1568 }
1569 return false;
1570 });
1571
1572 bool bContMark = false;
1573 for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
1574 {
1575 const ScBigRange& rBigRange = aActions[i]->GetBigRange();
1576 if (rBigRange.IsValid(*pDoc) && m_xDialog->has_toplevel_focus())
1577 {
1578 bool bSetCursor = i == nCount - 1;
1579 pTabView->MarkRange(rBigRange.MakeRange(*pDoc), bSetCursor, bContMark);
1580 bContMark = true;
1581 }
1582 }
1583
1584 ScChangeTrack* pChanges = pDoc->GetChangeTrack();
1585 bool bEnable = pDoc->IsDocEditable() && pChanges && !pChanges->IsProtected();
1586 pTPView->EnableAccept( bAcceptFlag && bEnable );
1587 pTPView->EnableReject( bRejectFlag && bEnable );
1588}
1589
1590IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
1591{
1592 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
1593 return false;
1594
1595 weld::TreeView& rTreeView = pTheView->GetWidget();
1596 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1597 bool bEntry = rTreeView.get_cursor(xEntry.get());
1598 if (bEntry)
1599 rTreeView.select(*xEntry);
1600
1601 int nSortedCol = rTreeView.get_sort_column();
1602 for (sal_Int32 i = 0; i < 5; ++i)
1603 m_xSortMenu->set_active("calcsort" + OUString::number(i), i == nSortedCol);
1604
1605 m_xPopup->set_sensitive("calcedit", false);
1606
1607 if (pDoc->IsDocEditable() && bEntry)
1608 {
1609 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1610 if (pEntryData)
1611 {
1612 ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1613 if (pScChangeAction && !rTreeView.get_iter_depth(*xEntry))
1614 m_xPopup->set_sensitive("calcedit", true);
1615 }
1616 }
1617
1618 OUString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
1619
1620 if (!sCommand.isEmpty())
1621 {
1622 if (sCommand == "calcedit")
1623 {
1624 if (bEntry)
1625 {
1626 ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
1627 if (pEntryData)
1628 {
1629 ScChangeAction* pScChangeAction = static_cast<ScChangeAction*>(pEntryData->pData);
1630 pViewData->GetDocShell()->ExecuteChangeCommentDialog(pScChangeAction, m_xDialog.get(), false);
1631 }
1632 }
1633 }
1634 else
1635 {
1636 int nDialogCol = o3tl::toInt32(sCommand.subView(8));
1637 pTheView->HeaderBarClick(nDialogCol);
1638 }
1639 }
1640
1641 return true;
1642}
1643
1644namespace
1645{
1646 //at one point we were writing multiple AcceptChgDat strings,
1647 //so strip all of them and keep the results of the last one
1648 OUString lcl_StripAcceptChgDat(OUString &rExtraString)
1649 {
1650 OUString aStr;
1651 while (true)
1652 {
1653 sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:");
1654 if (nPos == -1)
1655 break;
1656 // Try to read the alignment string "ALIGN:(...)"; if it is missing
1657 // we have an old version
1658 sal_Int32 n1 = rExtraString.indexOf('(', nPos);
1659 if ( n1 != -1 )
1660 {
1661 sal_Int32 n2 = rExtraString.indexOf(')', n1);
1662 if ( n2 != -1 )
1663 {
1664 // cut out alignment string
1665 aStr = rExtraString.copy(nPos, n2 - nPos + 1);
1666 rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, u"");
1667 aStr = aStr.copy( n1-nPos+1 );
1668 }
1669 }
1670 }
1671 return aStr;
1672 }
1673}
1674
1676{
1677 OUString aStr;
1678 if (pInfo && !pInfo->aExtraString.isEmpty())
1679 aStr = lcl_StripAcceptChgDat(pInfo->aExtraString);
1680
1682
1683 if (aStr.isEmpty())
1684 return;
1685
1686 int nCount = aStr.toInt32();
1687 if (nCount <= 2)
1688 return;
1689
1690 std::vector<int> aEndPos;
1691
1692 for (int i = 0; i < nCount; ++i)
1693 {
1694 sal_Int32 n1 = aStr.indexOf(';');
1695 aStr = aStr.copy( n1+1 );
1696 aEndPos.push_back(aStr.toInt32());
1697 }
1698
1699 std::vector<int> aWidths;
1700 for (int i = 1; i < nCount; ++i)
1701 aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
1702
1703 // turn column end points back to column widths, ignoring the small
1704 // value used for the expander column
1705 weld::TreeView& rTreeView = pTheView->GetWidget();
1706 rTreeView.set_column_fixed_widths(aWidths);
1707}
1708
1710{
1712 //remove any old one before adding a new one
1713 lcl_StripAcceptChgDat(rInfo.aExtraString);
1714 rInfo.aExtraString += "AcceptChgDat:(";
1715
1716 const int nTabCount = 5;
1717
1718 rInfo.aExtraString += OUString::number(nTabCount);
1719 rInfo.aExtraString += ";";
1720
1721 weld::TreeView& rTreeView = pTheView->GetWidget();
1722 std::vector<int> aWidths;
1723 // turn column widths back into column end points for compatibility
1724 // with how they used to be stored, including a small value for the
1725 // expander column
1726 aWidths.push_back(rTreeView.get_checkbox_column_width());
1727 for (int i = 0; i < nTabCount - 1; ++i)
1728 aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i));
1729
1730 for (auto a : aWidths)
1731 {
1732 rInfo.aExtraString += OUString::number(a);
1733 rInfo.aExtraString += ";";
1734 }
1735 rInfo.aExtraString += ")";
1736}
1737
1738#define CALC_DATE 3
1739#define CALC_POS 1
1740
1742{
1743 weld::TreeView& rTreeView = pTheView->GetWidget();
1744
1745 sal_Int32 nCompare = 0;
1746 SCCOL nSortCol = rTreeView.get_sort_column();
1747
1748 if (CALC_DATE == nSortCol)
1749 {
1750 RedlinData *pLeftData = weld::fromId<RedlinData*>(rTreeView.get_id(rLeft));
1751 RedlinData *pRightData = weld::fromId<RedlinData*>(rTreeView.get_id(rRight));
1752 if (pLeftData && pRightData)
1753 {
1754 if(pLeftData->aDateTime < pRightData->aDateTime)
1755 nCompare = -1;
1756 else if(pLeftData->aDateTime > pRightData->aDateTime)
1757 nCompare = 1;
1758 return nCompare;
1759 }
1760 }
1761 else if (CALC_POS == nSortCol)
1762 {
1763 ScRedlinData *pLeftData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rLeft));
1764 ScRedlinData *pRightData = weld::fromId<ScRedlinData*>(rTreeView.get_id(rRight));
1765 if (pLeftData && pRightData)
1766 {
1767 nCompare = 1;
1768
1769 if(pLeftData->nTable < pRightData->nTable)
1770 nCompare = -1;
1771 else if(pLeftData->nTable == pRightData->nTable)
1772 {
1773 if(pLeftData->nRow < pRightData->nRow)
1774 nCompare = -1;
1775 else if(pLeftData->nRow == pRightData->nRow)
1776 {
1777 if(pLeftData->nCol < pRightData->nCol)
1778 nCompare = -1;
1779 else if(pLeftData->nCol == pRightData->nCol)
1780 nCompare = 0;
1781 }
1782 }
1783
1784 return nCompare;
1785 }
1786 }
1787
1788 return ScGlobal::GetCaseCollator().compareString(rTreeView.get_text(rLeft, nSortCol),
1789 rTreeView.get_text(rRight, nSortCol));
1790}
1791
1792/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define CALC_POS
Definition: acredlin.cxx:1739
#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:804
#define CALC_DATE
Definition: acredlin.cxx:1738
IMPL_LINK(ScAcceptChgDlg, RefInfoHandle, const OUString *, pResult, void)
Definition: acredlin.cxx:827
#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:798
std::vector< ScChangeTrackMsgInfo > ScChangeTrackMsgQueue
Definition: chgtrack.hxx:796
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:1184
void UpdateView()
Definition: acredlin.cxx:721
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:1432
void RemoveEntries(sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1386
OUString aStrDeleteRows
Definition: acredlin.hxx:60
OUString aUnknown
Definition: acredlin.hxx:72
void AcceptFiltered()
Definition: acredlin.cxx:950
std::unique_ptr< weld::TreeIter > InsertChangeActionContent(const ScChangeActionContent *pScChangeAction, const weld::TreeIter &rParent, sal_uLong nSpecial)
Definition: acredlin.cxx:615
void AppendChanges(const ScChangeTrack *pChanges, sal_uLong nStartAction, sal_uLong nEndAction)
Definition: acredlin.cxx:1313
virtual void FillInfo(SfxChildWinInfo &) const override
Definition: acredlin.cxx:1709
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:1029
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:1129
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:1054
bool Expand(const ScChangeTrack *pChanges, const ScChangeAction *pScChangeAction, const weld::TreeIter &rEntry, bool bFilter=false)
Definition: acredlin.cxx:1216
sal_uLong nAcceptCount
Definition: acredlin.hxx:73
void RejectFiltered()
Definition: acredlin.cxx:930
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:1158
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:1741
OUString aStrReject
Definition: acredlin.hxx:64
void Initialize(SfxChildWinInfo *pInfo)
Definition: acredlin.cxx:1675
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:502
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:1430
OUString GetOldString(const ScDocument *pDoc) const
Definition: chgtrack.cxx:1380
OUString GetNewString(const ScDocument *pDoc) const
Definition: chgtrack.cxx:1385
const OUString & GetComment() const
Definition: chgtrack.hxx:348
ScBigRange & GetBigRange()
Definition: chgtrack.hxx:229
bool IsClickable() const
Definition: chgtrack.cxx:166
bool IsVisible() const
Definition: chgtrack.cxx:143
bool IsMasterDelete() const
Definition: chgtrack.cxx:274
bool IsDialogRoot() const
Definition: chgtrack.cxx:233
bool IsDialogParent() const
Definition: chgtrack.cxx:238
sal_uLong GetActionNumber() const
Definition: chgtrack.hxx:317
ScChangeActionType GetType() const
Definition: chgtrack.hxx:315
bool IsRejectable() const
Definition: chgtrack.cxx:197
virtual OUString GetDescription(ScDocument &rDoc, bool bSplitRange=false, bool bWarning=true) const
Definition: chgtrack.cxx:421
ScChangeAction * GetNext() const
Definition: chgtrack.hxx:320
ScChangeAction * GetPrev() const
Definition: chgtrack.hxx:321
SC_DLLPUBLIC DateTime GetDateTime() const
Definition: chgtrack.cxx:407
OUString GetRefString(const ScBigRange &rRange, const ScDocument &rDoc, bool bFlag3D=false) const
Definition: chgtrack.cxx:477
ScChangeActionState GetState() const
Definition: chgtrack.hxx:316
const OUString & GetUser() const
Definition: chgtrack.hxx:347
const std::set< OUString > & GetUserCollection() const
Definition: chgtrack.hxx:972
bool SelectContent(ScChangeAction *, bool bOldest=false)
Definition: chgtrack.cxx:3997
ScChangeAction * GetLast() const
Definition: chgtrack.hxx:952
SC_DLLPUBLIC ScChangeAction * GetAction(sal_uLong nAction) const
Definition: chgtrack.cxx:2110
void SetModifiedLink(const Link< ScChangeTrack &, void > &r)
Definition: chgtrack.hxx:1109
void AcceptAll()
Definition: chgtrack.cxx:4080
bool RejectAll()
Definition: chgtrack.cxx:4108
bool IsProtected() const
Definition: chgtrack.hxx:1126
SC_DLLPUBLIC void GetDependents(ScChangeAction *, ScChangeActionMap &, bool bListMasterDelete=false, bool bAllFlat=false) const
Definition: chgtrack.cxx:3802
SC_DLLPUBLIC bool Accept(ScChangeAction *)
Definition: chgtrack.cxx:4088
bool IsGenerated(sal_uLong nAction) const
Definition: chgtrack.cxx:2105
bool Reject(ScChangeAction *, ScChangeActionMap *, bool bRecursion)
Definition: chgtrack.cxx:4139
const OUString & GetUser() const
Definition: chgtrack.hxx:971
ScChangeAction * GetFirst() const
Definition: chgtrack.hxx:951
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:2982
void PostPaintExtras()
Definition: docsh3.cxx:198
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
bool IsDocEditable() const
Definition: documen3.cxx:1899
ScChangeViewSettings * GetChangeViewSettings() const
Definition: document.hxx:2243
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2494
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
Definition: global.cxx:1055
static CollatorWrapper & GetCaseCollator()
case-sensitive collator
Definition: global.cxx:1106
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:509
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1708
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
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:247
sal_uIntPtr sal_uLong
OUString aExtraString
sal_Int16 SCCOL
Definition: types.hxx:21
OUString sId