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