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