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