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