1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_CONFLICTSDLG_HXX
21 #define SC_CONFLICTSDLG_HXX
23 #include <vcl/button.hxx>
24 #include <vcl/dialog.hxx>
25 #include <vcl/fixed.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <svx/ctredlin.hxx>
29 #include "chgtrack.hxx"
35 //=============================================================================
39 SC_CONFLICT_ACTION_NONE
,
40 SC_CONFLICT_ACTION_KEEP_MINE
,
41 SC_CONFLICT_ACTION_KEEP_OTHER
44 typedef ::std::vector
< sal_uLong
> ScChangeActionList
;
47 //=============================================================================
48 // struct ScConflictsListEntry
49 //=============================================================================
51 struct ScConflictsListEntry
53 ScConflictAction meConflictAction
;
54 ScChangeActionList maSharedActions
;
55 ScChangeActionList maOwnActions
;
57 bool HasSharedAction( sal_uLong nSharedAction
) const;
58 bool HasOwnAction( sal_uLong nOwnAction
) const;
62 //=============================================================================
64 typedef ::std::vector
< ScConflictsListEntry
> ScConflictsList
;
67 //=============================================================================
68 // class ScConflictsListHelper
69 //=============================================================================
71 class ScConflictsListHelper
74 static void Transform_Impl( ScChangeActionList
& rActionList
, ScChangeActionMergeMap
* pMergeMap
);
77 static bool HasOwnAction( ScConflictsList
& rConflictsList
, sal_uLong nOwnAction
);
79 static ScConflictsListEntry
* GetSharedActionEntry( ScConflictsList
& rConflictsList
, sal_uLong nSharedAction
);
80 static ScConflictsListEntry
* GetOwnActionEntry( ScConflictsList
& rConflictsList
, sal_uLong nOwnAction
);
82 static void TransformConflictsList( ScConflictsList
& rConflictsList
,
83 ScChangeActionMergeMap
* pSharedMap
, ScChangeActionMergeMap
* pOwnMap
);
87 //=============================================================================
88 // class ScConflictsFinder
89 //=============================================================================
91 class ScConflictsFinder
94 ScChangeTrack
* mpTrack
;
95 sal_uLong mnStartShared
;
96 sal_uLong mnEndShared
;
99 ScConflictsList
& mrConflictsList
;
101 static bool DoActionsIntersect( const ScChangeAction
* pAction1
, const ScChangeAction
* pAction2
);
102 ScConflictsListEntry
* GetIntersectingEntry( const ScChangeAction
* pAction
) const;
103 ScConflictsListEntry
* GetEntry( sal_uLong nSharedAction
, const ScChangeActionList
& rOwnActions
);
106 ScConflictsFinder( ScChangeTrack
* pTrack
, sal_uLong nStartShared
, sal_uLong nEndShared
,
107 sal_uLong nStartOwn
, sal_uLong nEndOwn
, ScConflictsList
& rConflictsList
);
108 virtual ~ScConflictsFinder();
114 //=============================================================================
115 // class ScConflictsResolver
116 //=============================================================================
118 class ScConflictsResolver
121 ScChangeTrack
* mpTrack
;
122 ScConflictsList
& mrConflictsList
;
125 ScConflictsResolver( ScChangeTrack
* pTrack
, ScConflictsList
& rConflictsList
);
126 virtual ~ScConflictsResolver();
128 void HandleAction( ScChangeAction
* pAction
, bool bIsSharedAction
,
129 bool bHandleContentAction
, bool bHandleNonContentAction
);
133 //=============================================================================
134 // class ScConflictsDlg
135 //=============================================================================
137 class ScConflictsDlg
: public ModalDialog
140 FixedText maFtConflicts
;
141 SvSimpleTableContainer m_aLbConflictsContainer
;
142 SvxRedlinTable maLbConflicts
;
143 PushButton maBtnKeepMine
;
144 PushButton maBtnKeepOther
;
145 FixedLine maFlConflicts
;
146 PushButton maBtnKeepAllMine
;
147 PushButton maBtnKeepAllOthers
;
148 CancelButton maBtnCancel
;
149 HelpButton maBtnHelp
;
151 OUString maStrTitleConflict
;
152 OUString maStrTitleAuthor
;
153 OUString maStrTitleDate
;
154 OUString maStrUnknownUser
;
156 ScViewData
* mpViewData
;
157 ScDocument
* mpOwnDoc
;
158 ScChangeTrack
* mpOwnTrack
;
159 ScDocument
* mpSharedDoc
;
160 ScChangeTrack
* mpSharedTrack
;
161 ScConflictsList
& mrConflictsList
;
164 Timer maSelectionTimer
;
166 bool mbInDeselectHdl
;
168 OUString
GetConflictString( const ScConflictsListEntry
& rConflictEntry
);
169 OUString
GetActionString( const ScChangeAction
* pAction
, ScDocument
* pDoc
);
170 void HandleListBoxSelection( bool bSelectHandle
);
172 void SetConflictAction( SvTreeListEntry
* pRootEntry
, ScConflictAction eConflictAction
);
173 void KeepHandler( bool bMine
);
174 void KeepAllHandler( bool bMine
);
176 DECL_LINK( SelectHandle
, void* );
177 DECL_LINK( DeselectHandle
, void* );
178 DECL_LINK( UpdateSelectionHdl
, void* );
179 DECL_LINK( KeepMineHandle
, void* );
180 DECL_LINK( KeepOtherHandle
, void* );
181 DECL_LINK( KeepAllMineHandle
, void* );
182 DECL_LINK( KeepAllOthersHandle
, void* );
185 ScConflictsDlg( Window
* pParent
, ScViewData
* pViewData
, ScDocument
* pSharedDoc
, ScConflictsList
& rConflictsList
);
188 virtual void Resize();
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */