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 <osl/diagnose.h>
49 #include <bitmaps.hlst>
50 
51 #include <docsh.hxx>
52 
54 #include <usrpref.hxx>
55 #include <memory>
56 
58 
60  sal_uInt16 nId,
61  SfxBindings* pBindings,
62  SfxChildWinInfo* pInfo)
63  : SwChildWinWrapper(_pParent, nId)
64 {
65  auto xDlg = std::make_shared<SwModelessRedlineAcceptDlg>(pBindings, this, _pParent->GetFrameWeld());
66  SetController(xDlg);
67  xDlg->Initialize(pInfo);
68 }
69 
70 // newly initialise dialog after document switch
72 {
73  bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
74  if (bRet) // update immediately, doc switch!
75  static_cast<SwModelessRedlineAcceptDlg*>(GetController().get())->Activate();
76 
77  return bRet;
78 }
79 
81  SfxBindings* _pBindings, SwChildWinWrapper* pChild, weld::Window *pParent)
82  : SfxModelessDialogController(_pBindings, pChild, pParent,
83  "svx/ui/acceptrejectchangesdialog.ui", "AcceptRejectChangesDialog")
84  , m_xContentArea(m_xDialog->weld_content_area())
85  , m_pChildWin(pChild)
86 {
87  m_xImplDlg.reset(new SwRedlineAcceptDlg(m_xDialog, m_xBuilder.get(), m_xContentArea.get()));
88 }
89 
91 {
92  SwView *pView = ::GetActiveView();
93  if (!pView) // can happen when switching to another app, when a Listbox in dialog
94  return; // had the focus previously (actually THs Bug)
95 
96  SwDocShell *pDocSh = pView->GetDocShell();
97 
98  if (m_pChildWin->GetOldDocShell() != pDocSh)
99  { // doc-switch
100  SwWait aWait( *pDocSh, false );
101  SwWrtShell* pSh = pView->GetWrtShellPtr();
102 
103  m_pChildWin->SetOldDocShell(pDocSh); // avoid recursion (using modified-Hdl)
104 
105  bool bMod = pSh->IsModified();
106  SfxBoolItem aShow(FN_REDLINE_SHOW, true);
108  FN_REDLINE_SHOW, SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
109  { &aShow });
110  if (!bMod)
111  pSh->ResetModified();
112  m_xImplDlg->Init();
114 
115  return;
116  }
117 
119  m_xImplDlg->Activate();
120 }
121 
123 {
124  if (pInfo != nullptr)
125  m_xImplDlg->Initialize(pInfo->aExtraString);
126 
128 }
129 
131 {
133  m_xImplDlg->FillInfo(rInfo.aExtraString);
134 }
135 
137 {
138 }
139 
140 SwRedlineAcceptDlg::SwRedlineAcceptDlg(const std::shared_ptr<weld::Window>& rParent, weld::Builder *pBuilder,
141  weld::Container *pContentArea, bool bAutoFormat)
142  : m_xParentDlg(rParent)
143  , m_aSelectTimer("SwRedlineAcceptDlg m_aSelectTimer")
144  , m_sInserted(SwResId(STR_REDLINE_INSERTED))
145  , m_sDeleted(SwResId(STR_REDLINE_DELETED))
146  , m_sFormated(SwResId(STR_REDLINE_FORMATTED))
147  , m_sTableChgd(SwResId(STR_REDLINE_TABLECHG))
148  , m_sFormatCollSet(SwResId(STR_REDLINE_FMTCOLLSET))
149  , m_sAutoFormat(SwResId(STR_REDLINE_AUTOFMT))
150  , m_bOnlyFormatedRedlines(false)
151  , m_bRedlnAutoFormat(bAutoFormat)
152  , m_bInhibitActivate(false)
153  , m_xTabPagesCTRL(new SvxAcceptChgCtr(pContentArea, m_xParentDlg.get(), pBuilder))
154  , m_xPopup(pBuilder->weld_menu("writermenu"))
155  , m_xSortMenu(pBuilder->weld_menu("writersortmenu"))
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_RedlinData.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 
258  if( m_bOnlyFormatedRedlines && RedlineType::Format != rRedln.GetType() )
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) == -1 && !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;
327  case RedlineType::ParagraphFormat: return m_sFormated;
328  case RedlineType::Table: return m_sTableChgd;
329  case RedlineType::FmtColl: return m_sFormatCollSet;
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  i = CalcDiff(i, false);
378  if (i == SwRedlineTable::npos)
379  return;
380  continue;
381  }
382 
383  const SwRedlineData *pRedlineData = rRedln.GetRedlineData().Next();
384  const SwRedlineDataChild *pBackupData = pParent->pNext;
385 
386  if (!pRedlineData && pBackupData)
387  {
388  // Redline-Children were deleted
389  i = CalcDiff(i, true);
390  if (i == SwRedlineTable::npos)
391  return;
392  continue;
393  }
394  else
395  {
396  while (pRedlineData)
397  {
398  if (pRedlineData != pBackupData->pChild)
399  {
400  // Redline-Children were inserted, changed or deleted
401  i = CalcDiff(i, true);
402  if (i == SwRedlineTable::npos)
403  return;
404  continue;
405  }
406  pBackupData = pBackupData->pNext;
407  pRedlineData = pRedlineData->Next();
408  }
409  }
410  }
411 
412  if (nCount != m_RedlineParents.size())
413  {
414  // Redlines were deleted at the end
415  Init(nCount);
416  return;
417  }
418 
419  // check comment
420  weld::TreeView& rTreeView = m_pTable->GetWidget();
421  bool bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin();
422  for (SwRedlineTable::size_type i = 0; i < nCount; i++)
423  {
424  const SwRangeRedline& rRedln = pSh->GetRedline(i);
425  SwRedlineDataParent *const pParent = m_RedlineParents[i].get();
426 
427  if(rRedln.GetComment() != pParent->sComment)
428  {
429  bool bShowDeletedTextAsComment = bIsShowChangesInMargin &&
430  RedlineType::Delete == rRedln.GetType() && rRedln.GetComment().isEmpty();
431  const OUString sComment = bShowDeletedTextAsComment
432  ? const_cast<SwRangeRedline&>(rRedln).GetDescr()
433  : rRedln.GetComment();
434  if (pParent->xTLBParent)
435  {
436  // update only comment
437  rTreeView.set_text(*pParent->xTLBParent, sComment.replace('\n', ' '), 3);
438  }
439  pParent->sComment = sComment;
440  }
441  }
442 
443  InitAuthors();
444 }
445 
447 {
448  if (!nStart)
449  {
450  Init();
451  return SwRedlineTable::npos;
452  }
453 
454  weld::TreeView& rTreeView = m_pTable->GetWidget();
455  rTreeView.freeze();
456  SwView *pView = ::GetActiveView();
457  SwWrtShell* pSh = pView->GetWrtShellPtr();
458  bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
459  SwRedlineDataParent *const pParent = m_RedlineParents[nStart].get();
460  const SwRangeRedline& rRedln = pSh->GetRedline(nStart);
461 
462  if (bChild) // should actually never happen, but just in case...
463  {
464  // throw away all entry's children and initialise newly
465  SwRedlineDataChild* pBackupData = const_cast<SwRedlineDataChild*>(pParent->pNext);
466  SwRedlineDataChild* pNext;
467 
468  while (pBackupData)
469  {
470  pNext = const_cast<SwRedlineDataChild*>(pBackupData->pNext);
471  if (pBackupData->xTLBChild)
472  rTreeView.remove(*pBackupData->xTLBChild);
473 
474  auto it = std::find_if(m_RedlineChildren.begin(), m_RedlineChildren.end(),
475  [&pBackupData](const std::unique_ptr<SwRedlineDataChild>& rChildPtr) { return rChildPtr.get() == pBackupData; });
476  if (it != m_RedlineChildren.end())
477  m_RedlineChildren.erase(it);
478 
479  pBackupData = pNext;
480  }
481  pParent->pNext = nullptr;
482 
483  // insert new children
484  InsertChildren(pParent, rRedln, bHasRedlineAutoFormat);
485 
486  rTreeView.thaw();
487  return nStart;
488  }
489 
490  // have entries been deleted?
491  const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
492  for (SwRedlineTable::size_type i = nStart + 1; i < m_RedlineParents.size(); i++)
493  {
494  if (m_RedlineParents[i]->pData == pRedlineData)
495  {
496  // remove entries from nStart to i-1
497  RemoveParents(nStart, i - 1);
498  rTreeView.thaw();
499  return nStart - 1;
500  }
501  }
502 
503  // entries been inserted?
505  pRedlineData = m_RedlineParents[nStart]->pData;
506 
507  for (SwRedlineTable::size_type i = nStart + 1; i < nCount; i++)
508  {
509  if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData)
510  {
511  // insert entries from nStart to i-1
512  InsertParents(nStart, i - 1);
513  rTreeView.thaw();
514  return nStart - 1;
515  }
516  }
517 
518  rTreeView.thaw();
519  Init(nStart); // adjust all entries until the end
520  return SwRedlineTable::npos;
521 }
522 
523 void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, bool bHasRedlineAutoFormat)
524 {
525  SwRedlineDataChild *pLastRedlineChild = nullptr;
526  const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
527  bool bAutoFormatRedline = rRedln.IsAutoFormat();
528 
529  weld::TreeView& rTreeView = m_pTable->GetWidget();
530 
531  OUString sAction = GetActionText(rRedln);
532  bool bValidParent = m_sFilterAction.isEmpty() || m_sFilterAction == sAction;
533  bValidParent = bValidParent && m_pTable->IsValidEntry(rRedln.GetAuthorString(), rRedln.GetTimeStamp(), rRedln.GetComment());
534  if (bHasRedlineAutoFormat)
535  {
536 
537  if (pParent->pData->GetSeqNo())
538  {
539  std::pair<SwRedlineDataParentSortArr::const_iterator,bool> const ret
540  = m_aUsedSeqNo.insert(pParent);
541  if (ret.second) // already there
542  {
543  if (pParent->xTLBParent)
544  {
545  rTreeView.set_text(*(*ret.first)->xTLBParent, m_sAutoFormat, 0);
546  rTreeView.remove(*pParent->xTLBParent);
547  pParent->xTLBParent.reset();
548  }
549  return;
550  }
551  }
552  bValidParent = bValidParent && bAutoFormatRedline;
553  }
554  bool bValidTree = bValidParent;
555 
556  for (sal_uInt16 nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
557  {
558  pRedlineData = pRedlineData->Next();
559 
560  SwRedlineDataChild* pRedlineChild = new SwRedlineDataChild;
561  pRedlineChild->pChild = pRedlineData;
562  m_RedlineChildren.push_back(std::unique_ptr<SwRedlineDataChild>(pRedlineChild));
563 
564  if ( pLastRedlineChild )
565  pLastRedlineChild->pNext = pRedlineChild;
566  else
567  pParent->pNext = pRedlineChild;
568 
569  sAction = GetActionText(rRedln, nStack);
570  bool bValidChild = m_sFilterAction.isEmpty() || m_sFilterAction == sAction;
571  bValidChild = bValidChild && m_pTable->IsValidEntry(rRedln.GetAuthorString(nStack), rRedln.GetTimeStamp(nStack), rRedln.GetComment());
572  if (bHasRedlineAutoFormat)
573  bValidChild = bValidChild && bAutoFormatRedline;
574  bValidTree |= bValidChild;
575 
576  if (bValidChild)
577  {
578  std::unique_ptr<RedlinData> pData(new RedlinData);
579  pData->pData = pRedlineChild;
580  pData->bDisabled = true;
581 
582  OUString sImage(GetActionImage(rRedln, nStack));
583  OUString sAuthor = rRedln.GetAuthorString(nStack);
584  pData->aDateTime = rRedln.GetTimeStamp(nStack);
585  pData->eType = rRedln.GetType(nStack);
586  OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
587  OUString sComment = rRedln.GetComment(nStack);
588 
589  std::unique_ptr<weld::TreeIter> xChild(rTreeView.make_iterator());
590  OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pData.get())));
591  rTreeView.insert(pParent->xTLBParent.get(), -1, nullptr, &sId, nullptr, nullptr,
592  false, xChild.get());
593  m_RedlinData.push_back(std::move(pData));
594 
595  rTreeView.set_image(*xChild, sImage, -1);
596  rTreeView.set_text(*xChild, sAuthor, 1);
597  rTreeView.set_text(*xChild, sDateEntry, 2);
598  rTreeView.set_text(*xChild, sComment, 3);
599 
600  pRedlineChild->xTLBChild = std::move(xChild);
601  if (!bValidParent)
602  rTreeView.expand_row(*pParent->xTLBParent);
603  }
604  else
605  pRedlineChild->xTLBChild.reset();
606 
607  pLastRedlineChild = pRedlineChild;
608  }
609 
610  if (pLastRedlineChild)
611  pLastRedlineChild->pNext = nullptr;
612 
613  if (!bValidTree && pParent->xTLBParent)
614  {
615  rTreeView.remove(*pParent->xTLBParent);
616  pParent->xTLBParent.reset();
617  if (bHasRedlineAutoFormat)
618  m_aUsedSeqNo.erase(pParent);
619  }
620 }
621 
623 {
626 
627  std::vector<const weld::TreeIter*> aLBoxArr;
628 
629  weld::TreeView& rTreeView = m_pTable->GetWidget();
630 
631  // because of Bug of TLB that ALWAYS calls the SelectHandler at Remove:
633 
634  bool bChildrenRemoved = false;
635  rTreeView.thaw();
636  rTreeView.unselect_all();
637 
638  // set the cursor after the last entry because otherwise performance problem in TLB.
639  // TLB would otherwise reset the cursor at every Remove (expensive)
641  weld::TreeIter *pCurEntry = nullptr;
642  while( ( pCurEntry == nullptr ) && ( nPos > 0 ) )
643  {
644  --nPos;
645  pCurEntry = m_RedlineParents[nPos]->xTLBParent.get();
646  }
647 
648  if (pCurEntry)
649  rTreeView.set_cursor(*pCurEntry);
650 
651  rTreeView.freeze();
652 
653  for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++)
654  {
655  if (!bChildrenRemoved && m_RedlineParents[i]->pNext)
656  {
657  SwRedlineDataChild * pChildPtr =
658  const_cast<SwRedlineDataChild*>(m_RedlineParents[i]->pNext);
659  auto it = std::find_if(m_RedlineChildren.begin(), m_RedlineChildren.end(),
660  [&pChildPtr](const std::unique_ptr<SwRedlineDataChild>& rChildPtr) { return rChildPtr.get() == pChildPtr; });
661  if (it != m_RedlineChildren.end())
662  {
663  sal_uInt16 nChildren = 0;
664  while (pChildPtr)
665  {
666  pChildPtr = const_cast<SwRedlineDataChild*>(pChildPtr->pNext);
667  nChildren++;
668  }
669 
670  m_RedlineChildren.erase(it, it + nChildren);
671  bChildrenRemoved = true;
672  }
673  }
674  weld::TreeIter *const pEntry = m_RedlineParents[i]->xTLBParent.get();
675  if (pEntry)
676  aLBoxArr.push_back(pEntry);
677  }
678 
679  std::sort(aLBoxArr.begin(), aLBoxArr.end(), [&rTreeView](const weld::TreeIter* a, const weld::TreeIter* b) {
680  return rTreeView.iter_compare(*a, *b) == -1;
681  });
682  // clear TLB from behind
683  for (auto it = aLBoxArr.rbegin(); it != aLBoxArr.rend(); ++it)
684  {
685  const weld::TreeIter* pIter = *it;
686  rTreeView.remove(*pIter);
687  }
688 
689  rTreeView.thaw();
690  rTreeView.connect_changed(LINK(this, SwRedlineAcceptDlg, SelectHdl));
691  // unfortunately by Remove it was selected from the TLB always again ...
692  rTreeView.unselect_all();
693  rTreeView.freeze();
694 
695  m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.begin() + nEnd + 1);
696 }
697 
699 {
700  SwView *pView = ::GetActiveView();
701  SwWrtShell* pSh = pView->GetWrtShellPtr();
702  bool bHasRedlineAutoFormat = HasRedlineAutoFormat();
703 
705  nEnd = std::min(nEnd, (nCount - 1)); // also treats nEnd=SwRedlineTable::npos (until the end)
706 
707  if (nEnd == SwRedlineTable::npos)
708  return; // no redlines in the document
709 
710  weld::TreeView& rTreeView = m_pTable->GetWidget();
711 
712  SwRedlineDataParent* pRedlineParent;
713  const SwRangeRedline* pCurrRedline;
714  if (!nStart && !rTreeView.get_selected(nullptr))
715  {
716  pCurrRedline = pSh->GetCurrRedline();
717  if( !pCurrRedline )
718  {
719  pSh->SwCursorShell::Push();
720  pCurrRedline = pSh->SelNextRedline();
721  if( nullptr == pCurrRedline )
722  pCurrRedline = pSh->SelPrevRedline();
723  pSh->SwCursorShell::Pop(SwCursorShell::PopMode::DeleteCurrent);
724  }
725  }
726  else
727  pCurrRedline = nullptr;
728 
729  rTreeView.freeze();
730  if (m_pTable->IsSorted())
731  rTreeView.make_unsorted();
732 
733  bool bIsShowChangesInMargin = SW_MOD()->GetUsrPref(false)->IsShowChangesInMargin();
734  for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++)
735  {
736  const SwRangeRedline& rRedln = pSh->GetRedline(i);
737  const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
738 
739  pRedlineParent = new SwRedlineDataParent;
740  pRedlineParent->pData = pRedlineData;
741  pRedlineParent->pNext = nullptr;
742 
743  bool bShowDeletedTextAsComment = bIsShowChangesInMargin &&
744  RedlineType::Delete == rRedln.GetType() && rRedln.GetComment().isEmpty();
745  const OUString& sComment = bShowDeletedTextAsComment
746  ? const_cast<SwRangeRedline&>(rRedln).GetDescr()
747  : rRedln.GetComment();
748  pRedlineParent->sComment = sComment.replace('\n', ' ');
749  m_RedlineParents.insert(m_RedlineParents.begin() + i,
750  std::unique_ptr<SwRedlineDataParent>(pRedlineParent));
751 
752  std::unique_ptr<RedlinData> pData(new RedlinData);
753  pData->pData = pRedlineParent;
754  pData->bDisabled = false;
755 
756  OUString sImage = GetActionImage(rRedln);
757  OUString sAuthor = rRedln.GetAuthorString(0);
758  pData->aDateTime = rRedln.GetTimeStamp(0);
759  pData->eType = rRedln.GetType(0);
760  OUString sDateEntry = GetAppLangDateTimeString(pData->aDateTime);
761 
762  OUString sId = OUString::number(reinterpret_cast<sal_Int64>(pData.get()));
763  std::unique_ptr<weld::TreeIter> xParent(rTreeView.make_iterator());
764  rTreeView.insert(nullptr, i, nullptr, &sId, nullptr, nullptr, false, xParent.get());
765  m_RedlinData.push_back(std::move(pData));
766 
767  rTreeView.set_image(*xParent, sImage, -1);
768  rTreeView.set_text(*xParent, sAuthor, 1);
769  rTreeView.set_text(*xParent, sDateEntry, 2);
770  rTreeView.set_text(*xParent, sComment, 3);
771 
772  if (pCurrRedline == &rRedln)
773  {
774  rTreeView.thaw();
775  rTreeView.set_cursor(*xParent);
776  rTreeView.select(*xParent);
777  rTreeView.scroll_to_row(*xParent);
778  rTreeView.freeze();
779  }
780 
781  pRedlineParent->xTLBParent = std::move(xParent);
782 
783  InsertChildren(pRedlineParent, rRedln, bHasRedlineAutoFormat);
784  }
785  rTreeView.thaw();
786  if (m_pTable->IsSorted())
787  rTreeView.make_sorted();
788 }
789 
790 void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
791 {
793  int nPos = -1;
794 
795  typedef std::vector<std::unique_ptr<weld::TreeIter>> ListBoxEntries_t;
796  ListBoxEntries_t aRedlines;
797 
798  // don't activate
799  OSL_ENSURE( !m_bInhibitActivate,
800  "recursive call of CallAcceptReject?");
801  m_bInhibitActivate = true;
802 
803  weld::TreeView& rTreeView = m_pTable->GetWidget();
804 
805  auto lambda = [this, pSh, bSelect, bAccept, &rTreeView, &nPos, &aRedlines](weld::TreeIter& rEntry) {
806  if (!rTreeView.get_iter_depth(rEntry))
807  {
808  if (bSelect && nPos == -1)
809  nPos = rTreeView.get_iter_index_in_parent(rEntry);
810 
811  RedlinData *pData = reinterpret_cast<RedlinData*>(rTreeView.get_id(rEntry).toInt64());
812 
813  bool bIsNotFormatted = true;
814 
815  // first remove only changes with insertion/deletion, if they exist
816  // (format-only changes haven't had real rejection yet, only an
817  // approximation: clear direct formatting, so try to warn
818  // with the extended button label "Reject All/Clear formatting")
819  if ( !bSelect && !bAccept && !m_bOnlyFormatedRedlines )
820  {
821  SwRedlineTable::size_type nPosition = GetRedlinePos(rEntry);
822  const SwRangeRedline& rRedln = pSh->GetRedline(nPosition);
823 
824  if( RedlineType::Format == rRedln.GetType() )
825  bIsNotFormatted = false;
826  }
827 
828  if (!pData->bDisabled && bIsNotFormatted)
829  aRedlines.emplace_back(rTreeView.make_iterator(&rEntry));
830  }
831  return false;
832  };
833 
834  // collect redlines-to-be-accepted/rejected in aRedlines vector
835  if (bSelect)
836  rTreeView.selected_foreach(lambda);
837  else
838  rTreeView.all_foreach(lambda);
839 
841  if( !bAccept )
842  FnAccRej = &SwEditShell::RejectRedline;
843 
844  SwWait aWait( *pSh->GetView().GetDocShell(), true );
845  pSh->StartAction();
846 
847  if (aRedlines.size() > 1)
848  {
849  OUString aTmpStr;
850  {
851  SwRewriter aRewriter;
852  aRewriter.AddRule(UndoArg1,
853  OUString::number(aRedlines.size()));
854  aTmpStr = aRewriter.Apply(SwResId(STR_N_REDLINES));
855  }
856 
857  SwRewriter aRewriter;
858  aRewriter.AddRule(UndoArg1, aTmpStr);
859 
861  &aRewriter);
862  }
863 
864  // accept/reject the redlines in aRedlines. The absolute
865  // position may change during the process (e.g. when two redlines
866  // are merged in result of another one being deleted), so the
867  // position must be resolved late and checked before using it.
868  // (cf #102547#)
869  for (const auto& rRedLine : aRedlines)
870  {
871  SwRedlineTable::size_type nPosition = GetRedlinePos( *rRedLine );
872  if( nPosition != SwRedlineTable::npos )
873  (pSh->*FnAccRej)( nPosition );
874  }
875 
876  if (aRedlines.size() > 1)
877  {
878  pSh->EndUndo();
879  }
880 
881  pSh->EndAction();
882 
883  m_bInhibitActivate = false;
884  Activate();
885 
886  if (nPos != -1 && rTreeView.n_children())
887  {
888  if (nPos >= rTreeView.n_children())
889  nPos = rTreeView.n_children() - 1;
890  rTreeView.select(nPos);
891  rTreeView.scroll_to_row(nPos);
892  rTreeView.set_cursor(nPos);
893  SelectHdl(rTreeView);
894  }
896 }
897 
899 {
901  weld::TreeView& rTreeView = m_pTable->GetWidget();
902  return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(reinterpret_cast<RedlinData*>(
903  rTreeView.get_id(rEntry).toInt64())->pData)->pData );
904 }
905 
907 {
908  CallAcceptReject( true, true );
909 }
910 
912 {
913  CallAcceptReject( false, true );
914 }
915 
917 {
918  CallAcceptReject( true, false );
919 }
920 
922 {
923  CallAcceptReject( false, false );
924 }
925 
927 {
928  SwView * pView = ::GetActiveView();
929  pView->GetViewFrame()->GetDispatcher()->
930  Execute(SID_UNDO, SfxCallMode::SYNCHRON);
931  m_pTPView->EnableUndo(pView->GetSlotState(SID_UNDO) != nullptr);
932 
933  Activate();
934 }
935 
937 {
938  SvxTPFilter *pFilterTP = m_xTabPagesCTRL->GetFilterPage();
939 
940  if (pFilterTP->IsAction())
941  m_sFilterAction = pFilterTP->GetLbAction()->get_active_text();
942  else
943  m_sFilterAction.clear();
944 
945  Init();
946 }
947 
949 {
950  m_aSelectTimer.Start();
951 }
952 
954 {
956  m_aSelectTimer.Stop();
957 
958  bool bIsNotFormated = false;
959  bool bSel = false;
960 
961  //#98883# don't select redlines while the dialog is not focused
962  //#107938# But not only ask pTable if it has the focus. To move
963  // the selection to the selected redline any child of pParentDlg
964  // may the focus.
965  if (!m_xParentDlg || m_xParentDlg->has_toplevel_focus())
966  {
967  weld::TreeView& rTreeView = m_pTable->GetWidget();
968  std::unique_ptr<weld::TreeIter> xActEntry(rTreeView.make_iterator());
969  if (rTreeView.get_selected(xActEntry.get()))
970  {
971  pSh->StartAction();
972  pSh->EnterStdMode();
973  SwViewShell::SetCareDialog(m_xParentDlg);
974 
975  rTreeView.selected_foreach([this, pSh, &rTreeView, &xActEntry, &bIsNotFormated, &bSel](weld::TreeIter& rEntry){
976  rTreeView.copy_iterator(rEntry, *xActEntry);
977  if (rTreeView.get_iter_depth(rEntry))
978  {
979  rTreeView.iter_parent(*xActEntry);
980  if (rTreeView.is_selected(*xActEntry))
981  return false; // don't select twice
982  }
983  else
984  bSel = true;
985 
986  // #98864# find the selected redline (ignore, if the redline is already gone)
987  SwRedlineTable::size_type nPos = GetRedlinePos(*xActEntry);
988  if (nPos != SwRedlineTable::npos)
989  {
990 
991  const SwRangeRedline& rRedln = pSh->GetRedline( nPos );
992  bIsNotFormated |= RedlineType::Format != rRedln.GetType();
993 
994  if (pSh->GotoRedline(nPos, true))
995  {
996  pSh->SetInSelect();
997  pSh->EnterAddMode();
998  }
999  }
1000  return false;
1001  });
1002 
1003  pSh->LeaveAddMode();
1004  pSh->EndAction();
1005  SwViewShell::SetCareDialog(nullptr);
1006  }
1007  }
1008 
1009  bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements();
1010  m_pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ );
1011  m_pTPView->EnableReject( bEnable && bSel /*&& !bReadonlySel*/ );
1012  m_pTPView->EnableClearFormat( bEnable && bSel && !bIsNotFormated /*&& !bReadonlySel*/ );
1013  m_pTPView->EnableRejectAll( bEnable );
1014  m_pTPView->EnableClearFormatAll( bEnable && m_bOnlyFormatedRedlines );
1015 }
1016 
1017 IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
1018 {
1019  if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
1020  return false;
1021 
1023  const SwRangeRedline *pRed = nullptr;
1024 
1025  weld::TreeView& rTreeView = m_pTable->GetWidget();
1026  std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
1027  bool bEntry = rTreeView.get_selected(xEntry.get());
1028  if (bEntry)
1029  {
1030  std::unique_ptr<weld::TreeIter> xTopEntry(rTreeView.make_iterator(xEntry.get()));
1031 
1032  if (rTreeView.get_iter_depth(*xTopEntry))
1033  rTreeView.iter_parent(*xTopEntry);
1034 
1035  SwRedlineTable::size_type nPos = GetRedlinePos(*xTopEntry);
1036 
1037  // disable commenting for protected areas
1038  if (nPos != SwRedlineTable::npos && (pRed = pSh->GotoRedline(nPos, true)) != nullptr)
1039  {
1040  if( pSh->IsCursorPtAtEnd() )
1041  pSh->SwapPam();
1042  pSh->SetInSelect();
1043  }
1044  }
1045 
1046  m_xPopup->set_sensitive("writeredit", bEntry && pRed &&
1047  !rTreeView.get_iter_depth(*xEntry) &&
1048  rTreeView.count_selected_rows() == 1);
1049  m_xPopup->set_sensitive("writersort", rTreeView.n_children() != 0);
1050  int nColumn = rTreeView.get_sort_column();
1051  if (nColumn == -1)
1052  nColumn = 4;
1053  for (sal_Int32 i = 0; i < 5; ++i)
1054  m_xSortMenu->set_active("writersort" + OString::number(i), i == nColumn);
1055 
1056  OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
1057 
1058  if (sCommand == "writeredit")
1059  {
1060  if (bEntry)
1061  {
1062  if (rTreeView.get_iter_depth(*xEntry))
1063  rTreeView.iter_parent(*xEntry);
1064 
1065  SwRedlineTable::size_type nPos = GetRedlinePos(*xEntry);
1066 
1067  if (nPos == SwRedlineTable::npos)
1068  return true;
1069 
1070  const SwRangeRedline &rRedline = pSh->GetRedline(nPos);
1071 
1072  /* enable again once we have redline comments in the margin
1073  sComment = rRedline.GetComment();
1074  if ( !sComment.Len() )
1075  GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED));
1076  const_cast<SwRangeRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS));
1077  */
1078 
1079  OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd());
1081  ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
1082  SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() );
1083 
1084  aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
1085  aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
1086 
1088  rRedline.GetRedlineData().GetTimeStamp() ),
1089  SID_ATTR_POSTIT_DATE ));
1090 
1091  ScopedVclPtr<AbstractSvxPostItDialog> pDlg(pFact->CreateSvxPostItDialog(&rTreeView, aSet));
1092 
1093  pDlg->HideAuthor();
1094 
1095  TranslateId pResId;
1096  switch( rRedline.GetType() )
1097  {
1098  case RedlineType::Insert:
1099  pResId = STR_REDLINE_INSERTED;
1100  break;
1101  case RedlineType::Delete:
1102  pResId = STR_REDLINE_DELETED;
1103  break;
1104  case RedlineType::Format:
1105  case RedlineType::ParagraphFormat:
1106  pResId = STR_REDLINE_FORMATTED;
1107  break;
1108  case RedlineType::Table:
1109  pResId = STR_REDLINE_TABLECHG;
1110  break;
1111  default:;//prevent warning
1112  }
1113  OUString sTitle(SwResId(STR_REDLINE_COMMENT));
1114  if (pResId)
1115  sTitle += SwResId(pResId);
1116  pDlg->SetText(sTitle);
1117 
1118  SwViewShell::SetCareDialog(pDlg->GetDialog());
1119 
1120  if ( pDlg->Execute() == RET_OK )
1121  {
1122  const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
1123  OUString sMsg(pOutSet->Get(SID_ATTR_POSTIT_TEXT).GetValue());
1124 
1125  // insert / change comment
1126  pSh->SetRedlineComment(sMsg);
1127  rTreeView.set_text(*xEntry, sMsg.replace('\n', ' '), 3);
1128  Init();
1129  }
1130 
1131  SwViewShell::SetCareDialog(nullptr);
1132  pDlg.disposeAndClear();
1133  }
1134  }
1135  else if (!sCommand.isEmpty())
1136  {
1137  int nSortMode = sCommand.copy(10).toInt32();
1138 
1139  if (nSortMode == 4 && nColumn == 4)
1140  return true; // we already have it
1141  if (nSortMode == 4)
1142  nSortMode = -1; // unsorted / sorted by position
1143 
1144  SwWait aWait( *::GetActiveView()->GetDocShell(), false );
1145  m_pTable->HeaderBarClick(nSortMode);
1146  if (nSortMode == -1)
1147  Init(); // newly fill everything
1148  }
1149  return true;
1150 }
1151 
1152 namespace
1153 {
1154  OUString lcl_StripAcceptChgDat(OUString &rExtraString)
1155  {
1156  OUString aStr;
1157  while(true)
1158  {
1159  sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:");
1160  if (nPos == -1)
1161  break;
1162  // try to read the alignment string "ALIGN:(...)"; if none existing,
1163  // it's an old version
1164  sal_Int32 n1 = rExtraString.indexOf('(', nPos);
1165  if (n1 != -1)
1166  {
1167  sal_Int32 n2 = rExtraString.indexOf(')', n1);
1168  if (n2 != -1)
1169  {
1170  // cut out the alignment string
1171  aStr = rExtraString.copy(nPos, n2 - nPos + 1);
1172  rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, "");
1173  aStr = aStr.copy(n1 - nPos + 1);
1174  }
1175  }
1176  }
1177  return aStr;
1178  }
1179 }
1180 
1181 void SwRedlineAcceptDlg::Initialize(OUString& rExtraString)
1182 {
1183  if (rExtraString.isEmpty())
1184  return;
1185 
1186  OUString aStr = lcl_StripAcceptChgDat(rExtraString);
1187  if (aStr.isEmpty())
1188  return;
1189 
1190  int nCount = aStr.toInt32();
1191  if (nCount <= 2)
1192  return;
1193 
1194  std::vector<int> aEndPos;
1195 
1196  for (int i = 0; i < nCount; ++i)
1197  {
1198  sal_Int32 n1 = aStr.indexOf(';');
1199  aStr = aStr.copy( n1+1 );
1200  aEndPos.push_back(aStr.toInt32());
1201  }
1202 
1203  bool bUseless = false;
1204 
1205  std::vector<int> aWidths;
1206  for (int i = 1; i < nCount; ++i)
1207  {
1208  aWidths.push_back(aEndPos[i] - aEndPos[i - 1]);
1209  if (aWidths.back() <= 0)
1210  bUseless = true;
1211  }
1212 
1213  if (!bUseless)
1214  {
1215  // turn column end points back to column widths, ignoring the small
1216  // value used for the expander column
1217  weld::TreeView& rTreeView = m_pTable->GetWidget();
1218  rTreeView.set_column_fixed_widths(aWidths);
1219  }
1220 }
1221 
1222 void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) const
1223 {
1224  //remove any old one before adding a new one
1225  lcl_StripAcceptChgDat(rExtraData);
1226  rExtraData += "AcceptChgDat:(";
1227 
1228  const int nTabCount = 4;
1229 
1230  rExtraData += OUString::number(nTabCount);
1231  rExtraData += ";";
1232 
1233  weld::TreeView& rTreeView = m_pTable->GetWidget();
1234  std::vector<int> aWidths;
1235  // turn column widths back into column end points for compatibility
1236  // with how they used to be stored, including a small value for the
1237  // expander column
1238  aWidths.push_back(rTreeView.get_checkbox_column_width());
1239  for (int i = 0; i < nTabCount - 1; ++i)
1240  {
1241  int nWidth = rTreeView.get_column_width(i);
1242  assert(nWidth > 0 && "suspicious to get a value like this");
1243  aWidths.push_back(aWidths.back() + nWidth);
1244  }
1245 
1246  for (auto a : aWidths)
1247  {
1248  rExtraData += OUString::number(a);
1249  rExtraData += ";";
1250  }
1251  rExtraData += ")";
1252 }
1253 
1255  : PanelLayout(pParent, "ManageChangesPanel", "modules/swriter/ui/managechangessidebar.ui")
1256  , mxContentArea(m_xBuilder->weld_container("content_area"))
1257 {
1258  mpImplDlg.reset(new SwRedlineAcceptDlg(nullptr, m_xBuilder.get(), mxContentArea.get()));
1259 
1260  mpImplDlg->Init();
1261 
1262  // we want to receive SfxHintId::DocChanged
1263  StartListening(*(SW_MOD()->GetView()->GetDocShell()));
1264 }
1265 
1267 {
1268 }
1269 
1271 {
1272  if (mpImplDlg && rHint.GetId() == SfxHintId::DocChanged)
1273  mpImplDlg->Activate();
1274 }
1275 
1276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
bool IsSorted() const
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
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:33
sal_uInt16 GetSeqNo() const
Definition: redline.hxx:146
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:53
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:1872
std::unique_ptr< SvxAcceptChgCtr > m_xTabPagesCTRL
Definition: redlndlg.hxx:80
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
OUString m_sInserted
Definition: redlndlg.hxx:67
SwView * GetActiveView()
Definition: swmodul1.cxx:116
virtual bool iter_parent(TreeIter &rIter) const =0
void SetWriterView()
virtual void copy_iterator(const TreeIter &rSource, TreeIter &rDest) const =0
std::unique_ptr< ContentProperties > pData
void FillInfo(OUString &rExtraData) const
Definition: redlndlg.cxx:1222
const SwRedlineData * Next() const
Definition: redline.hxx:129
const SwRangeRedline * SelNextRedline()
Definition: crstrvl.cxx:2223
void unselect_all()
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, bool bChildrenOnDemand, TreeIter *pRet)=0
SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline &rRedln, sal_uInt16 nStack=0)
Definition: redlndlg.cxx:320
int n1
SfxDispatcher * GetDispatcher()
static SvxAbstractDialogFactory * Create()
bool IsModified() const
Changes in document?
Definition: edws.cxx:65
virtual void make_unsorted()=0
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
virtual void Activate() override
Definition: redlndlg.cxx:90
std::unique_ptr< weld::TreeIter > xTLBParent
Definition: redlndlg.hxx:47
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
SwDocShell * GetOldDocShell()
Definition: chldwrap.hxx:41
virtual void clear()=0
const SwRangeRedline * GotoRedline(SwRedlineTable::size_type nArrPos, bool bSelect)
Definition: move.cxx:717
void EnterStdMode()
Definition: select.cxx:551
bool HasRedlineAutoFormat() const
Definition: redlndlg.hxx:114
void EnableRejectAll(bool bFlag)
virtual bool is_selected(int pos) const =0
OUString GetAppLangDateTimeString(const DateTime &)
Definition: uitool.cxx:870
void EnableClearFormat(bool bFlag)
SAL_DLLPRIVATE SwRedlineTable::size_type CalcDiff(SwRedlineTable::size_type nStart, bool bChild)
Definition: redlndlg.cxx:446
SfxHintId GetId() const
virtual ~SwModelessRedlineAcceptDlg() override
Definition: redlndlg.cxx:136
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
void ClearAuthors()
void SetRejectClickHdl(const Link< SvxTPView *, void > &rLink)
void SwapPam()
Definition: crsrsh.cxx:975
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:93
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
std::unique_ptr< weld::Container > mxContentArea
Definition: redlndlg.hxx:157
SwChildWinWrapper * m_pChildWin
Definition: redlndlg.hxx:129
std::unique_ptr< weld::Builder > m_xBuilder
void connect_changed(const Link< TreeView &, void > &rLink)
std::vector< std::unique_ptr< SwRedlineDataChild > > m_RedlineChildren
Definition: redlndlg.hxx:61
const SwView & GetView() const
Definition: wrtsh.hxx:431
int n2
OUString m_sAutoFormat
Definition: redlndlg.hxx:73
void LeaveAddMode()
Definition: select.cxx:641
weld::ComboBox * GetLbAction()
const DateTime & GetTimeStamp(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1877
int nCount
virtual int n_children() const =0
OUString m_sTableChgd
Definition: redlndlg.hxx:70
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
OUString m_sFormated
Definition: redlndlg.hxx:69
virtual OUString get_id(int pos) const =0
IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent &, rCEvt, bool)
Definition: redlndlg.cxx:1017
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:1270
std::vector< std::unique_ptr< SwRedlineDataParent > > m_RedlineParents
Definition: redlndlg.hxx:59
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2724
sal_uInt16 GetStackCount() const
Definition: docredln.cxx:1859
SvxTPView * m_pTPView
Definition: redlndlg.hxx:82
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1900
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(SvxContourDlgChildWindow, SID_CONTOUR_DLG)
void SetInSelect()
Definition: wrtsh.hxx:142
bool AcceptRedline(SwRedlineTable::size_type nPos)
Definition: edredln.cxx:67
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:613
OUString m_sFilterAction
Definition: redlndlg.hxx:72
bool IsAutoFormat() const
Definition: redline.hxx:200
#define SW_MOD()
Definition: swmodule.hxx:256
SAL_DLLPRIVATE SwRedlineTable::size_type GetRedlinePos(const weld::TreeIter &rEntry)
Definition: redlndlg.cxx:898
SAL_DLLPRIVATE void InitAuthors()
Definition: redlndlg.cxx:235
int i
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
std::unique_ptr< SwRedlineAcceptDlg > mpImplDlg
Definition: redlndlg.hxx:156
uno_Any a
bool SetRedlineComment(const OUString &rS)
Set comment to Redline at position.
Definition: edredln.cxx:108
std::unique_ptr< weld::TreeIter > xTLBChild
Definition: redlndlg.hxx:40
OUString Apply(const OUString &rStr) const
Definition: SwRewriter.cxx:39
void Initialize(SfxChildWinInfo *pInfo)
Definition: redlndlg.cxx:122
SwRedlineTable::size_type GetRedlineCount() const
Definition: edredln.cxx:48
const SwRangeRedline * SelPrevRedline()
Definition: crstrvl.cxx:2251
virtual void freeze()=0
void EnableClearFormatAll(bool bFlag)
vector_type::size_type size_type
Definition: docary.hxx:223
SwRedlineAcceptDlg(SwRedlineAcceptDlg const &)=delete
SwRedlineTable::size_type FindRedlineOfData(const SwRedlineData &) const
Search Redline for this Data and.
Definition: edredln.cxx:144
static SAL_DLLPRIVATE OUString GetActionImage(const SwRangeRedline &rRedln, sal_uInt16 nStack=0)
Definition: redlndlg.cxx:304
const SwRedlineDataChild * pNext
Definition: redlndlg.hxx:46
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
const DateTime & GetTimeStamp() const
Definition: redline.hxx:128
const SwRedlineData * pChild
Definition: redlndlg.hxx:38
OUString GetSelectedAuthor() const
virtual void set_active(int pos)=0
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
SvxRedlinTable * m_pTable
Definition: redlndlg.hxx:83
virtual ~SwRedlineAcceptPanel() override
Definition: redlndlg.cxx:1266
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:127
std::unique_ptr< SwRedlineAcceptDlg > m_xImplDlg
Definition: redlndlg.hxx:128
void DisableUndo()
SwDocShell * GetDocShell()
Definition: view.cxx:1127
SAL_DLLPRIVATE void InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd=SwRedlineTable::npos)
Definition: redlndlg.cxx:698
IMPL_LINK_NOARG(SwRedlineAcceptDlg, AcceptHdl, SvxTPView *, void)
Definition: redlndlg.cxx:906
virtual void remove(int pos)=0
void StartAction()
Definition: crsrsh.cxx:226
int get_checkbox_column_width() const
const OUString & GetComment(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1887
void EnableUndo(bool bFlag=true)
bool IsValidEntry(std::u16string_view rAuthor, const DateTime &rDateTime, const OUString &rComment)
#define HID_REDLINE_CTRL
Definition: helpids.h:60
const SwRangeRedline * GetCurrRedline() const
Definition: edredln.cxx:119
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool bDisabled
virtual void select(int pos)=0
void SetUndoClickHdl(const Link< SvxTPView *, void > &rLink)
virtual void Activate() override
SwRedlineAcceptPanel(weld::Widget *pParent)
Definition: redlndlg.cxx:1254
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
void CallAcceptReject(bool bSelect, bool bAccept)
Definition: redlndlg.cxx:790
void EnableReject(bool bFlag)
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2606
virtual int get_sort_column() const =0
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:80
virtual bool get_selected(TreeIter *pIter) const =0
bool IsAction() const
weld::TreeView & GetWidget()
bool RejectRedline(SwRedlineTable::size_type nPos)
Definition: edredln.cxx:78
void EnableAccept(bool bFlag)
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:891
void ResetModified()
Definition: edws.cxx:75
virtual bool ReInitDlg(SwDocShell *pDocSh) override
Definition: redlndlg.cxx:71
void SetAcceptAllClickHdl(const Link< SvxTPView *, void > &rLink)
RET_OK
Reference< XExecutableDialog > m_xDialog
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1882
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:523
virtual void set_image(int row, const OUString &rImage, int col=-1)=0
bool m_bOnlyFormatedRedlines
Definition: redlndlg.hxx:74
const SwRedlineData * pData
Definition: redlndlg.hxx:45
void Initialize(OUString &rExtraData)
Definition: redlndlg.cxx:1181
SAL_DLLPRIVATE void RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd)
Definition: redlndlg.cxx:622
OUString m_sDeleted
Definition: redlndlg.hxx:68
void append_text(const OUString &rStr)
OUString m_sFormatCollSet
Definition: redlndlg.hxx:71
const SwRedlineDataChild * pNext
Definition: redlndlg.hxx:39
virtual void FillInfo(SfxChildWinInfo &) const override
Definition: redlndlg.cxx:130
virtual bool ReInitDlg(SwDocShell *pDocSh)
Definition: fldwrap.cxx:46
std::pair< const_iterator, bool > insert(Value &&x)
SwRedlineDataParentSortArr m_aUsedSeqNo
Definition: redlndlg.hxx:65
void EnterAddMode()
Definition: select.cxx:626
#define FN_REDLINE_SHOW
Definition: cmdid.h:122
void InsertAuthor(const OUString &rString)
static constexpr size_type npos
Definition: docary.hxx:224
virtual void connect_popup_menu(const Link< const CommandEvent &, bool > &rLink)
void Init(SwRedlineTable::size_type nStart=0)
Definition: redlndlg.cxx:207
virtual void make_sorted()=0
#define FN_REDLINE_ACCEPT
Definition: cmdid.h:130
aStr
void EnableAcceptAll(bool bFlag)
void SetAcceptClickHdl(const Link< SvxTPView *, void > &rLink)
Definition: view.hxx:144
sal_uInt16 nPos
std::vector< std::unique_ptr< RedlinData > > m_RedlinData
Definition: redlndlg.hxx:64
size_type erase(const Value &x)
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
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
OUString sId
virtual void scroll_to_row(int row)=0