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