LibreOffice Module sw (master)  1
redlndlg.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 <redline.hxx>
21 #include <tools/datetime.hxx>
22 #include <tools/lineend.hxx>
23 #include <svl/eitem.hxx>
24 #include <sfx2/viewfrm.hxx>
25 #include <sfx2/dispatch.hxx>
26 #include <svx/ctredlin.hxx>
27 #include <svx/postattr.hxx>
28 #include <vcl/commandevent.hxx>
29 #include <swtypes.hxx>
30 #include <wrtsh.hxx>
31 #include <view.hxx>
32 #include <swmodule.hxx>
33 #include <redlndlg.hxx>
34 #include <swwait.hxx>
35 #include <uitool.hxx>
36 
37 #include <helpids.h>
38 #include <cmdid.h>
39 #include <strings.hrc>
40 
41 // -> #111827#
42 #include <swundo.hxx>
43 #include <SwRewriter.hxx>
44 // <- #111827#
45 
46 #include <vector>
47 #include <svx/svxdlg.hxx>
48 #include <svx/dialogs.hrc>
49 #include <svx/svxids.hrc>
50 #include <bitmaps.hlst>
51 
52 #include <unomid.h>
53 
54 #include <docsh.hxx>
55 
57 #include <memory>
58 
60 
62  sal_uInt16 nId,
63  SfxBindings* pBindings,
64  SfxChildWinInfo* pInfo)
65  : SwChildWinWrapper(_pParent, nId)
66 {
67  SetController(std::make_shared<SwModelessRedlineAcceptDlg>(pBindings, this, _pParent->GetFrameWeld()));
68 
69  static_cast<SwModelessRedlineAcceptDlg*>(GetController().get())->Initialize(pInfo);
70 }
71 
72 // newly initialise dialog after document switch
74 {
75  bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
76  if (bRet) // update immediately, doc switch!
77  static_cast<SwModelessRedlineAcceptDlg*>(GetController().get())->Activate();
78 
79  return bRet;
80 }
81 
83  SfxBindings* _pBindings, SwChildWinWrapper* pChild, weld::Window *pParent)
84  : SfxModelessDialogController(_pBindings, pChild, pParent,
85  "svx/ui/acceptrejectchangesdialog.ui", "AcceptRejectChangesDialog")
86  , m_xContentArea(m_xDialog->weld_content_area())
87  , pChildWin(pChild)
88 {
89  m_xImplDlg.reset(new SwRedlineAcceptDlg(m_xDialog, m_xBuilder.get(), m_xContentArea.get()));
90 }
91 
93 {
94  SwView *pView = ::GetActiveView();
95  if (!pView) // can happen when switching to another app, when a Listbox in dialog
96  return; // had the focus previously (actually THs Bug)
97 
98  SwDocShell *pDocSh = pView->GetDocShell();
99 
100  if (pChildWin->GetOldDocShell() != pDocSh)
101  { // doc-switch
102  SwWait aWait( *pDocSh, false );
103  SwWrtShell* pSh = pView->GetWrtShellPtr();
104 
105  pChildWin->SetOldDocShell(pDocSh); // avoid recursion (using modified-Hdl)
106 
107  bool bMod = pSh->IsModified();
108  SfxBoolItem aShow(FN_REDLINE_SHOW, true);
110  FN_REDLINE_SHOW, SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
111  { &aShow });
112  if (!bMod)
113  pSh->ResetModified();
114  m_xImplDlg->Init();
116 
117  return;
118  }
119 
121  m_xImplDlg->Activate();
122 }
123 
125 {
126  if (pInfo != nullptr)
127  m_xImplDlg->Initialize(pInfo->aExtraString);
128 
130 }
131 
133 {
135  m_xImplDlg->FillInfo(rInfo.aExtraString);
136 }
137 
139 {
140 }
141 
142 SwRedlineAcceptDlg::SwRedlineAcceptDlg(const std::shared_ptr<weld::Window>& rParent, weld::Builder *pBuilder,
143  weld::Container *pContentArea, bool bAutoFormat)
144  : m_xParentDlg(rParent)
145  , m_sInserted(SwResId(STR_REDLINE_INSERTED))
146  , m_sDeleted(SwResId(STR_REDLINE_DELETED))
147  , m_sFormated(SwResId(STR_REDLINE_FORMATTED))
148  , m_sTableChgd(SwResId(STR_REDLINE_TABLECHG))
149  , m_sFormatCollSet(SwResId(STR_REDLINE_FMTCOLLSET))
150  , m_sAutoFormat(SwResId(STR_REDLINE_AUTOFMT))
151  , m_bOnlyFormatedRedlines(false)
152  , m_bRedlnAutoFormat(bAutoFormat)
153  , m_bInhibitActivate(false)
154  , m_xTabPagesCTRL(new SvxAcceptChgCtr(pContentArea, m_xParentDlg.get(), pBuilder))
155  , m_xPopup(pBuilder->weld_menu("writermenu"))
156 {
157  m_xTabPagesCTRL->set_help_id(HID_REDLINE_CTRL);
158  m_pTPView = m_xTabPagesCTRL->GetViewPage();
159 
162 
164  m_pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptAllHdl));
166  m_pTPView->SetRejectAllClickHdl(LINK(this, SwRedlineAcceptDlg, RejectAllHdl));
168  //tdf#89227 default to disabled, and only enable if possible to accept/reject
169  m_pTPView->EnableAccept(false);
170  m_pTPView->EnableReject(false);
171  m_pTPView->EnableAcceptAll(false);
172  m_pTPView->EnableRejectAll(false);
173 
174  m_xTabPagesCTRL->GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
175 
176  weld::ComboBox* pActLB = m_xTabPagesCTRL->GetFilterPage()->GetLbAction();
177  pActLB->append_text(m_sInserted);
178  pActLB->append_text(m_sDeleted);
179  pActLB->append_text(m_sFormated);
180  pActLB->append_text(m_sTableChgd);
181 
182  if (HasRedlineAutoFormat())
183  {
184  pActLB->append_text(m_sFormatCollSet);
185  pActLB->append_text(m_sAutoFormat);
186  m_pTPView->ShowUndo();
187  m_pTPView->DisableUndo(); // no UNDO events yet
188  }
189 
190  pActLB->set_active(0);
191 
192  weld::TreeView& rTreeView = m_pTable->GetWidget();
193  rTreeView.set_selection_mode(SelectionMode::Multiple);
194 
195  rTreeView.connect_changed(LINK(this, SwRedlineAcceptDlg, SelectHdl));
196  rTreeView.connect_popup_menu(LINK(this, SwRedlineAcceptDlg, CommandHdl));
197 
198  // avoid multiple selection of the same texts:
201 }
202 
204 {
205 }
206 
208 {
209  SwWait aWait( *::GetActiveView()->GetDocShell(), false );
210  weld::TreeView& rTreeView = m_pTable->GetWidget();
212 
213  rTreeView.freeze();
214  if (nStart)
215  RemoveParents(nStart, m_RedlineParents.size() - 1);
216  else
217  {
218  rTreeView.clear();
219  m_RedlineChildren.clear();
220  m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.end());
221  }
222  rTreeView.thaw();
223 
224  // insert parents
225  InsertParents(nStart);
226  InitAuthors();
227 
228  // #i69618# this moves the list box to the right position, visually
229  std::unique_ptr<weld::TreeIter> xSelEntry(rTreeView.make_iterator());
230  if (rTreeView.get_selected(xSelEntry.get()))
231  rTreeView.scroll_to_row(*xSelEntry); //#i70937#, force the scroll
232 }
233 
235 {
237 
238  if (!m_xTabPagesCTRL)
239  return;
240 
241  SvxTPFilter *pFilterPage = m_xTabPagesCTRL->GetFilterPage();
242 
243  std::vector<OUString> aStrings;
244  OUString sOldAuthor(pFilterPage->GetSelectedAuthor());
245  pFilterPage->ClearAuthors();
246 
248 
250  bool bIsNotFormated = false;
251 
252  // determine authors
253  for ( SwRedlineTable::size_type i = 0; i < nCount; i++)
254  {
255  const SwRangeRedline& rRedln = pSh->GetRedline(i);
256 
258  m_bOnlyFormatedRedlines = false;
259 
260  aStrings.push_back(rRedln.GetAuthorString());
261 
262  for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
263  {
264  aStrings.push_back(rRedln.GetAuthorString(nStack));
265  }
266  }
267 
268  std::sort(aStrings.begin(), aStrings.end());
269  aStrings.erase(std::unique(aStrings.begin(), aStrings.end()), aStrings.end());
270 
271  for (auto const & i: aStrings)
272  pFilterPage->InsertAuthor(i);
273 
274  if (pFilterPage->SelectAuthor(sOldAuthor) == -1 && !aStrings.empty())
275  pFilterPage->SelectAuthor(aStrings[0]);
276 
277  weld::TreeView& rTreeView = m_pTable->GetWidget();
278  bool bEnable = rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
279  bool bSel = rTreeView.get_selected(nullptr);
280 
281  rTreeView.selected_foreach([this, pSh, &bIsNotFormated](weld::TreeIter& rEntry){
282  // find the selected redline
283  // (fdo#57874: ignore, if the redline is already gone)
285  if( nPos != SwRedlineTable::npos )
286  {
287  const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
288 
289  bIsNotFormated |= RedlineType::Format != rRedln.GetType();
290  }
291  return false;
292  });
293 
294  m_pTPView->EnableAccept( bEnable && bSel );
295  m_pTPView->EnableReject( bEnable && bSel );
296  m_pTPView->EnableClearFormat( bEnable && !bIsNotFormated && bSel );
297  m_pTPView->EnableAcceptAll( bEnable );
298  m_pTPView->EnableRejectAll( bEnable );
299  m_pTPView->EnableClearFormatAll( bEnable &&
301 }
302 
303 OUString SwRedlineAcceptDlg::GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack)
304 {
305  switch (rRedln.GetType(nStack))
306  {
307  case RedlineType::Insert: return BMP_REDLINE_INSERTED;
308  case RedlineType::Delete: return BMP_REDLINE_DELETED;
309  case RedlineType::Format: return BMP_REDLINE_FORMATTED;
310  case RedlineType::ParagraphFormat: return BMP_REDLINE_FORMATTED;
311  case RedlineType::Table: return BMP_REDLINE_TABLECHG;
312  case RedlineType::FmtColl: return BMP_REDLINE_FMTCOLLSET;
313  default: break;
314  }
315 
316  return OUString();
317 }
318 
319 OUString SwRedlineAcceptDlg::GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack)
320 {
321  switch( rRedln.GetType(nStack) )
322  {
323  case RedlineType::Insert: return m_sInserted;
324  case RedlineType::Delete: return m_sDeleted;
325  case RedlineType::Format: return m_sFormated;
327  case RedlineType::Table: return m_sTableChgd;
329  default:;//prevent warning
330  }
331 
332  return OUString();
333 }
334 
335 // newly initialise after activation
337 {
338  // prevent update if flag is set (#102547#)
339  if( m_bInhibitActivate )
340  return;
341 
342  SwView *pView = ::GetActiveView();
343  if (!pView) // can happen when switching to another app
344  {
345  m_pTPView->EnableAccept(false);
346  m_pTPView->EnableReject(false);
347  m_pTPView->EnableAcceptAll(false);
348  m_pTPView->EnableRejectAll(false);
349  return; // had the focus previously
350  }
351 
352  SwWait aWait( *pView->GetDocShell(), false );
353 
355 
356  // did something change?
357  SwWrtShell* pSh = pView->GetWrtShellPtr();
359 
360  // check the number of pointers
361  for ( SwRedlineTable::size_type i = 0; i < nCount; i++)
362  {
363  const SwRangeRedline& rRedln = pSh->GetRedline(i);
364 
365  if (i >= m_RedlineParents.size())
366  {
367  // new entries have been appended
368  Init(i);
369  return;
370  }
371 
372  SwRedlineDataParent *const pParent = m_RedlineParents[i].get();
373  if (&rRedln.GetRedlineData() != pParent->pData)
374  {
375  // Redline-Parents were inserted, changed or deleted
376  if ((i = CalcDiff(i, false)) == SwRedlineTable::npos)
377  return;
378  continue;
379  }
380 
381  const SwRedlineData *pRedlineData = rRedln.GetRedlineData().Next();
382  const SwRedlineDataChild *pBackupData = pParent->pNext;
383 
384  if (!pRedlineData && pBackupData)
385  {
386  // Redline-Children were deleted
387  if ((i = CalcDiff(i, true)) == SwRedlineTable::npos)
388  return;
389  continue;
390  }
391  else
392  {
393  while (pRedlineData)
394  {
395  if (pRedlineData != pBackupData->pChild)
396  {
397  // Redline-Children were inserted, changed or deleted
398  if ((i = CalcDiff(i, true)) == SwRedlineTable::npos)
399  return;
400  continue;
401  }
402  pBackupData = pBackupData->pNext;
403  pRedlineData = pRedlineData->Next();
404  }
405  }
406  }
407 
408  if (nCount != m_RedlineParents.size())
409  {
410  // Redlines were deleted at the end
411  Init(nCount);
412  return;
413  }
414 
415  // check comment
416  weld::TreeView& rTreeView = m_pTable->GetWidget();
417  for (SwRedlineTable::size_type i = 0; i < nCount; i++)
418  {
419  const SwRangeRedline& rRedln = pSh->GetRedline(i);
420  SwRedlineDataParent *const pParent = m_RedlineParents[i].get();
421 
422  if(rRedln.GetComment() != pParent->sComment)
423  {
424  if (pParent->xTLBParent)
425  {
426  // update only comment
427  const OUString& sComment(rRedln.GetComment());
428  rTreeView.set_text(*pParent->xTLBParent, sComment.replace('\n', ' '), 3);
429  }
430  pParent->sComment = rRedln.GetComment();
431  }
432  }
433 
434  InitAuthors();
435 }
436 
438 {
439  if (!nStart)
440  {
441  Init();
442  return SwRedlineTable::npos;
443  }
444 
445  weld::TreeView& rTreeView = m_pTable->GetWidget();
446  rTreeView.freeze();
447  SwView *pView = ::GetActiveView();
448  SwWrtShell* pSh = pView->GetWrtShellPtr();
449  bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
450  SwRedlineDataParent *const pParent = m_RedlineParents[nStart].get();
451  const SwRangeRedline& rRedln = pSh->GetRedline(nStart);
452 
453  if (bChild) // should actually never happen, but just in case...
454  {
455  // throw away all entry's children and initialise newly
456  SwRedlineDataChild* pBackupData = const_cast<SwRedlineDataChild*>(pParent->pNext);
457  SwRedlineDataChild* pNext;
458 
459  while (pBackupData)
460  {
461  pNext = const_cast<SwRedlineDataChild*>(pBackupData->pNext);
462  if (pBackupData->xTLBChild)
463  rTreeView.remove(*pBackupData->xTLBChild);
464 
465  auto it = std::find_if(m_RedlineChildren.begin(), m_RedlineChildren.end(),
466  [&pBackupData](const std::unique_ptr<SwRedlineDataChild>& rChildPtr) { return rChildPtr.get() == pBackupData; });
467  if (it != m_RedlineChildren.end())
468  m_RedlineChildren.erase(it);
469 
470  pBackupData = pNext;
471  }
472  pParent->pNext = nullptr;
473 
474  // insert new children
475  InsertChildren(pParent, rRedln, bHasRedlineAutoFormat);
476 
477  rTreeView.thaw();
478  return nStart;
479  }
480 
481  // have entries been deleted?
482  const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
483  for (SwRedlineTable::size_type i = nStart + 1; i < m_RedlineParents.size(); i++)
484  {
485  if (m_RedlineParents[i]->pData == pRedlineData)
486  {
487  // remove entries from nStart to i-1
488  RemoveParents(nStart, i - 1);
489  rTreeView.thaw();
490  return nStart - 1;
491  }
492  }
493 
494  // entries been inserted?
496  pRedlineData = m_RedlineParents[nStart]->pData;
497 
498  for (SwRedlineTable::size_type i = nStart + 1; i < nCount; i++)
499  {
500  if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData)
501  {
502  // insert entries from nStart to i-1
503  InsertParents(nStart, i - 1);
504  rTreeView.thaw();
505  return nStart - 1;
506  }
507  }
508 
509  rTreeView.thaw();
510  Init(nStart); // adjust all entries until the end
511  return SwRedlineTable::npos;
512 }
513 
514 void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, bool bHasRedlineAutoFormat)
515 {
516  SwRedlineDataChild *pLastRedlineChild = nullptr;
517  const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
518  bool bAutoFormatRedline = rRedln.IsAutoFormat();
519 
520  weld::TreeView& rTreeView = m_pTable->GetWidget();
521 
522  OUString sAction = GetActionText(rRedln);
523  bool bValidParent = m_sFilterAction.isEmpty() || m_sFilterAction == sAction;
524  bValidParent = bValidParent && m_pTable->IsValidEntry(rRedln.GetAuthorString(), rRedln.GetTimeStamp(), rRedln.GetComment());
525  if (bHasRedlineAutoFormat)
526  {
527 
528  if (pParent->pData->GetSeqNo())
529  {
530  std::pair<SwRedlineDataParentSortArr::const_iterator,bool> const ret
531  = m_aUsedSeqNo.insert(pParent);
532  if (ret.second) // already there
533  {
534  if (pParent->xTLBParent)
535  {
536  rTreeView.set_text(*(*ret.first)->xTLBParent, m_sAutoFormat, 0);
537  rTreeView.remove(*pParent->xTLBParent);
538  pParent->xTLBParent.reset();
539  }
540  return;
541  }
542  }
543  bValidParent = bValidParent && bAutoFormatRedline;
544  }
545  bool bValidTree = bValidParent;
546 
547  for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
548  {
549  pRedlineData = pRedlineData->Next();
550 
551  SwRedlineDataChild* pRedlineChild = new SwRedlineDataChild;
552  pRedlineChild->pChild = pRedlineData;
553  m_RedlineChildren.push_back(std::unique_ptr<SwRedlineDataChild>(pRedlineChild));
554 
555  if ( pLastRedlineChild )
556  pLastRedlineChild->pNext = pRedlineChild;
557  else
558  pParent->pNext = pRedlineChild;
559 
560  sAction = GetActionText(rRedln, nStack);
561  bool bValidChild = m_sFilterAction.isEmpty() || m_sFilterAction == sAction;
562  bValidChild = bValidChild && m_pTable->IsValidEntry(rRedln.GetAuthorString(nStack), rRedln.GetTimeStamp(nStack), rRedln.GetComment());
563  if (bHasRedlineAutoFormat)
564  bValidChild = bValidChild && bAutoFormatRedline;
565  bValidTree |= bValidChild;
566 
567  if (bValidChild)
568  {
569  std::unique_ptr<RedlinData> pData(new RedlinData);
570  pData->pData = pRedlineChild;
571  pData->bDisabled = true;
572 
573  OUString sImage(GetActionImage(rRedln, nStack));
574  OUString sAuthor = rRedln.GetAuthorString(nStack);
575  pData->aDateTime = rRedln.GetTimeStamp(nStack);
576  OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
577  OUString sComment = rRedln.GetComment(nStack);
578 
579  std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator());
580  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData.release())));
581  rTreeView.insert(pParent->xTLBParent.get(), -1, nullptr, &sId, nullptr, nullptr,
582  nullptr, false, xChild.get());
583 
584  rTreeView.set_image(*xChild, sImage, -1);
585  rTreeView.set_text(*xChild, sAuthor, 1);
586  rTreeView.set_text(*xChild, sDateEntry, 2);
587  rTreeView.set_text(*xChild, sComment, 3);
588 
589  pRedlineChild->xTLBChild = std::move(xChild);
590  if (!bValidParent)
591  rTreeView.expand_row(*pParent->xTLBParent);
592  }
593  else
594  pRedlineChild->xTLBChild.reset();
595 
596  pLastRedlineChild = pRedlineChild;
597  }
598 
599  if (pLastRedlineChild)
600  pLastRedlineChild->pNext = nullptr;
601 
602  if (!bValidTree && pParent->xTLBParent)
603  {
604  rTreeView.remove(*pParent->xTLBParent);
605  pParent->xTLBParent.reset();
606  if (bHasRedlineAutoFormat)
607  m_aUsedSeqNo.erase(pParent);
608  }
609 }
610 
612 {
615 
616  std::vector<const weld::TreeIter*> aLBoxArr;
617 
618  weld::TreeView& rTreeView = m_pTable->GetWidget();
619 
620  // because of Bug of TLB that ALWAYS calls the SelectHandler at Remove:
622 
623  bool bChildrenRemoved = false;
624  rTreeView.thaw();
625  rTreeView.unselect_all();
626 
627  // set the cursor after the last entry because otherwise performance problem in TLB.
628  // TLB would otherwise reset the cursor at every Remove (expensive)
629  SwRedlineTable::size_type nPos = std::min(nCount, m_RedlineParents.size());
630  weld::TreeIter *pCurEntry = nullptr;
631  while( ( pCurEntry == nullptr ) && ( nPos > 0 ) )
632  {
633  --nPos;
634  pCurEntry = m_RedlineParents[nPos]->xTLBParent.get();
635  }
636 
637  if (pCurEntry)
638  rTreeView.set_cursor(*pCurEntry);
639 
640  rTreeView.freeze();
641 
642  for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++)
643  {
644  if (!bChildrenRemoved && m_RedlineParents[i]->pNext)
645  {
646  SwRedlineDataChild * pChildPtr =
647  const_cast<SwRedlineDataChild*>(m_RedlineParents[i]->pNext);
648  auto it = std::find_if(m_RedlineChildren.begin(), m_RedlineChildren.end(),
649  [&pChildPtr](const std::unique_ptr<SwRedlineDataChild>& rChildPtr) { return rChildPtr.get() == pChildPtr; });
650  if (it != m_RedlineChildren.end())
651  {
652  sal_uInt16 nChildren = 0;
653  while (pChildPtr)
654  {
655  pChildPtr = const_cast<SwRedlineDataChild*>(pChildPtr->pNext);
656  nChildren++;
657  }
658 
659  m_RedlineChildren.erase(it, it + nChildren);
660  bChildrenRemoved = true;
661  }
662  }
663  weld::TreeIter *const pEntry = m_RedlineParents[i]->xTLBParent.get();
664  if (pEntry)
665  aLBoxArr.push_back(pEntry);
666  }
667 
668  std::sort(aLBoxArr.begin(), aLBoxArr.end(), [&rTreeView](const weld::TreeIter* a, const weld::TreeIter* b) {
669  return rTreeView.iter_compare(*a, *b) == -1;
670  });
671  // clear TLB from behind
672  for (auto it = aLBoxArr.rbegin(); it != aLBoxArr.rend(); ++it)
673  {
674  const weld::TreeIter* pIter = *it;
675  rTreeView.remove(*pIter);
676  }
677 
678  rTreeView.thaw();
679  rTreeView.connect_changed(LINK(this, SwRedlineAcceptDlg, SelectHdl));
680  // unfortunately by Remove it was selected from the TLB always again ...
681  rTreeView.unselect_all();
682  rTreeView.freeze();
683 
684  m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.begin() + nEnd + 1);
685 }
686 
688 {
689  SwView *pView = ::GetActiveView();
690  SwWrtShell* pSh = pView->GetWrtShellPtr();
691  bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
692 
694  nEnd = std::min(nEnd, (nCount - 1)); // also treats nEnd=SwRedlineTable::npos (until the end)
695 
696  if (nEnd == SwRedlineTable::npos)
697  return; // no redlines in the document
698 
699  weld::TreeView& rTreeView = m_pTable->GetWidget();
700 
701  SwRedlineDataParent* pRedlineParent;
702  const SwRangeRedline* pCurrRedline;
703  if (!nStart && !rTreeView.get_selected(nullptr))
704  {
705  pCurrRedline = pSh->GetCurrRedline();
706  if( !pCurrRedline )
707  {
708  pSh->SwCursorShell::Push();
709  if( nullptr == (pCurrRedline = pSh->SelNextRedline()))
710  pCurrRedline = pSh->SelPrevRedline();
711  pSh->SwCursorShell::Pop(SwCursorShell::PopMode::DeleteCurrent);
712  }
713  }
714  else
715  pCurrRedline = nullptr;
716 
717  rTreeView.freeze();
718  for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++)
719  {
720  const SwRangeRedline& rRedln = pSh->GetRedline(i);
721  const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
722 
723  pRedlineParent = new SwRedlineDataParent;
724  pRedlineParent->pData = pRedlineData;
725  pRedlineParent->pNext = nullptr;
726  const OUString& sComment(rRedln.GetComment());
727  pRedlineParent->sComment = sComment.replace('\n', ' ');
728  m_RedlineParents.insert(m_RedlineParents.begin() + i,
729  std::unique_ptr<SwRedlineDataParent>(pRedlineParent));
730 
731  std::unique_ptr<RedlinData> pData(new RedlinData);
732  pData->pData = pRedlineParent;
733  pData->bDisabled = false;
734 
735  OUString sImage = GetActionImage(rRedln);
736  OUString sAuthor = rRedln.GetAuthorString(0);
737  pData->aDateTime = rRedln.GetTimeStamp(0);
738  OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
739 
740  OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pData.release()));
741  std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator());
742  rTreeView.insert(nullptr, i, nullptr, &sId, nullptr, nullptr, nullptr, false, xParent.get());
743 
744  rTreeView.set_image(*xParent, sImage, -1);
745  rTreeView.set_text(*xParent, sAuthor, 1);
746  rTreeView.set_text(*xParent, sDateEntry, 2);
747  rTreeView.set_text(*xParent, sComment, 3);
748 
749  if (pCurrRedline == &rRedln)
750  {
751  rTreeView.thaw();
752  rTreeView.set_cursor(*xParent);
753  rTreeView.select(*xParent);
754  rTreeView.scroll_to_row(*xParent);
755  rTreeView.freeze();
756  }
757 
758  pRedlineParent->xTLBParent = std::move(xParent);
759 
760  InsertChildren(pRedlineParent, rRedln, bHasRedlineAutoFormat);
761  }
762  rTreeView.thaw();
763 }
764 
765 void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
766 {
768  int nPos = -1;
769 
770  typedef std::vector<std::unique_ptr<weld::TreeIter>> ListBoxEntries_t;
771  ListBoxEntries_t aRedlines;
772 
773  // don't activate
774  OSL_ENSURE( !m_bInhibitActivate,
775  "recursive call of CallAcceptReject?");
776  m_bInhibitActivate = true;
777 
778  weld::TreeView& rTreeView = m_pTable->GetWidget();
779 
780  auto lambda = [this, pSh, bSelect, bAccept, &rTreeView, &nPos, &aRedlines](weld::TreeIter& rEntry) {
781  if (!rTreeView.get_iter_depth(rEntry))
782  {
783  if (bSelect && nPos == -1)
784  nPos = rTreeView.get_iter_index_in_parent(rEntry);
785 
786  RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64());
787 
788  bool bIsNotFormatted = true;
789 
790  // first remove only changes with insertion/deletion, if they exist
791  // (format-only changes haven't had real rejection yet, only an
792  // approximation: clear direct formatting, so try to warn
793  // with the extended button label "Reject All/Clear formatting")
794  if ( !bSelect && !bAccept && !m_bOnlyFormatedRedlines )
795  {
796  SwRedlineTable::size_type nPosition = GetRedlinePos(rEntry);
797  const SwRangeRedline& rRedln = pSh->GetRedline(nPosition);
798 
799  if( RedlineType::Format == rRedln.GetType() )
800  bIsNotFormatted = false;
801  }
802 
803  if (!pData->bDisabled && bIsNotFormatted)
804  aRedlines.emplace_back(rTreeView.make_iterator(&rEntry));
805  }
806  return false;
807  };
808 
809  // collect redlines-to-be-accepted/rejected in aRedlines vector
810  if (bSelect)
811  rTreeView.selected_foreach(lambda);
812  else
813  rTreeView.all_foreach(lambda);
814 
816  if( !bAccept )
817  FnAccRej = &SwEditShell::RejectRedline;
818 
819  SwWait aWait( *pSh->GetView().GetDocShell(), true );
820  pSh->StartAction();
821 
822  if (aRedlines.size() > 1)
823  {
824  OUString aTmpStr;
825  {
826  SwRewriter aRewriter;
827  aRewriter.AddRule(UndoArg1,
828  OUString::number(aRedlines.size()));
829  aTmpStr = aRewriter.Apply(SwResId(STR_N_REDLINES));
830  }
831 
832  SwRewriter aRewriter;
833  aRewriter.AddRule(UndoArg1, aTmpStr);
834 
836  &aRewriter);
837  }
838 
839  // accept/reject the redlines in aRedlines. The absolute
840  // position may change during the process (e.g. when two redlines
841  // are merged in result of another one being deleted), so the
842  // position must be resolved late and checked before using it.
843  // (cf #102547#)
844  for (const auto& rRedLine : aRedlines)
845  {
846  SwRedlineTable::size_type nPosition = GetRedlinePos( *rRedLine );
847  if( nPosition != SwRedlineTable::npos )
848  (pSh->*FnAccRej)( nPosition );
849  }
850 
851  if (aRedlines.size() > 1)
852  {
853  pSh->EndUndo();
854  }
855 
856  pSh->EndAction();
857 
858  m_bInhibitActivate = false;
859  Activate();
860 
861  if (nPos != -1 && rTreeView.n_children())
862  {
863  if (nPos >= rTreeView.n_children())
864  nPos = rTreeView.n_children() - 1;
865  rTreeView.select(nPos);
866  rTreeView.scroll_to_row(nPos);
867  rTreeView.set_cursor(nPos);
868  }
870 }
871 
873 {
875  weld::TreeView& rTreeView = m_pTable->GetWidget();
876  return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(reinterpret_cast<RedlinData*>(
877  rTreeView.get_id(rEntry).toInt64())->pData)->pData );
878 }
879 
881 {
882  CallAcceptReject( true, true );
883 }
884 
886 {
887  CallAcceptReject( false, true );
888 }
889 
891 {
892  CallAcceptReject( true, false );
893 }
894 
896 {
897  CallAcceptReject( false, false );
898 }
899 
901 {
902  SwView * pView = ::GetActiveView();
903  pView->GetViewFrame()->GetDispatcher()->
904  Execute(SID_UNDO, SfxCallMode::SYNCHRON);
905  m_pTPView->EnableUndo(pView->GetSlotState(SID_UNDO) != nullptr);
906 
907  Activate();
908 }
909 
911 {
912  SvxTPFilter *pFilterTP = m_xTabPagesCTRL->GetFilterPage();
913 
914  if (pFilterTP->IsAction())
915  m_sFilterAction = pFilterTP->GetLbAction()->get_active_text();
916  else
917  m_sFilterAction.clear();
918 
919  Init();
920 }
921 
923 {
924  m_aSelectTimer.Start();
925 }
926 
928 {
930  m_aSelectTimer.Stop();
931 
932  bool bIsNotFormated = false;
933  bool bSel = false;
934 
935  //#98883# don't select redlines while the dialog is not focused
936  //#107938# But not only ask pTable if it has the focus. To move
937  // the selection to the selected redline any child of pParentDlg
938  // may the focus.
939  if (!m_xParentDlg || m_xParentDlg->has_toplevel_focus())
940  {
941  weld::TreeView& rTreeView = m_pTable->GetWidget();
942  std::unique_ptr<weld::TreeIter> xActEntry(rTreeView.make_iterator());
943  if (rTreeView.get_selected(xActEntry.get()))
944  {
945  pSh->StartAction();
946  pSh->EnterStdMode();
947  SwViewShell::SetCareDialog(m_xParentDlg);
948 
949  rTreeView.selected_foreach([this, pSh, &rTreeView, &xActEntry, &bIsNotFormated, &bSel](weld::TreeIter& rEntry){
950  rTreeView.copy_iterator(rEntry, *xActEntry);
951  if (rTreeView.get_iter_depth(rEntry))
952  {
953  rTreeView.iter_parent(*xActEntry);
954  if (rTreeView.is_selected(*xActEntry))
955  return false; // don't select twice
956  }
957  else
958  bSel = true;
959 
960  // #98864# find the selected redline (ignore, if the redline is already gone)
961  SwRedlineTable::size_type nPos = GetRedlinePos(*xActEntry);
962  if (nPos != SwRedlineTable::npos)
963  {
964 
965  const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
966  bIsNotFormated |= RedlineType::Format != rRedln.GetType();
967 
968  if (pSh->GotoRedline(nPos, true))
969  {
970  pSh->SetInSelect();
971  pSh->EnterAddMode();
972  }
973  }
974  return false;
975  });
976 
977  pSh->LeaveAddMode();
978  pSh->EndAction();
980  }
981  }
982 
983  bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
984  m_pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ );
985  m_pTPView->EnableReject( bEnable && bSel /*&& !bReadonlySel*/ );
986  m_pTPView->EnableClearFormat( bEnable && bSel && !bIsNotFormated /*&& !bReadonlySel*/ );
987  m_pTPView->EnableRejectAll( bEnable );
988  m_pTPView->EnableClearFormatAll( bEnable && m_bOnlyFormatedRedlines );
989 }
990 
991 IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
992 {
993  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
994  return false;
995 
997  const SwRangeRedline *pRed = nullptr;
998 
999  weld::TreeView& rTreeView = m_pTable->GetWidget();
1000  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1001  bool bEntry = rTreeView.get_selected(xEntry.get());
1002  if (bEntry)
1003  {
1004  std::unique_ptr<weld::TreeIter> xTopEntry(rTreeView.make_iterator(xEntry.get()));
1005 
1006  if (rTreeView.get_iter_depth(*xTopEntry))
1007  rTreeView.iter_parent(*xTopEntry);
1008 
1009  SwRedlineTable::size_type nPos = GetRedlinePos(*xTopEntry);
1010 
1011  // disable commenting for protected areas
1012  if (nPos != SwRedlineTable::npos && (pRed = pSh->GotoRedline(nPos, true)) != nullptr)
1013  {
1014  if( pSh->IsCursorPtAtEnd() )
1015  pSh->SwapPam();
1016  pSh->SetInSelect();
1017  }
1018  }
1019 
1020  m_xPopup->set_sensitive("writeredit", bEntry && pRed &&
1021  !rTreeView.get_iter_depth(*xEntry) &&
1022  rTreeView.count_selected_rows() == 1);
1023  m_xPopup->set_sensitive("writersort", rTreeView.n_children() != 0);
1024  int nColumn = rTreeView.get_sort_column();
1025  if (nColumn == -1)
1026  nColumn = 4;
1027  for (sal_Int32 i = 0; i < 5; ++i)
1028  m_xPopup->set_active("writersort" + OString::number(i), i == nColumn);
1029 
1030  OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
1031 
1032  if (sCommand == "writeredit")
1033  {
1034  if (bEntry)
1035  {
1036  if (rTreeView.get_iter_depth(*xEntry))
1037  rTreeView.iter_parent(*xEntry);
1038 
1039  SwRedlineTable::size_type nPos = GetRedlinePos(*xEntry);
1040 
1041  if (nPos == SwRedlineTable::npos)
1042  return true;
1043 
1044  const SwRangeRedline &rRedline = pSh->GetRedline(nPos);
1045 
1046  /* enable again once we have redline comments in the margin
1047  sComment = rRedline.GetComment();
1048  if ( !sComment.Len() )
1049  GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED));
1050  const_cast<SwRangeRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS));
1051  */
1052 
1053  OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd());
1055  ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
1056  SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() );
1057 
1058  aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
1059  aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
1060 
1062  rRedline.GetRedlineData().GetTimeStamp() ),
1063  SID_ATTR_POSTIT_DATE ));
1064 
1065  ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog(&rTreeView, aSet));
1066 
1067  pDlg->HideAuthor();
1068 
1069  const char* pResId = nullptr;
1070  switch( rRedline.GetType() )
1071  {
1072  case RedlineType::Insert:
1073  pResId = STR_REDLINE_INSERTED;
1074  break;
1075  case RedlineType::Delete:
1076  pResId = STR_REDLINE_DELETED;
1077  break;
1078  case RedlineType::Format:
1080  pResId = STR_REDLINE_FORMATTED;
1081  break;
1082  case RedlineType::Table:
1083  pResId = STR_REDLINE_TABLECHG;
1084  break;
1085  default:;//prevent warning
1086  }
1087  OUString sTitle(SwResId(STR_REDLINE_COMMENT));
1088  if (pResId)
1089  sTitle += SwResId(pResId);
1090  pDlg->SetText(sTitle);
1091 
1092  SwViewShell::SetCareDialog(pDlg->GetDialog());
1093 
1094  if ( pDlg->Execute() == RET_OK )
1095  {
1096  const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
1097  OUString sMsg(pOutSet->Get(SID_ATTR_POSTIT_TEXT).GetValue());
1098 
1099  // insert / change comment
1100  pSh->SetRedlineComment(sMsg);
1101  rTreeView.set_text(*xEntry, sMsg.replace('\n', ' '), 3);
1102  Init();
1103  }
1104 
1105  SwViewShell::SetCareDialog(nullptr);
1106  pDlg.disposeAndClear();
1107  }
1108  }
1109  else if (!sCommand.isEmpty())
1110  {
1111  int nSortMode = sCommand.copy(10).toInt32();
1112 
1113  if (nSortMode == 4 && nColumn == 4)
1114  return true; // we already have it
1115  if (nSortMode == 4)
1116  nSortMode = -1; // unsorted / sorted by position
1117 
1118  SwWait aWait( *::GetActiveView()->GetDocShell(), false );
1119  m_pTable->HeaderBarClick(nSortMode);
1120  if (nSortMode == -1)
1121  Init(); // newly fill everything
1122  }
1123  return true;
1124 }
1125 
1126 namespace
1127 {
1128  OUString lcl_StripAcceptChgDat(OUString &rExtraString)
1129  {
1130  OUString aStr;
1131  while(true)
1132  {
1133  sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:");
1134  if (nPos == -1)
1135  break;
1136  // try to read the alignment string "ALIGN:(...)"; if none existing,
1137  // it's an old version
1138  sal_Int32 n1 = rExtraString.indexOf('(', nPos);
1139  if (n1 != -1)
1140  {
1141  sal_Int32 n2 = rExtraString.indexOf(')', n1);
1142  if (n2 != -1)
1143  {
1144  // cut out the alignment string
1145  aStr = rExtraString.copy(nPos, n2 - nPos + 1);
1146  rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, "");
1147  aStr = aStr.copy(n1 - nPos + 1);
1148  }
1149  }
1150  }
1151  return aStr;
1152  }
1153 }
1154 
1155 void SwRedlineAcceptDlg::Initialize(OUString& rExtraString)
1156 {
1157  if (!rExtraString.isEmpty())
1158  {
1159  OUString aStr = lcl_StripAcceptChgDat(rExtraString);
1160  if (!aStr.isEmpty())
1161  {
1162  int nCount = aStr.toInt32();
1163  if (nCount > 2)
1164  {
1165  std::vector<int> aEndPos;
1166 
1167  for (int i = 0; i < nCount; ++i)
1168  {
1169  sal_Int32 n1 = aStr.indexOf(';');
1170  aStr = aStr.copy( n1+1 );
1171  aEndPos.push_back(aStr.toInt32());
1172  }
1173 
1174  bool bUseless = false;
1175 
1176  std::vector<int> aWidths;
1177  for (int i = 1; i < nCount; ++i)
1178  {
1179  aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
1180  if (aWidths.back() <= 0)
1181  bUseless = true;
1182  }
1183 
1184  if (!bUseless)
1185  {
1186  // turn column end points back to column widths, ignoring the small
1187  // value used for the expander column
1188  weld::TreeView& rTreeView = m_pTable->GetWidget();
1189  rTreeView.set_column_fixed_widths(aWidths);
1190  }
1191  }
1192  }
1193  }
1194 }
1195 
1196 void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) const
1197 {
1198  //remove any old one before adding a new one
1199  lcl_StripAcceptChgDat(rExtraData);
1200  rExtraData += "AcceptChgDat:(";
1201 
1202  const int nTabCount = 4;
1203 
1204  rExtraData += OUString::number(nTabCount);
1205  rExtraData += ";";
1206 
1207  weld::TreeView& rTreeView = m_pTable->GetWidget();
1208  std::vector<int> aWidths;
1209  // turn column widths back into column end points for compatibility
1210  // with how they used to be stored, including a small value for the
1211  // expander column
1212  aWidths.push_back(rTreeView.get_checkbox_column_width());
1213  for (int i = 0; i < nTabCount - 1; ++i)
1214  {
1215  int nWidth = rTreeView.get_column_width(i);
1216  assert(nWidth > 0 && "suspicious to get a value like this");
1217  aWidths.push_back(aWidths.back() + nWidth);
1218  }
1219 
1220  for (auto a : aWidths)
1221  {
1222  rExtraData += OUString::number(a);
1223  rExtraData += ";";
1224  }
1225  rExtraData += ")";
1226 }
1227 
1228 SwRedlineAcceptPanel::SwRedlineAcceptPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame)
1229  : PanelLayout(pParent, "ManageChangesPanel", "modules/swriter/ui/managechangessidebar.ui", rFrame, true)
1230  , mxContentArea(m_xBuilder->weld_container("content_area"))
1231 {
1232  mpImplDlg.reset(new SwRedlineAcceptDlg(nullptr, m_xBuilder.get(), mxContentArea.get()));
1233 
1234  mpImplDlg->Init();
1235 
1236  // we want to receive SfxHintId::DocChanged
1237  StartListening(*(SW_MOD()->GetView()->GetDocShell()));
1238 }
1239 
1241 {
1242  disposeOnce();
1243 }
1244 
1246 {
1247  mpImplDlg.reset();
1249 }
1250 
1252 {
1253  if (mpImplDlg && rHint.GetId() == SfxHintId::DocChanged)
1254  mpImplDlg->Activate();
1255 }
1256 
1257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual void FillInfo(SfxChildWinInfo &) const
virtual void set_text(int row, const OUString &rText, int col=-1)=0
std::shared_ptr< SfxDialogController > & GetController()
SfxViewFrame * GetViewFrame() const
sal_uInt16 GetSeqNo() const
Definition: redline.hxx:147
virtual int get_iter_index_in_parent(const TreeIter &rIter) const =0
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
OUString aExtraString
const SwRangeRedline & GetRedline(SwRedlineTable::size_type nPos) const
Definition: edredln.cxx:52
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
virtual int count_selected_rows() const =0
void Init()
void SetRejectAllClickHdl(const Link< SvxTPView *, void > &rLink)
void Initialize(SfxChildWinInfo const *pInfo)
OUString const & GetAuthorString(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1718
std::unique_ptr< SvxAcceptChgCtr > m_xTabPagesCTRL
Definition: redlndlg.hxx:77
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
SwView * GetActiveView()
Definition: swmodul1.cxx:123
virtual bool iter_parent(TreeIter &rIter) const =0
void SetWriterView()
virtual void copy_iterator(const TreeIter &rSource, TreeIter &rDest) const =0
virtual void dispose() override
Definition: redlndlg.cxx:1245
void FillInfo(OUString &rExtraData) const
Definition: redlndlg.cxx:1196
const SwRedlineData * Next() const
Definition: redline.hxx:130
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2185
void unselect_all()
SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline &rRedln, sal_uInt16 nStack=0)
Definition: redlndlg.cxx:319
SfxDispatcher * GetDispatcher()
static SvxAbstractDialogFactory * Create()
virtual void scroll_to_row(int pos)=0
bool IsModified() const
Changes in document?
Definition: edws.cxx:64
OUString const m_sFormated
Definition: redlndlg.hxx:66
virtual void Activate() override
Definition: redlndlg.cxx:92
std::unique_ptr< weld::TreeIter > xTLBParent
Definition: redlndlg.hxx:46
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:233
SwDocShell * GetOldDocShell()
Definition: chldwrap.hxx:41
virtual void clear()=0
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: move.cxx:667
void EnterStdMode()
Definition: select.cxx:555
SwRedlineDataChildArr m_RedlineChildren
Definition: redlndlg.hxx:61
bool HasRedlineAutoFormat() const
Definition: redlndlg.hxx:111
void EnableRejectAll(bool bFlag)
OUString const m_sFormatCollSet
Definition: redlndlg.hxx:68
virtual bool is_selected(int pos) const =0
OUString GetAppLangDateTimeString(const DateTime &)
Definition: uitool.cxx:818
void EnableClearFormat(bool bFlag)
SAL_DLLPRIVATE SwRedlineTable::size_type CalcDiff(SwRedlineTable::size_type nStart, bool bChild)
Definition: redlndlg.cxx:437
SfxHintId GetId() const
virtual ~SwModelessRedlineAcceptDlg() override
Definition: redlndlg.cxx:138
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, const OUString *pExpanderName, bool bChildrenOnDemand, TreeIter *pRet)=0
void ClearAuthors()
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
void SwapPam()
Definition: crsrsh.cxx:963
virtual void thaw()=0
virtual int get_column_width(int nCol) const =0
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
std::unique_ptr< weld::Container > mxContentArea
Definition: redlndlg.hxx:154
std::unique_ptr< weld::Builder > m_xBuilder
void connect_changed(const Link< TreeView &, void > &rLink)
const SwView & GetView() const
Definition: wrtsh.hxx:428
void LeaveAddMode()
Definition: select.cxx:645
weld::ComboBox * GetLbAction()
SwRedlineAcceptPanel(vcl::Window *pParent, const css::uno::Reference< css::frame::XFrame > &rFrame)
Definition: redlndlg.cxx:1228
const DateTime & GetTimeStamp(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1723
virtual int n_children() const =0
LineEnd GetSystemLineEnd()
void ShowUndo()
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual void selected_foreach(const std::function< bool(TreeIter &)> &func)=0
virtual OUString get_id(int pos) const =0
IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent &, rCEvt, bool)
Definition: redlndlg.cxx:991
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
We need to be a SfxListener to be able to update the list of changes when we get SfxHintId::DocChange...
Definition: redlndlg.cxx:1251
std::vector< std::unique_ptr< SwRedlineDataParent > > m_RedlineParents
Definition: redlndlg.hxx:60
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2599
sal_uInt16 GetStackCount() const
Definition: docredln.cxx:1705
OUString const m_sDeleted
Definition: redlndlg.hxx:65
SvxTPView * m_pTPView
Definition: redlndlg.hxx:79
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1746
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(SvxContourDlgChildWindow, SID_CONTOUR_DLG)
void SetInSelect()
Definition: wrtsh.hxx:139
bool AcceptRedline(SwRedlineTable::size_type nPos)
Definition: edredln.cxx:66
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
OUString m_sFilterAction
Definition: redlndlg.hxx:69
bool IsAutoFormat() const
Definition: redline.hxx:201
#define SW_MOD()
Definition: swmodule.hxx:256
SAL_DLLPRIVATE SwRedlineTable::size_type GetRedlinePos(const weld::TreeIter &rEntry)
Definition: redlndlg.cxx:872
SAL_DLLPRIVATE void InitAuthors()
Definition: redlndlg.cxx:234
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
std::unique_ptr< SwRedlineAcceptDlg > mpImplDlg
Definition: redlndlg.hxx:153
bool SetRedlineComment(const OUString &rS)
Set comment to Redline at position.
Definition: edredln.cxx:107
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:228
std::unique_ptr< weld::TreeIter > xTLBChild
Definition: redlndlg.hxx:39
OUString Apply(const OUString &rStr) const
Definition: SwRewriter.cxx:43
void Initialize(SfxChildWinInfo *pInfo)
Definition: redlndlg.cxx:124
SwRedlineTable::size_type GetRedlineCount() const
Definition: edredln.cxx:47
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2205
virtual void freeze()=0
int i
void EnableClearFormatAll(bool bFlag)
vector_type::size_type size_type
Definition: docary.hxx:330
SwRedlineAcceptDlg(SwRedlineAcceptDlg const &)=delete
SwRedlineTable::size_type FindRedlineOfData(const SwRedlineData &) const
Search Redline for this Data and.
Definition: edredln.cxx:143
static SAL_DLLPRIVATE OUString GetActionImage(const SwRangeRedline &rRedln, sal_uInt16 nStack=0)
Definition: redlndlg.cxx:303
const SwRedlineDataChild * pNext
Definition: redlndlg.hxx:45
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:222
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
const DateTime & GetTimeStamp() const
Definition: redline.hxx:129
const SwRedlineData * pChild
Definition: redlndlg.hxx:37
OUString GetSelectedAuthor() const
virtual void set_active(int pos)=0
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
SvxRedlinTable * m_pTable
Definition: redlndlg.hxx:80
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
virtual ~SwRedlineAcceptPanel() override
Definition: redlndlg.cxx:1240
virtual void expand_row(const TreeIter &rIter)=0
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetOldDocShell(SwDocShell *pDcSh)
Definition: chldwrap.hxx:42
std::unique_ptr< weld::Container > m_xContentArea
Definition: redlndlg.hxx:124
std::unique_ptr< SwRedlineAcceptDlg > m_xImplDlg
Definition: redlndlg.hxx:125
void DisableUndo()
SwDocShell * GetDocShell()
Definition: view.cxx:1128
SAL_DLLPRIVATE void InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd=SwRedlineTable::npos)
Definition: redlndlg.cxx:687
IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptHdl, SvxTPView *, void)
Definition: redlndlg.cxx:880
virtual void remove(int pos)=0
void StartAction()
Definition: crsrsh.cxx:211
int get_checkbox_column_width() const
OUString const m_sAutoFormat
Definition: redlndlg.hxx:70
const OUString & GetComment(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1733
bool IsValidEntry(const OUString &rAuthor, const DateTime &rDateTime, const OUString &rComment)
void EnableUndo(bool bFlag=true)
virtual void dispose() override
#define HID_REDLINE_CTRL
Definition: helpids.h:60
const SwRangeRedline * GetCurrRedline() const
Definition: edredln.cxx:118
bool bDisabled
virtual void select(int pos)=0
void SetUndoClickHdl(const Link< SvxTPView *, void > &rLink)
virtual void Activate() override
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:401
void CallAcceptReject(bool bSelect, bool bAccept)
Definition: redlndlg.cxx:765
void EnableReject(bool bFlag)
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2498
virtual int get_sort_column() const =0
SwChildWinWrapper * pChildWin
Definition: redlndlg.hxx:126
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_Int32 SelectAuthor(const OUString &aString)
SwModelessRedlineAcceptDlg(SfxBindings *, SwChildWinWrapper *, weld::Window *pParent)
Definition: redlndlg.cxx:82
virtual bool get_selected(TreeIter *pIter) const =0
bool IsAction() const
weld::TreeView & GetWidget()
bool RejectRedline(SwRedlineTable::size_type nPos)
Definition: edredln.cxx:77
void EnableAccept(bool bFlag)
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:898
void ResetModified()
Definition: edws.cxx:74
virtual bool ReInitDlg(SwDocShell *pDocSh) override
Definition: redlndlg.cxx:73
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
RET_OK
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1728
virtual void set_cursor(int pos)=0
void SetInvokeHandler(const Link< Timer *, void > &rLink)
SvxRedlinTable * GetTableControl()
virtual void set_selection_mode(SelectionMode eMode)=0
SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline &rRedln, bool bHasRedlineAutoFormat)
Definition: redlndlg.cxx:514
virtual void set_image(int row, const OUString &rImage, int col=-1)=0
bool m_bOnlyFormatedRedlines
Definition: redlndlg.hxx:71
const SwRedlineData * pData
Definition: redlndlg.hxx:44
void Initialize(OUString &rExtraData)
Definition: redlndlg.cxx:1155
SAL_DLLPRIVATE void RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd)
Definition: redlndlg.cxx:611
void append_text(const OUString &rStr)
const SwRedlineDataChild * pNext
Definition: redlndlg.hxx:38
virtual void FillInfo(SfxChildWinInfo &) const override
Definition: redlndlg.cxx:132
virtual bool ReInitDlg(SwDocShell *pDocSh)
Definition: fldwrap.cxx:53
std::pair< const_iterator, bool > insert(Value &&x)
SwRedlineDataParentSortArr m_aUsedSeqNo
Definition: redlndlg.hxx:62
void EnterAddMode()
Definition: select.cxx:630
#define FN_REDLINE_SHOW
Definition: cmdid.h:121
OUString const m_sTableChgd
Definition: redlndlg.hxx:67
sal_Int32 nPos
void InsertAuthor(const OUString &rString)
static constexpr size_type npos
Definition: docary.hxx:331
virtual void connect_popup_menu(const Link< const CommandEvent &, bool > &rLink)
void Init(SwRedlineTable::size_type nStart=0)
Definition: redlndlg.cxx:207
#define FN_REDLINE_ACCEPT
Definition: cmdid.h:129
aStr
void EnableAcceptAll(bool bFlag)
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: view.hxx:146
size_type erase(const Value &x)
OUString const m_sInserted
Definition: redlndlg.hxx:64
virtual OUString get_active_text() const =0
virtual int iter_compare(const TreeIter &a, const TreeIter &b) const =0
virtual int get_iter_depth(const TreeIter &rIter) const =0
OUString sId