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