LibreOffice Module sc (master) 1
conflictsdlg.hxx
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#pragma once
21
22#include <vcl/idle.hxx>
23#include <svx/ctredlin.hxx>
24
25#include "docsh.hxx"
26
27class ScViewData;
28class ScChangeTrack;
29class ScChangeAction;
30
32{
36};
37
38// struct ScConflictsListEntry
39
41{
43 std::vector<sal_uLong> maSharedActions;
44 std::vector<sal_uLong> maOwnActions;
45
46 bool HasSharedAction( sal_uLong nSharedAction ) const;
47 bool HasOwnAction( sal_uLong nOwnAction ) const;
48};
49
50typedef ::std::vector< ScConflictsListEntry > ScConflictsList;
51
52
54{
55private:
56 static void Transform_Impl( std::vector<sal_uLong>& rActionList, ScChangeActionMergeMap* pMergeMap );
57
58public:
59 static bool HasOwnAction( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
60
61 static ScConflictsListEntry* GetSharedActionEntry( ScConflictsList& rConflictsList, sal_uLong nSharedAction );
62 static ScConflictsListEntry* GetOwnActionEntry( ScConflictsList& rConflictsList, sal_uLong nOwnAction );
63
64 static void TransformConflictsList( ScConflictsList& rConflictsList,
65 ScChangeActionMergeMap* pSharedMap, ScChangeActionMergeMap* pOwnMap );
66};
67
68
70{
71private:
78
79 static bool DoActionsIntersect( const ScChangeAction* pAction1, const ScChangeAction* pAction2 );
81 ScConflictsListEntry& GetEntry(sal_uLong nSharedAction, const std::vector<sal_uLong>& rOwnActions);
82
83public:
84 ScConflictsFinder( ScChangeTrack* pTrack, sal_uLong nStartShared, sal_uLong nEndShared,
85 sal_uLong nStartOwn, sal_uLong nEndOwn, ScConflictsList& rConflictsList );
86
87 bool Find();
88};
89
90
92{
93private:
96
97public:
98 ScConflictsResolver( ScChangeTrack* pTrack, ScConflictsList& rConflictsList );
99
100 void HandleAction( ScChangeAction* pAction, bool bIsSharedAction,
101 bool bHandleContentAction, bool bHandleNonContentAction );
102};
103
104
106{
107private:
109
116
119
120 std::unique_ptr<weld::Button> m_xBtnKeepMine;
121 std::unique_ptr<weld::Button> m_xBtnKeepOther;
122 std::unique_ptr<weld::Button> m_xBtnKeepAllMine;
123 std::unique_ptr<weld::Button> m_xBtnKeepAllOthers;
124 std::unique_ptr<SvxRedlinTable> m_xLbConflicts;
125
126 OUString GetConflictString( const ScConflictsListEntry& rConflictEntry );
127 void SetActionString(const ScChangeAction* pAction, ScDocument* pDoc, const weld::TreeIter& rEntry);
129
130 void SetConflictAction(const weld::TreeIter& rRootEntry, ScConflictAction eConflictAction);
131 void KeepHandler( bool bMine );
132 void KeepAllHandler( bool bMine );
133
134 DECL_LINK( SelectHandle, weld::TreeView&, void );
135 DECL_LINK( UpdateSelectionHdl, Timer*, void );
136 DECL_LINK( KeepMineHandle, weld::Button&, void );
137 DECL_LINK( KeepOtherHandle, weld::Button&, void );
138 DECL_LINK( KeepAllMineHandle, weld::Button&, void );
139 DECL_LINK( KeepAllOthersHandle, weld::Button&, void );
140
141public:
142 ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScDocument* pSharedDoc, ScConflictsList& rConflictsList);
143 virtual ~ScConflictsDlg() override;
144
145 void UpdateView();
146};
147
148/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScConflictsList & mrConflictsList
std::unique_ptr< SvxRedlinTable > m_xLbConflicts
DECL_LINK(KeepAllOthersHandle, weld::Button &, void)
void SetConflictAction(const weld::TreeIter &rRootEntry, ScConflictAction eConflictAction)
ScConflictsDlg(weld::Window *pParent, ScViewData *pViewData, ScDocument *pSharedDoc, ScConflictsList &rConflictsList)
DECL_LINK(SelectHandle, weld::TreeView &, void)
DECL_LINK(KeepAllMineHandle, weld::Button &, void)
ScChangeTrack * mpSharedTrack
OUString maStrUnknownUser
DECL_LINK(KeepMineHandle, weld::Button &, void)
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)
DECL_LINK(KeepOtherHandle, weld::Button &, void)
void KeepAllHandler(bool bMine)
ScViewData *const mpViewData
void HandleListBoxSelection()
DECL_LINK(UpdateSelectionHdl, Timer *, void)
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)
ScConflictAction
@ SC_CONFLICT_ACTION_NONE
@ SC_CONFLICT_ACTION_KEEP_MINE
@ SC_CONFLICT_ACTION_KEEP_OTHER
::std::vector< ScConflictsListEntry > ScConflictsList
std::unordered_map< sal_uLong, sal_uLong > ScChangeActionMergeMap
Definition: docsh.hxx:65
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