LibreOffice Module sc (master) 1
conflictsdlg.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 <comphelper/string.hxx>
21#include <osl/diagnose.h>
22
23#include <conflictsdlg.hxx>
24#include <o3tl/safeint.hxx>
25#include <strings.hrc>
26#include <scresid.hxx>
27#include <viewdata.hxx>
28#include <dbfunc.hxx>
29#include <chgtrack.hxx>
30
31// struct ScConflictsListEntry
32
34{
35 auto aEnd = maSharedActions.cend();
36 auto aItr = std::find(maSharedActions.cbegin(), aEnd, nSharedAction);
37
38 return aItr != aEnd;
39}
40
42{
43 auto aEnd = maOwnActions.cend();
44 auto aItr = std::find(maOwnActions.cbegin(), aEnd, nOwnAction);
45
46 return aItr != aEnd;
47}
48
49
51{
52 return std::any_of(rConflictsList.begin(), rConflictsList.end(),
53 [nOwnAction](ScConflictsListEntry& rConflict) { return rConflict.HasOwnAction( nOwnAction ); });
54}
55
57{
58 auto aEnd = rConflictsList.end();
59 auto aItr = std::find_if(rConflictsList.begin(), aEnd,
60 [nSharedAction](ScConflictsListEntry& rConflict) { return rConflict.HasSharedAction( nSharedAction ); });
61
62 if (aItr != aEnd)
63 return &(*aItr);
64
65 return nullptr;
66}
67
69{
70 auto aEnd = rConflictsList.end();
71 auto aItr = std::find_if(rConflictsList.begin(), aEnd,
72 [nOwnAction](ScConflictsListEntry& rConflict) { return rConflict.HasOwnAction( nOwnAction ); });
73
74 if (aItr != aEnd)
75 return &(*aItr);
76
77 return nullptr;
78}
79
80void ScConflictsListHelper::Transform_Impl( std::vector<sal_uLong>& rActionList, ScChangeActionMergeMap* pMergeMap )
81{
82 if ( !pMergeMap )
83 {
84 return;
85 }
86
87 for ( auto aItr = rActionList.begin(); aItr != rActionList.end(); )
88 {
89 ScChangeActionMergeMap::iterator aItrMap = pMergeMap->find( *aItr );
90 if ( aItrMap != pMergeMap->end() )
91 {
92 *aItr = aItrMap->second;
93 ++aItr;
94 }
95 else
96 {
97 aItr = rActionList.erase( aItr );
98 OSL_FAIL( "ScConflictsListHelper::Transform_Impl: erased action from conflicts list!" );
99 }
100 }
101}
102
104 ScChangeActionMergeMap* pSharedMap, ScChangeActionMergeMap* pOwnMap )
105{
106 for ( auto& rConflictEntry : rConflictsList )
107 {
108 if ( pSharedMap )
109 {
110 ScConflictsListHelper::Transform_Impl( rConflictEntry.maSharedActions, pSharedMap );
111 }
112
113 if ( pOwnMap )
114 {
115 ScConflictsListHelper::Transform_Impl( rConflictEntry.maOwnActions, pOwnMap );
116 }
117 }
118}
119
120
122 sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList& rConflictsList )
123 :mpTrack( pTrack )
124 ,mnStartShared( nStartShared )
125 ,mnEndShared( nEndShared )
126 ,mnStartOwn( nStartOwn )
127 ,mnEndOwn( nEndOwn )
128 ,mrConflictsList( rConflictsList )
129{
130}
131
133{
134 return pAction1 && pAction2 && pAction1->GetBigRange().Intersects( pAction2->GetBigRange() );
135}
136
138{
139 auto doActionsIntersect = [this, pAction](const sal_uLong& aAction) { return DoActionsIntersect( mpTrack->GetAction( aAction ), pAction ); };
140
141 for ( auto& rConflict : mrConflictsList )
142 {
143 if (std::any_of( rConflict.maSharedActions.cbegin(), rConflict.maSharedActions.cend(), doActionsIntersect ))
144 return &rConflict;
145
146 if (std::any_of( rConflict.maOwnActions.cbegin(), rConflict.maOwnActions.cend(), doActionsIntersect ))
147 return &rConflict;
148 }
149
150 return nullptr;
151}
152
153ScConflictsListEntry& ScConflictsFinder::GetEntry( sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions )
154{
155 // try to get a list entry which already contains the shared action
157 if ( pEntry )
158 {
159 return *pEntry;
160 }
161
162 // try to get a list entry for which the shared action intersects with any
163 // other action of this entry
164 pEntry = GetIntersectingEntry( mpTrack->GetAction( nSharedAction ) );
165 if ( pEntry )
166 {
167 pEntry->maSharedActions.push_back( nSharedAction );
168 return *pEntry;
169 }
170
171 // try to get a list entry for which any of the own actions intersects with
172 // any other action of this entry
173 for ( auto& rOwnAction : rOwnActions )
174 {
175 pEntry = GetIntersectingEntry( mpTrack->GetAction( rOwnAction ) );
176 if ( pEntry )
177 {
178 pEntry->maSharedActions.push_back( nSharedAction );
179 return *pEntry;
180 }
181 }
182
183 // if no entry was found, create a new one
186 aEntry.maSharedActions.push_back( nSharedAction );
187 mrConflictsList.push_back( aEntry );
188 return mrConflictsList.back();
189}
190
192{
193 if ( !mpTrack )
194 {
195 return false;
196 }
197
198 bool bReturn = false;
199 ScChangeAction* pSharedAction = mpTrack->GetAction( mnStartShared );
200 while ( pSharedAction && pSharedAction->GetActionNumber() <= mnEndShared )
201 {
202 std::vector<sal_uLong> aOwnActions;
203 ScChangeAction* pOwnAction = mpTrack->GetAction( mnStartOwn );
204 while ( pOwnAction && pOwnAction->GetActionNumber() <= mnEndOwn )
205 {
206 if ( DoActionsIntersect( pSharedAction, pOwnAction ) )
207 {
208 aOwnActions.push_back( pOwnAction->GetActionNumber() );
209 }
210 pOwnAction = pOwnAction->GetNext();
211 }
212
213 if ( !aOwnActions.empty() )
214 {
215 ScConflictsListEntry& rEntry = GetEntry(pSharedAction->GetActionNumber(), aOwnActions);
216 for ( const auto& aOwnAction : aOwnActions )
217 {
219 {
220 rEntry.maOwnActions.push_back(aOwnAction);
221 }
222 }
223 bReturn = true;
224 }
225
226 pSharedAction = pSharedAction->GetNext();
227 }
228
229 return bReturn;
230}
231
232
234 :mpTrack ( pTrack )
235 ,mrConflictsList ( rConflictsList )
236{
237 OSL_ENSURE( mpTrack, "ScConflictsResolver CTOR: mpTrack is null!" );
238}
239
240void ScConflictsResolver::HandleAction( ScChangeAction* pAction, bool bIsSharedAction,
241 bool bHandleContentAction, bool bHandleNonContentAction )
242{
243 if ( !mpTrack || !pAction )
244 {
245 return;
246 }
247
248 if ( bIsSharedAction )
249 {
251 mrConflictsList, pAction->GetActionNumber() );
252 if ( pConflictEntry )
253 {
254 ScConflictAction eConflictAction = pConflictEntry->meConflictAction;
255 if ( eConflictAction == SC_CONFLICT_ACTION_KEEP_MINE )
256 {
257 if ( pAction->GetType() == SC_CAT_CONTENT )
258 {
259 if ( bHandleContentAction )
260 {
261 mpTrack->Reject( pAction );
262 }
263 }
264 else
265 {
266 if ( bHandleNonContentAction )
267 {
268 mpTrack->Reject( pAction );
269 }
270 }
271 }
272 }
273 }
274 else
275 {
277 mrConflictsList, pAction->GetActionNumber() );
278 if ( pConflictEntry )
279 {
280 ScConflictAction eConflictAction = pConflictEntry->meConflictAction;
281 if ( eConflictAction == SC_CONFLICT_ACTION_KEEP_MINE )
282 {
283 if ( pAction->GetType() == SC_CAT_CONTENT )
284 {
285 if ( bHandleContentAction )
286 {
287 // do nothing
288 //mpTrack->SelectContent( pAction );
289 }
290 }
291 else
292 {
293 if ( bHandleNonContentAction )
294 {
295 // do nothing
296 //mpTrack->Accept( pAction );
297 }
298 }
299 }
300 else if ( eConflictAction == SC_CONFLICT_ACTION_KEEP_OTHER )
301 {
302 if ( pAction->GetType() == SC_CAT_CONTENT )
303 {
304 if ( bHandleContentAction )
305 {
306 mpTrack->Reject( pAction );
307 }
308 }
309 else
310 {
311 if ( bHandleNonContentAction )
312 {
313 mpTrack->Reject( pAction );
314 }
315 }
316 }
317 }
318 }
319}
320
321
322ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList)
323 : GenericDialogController(pParent, "modules/scalc/ui/conflictsdialog.ui", "ConflictsDialog")
324 , maStrUnknownUser ( ScResId( STR_UNKNOWN_USER_CONFLICT ) )
325 , mpViewData ( pViewData )
326 , mpOwnDoc ( nullptr )
327 , mpOwnTrack ( nullptr )
328 , mpSharedDoc ( pSharedDoc )
329 , mpSharedTrack ( nullptr )
330 , mrConflictsList ( rConflictsList )
331 , maSelectionIdle ( "ScConflictsDlg maSelectionIdle" )
332 , mbInSelectHdl ( false )
333 , m_xBtnKeepMine(m_xBuilder->weld_button("keepmine"))
334 , m_xBtnKeepOther(m_xBuilder->weld_button("keepother"))
335 , m_xBtnKeepAllMine(m_xBuilder->weld_button("keepallmine"))
336 , m_xBtnKeepAllOthers(m_xBuilder->weld_button("keepallothers"))
337 , m_xLbConflicts(new SvxRedlinTable(m_xBuilder->weld_tree_view("container"), nullptr))
338{
339 OSL_ENSURE( mpViewData, "ScConflictsDlg CTOR: mpViewData is null!" );
340 mpOwnDoc = ( mpViewData ? &mpViewData->GetDocument() : nullptr );
341 OSL_ENSURE( mpOwnDoc, "ScConflictsDlg CTOR: mpOwnDoc is null!" );
342 mpOwnTrack = ( mpOwnDoc ? mpOwnDoc->GetChangeTrack() : nullptr );
343 OSL_ENSURE( mpOwnTrack, "ScConflictsDlg CTOR: mpOwnTrack is null!" );
344 OSL_ENSURE( mpSharedDoc, "ScConflictsDlg CTOR: mpSharedDoc is null!" );
346 OSL_ENSURE( mpSharedTrack, "ScConflictsDlg CTOR: mpSharedTrack is null!" );
347
348 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
349
350 auto nDigitWidth = rTreeView.get_approximate_digit_width();
351 std::vector<int> aWidths
352 {
353 o3tl::narrowing<int>(nDigitWidth * 60),
354 o3tl::narrowing<int>(nDigitWidth * 20)
355 };
356 rTreeView.set_column_fixed_widths(aWidths);
357
358 rTreeView.set_selection_mode(SelectionMode::Multiple);
359 rTreeView.set_size_request(-1, rTreeView.get_height_rows(16));
360
361 maSelectionIdle.SetInvokeHandler( LINK( this, ScConflictsDlg, UpdateSelectionHdl ) );
362
363 rTreeView.connect_changed(LINK(this, ScConflictsDlg, SelectHandle));
364
365 m_xBtnKeepMine->connect_clicked( LINK( this, ScConflictsDlg, KeepMineHandle ) );
366 m_xBtnKeepOther->connect_clicked( LINK( this, ScConflictsDlg, KeepOtherHandle ) );
367 m_xBtnKeepAllMine->connect_clicked( LINK( this, ScConflictsDlg, KeepAllMineHandle ) );
368 m_xBtnKeepAllOthers->connect_clicked( LINK( this, ScConflictsDlg, KeepAllOthersHandle ) );
369
370 UpdateView();
371
372 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
373 if (rTreeView.get_iter_first(*xEntry))
374 rTreeView.select(*xEntry);
375}
376
378{
379}
380
382{
383 OUString aString;
384 if ( mpOwnTrack )
385 {
386 const ScChangeAction* pAction = mpOwnTrack->GetAction( rConflictEntry.maOwnActions[ 0 ] );
387 if ( pAction && mpOwnDoc )
388 {
389 SCTAB nTab = pAction->GetBigRange().MakeRange( *mpOwnDoc ).aStart.Tab();
390 mpOwnDoc->GetName( nTab, aString );
391 }
392 }
393 return aString;
394}
395
397{
398 OSL_ENSURE( pAction, "ScConflictsDlg::GetActionString(): pAction is null!" );
399 OSL_ENSURE( pDoc, "ScConflictsDlg::GetActionString(): pDoc is null!" );
400 if (!pAction || !pDoc)
401 return;
402
403 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
404 OUString aDesc = pAction->GetDescription(*pDoc, true, false);
405 rTreeView.set_text(rEntry, aDesc, 0);
406
407 OUString aUser = comphelper::string::strip(pAction->GetUser(), ' ');
408 if ( aUser.isEmpty() )
409 {
410 aUser = maStrUnknownUser;
411 }
412 rTreeView.set_text(rEntry, aUser, 1);
413
414 DateTime aDateTime = pAction->GetDateTime();
415 OUString aString = ScGlobal::getLocaleData().getDate( aDateTime ) + " " +
416 ScGlobal::getLocaleData().getTime( aDateTime, false );
417 rTreeView.set_text(rEntry, aString, 2);
418}
419
421{
422 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
423 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
424 bool bSelEntry = rTreeView.get_cursor(xEntry.get());
425 if (!bSelEntry)
426 bSelEntry = rTreeView.get_selected(xEntry.get());
427 if (!bSelEntry)
428 return;
429
430 bool bSelectHandle = rTreeView.is_selected(*xEntry);
431
432 while (rTreeView.get_iter_depth(*xEntry))
433 rTreeView.iter_parent(*xEntry);
434
435 if (bSelectHandle)
436 rTreeView.unselect_all();
437 if (!rTreeView.is_selected(*xEntry))
438 rTreeView.select(*xEntry);
439 if (rTreeView.iter_children(*xEntry))
440 {
441 do
442 {
443 if (!rTreeView.is_selected(*xEntry))
444 rTreeView.select(*xEntry);
445 } while (rTreeView.iter_next_sibling(*xEntry));
446 }
447}
448
450{
451 if (mbInSelectHdl)
452 return;
453
454 mbInSelectHdl = true;
455 HandleListBoxSelection();
456 maSelectionIdle.Start();
457 mbInSelectHdl = false;
458}
459
460IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void)
461{
462 if ( !mpViewData || !mpOwnDoc )
463 {
464 return;
465 }
466
467 ScTabView* pTabView = mpViewData->GetView();
468 pTabView->DoneBlockMode();
469
470 std::vector<const ScChangeAction*> aActions;
471
472 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
473 rTreeView.selected_foreach([&rTreeView, &aActions](weld::TreeIter& rEntry){
474 if (rTreeView.get_iter_depth(rEntry))
475 {
476 RedlinData* pUserData = weld::fromId<RedlinData*>(rTreeView.get_id(rEntry));
477 if (pUserData)
478 {
479 ScChangeAction* pAction = static_cast< ScChangeAction* >( pUserData->pData );
480 if ( pAction && ( pAction->GetType() != SC_CAT_DELETE_TABS ) &&
481 ( pAction->IsClickable() || pAction->IsVisible() ) )
482 {
483 aActions.push_back(pAction);
484 }
485 }
486 }
487 return false;
488 });
489
490 bool bContMark = false;
491 for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
492 {
493 const ScBigRange& rBigRange = aActions[i]->GetBigRange();
494 if (rBigRange.IsValid(*mpOwnDoc))
495 {
496 bool bSetCursor = i == nCount - 1;
497 pTabView->MarkRange(rBigRange.MakeRange( *mpOwnDoc ), bSetCursor, bContMark);
498 bContMark = true;
499 }
500 }
501}
502
504{
505 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
506 RedlinData* pUserData = weld::fromId<RedlinData*>(rTreeView.get_id(rRootEntry));
507 ScConflictsListEntry* pConflictEntry = static_cast< ScConflictsListEntry* >( pUserData ? pUserData->pData : nullptr );
508 if ( pConflictEntry )
509 {
510 pConflictEntry->meConflictAction = eConflictAction;
511 }
512}
513
515{
516 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
517 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
518 if (!rTreeView.get_selected(xEntry.get()))
519 return;
520
521 while (rTreeView.get_iter_depth(*xEntry))
522 rTreeView.iter_parent(*xEntry);
523
524 m_xDialog->set_busy_cursor(true);
526 SetConflictAction(*xEntry, eConflictAction);
527 rTreeView.remove(*xEntry);
528 m_xDialog->set_busy_cursor(false);
529 if (rTreeView.n_children() == 0)
530 m_xDialog->response(RET_OK);
531}
532
534{
535 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
536 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
537 if (!rTreeView.get_iter_first(*xEntry))
538 return;
539
540 while (rTreeView.get_iter_depth(*xEntry))
541 rTreeView.iter_parent(*xEntry);
542
543 m_xDialog->set_busy_cursor(true);
544
546 do
547 {
548 SetConflictAction(*xEntry, eConflictAction);
549 } while (rTreeView.iter_next_sibling(*xEntry));
550
551 rTreeView.freeze();
552 rTreeView.clear();
553 rTreeView.thaw();
554
555 m_xDialog->set_busy_cursor(false);
556
557 m_xDialog->response(RET_OK);
558}
559
561{
562 KeepHandler( true );
563}
564
566{
567 KeepHandler( false );
568}
569
570IMPL_LINK_NOARG(ScConflictsDlg, KeepAllMineHandle, weld::Button&, void)
571{
572 KeepAllHandler( true );
573}
574
575IMPL_LINK_NOARG(ScConflictsDlg, KeepAllOthersHandle, weld::Button&, void)
576{
577 KeepAllHandler( false );
578}
579
581{
582 weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
583 for ( ScConflictsListEntry& rConflictEntry : mrConflictsList )
584 {
585 if (rConflictEntry.meConflictAction == SC_CONFLICT_ACTION_NONE)
586 {
587 std::unique_ptr<RedlinData> pRootUserData(new RedlinData());
588 pRootUserData->pData = static_cast<void*>(&rConflictEntry);
589 OUString sString(GetConflictString(rConflictEntry));
590 OUString sId(weld::toId(pRootUserData.release()));
591 std::unique_ptr<weld::TreeIter> xRootEntry(rTreeView.make_iterator());
592 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
593 rTreeView.insert(nullptr, -1, &sString, &sId, nullptr, nullptr, false, xRootEntry.get());
594
595 for ( const auto& aSharedAction : rConflictEntry.maSharedActions )
596 {
597 ScChangeAction* pAction = mpSharedTrack ? mpSharedTrack->GetAction(aSharedAction) : nullptr;
598 if ( pAction )
599 {
600 // only display shared top content entries
601 if ( pAction->GetType() == SC_CAT_CONTENT )
602 {
603 ScChangeActionContent* pNextContent = dynamic_cast<ScChangeActionContent&>(*pAction).GetNextContent();
604 if ( pNextContent && rConflictEntry.HasSharedAction( pNextContent->GetActionNumber() ) )
605 {
606 continue;
607 }
608 }
609
610 rTreeView.insert(xRootEntry.get(), -1, nullptr, nullptr, nullptr, nullptr, false, xEntry.get());
611 SetActionString(pAction, mpSharedDoc, *xEntry);
612 }
613 }
614
615 for ( const auto& aOwnAction : rConflictEntry.maOwnActions )
616 {
617 ScChangeAction* pAction = mpOwnTrack ? mpOwnTrack->GetAction(aOwnAction) : nullptr;
618 if ( pAction )
619 {
620 // only display own top content entries
621 if ( pAction->GetType() == SC_CAT_CONTENT )
622 {
623 ScChangeActionContent* pNextContent = dynamic_cast<ScChangeActionContent&>(*pAction).GetNextContent();
624 if ( pNextContent && rConflictEntry.HasOwnAction( pNextContent->GetActionNumber() ) )
625 {
626 continue;
627 }
628 }
629
630 std::unique_ptr<RedlinData> pUserData(new RedlinData());
631 pUserData->pData = static_cast< void* >( pAction );
632 OUString aId(weld::toId(pUserData.release()));
633 rTreeView.insert(xRootEntry.get(), -1, nullptr, &aId, nullptr, nullptr, false, xEntry.get());
634 SetActionString(pAction, mpOwnDoc, *xEntry);
635 }
636 }
637
638 rTreeView.expand_row(*xRootEntry);
639 }
640 }
641}
642
643/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ SC_CAT_CONTENT
Definition: chgtrack.hxx:72
OUString getDate(const Date &rDate) const
OUString getTime(const tools::Time &rTime, bool bSec=true, bool b100Sec=false) const
void * pData
SCTAB Tab() const
Definition: address.hxx:283
bool Intersects(const ScBigRange &) const
do two ranges overlap?
Definition: bigrange.hxx:170
bool IsValid(const ScDocument &rDoc) const
Definition: bigrange.hxx:132
ScRange MakeRange(const ScDocument &rDoc) const
Definition: bigrange.hxx:134
ScChangeActionContent * GetNextContent() const
Definition: chgtrack.hxx:697
ScBigRange & GetBigRange()
Definition: chgtrack.hxx:229
sal_uLong GetActionNumber() const
Definition: chgtrack.hxx:317
ScChangeActionType GetType() const
Definition: chgtrack.hxx:315
virtual OUString GetDescription(ScDocument &rDoc, bool bSplitRange=false, bool bWarning=true) const
Definition: chgtrack.cxx:421
ScChangeAction * GetNext() const
Definition: chgtrack.hxx:320
SC_DLLPUBLIC DateTime GetDateTime() const
Definition: chgtrack.cxx:407
const OUString & GetUser() const
Definition: chgtrack.hxx:347
SC_DLLPUBLIC ScChangeAction * GetAction(sal_uLong nAction) const
Definition: chgtrack.cxx:2110
bool Reject(ScChangeAction *, ScChangeActionMap *, bool bRecursion)
Definition: chgtrack.cxx:4139
ScConflictsList & mrConflictsList
std::unique_ptr< SvxRedlinTable > m_xLbConflicts
void SetConflictAction(const weld::TreeIter &rRootEntry, ScConflictAction eConflictAction)
ScConflictsDlg(weld::Window *pParent, ScViewData *pViewData, ScDocument *pSharedDoc, ScConflictsList &rConflictsList)
ScChangeTrack * mpSharedTrack
OUString maStrUnknownUser
std::unique_ptr< weld::Button > m_xBtnKeepAllMine
std::unique_ptr< weld::Button > m_xBtnKeepMine
OUString GetConflictString(const ScConflictsListEntry &rConflictEntry)
ScDocument *const mpSharedDoc
void SetActionString(const ScChangeAction *pAction, ScDocument *pDoc, const weld::TreeIter &rEntry)
void KeepHandler(bool bMine)
void KeepAllHandler(bool bMine)
ScViewData *const mpViewData
void HandleListBoxSelection()
ScDocument * mpOwnDoc
std::unique_ptr< weld::Button > m_xBtnKeepAllOthers
virtual ~ScConflictsDlg() override
ScChangeTrack * mpOwnTrack
std::unique_ptr< weld::Button > m_xBtnKeepOther
ScConflictsList & mrConflictsList
ScChangeTrack * mpTrack
sal_uLong mnStartOwn
ScConflictsListEntry * GetIntersectingEntry(const ScChangeAction *pAction) const
sal_uLong mnStartShared
ScConflictsListEntry & GetEntry(sal_uLong nSharedAction, const std::vector< sal_uLong > &rOwnActions)
sal_uLong mnEndShared
static bool DoActionsIntersect(const ScChangeAction *pAction1, const ScChangeAction *pAction2)
ScConflictsFinder(ScChangeTrack *pTrack, sal_uLong nStartShared, sal_uLong nEndShared, sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList &rConflictsList)
static void TransformConflictsList(ScConflictsList &rConflictsList, ScChangeActionMergeMap *pSharedMap, ScChangeActionMergeMap *pOwnMap)
static void Transform_Impl(std::vector< sal_uLong > &rActionList, ScChangeActionMergeMap *pMergeMap)
static bool HasOwnAction(ScConflictsList &rConflictsList, sal_uLong nOwnAction)
static ScConflictsListEntry * GetSharedActionEntry(ScConflictsList &rConflictsList, sal_uLong nSharedAction)
static ScConflictsListEntry * GetOwnActionEntry(ScConflictsList &rConflictsList, sal_uLong nOwnAction)
ScConflictsList & mrConflictsList
ScChangeTrack * mpTrack
void HandleAction(ScChangeAction *pAction, bool bIsSharedAction, bool bHandleContentAction, bool bHandleNonContentAction)
ScConflictsResolver(ScChangeTrack *pTrack, ScConflictsList &rConflictsList)
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2494
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:204
static SC_DLLPUBLIC const LocaleDataWrapper & getLocaleData()
Definition: global.cxx:1055
ScAddress aStart
Definition: address.hxx:497
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:509
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
void SetInvokeHandler(const Link< Timer *, void > &rLink)
std::shared_ptr< weld::Dialog > m_xDialog
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual bool get_selected(TreeIter *pIter) const=0
virtual void expand_row(const TreeIter &rIter)=0
virtual void set_text(int row, const OUString &rText, int col=-1)=0
virtual int n_children() const=0
void unselect_all()
virtual void set_selection_mode(SelectionMode eMode)=0
virtual void insert(const TreeIter *pParent, int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface, bool bChildrenOnDemand, TreeIter *pRet)=0
virtual void clear()=0
virtual void selected_foreach(const std::function< bool(TreeIter &)> &func)=0
void connect_changed(const Link< TreeView &, void > &rLink)
virtual bool get_iter_first(TreeIter &rIter) const=0
virtual bool is_selected(int pos) const=0
virtual int get_height_rows(int nRows) const=0
virtual void remove(int pos)=0
virtual bool iter_next_sibling(TreeIter &rIter) const=0
virtual void select(int pos)=0
virtual bool iter_parent(TreeIter &rIter) const=0
virtual void set_column_fixed_widths(const std::vector< int > &rWidths)=0
virtual bool iter_children(TreeIter &rIter) const=0
virtual bool get_cursor(TreeIter *pIter) const=0
virtual int get_iter_depth(const TreeIter &rIter) const=0
virtual OUString get_id(int pos) const=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual void freeze()=0
virtual void thaw()=0
virtual float get_approximate_digit_width() const=0
IMPL_LINK_NOARG(ScConflictsDlg, SelectHandle, weld::TreeView &, void)
ScConflictAction
@ SC_CONFLICT_ACTION_NONE
@ SC_CONFLICT_ACTION_KEEP_MINE
@ SC_CONFLICT_ACTION_KEEP_OTHER
::std::vector< ScConflictsListEntry > ScConflictsList
int nCount
std::unordered_map< sal_uLong, sal_uLong > ScChangeActionMergeMap
Definition: docsh.hxx:65
OString strip(const OString &rIn, char c)
int i
OUString toId(const void *pValue)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
sal_uIntPtr sal_uLong
bool HasOwnAction(sal_uLong nOwnAction) const
bool HasSharedAction(sal_uLong nSharedAction) const
std::vector< sal_uLong > maOwnActions
ScConflictAction meConflictAction
std::vector< sal_uLong > maSharedActions
sal_Int16 SCTAB
Definition: types.hxx:22
OUString sId
RET_OK