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